From 9d0d2ce524454a62b6b936d77498f10b0cf0c6a7 Mon Sep 17 00:00:00 2001 From: Polonkai Gergely Date: Mon, 16 Jul 2012 21:40:19 +0200 Subject: [PATCH] Updated to Symfony 2.1 BETA3 --- app/SymfonyRequirements.php | 16 +- app/bootstrap.php.cache | 146 +- composer.json | 3 +- composer.lock | 59 +- composer.phar | Bin 0 -> 533673 bytes vendor/composer/autoload_namespaces.php | 1 + vendor/composer/installed.json | 870 +-- .../ckeditor-bundle/Ivory/CKEditorBundle | 1 + .../Composer/ScriptHandler.php | 14 +- .../Bundle/DistributionBundle/Diff/Diff.php | 91 - .../skeleton/app/SymfonyRequirements.php | 16 +- .../DistributionBundle/Upgrader/Upgrader.php | 59 - .../Bundle/FrameworkExtraBundle/.gitignore | 4 + .../FrameworkExtraBundle/CHANGELOG-2.1.md | 6 + .../Resources/doc/annotations/converters.rst | 13 + .../ConfigurationAnnotationTest.php | 18 + .../Tests/EventListener/CacheListenerTest.php | 101 + .../EventListener/ControllerListenerTest.php | 85 + .../Fixture/FooControllerCacheAtClass.php | 17 + .../FooControllerCacheAtClassAndMethod.php | 25 + .../Fixture/FooControllerCacheAtMethod.php | 17 + .../DoctrineParamConverterTest.php | 87 + .../ParamConverterManagerTest.php | 99 + .../FrameworkExtraBundle/phpunit.xml.dist | 20 + .../Sensio/Bundle/GeneratorBundle/.gitignore | 3 + .../Command/GenerateBundleCommand.php | 2 +- .../Command/GenerateBundleCommandTest.php | 101 + .../Tests/Command/GenerateCommandTest.php | 74 + .../GenerateDoctrineCrudCommandTest.php | 141 + .../GenerateDoctrineEntityCommandTest.php | 104 + .../Tests/Generator/BundleGeneratorTest.php | 59 + .../Generator/DoctrineCrudGeneratorTest.php | 206 + .../Generator/DoctrineFormGeneratorTest.php | 40 + .../Tests/Generator/GeneratorTest.php | 32 + .../Bundle/GeneratorBundle/phpunit.xml.dist | 20 + vendor/swiftmailer/swiftmailer/.gitignore | 6 + vendor/swiftmailer/swiftmailer/CHANGES | 100 + vendor/swiftmailer/swiftmailer/README | 16 + vendor/swiftmailer/swiftmailer/README.git | 67 + vendor/swiftmailer/swiftmailer/VERSION | 2 +- vendor/swiftmailer/swiftmailer/build.xml | 112 + .../swiftmailer/create_pear_package.php | 42 + .../lib/classes/Swift/SmtpTransport.php | 4 +- .../swiftmailer/lib/swift_required.php | 8 +- .../swiftmailer/lib/swift_required_pear.php | 8 +- vendor/swiftmailer/swiftmailer/notes/APPS | 15 + vendor/swiftmailer/swiftmailer/notes/CHARSETS | 46 + .../swiftmailer/swiftmailer/notes/message.xml | 22 + .../swiftmailer/notes/rfc/rfc0821.txt | 4050 +++++++++++++ .../swiftmailer/notes/rfc/rfc0822.txt | 2901 +++++++++ .../swiftmailer/notes/rfc/rfc1341.txt | 5265 +++++++++++++++++ .../swiftmailer/notes/rfc/rfc1521.txt | 4539 ++++++++++++++ .../swiftmailer/notes/rfc/rfc1854.txt | 395 ++ .../swiftmailer/notes/rfc/rfc2045.txt | 1739 ++++++ .../swiftmailer/notes/rfc/rfc2046.txt | 2467 ++++++++ .../swiftmailer/notes/rfc/rfc2047.txt | 843 +++ .../swiftmailer/notes/rfc/rfc2048.txt | 1180 ++++ .../swiftmailer/notes/rfc/rfc2049.txt | 1347 +++++ .../swiftmailer/notes/rfc/rfc2183.txt | 675 +++ .../swiftmailer/notes/rfc/rfc2222.txt | 899 +++ .../swiftmailer/notes/rfc/rfc2231.txt | 563 ++ .../swiftmailer/notes/rfc/rfc2234.txt | 787 +++ .../swiftmailer/notes/rfc/rfc2487.txt | 451 ++ .../swiftmailer/notes/rfc/rfc2554.txt | 619 ++ .../swiftmailer/notes/rfc/rfc2821.txt | 4427 ++++++++++++++ .../swiftmailer/notes/rfc/rfc2822.txt | 2859 +++++++++ .../swiftmailer/notes/rfc/rfc3676.txt | 1123 ++++ .../swiftmailer/notes/rfc/rfc4505.txt | 507 ++ .../swiftmailer/notes/rfc/rfc4616.txt | 619 ++ .../swiftmailer/notes/rfc/rfc4954.txt | 1123 ++++ .../swiftmailer/notes/rfc/whats_where.txt | 61 + vendor/swiftmailer/swiftmailer/notes/smtp.txt | 48 + .../swiftmailer/swiftmailer/package.xml.tpl | 73 + .../swiftmailer/test-suite/CHANGES | 7 + .../swiftmailer/test-suite/LICENSE | 165 + .../swiftmailer/swiftmailer/test-suite/README | 159 + .../swiftmailer/test-suite/config.php | 68 + .../swiftmailer/test-suite/index.php | 40 + .../test-suite/lib/Sweety/Reporter.php | 69 + .../lib/Sweety/Reporter/CliReporter.php | 203 + .../Sweety/Reporter/CliTestCaseReporter.php | 160 + .../lib/Sweety/Reporter/HtmlReporter.php | 174 + .../Sweety/Reporter/HtmlTestCaseReporter.php | 174 + .../test-suite/lib/Sweety/Runner.php | 56 + .../lib/Sweety/Runner/AbstractTestRunner.php | 365 ++ .../lib/Sweety/Runner/CliRunner.php | 128 + .../lib/Sweety/Runner/HtmlRunner.php | 160 + .../test-suite/lib/Sweety/TestLocator.php | 25 + .../Sweety/TestLocator/PearStyleLocator.php | 71 + .../HELP_MY_TESTS_DONT_WORK_ANYMORE | 383 ++ .../test-suite/lib/simpletest/LICENSE | 502 ++ .../test-suite/lib/simpletest/README | 108 + .../test-suite/lib/simpletest/TODO.xml | 176 + .../test-suite/lib/simpletest/VERSION | 1 + .../lib/simpletest/authentication.php | 237 + .../test-suite/lib/simpletest/autorun.php | 97 + .../test-suite/lib/simpletest/browser.php | 1094 ++++ .../test-suite/lib/simpletest/collector.php | 122 + .../lib/simpletest/compatibility.php | 166 + .../test-suite/lib/simpletest/cookies.php | 380 ++ .../lib/simpletest/default_reporter.php | 163 + .../test-suite/lib/simpletest/detached.php | 96 + .../lib/simpletest/docs/en/docs.css | 121 + .../lib/simpletest/docs/fr/docs.css | 84 + .../lib/simpletest/docs/lastcraft/README | 1 + .../lib/simpletest/docs/onpk/README | 1 + .../test-suite/lib/simpletest/docs/pkg/README | 1 + .../lib/simpletest/docs/simpletest.org/README | 1 + .../docs/simpletest.org/favicon.ico | Bin 0 -> 1150 bytes .../images/book-domain-driven-design.jpg | Bin 0 -> 6599 bytes .../book-guide-to-php-design-patterns.jpg | Bin 0 -> 5657 bytes ...nthology-object-oriented-php-solutions.jpg | Bin 0 -> 43265 bytes .../docs/simpletest.org/images/quote.png | Bin 0 -> 620 bytes .../images/simpletest-contribute.png | Bin 0 -> 4299 bytes .../images/simpletest-download.png | Bin 0 -> 4946 bytes .../images/simpletest-external-bottom.png | Bin 0 -> 533 bytes .../images/simpletest-external-middle.png | Bin 0 -> 217 bytes .../images/simpletest-external-top.png | Bin 0 -> 1085 bytes .../images/simpletest-internal-bottom.png | Bin 0 -> 516 bytes .../images/simpletest-internal-middle.png | Bin 0 -> 237 bytes .../images/simpletest-internal-top.png | Bin 0 -> 1158 bytes .../simpletest.org/images/simpletest-logo.png | Bin 0 -> 6892 bytes .../images/simpletest-start-testing.png | Bin 0 -> 5952 bytes .../images/simpletest-support.png | Bin 0 -> 5525 bytes .../simpletest.org/images/test-in-cli.png | Bin 0 -> 46023 bytes .../images/test-with-1-fail.png | Bin 0 -> 25562 bytes .../images/test-with-1-pass.png | Bin 0 -> 10213 bytes .../simpletest/docs/simpletest.org/index.html | 192 + .../simpletest.org/js/jquery-1.2.1.pack.js | 11 + .../js/jquery-speakers_coaches_consultants.js | 30 + .../simpletest.org/js/jquery.heartbeat.js | 9 + .../simpletest.org/js/jquery.sparkline.js | 76 + .../docs/simpletest.org/simpletest.css | 43 + .../docs/simpletest.org/views/heartbeat.php | 174 + .../simpletest.org/views/photos_stream.php | 37 + .../lib/simpletest/docs/source/en/about.xml | 112 + .../en/authentication_documentation.xml | 337 ++ .../docs/source/en/books_website.xml | 73 + .../source/en/boundary_classes_tutorial.xml | 405 ++ .../docs/source/en/browser_documentation.xml | 281 + .../simpletest/docs/source/en/changelog.xml | 188 + .../docs/source/en/coding_standards.xml | 135 + .../source/en/display_subclass_tutorial.xml | 267 + .../docs/source/en/download_website.xml | 106 + .../source/en/expectation_documentation.xml | 383 ++ .../source/en/experimental_dom_tester.xml | 231 + .../docs/source/en/experimental_intro.xml | 54 + .../docs/source/en/experimental_recorder.xml | 170 + .../docs/source/en/extension_eclipse.xml | 279 + .../docs/source/en/first_test_tutorial.xml | 436 ++ .../source/en/form_testing_documentation.xml | 304 + .../docs/source/en/gain_control_tutorial.xml | 290 + .../source/en/group_test_documentation.xml | 332 ++ .../docs/source/en/group_test_tutorial.xml | 239 + .../simpletest/docs/source/en/heartbeat.xml | 57 + .../lib/simpletest/docs/source/en/ideas.xml | 188 + .../source/en/improving_design_tutorial.xml | 195 + .../lib/simpletest/docs/source/en/index.xml | 220 + .../lib/simpletest/docs/source/en/intro.xml | 54 + .../source/en/mock_objects_documentation.xml | 708 +++ .../docs/source/en/mock_objects_tutorial.xml | 359 ++ .../simpletest/docs/source/en/overview.xml | 460 ++ .../source/en/partial_mocks_documentation.xml | 402 ++ .../docs/source/en/photos_stream.xml | 51 + .../docs/source/en/reporter_documentation.xml | 471 ++ .../simpletest/docs/source/en/screencasts.xml | 76 + .../simpletest/docs/source/en/simple_test.xml | 524 ++ .../source/en/softwares_using_simpletest.xml | 164 + .../en/speakers_coaches_consultancy.xml | 94 + .../docs/source/en/subclass_tutorial.xml | 255 + .../docs/source/en/support_website.xml | 59 + .../source/en/unit_test_documentation.xml | 313 + .../source/en/web_tester_documentation.xml | 379 ++ .../docs/source/en/writing_extensions.xml | 128 + .../fr/authentication_documentation.xml | 307 + .../docs/source/fr/books_website.xml | 77 + .../source/fr/boundary_classes_tutorial.xml | 410 ++ .../docs/source/fr/browser_documentation.xml | 259 + .../source/fr/display_subclass_tutorial.xml | 282 + .../docs/source/fr/download_website.xml | 110 + .../source/fr/expectation_documentation.xml | 308 + .../docs/source/fr/extension_eclipse.xml | 292 + .../docs/source/fr/first_test_tutorial.xml | 462 ++ .../source/fr/form_testing_documentation.xml | 308 + .../docs/source/fr/gain_control_tutorial.xml | 324 + .../source/fr/group_test_documentation.xml | 353 ++ .../docs/source/fr/group_test_tutorial.xml | 247 + .../source/fr/improving_design_tutorial.xml | 218 + .../lib/simpletest/docs/source/fr/index.xml | 69 + .../lib/simpletest/docs/source/fr/intro.xml | 39 + .../fr/logiciels_utilisant_simpletest.xml | 121 + .../source/fr/mock_objects_documentation.xml | 729 +++ .../docs/source/fr/mock_objects_tutorial.xml | 374 ++ .../simpletest/docs/source/fr/overview.xml | 297 + .../source/fr/partial_mocks_documentation.xml | 419 ++ .../docs/source/fr/reporter_documentation.xml | 488 ++ .../simpletest/docs/source/fr/simple_test.xml | 556 ++ .../docs/source/fr/subclass_tutorial.xml | 261 + .../docs/source/fr/support_website.xml | 60 + .../source/fr/unit_test_documentation.xml | 330 ++ .../source/fr/web_tester_documentation.xml | 377 ++ .../test-suite/lib/simpletest/dumper.php | 359 ++ .../test-suite/lib/simpletest/eclipse.php | 307 + .../test-suite/lib/simpletest/encoding.php | 552 ++ .../test-suite/lib/simpletest/errors.php | 257 + .../test-suite/lib/simpletest/exceptions.php | 198 + .../test-suite/lib/simpletest/expectation.php | 901 +++ .../extensions/colortext_reporter.php | 86 + .../lib/simpletest/extensions/css/webunit.css | 78 + .../lib/simpletest/extensions/dom_tester.php | 117 + .../extensions/dom_tester/css_selector.php | 539 ++ .../dom_tester/test/dom_tester_doc_test.php | 24 + .../dom_tester/test/dom_tester_test.php | 223 + .../test/support/child_adjacent.html | 24 + .../dom_tester/test/support/dom_tester.html | 59 + .../lib/simpletest/extensions/img/wait.gif | Bin 0 -> 1426 bytes .../extensions/js/tests/TestOfWebunit.js.html | 34 + .../lib/simpletest/extensions/js/webunit.js | 194 + .../lib/simpletest/extensions/js/x.js | 423 ++ .../extensions/junit_xml_reporter.php | 118 + .../simpletest/extensions/pear_test_case.php | 196 + .../lib/simpletest/extensions/recorder.php | 62 + .../extensions/recorder/test/sample.php | 14 + .../extensions/recorder/test/test.php | 28 + .../simpletest/extensions/selenese_tester.php | 393 ++ .../lib/simpletest/extensions/selenium.php | 136 + .../extensions/selenium/remote-control.php | 128 + .../selenium/test/remote-control_test.php | 36 + .../lib/simpletest/extensions/testdox.php | 55 + .../simpletest/extensions/testdox/test.php | 107 + .../extensions/treemap_reporter.php | 126 + .../extensions/treemap_reporter/jquery.php | 75 + .../test/treemap_node_test.php | 69 + .../treemap_reporter/treemap_recorder.php | 310 + .../extensions/webunit_reporter.php | 285 + .../test-suite/lib/simpletest/form.php | 355 ++ .../test-suite/lib/simpletest/frames.php | 592 ++ .../test-suite/lib/simpletest/http.php | 628 ++ .../test-suite/lib/simpletest/invoker.php | 139 + .../lib/simpletest/mock_objects.php | 1630 +++++ .../test-suite/lib/simpletest/packages/README | 26 + .../lib/simpletest/packages/build_tarball.sh | 132 + .../lib/simpletest/packages/bundled_docs.xslt | 246 + .../lib/simpletest/packages/bundled_map.xml | 14 + .../lib/simpletest/packages/extension.xml | 40 + .../simpletest/packages/generate_package.php | 54 + .../lib/simpletest/packages/lastcraft.xslt | 302 + .../simpletest/packages/make_bundled_docs.sh | 25 + .../packages/make_bundled_docs_with_xalan.sh | 26 + .../packages/make_lastcraft_docs.sh | 2 + .../simpletest/packages/make_phpdoc_docs.sh | 42 + .../lib/simpletest/packages/onpk/map_onpk.xml | 26 + .../lib/simpletest/packages/onpk/onpk.xslt | 227 + .../packages/onpk/transform_all_onpk.php | 32 + .../lib/simpletest/packages/package.xml | 710 +++ .../packages/pear_package_create.php | 170 + .../lib/simpletest/packages/phpdoc_docs.xslt | 127 + .../lib/simpletest/packages/simpletest.ini | 92 + .../packages/simpletest.org/index.php | 54 + .../packages/simpletest.org/integration.php | 41 + .../packages/simpletest.org/map.xml | 87 + .../packages/simpletest.org/package.php | 440 ++ .../packages/simpletest.org/template.html | 59 + .../test/package/content_without_section.xml | 91 + .../test/package/en/synchronisation.xml | 92 + .../test/package/fr/no-synchronisation.xml | 91 + .../test/package/fr/synchronisation.xml | 93 + .../test/package/here_download.xml | 91 + .../test/package/here_overview.xml | 91 + .../test/package/here_simpletest.xml | 91 + .../test/package/here_start_testing.xml | 91 + .../test/package/here_support.xml | 91 + .../test/package/here_unit-tester.xml | 91 + .../simpletest.org/test/package/map.xml | 20 + .../test/package/one_section_changelogged.xml | 65 + .../test/package/one_section_milestoned.xml | 95 + .../package/one_section_with_autorum_php.xml | 87 + .../package/one_section_with_php_code.xml | 93 + .../simpletest.org/test/package_test.php | 150 + .../lib/simpletest/packages/site_map.xml | 33 + .../packages/transform_all_lastcraft.php | 17 + .../test-suite/lib/simpletest/page.php | 979 +++ .../test-suite/lib/simpletest/parser.php | 760 +++ .../lib/simpletest/reflection_php4.php | 136 + .../lib/simpletest/reflection_php5.php | 386 ++ .../test-suite/lib/simpletest/remote.php | 115 + .../test-suite/lib/simpletest/reporter.php | 446 ++ .../test-suite/lib/simpletest/scorer.php | 862 +++ .../test-suite/lib/simpletest/selector.php | 141 + .../lib/simpletest/shell_tester.php | 330 ++ .../test-suite/lib/simpletest/simpletest.php | 396 ++ .../test-suite/lib/simpletest/socket.php | 308 + .../test-suite/lib/simpletest/tag.php | 1418 +++++ .../lib/simpletest/test/acceptance_test.php | 1653 ++++++ .../lib/simpletest/test/adapter_test.php | 50 + .../lib/simpletest/test/all_tests.php | 13 + .../simpletest/test/authentication_test.php | 145 + .../lib/simpletest/test/autorun_test.php | 13 + .../lib/simpletest/test/bad_test_suite.php | 10 + .../lib/simpletest/test/browser_test.php | 774 +++ .../lib/simpletest/test/collector_test.php | 50 + .../lib/simpletest/test/command_line_test.php | 40 + .../simpletest/test/compatibility_test.php | 87 + .../lib/simpletest/test/cookies_test.php | 227 + .../lib/simpletest/test/detached_test.php | 15 + .../lib/simpletest/test/dumper_test.php | 88 + .../lib/simpletest/test/eclipse_test.php | 32 + .../lib/simpletest/test/encoding_test.php | 213 + .../lib/simpletest/test/errors_test.php | 229 + .../lib/simpletest/test/exceptions_test.php | 153 + .../lib/simpletest/test/expectation_test.php | 223 + .../lib/simpletest/test/extensions_tests.php | 23 + .../lib/simpletest/test/form_test.php | 324 + .../lib/simpletest/test/frames_test.php | 549 ++ .../lib/simpletest/test/http_test.php | 424 ++ .../lib/simpletest/test/interfaces_test.php | 137 + .../test/interfaces_test_php5_1.php | 14 + .../lib/simpletest/test/live_test.php | 47 + .../lib/simpletest/test/mock_objects_test.php | 1012 ++++ .../lib/simpletest/test/page_test.php | 898 +++ .../lib/simpletest/test/parse_error_test.php | 9 + .../lib/simpletest/test/parser_test.php | 551 ++ .../simpletest/test/reflection_php4_test.php | 61 + .../simpletest/test/reflection_php5_test.php | 263 + .../lib/simpletest/test/remote_test.php | 19 + .../lib/simpletest/test/shell_test.php | 38 + .../lib/simpletest/test/shell_tester_test.php | 42 + .../lib/simpletest/test/simpletest_test.php | 58 + .../lib/simpletest/test/site/.htaccess | 2 + .../lib/simpletest/test/site/1.html | 6 + .../lib/simpletest/test/site/2.html | 6 + .../lib/simpletest/test/site/3.html | 6 + .../test/site/base_change_redirect.php | 6 + .../test/site/base_tag/base_link.html | 9 + .../simpletest/test/site/base_tag/form.html | 50 + .../test/site/base_tag/frameset.html | 9 + .../site/base_tag/frameset_with_base_tag.html | 12 + .../simpletest/test/site/base_tag/page_1.html | 7 + .../simpletest/test/site/base_tag/page_2.html | 7 + .../test/site/base_tag/relative_link.html | 8 + .../test/site/cookie_based_counter.php | 10 + .../test/site/counting_frameset.html | 10 + .../test/site/double_base_change_redirect.php | 6 + .../lib/simpletest/test/site/file.html | 6 + .../lib/simpletest/test/site/form.html | 47 + .../test/site/form_data_encoded_form.html | 47 + .../site/form_with_array_based_inputs.php | 15 + .../test/site/form_with_false_defaults.html | 40 + .../site/form_with_mixed_post_and_get.html | 15 + .../test/site/form_with_quoted_values.php | 14 + .../test/site/form_with_radio_buttons.html | 10 + .../test/site/form_with_tricky_defaults.html | 35 + .../test/site/form_with_unnamed_submit.html | 12 + .../test/site/form_without_action.php | 11 + .../lib/simpletest/test/site/frame_a.html | 6 + .../lib/simpletest/test/site/frame_b.html | 6 + .../lib/simpletest/test/site/frame_links.html | 7 + .../lib/simpletest/test/site/frameset.html | 10 + .../site/front_controller_style/a_page.php | 37 + .../site/front_controller_style/index.php | 44 + .../front_controller_style/show_request.php | 49 + .../lib/simpletest/test/site/link_confirm.php | 18 + .../simpletest/test/site/local_redirect.php | 6 + .../simpletest/test/site/messy_frameset.html | 16 + .../test/site/multiple_widget_form.html | 59 + .../simpletest/test/site/nested_frameset.html | 10 + .../simpletest/test/site/network_confirm.php | 84 + .../test/site/one_page_frameset.html | 9 + .../lib/simpletest/test/site/page_request.php | 60 + .../test/site/path/base_change_redirect.php | 6 + .../test/site/path/network_confirm.php | 71 + .../test/site/path/show_cookies.php | 18 + .../simpletest/test/site/protected/.htaccess | 5 + .../simpletest/test/site/protected/.htpasswd | 1 + .../lib/simpletest/test/site/protected/1.html | 6 + .../lib/simpletest/test/site/protected/2.html | 6 + .../lib/simpletest/test/site/protected/3.html | 6 + .../simpletest/test/site/protected/htaccess | 4 + .../test/site/protected/local_redirect.php | 6 + .../test/site/protected/network_confirm.php | 71 + .../lib/simpletest/test/site/redirect.php | 6 + .../test/site/savant_style_form.html | 20 + .../lib/simpletest/test/site/search.png | Bin 0 -> 1259 bytes .../lib/simpletest/test/site/self.php | 5 + .../lib/simpletest/test/site/self_form.php | 21 + .../lib/simpletest/test/site/set_cookies.php | 20 + .../lib/simpletest/test/site/slow_page.php | 6 + .../test/site/temp/.stop_cvs_removing_temp | 0 .../lib/simpletest/test/site/timestamp.php | 3 + .../lib/simpletest/test/site/upload_form.html | 11 + .../simpletest/test/site/upload_handler.php | 18 + .../lib/simpletest/test/socket_test.php | 25 + .../test/support/collector/collectable.1 | 0 .../test/support/collector/collectable.2 | 0 .../test/support/empty_test_file.php | 3 + .../lib/simpletest/test/support/latin1_sample | 1 + .../simpletest/test/support/spl_examples.php | 15 + .../support/supplementary_upload_sample.txt | 1 + .../lib/simpletest/test/support/test1.php | 7 + .../simpletest/test/support/upload_sample.txt | 1 + .../lib/simpletest/test/tag_test.php | 554 ++ .../lib/simpletest/test/unit_tester_test.php | 61 + .../lib/simpletest/test/unit_tests.php | 46 + .../lib/simpletest/test/url_test.php | 496 ++ .../lib/simpletest/test/user_agent_test.php | 348 ++ .../lib/simpletest/test/utf8_test.php | 78 + .../simpletest/test/visual/visual_errors.php | 65 + .../lib/simpletest/test/visual_test.php | 495 ++ .../lib/simpletest/test/web_tester_test.php | 155 + .../lib/simpletest/test/xml_test.php | 187 + .../test-suite/lib/simpletest/test_case.php | 655 ++ .../tutorials/SimpleTest/Expectations.pkg | 319 + .../tutorials/SimpleTest/FormTesting.pkg | 218 + .../tutorials/SimpleTest/GroupTests.pkg | 297 + .../tutorials/SimpleTest/MockObjects.pkg | 663 +++ .../tutorials/SimpleTest/PartialMock.pkg | 361 ++ .../tutorials/SimpleTest/Reporting.pkg | 450 ++ .../tutorials/SimpleTest/ServerStubs.pkg | 323 + .../tutorials/SimpleTest/SimpleTest.pkg | 387 ++ .../tutorials/SimpleTest/SimpleTest.pkg.ini | 10 + .../tutorials/SimpleTest/UnitTestCase.pkg | 405 ++ .../tutorials/SimpleTest/WebTester.pkg | 610 ++ .../test-suite/lib/simpletest/unit_tester.php | 402 ++ .../test-suite/lib/simpletest/url.php | 550 ++ .../test-suite/lib/simpletest/user_agent.php | 328 + .../test-suite/lib/simpletest/web_tester.php | 1495 +++++ .../test-suite/lib/simpletest/xml.php | 647 ++ .../test-suite/lib/yaymock/classes/Yay.php | 261 + .../lib/yaymock/classes/Yay/Action.php | 37 + .../classes/Yay/Actions/CallbackAction.php | 66 + .../Yay/Actions/ReturnReferenceAction.php | 64 + .../classes/Yay/Actions/ReturnValueAction.php | 100 + .../classes/Yay/Actions/ThrowAction.php | 66 + .../lib/yaymock/classes/Yay/Description.php | 45 + .../lib/yaymock/classes/Yay/Expectation.php | 88 + .../classes/Yay/ExpectationProvider.php | 33 + .../lib/yaymock/classes/Yay/Expectations.php | 306 + .../Yay/Expectations/AbstractExpectation.php | 345 ++ .../Yay/Expectations/AtLeastExpectation.php | 101 + .../Yay/Expectations/AtMostExpectation.php | 117 + .../Yay/Expectations/BetweenExpectation.php | 118 + .../Yay/Expectations/ExactlyExpectation.php | 117 + .../lib/yaymock/classes/Yay/Invocation.php | 49 + .../yaymock/classes/Yay/InvocationHandler.php | 36 + .../yaymock/classes/Yay/InvocationProxy.php | 90 + .../classes/Yay/InvocationRecorder.php | 36 + .../lib/yaymock/classes/Yay/Matcher.php | 48 + .../classes/Yay/Matchers/AnyMatcher.php | 85 + .../classes/Yay/Matchers/BoundsMatcher.php | 94 + .../classes/Yay/Matchers/EqualMatcher.php | 50 + .../classes/Yay/Matchers/IdenticalMatcher.php | 116 + .../classes/Yay/Matchers/OptionalMatcher.php | 103 + .../classes/Yay/Matchers/PatternMatcher.php | 88 + .../classes/Yay/Matchers/ReferenceMatcher.php | 104 + .../lib/yaymock/classes/Yay/MockGenerator.php | 323 + .../lib/yaymock/classes/Yay/MockObject.php | 25 + .../lib/yaymock/classes/Yay/Mockery.php | 183 + .../classes/Yay/NotSatisfiedException.php | 36 + .../yaymock/classes/Yay/SelfDescribing.php | 35 + .../lib/yaymock/classes/Yay/Sequence.php | 43 + .../yaymock/classes/Yay/SimpleDescription.php | 63 + .../yaymock/classes/Yay/SimpleInvocation.php | 163 + .../yaymock/classes/Yay/SimpleSequence.php | 108 + .../lib/yaymock/classes/Yay/SimpleState.php | 49 + .../classes/Yay/SimpleStatePredicate.php | 88 + .../lib/yaymock/classes/Yay/State.php | 34 + .../lib/yaymock/classes/Yay/StateMachine.php | 113 + .../yaymock/classes/Yay/StatePredicate.php | 35 + .../lib/yaymock/classes/Yay/States.php | 62 + .../test-suite/lib/yaymock/mock.tpl.php | 69 + .../lib/yaymock/yay_convenience.php | 176 + .../test-suite/lib/yaymock/yay_mock.php | 29 + .../swiftmailer/test-suite/run.php | 56 + .../swiftmailer/test-suite/sweety.js | 471 ++ .../test-suite/templates/sweety/css/main.css | 203 + .../templates/sweety/images/darr.gif | Bin 0 -> 57 bytes .../templates/sweety/images/group.gif | Bin 0 -> 90 bytes .../templates/sweety/images/htmlicon.gif | Bin 0 -> 1022 bytes .../templates/sweety/images/loading.gif | Bin 0 -> 1732 bytes .../templates/sweety/images/network.gif | Bin 0 -> 2130 bytes .../templates/sweety/images/rarr.gif | Bin 0 -> 59 bytes .../templates/sweety/images/runicon.gif | Bin 0 -> 159 bytes .../templates/sweety/images/xmlicon.gif | Bin 0 -> 128 bytes .../templates/sweety/js/sweety-template.js | 1155 ++++ .../templates/sweety/suite-ui-noajax.tpl.php | 155 + .../templates/sweety/suite-ui.tpl.php | 132 + .../swiftmailer/test-suite/xpath-legacy.js | 2764 +++++++++ .../_samples/charsets/iso-2022-jp/one.txt | 11 + .../_samples/charsets/iso-8859-1/one.txt | 19 + .../tests/_samples/charsets/utf-8/one.txt | 22 + .../tests/_samples/charsets/utf-8/three.txt | 45 + .../tests/_samples/charsets/utf-8/two.txt | 3 + .../swiftmailer/tests/_samples/files/data.txt | 1 + .../tests/_samples/files/textfile.zip | Bin 0 -> 202 bytes .../tests/acceptance.conf.php.default | 44 + .../Swift/AttachmentAcceptanceTest.php | 13 + .../FileByteStreamAcceptanceTest.php | 171 + ...leCharacterReaderFactoryAcceptanceTest.php | 183 + .../DependencyContainerAcceptanceTest.php | 22 + .../Swift/EmbeddedFileAcceptanceTest.php | 13 + .../Encoder/Base64EncoderAcceptanceTest.php | 49 + .../Swift/Encoder/QpEncoderAcceptanceTest.php | 58 + .../Encoder/Rfc2231EncoderAcceptanceTest.php | 56 + .../Swift/EncodingAcceptanceTest.php | 31 + .../KeyCache/ArrayKeyCacheAcceptanceTest.php | 179 + .../KeyCache/DiskKeyCacheAcceptanceTest.php | 189 + .../Swift/MessageAcceptanceTest.php | 57 + .../Swift/Mime/AttachmentAcceptanceTest.php | 136 + .../Base64ContentEncoderAcceptanceTest.php | 62 + .../NativeQpContentEncoderAcceptanceTest.php | 94 + .../PlainContentEncoderAcceptanceTest.php | 96 + .../QpContentEncoderAcceptanceTest.php | 170 + .../Swift/Mime/EmbeddedFileAcceptanceTest.php | 149 + .../Base64HeaderEncoderAcceptanceTest.php | 37 + .../Swift/Mime/MimePartAcceptanceTest.php | 142 + .../Mime/SimpleMessageAcceptanceTest.php | 1254 ++++ .../Swift/MimePartAcceptanceTest.php | 14 + .../AbstractStreamBufferAcceptanceTest.php | 122 + .../BasicSocketAcceptanceTest.php | 31 + .../StreamBuffer/ProcessAcceptanceTest.php | 23 + .../StreamBuffer/SocketTimeoutTest.php | 72 + .../StreamBuffer/SslSocketAcceptanceTest.php | 35 + .../StreamBuffer/TlsSocketAcceptanceTest.php | 35 + .../tests/bug/Swift/Bug111Test.php | 44 + .../tests/bug/Swift/Bug118Test.php | 22 + .../tests/bug/Swift/Bug206Test.php | 40 + .../swiftmailer/tests/bug/Swift/Bug34Test.php | 77 + .../swiftmailer/tests/bug/Swift/Bug35Test.php | 75 + .../swiftmailer/tests/bug/Swift/Bug38Test.php | 196 + .../swiftmailer/tests/bug/Swift/Bug51Test.php | 125 + .../swiftmailer/tests/bug/Swift/Bug71Test.php | 22 + .../swiftmailer/tests/bug/Swift/Bug76Test.php | 86 + .../Tests/IdenticalBinaryExpectation.php | 78 + .../Swift/Tests/SwiftSmokeTestCase.php | 53 + .../helpers/Swift/Tests/SwiftUnitTestCase.php | 97 + .../swiftmailer/tests/smoke.conf.php.default | 63 + .../smoke/Swift/Smoke/AttachmentSmokeTest.php | 30 + .../smoke/Swift/Smoke/BasicSmokeTest.php | 24 + .../Smoke/HtmlWithAttachmentSmokeTest.php | 30 + .../Swift/Smoke/InternationalSmokeTest.php | 37 + .../Swift/ByteStream/ArrayByteStreamTest.php | 204 + .../GenericFixedWidthReaderTest.php | 46 + .../CharacterReader/UsAsciiReaderTest.php | 55 + .../Swift/CharacterReader/Utf8ReaderTest.php | 68 + .../ArrayCharacterStreamTest.php | 374 ++ .../unit/Swift/DependencyContainerTest.php | 175 + .../unit/Swift/Encoder/Base64EncoderTest.php | 175 + .../unit/Swift/Encoder/QpEncoderTest.php | 361 ++ .../unit/Swift/Encoder/Rfc2231EncoderTest.php | 144 + .../unit/Swift/Events/CommandEventTest.php | 41 + .../unit/Swift/Events/EventObjectTest.php | 37 + .../unit/Swift/Events/ResponseEventTest.php | 44 + .../tests/unit/Swift/Events/SendEventTest.php | 103 + .../Events/SimpleEventDispatcherTest.php | 166 + .../Swift/Events/TransportChangeEventTest.php | 36 + .../Events/TransportExceptionEventTest.php | 49 + .../unit/Swift/KeyCache/ArrayKeyCacheTest.php | 242 + .../SimpleKeyCacheInputStreamTest.php | 77 + .../Mailer/ArrayRecipientIteratorTest.php | 46 + .../tests/unit/Swift/MailerTest.php | 149 + .../Swift/Mime/AbstractMimeEntityTest.php | 1094 ++++ .../tests/unit/Swift/Mime/AttachmentTest.php | 297 + .../Base64ContentEncoderTest.php | 293 + .../PlainContentEncoderTest.php | 275 + .../ContentEncoder/QpContentEncoderTest.php | 474 ++ .../unit/Swift/Mime/EmbeddedFileTest.php | 63 + .../HeaderEncoder/Base64HeaderEncoderTest.php | 15 + .../HeaderEncoder/QpHeaderEncoderTest.php | 223 + .../Swift/Mime/Headers/DateHeaderTest.php | 76 + .../Mime/Headers/IdentificationHeaderTest.php | 199 + .../Swift/Mime/Headers/MailboxHeaderTest.php | 338 ++ .../Mime/Headers/ParameterizedHeaderTest.php | 420 ++ .../Swift/Mime/Headers/PathHeaderTest.php | 83 + .../Mime/Headers/UnstructuredHeaderTest.php | 364 ++ .../tests/unit/Swift/Mime/MimePartTest.php | 252 + .../Swift/Mime/SimpleHeaderFactoryTest.php | 179 + .../unit/Swift/Mime/SimpleHeaderSetTest.php | 652 ++ .../unit/Swift/Mime/SimpleMessageTest.php | 803 +++ .../unit/Swift/Mime/SimpleMimeEntityTest.php | 15 + .../Swift/Plugins/AntiFloodPluginTest.php | 98 + .../Plugins/BandwidthMonitorPluginTest.php | 125 + .../Swift/Plugins/DecoratorPluginTest.php | 231 + .../unit/Swift/Plugins/LoggerPluginTest.php | 194 + .../Swift/Plugins/Loggers/ArrayLoggerTest.php | 70 + .../Swift/Plugins/Loggers/EchoLoggerTest.php | 29 + .../Swift/Plugins/PopBeforeSmtpPluginTest.php | 113 + .../Swift/Plugins/RedirectingPluginTest.php | 66 + .../unit/Swift/Plugins/ReporterPluginTest.php | 120 + .../Plugins/Reporters/HitReporterTest.php | 69 + .../Plugins/Reporters/HtmlReporterTest.php | 59 + .../Swift/Plugins/ThrottlerPluginTest.php | 124 + .../ByteArrayReplacementFilterTest.php | 135 + .../StringReplacementFilterFactoryTest.php | 41 + .../StringReplacementFilterTest.php | 59 + .../AbstractSmtpEventSupportTest.php | 378 ++ .../unit/Swift/Transport/AbstractSmtpTest.php | 924 +++ .../Esmtp/Auth/CramMd5AuthenticatorTest.php | 67 + .../Esmtp/Auth/LoginAuthenticatorTest.php | 60 + .../Esmtp/Auth/PlainAuthenticatorTest.php | 71 + .../Swift/Transport/Esmtp/AuthHandlerTest.php | 156 + .../EsmtpTransport/ExtensionSupportTest.php | 312 + .../Swift/Transport/EsmtpTransportTest.php | 234 + .../Swift/Transport/FailoverTransportTest.php | 334 ++ .../Transport/LoadBalancedTransportTest.php | 418 ++ .../Swift/Transport/MailTransportTest.php | 315 + .../Swift/Transport/SendmailTransportTest.php | 133 + .../unit/Swift/Transport/StreamBufferTest.php | 50 + .../Symfony/Bundle/AsseticBundle/.gitignore | 1 + .../Symfony/Bundle/MonologBundle/.gitignore | 4 + .../Bundle/SwiftmailerBundle/.gitignore | 3 + vendor/symfony/symfony/.gitignore | 5 + vendor/symfony/symfony/README.md | 57 + vendor/symfony/symfony/UPGRADE-2.1.md | 185 +- vendor/symfony/symfony/phpunit.xml.dist | 45 + .../src/Symfony/Bridge/Doctrine/CHANGELOG.md | 1 + ...gisterEventListenersAndSubscribersPass.php | 44 +- .../Form/ChoiceList/EntityLoaderInterface.php | 4 +- .../MergeDoctrineCollectionListener.php | 2 +- .../Doctrine/Form/Type/DoctrineType.php | 62 +- .../Bridge/Doctrine/RegistryInterface.php | 14 +- ...erEventListenersAndSubscribersPassTest.php | 35 +- .../Doctrine/Tests/DoctrineOrmTestCase.php | 2 +- .../Tests/Fixtures/SingleIdentEntity.php | 2 +- .../Form/Type/EntityTypePerformanceTest.php | 112 + .../Constraints/UniqueValidatorTest.php | 27 +- .../Validator/Constraints/UniqueEntity.php | 1 + .../Constraints/UniqueEntityValidator.php | 8 +- .../Bridge/Propel1/Form/Type/ModelType.php | 2 +- .../Tests/Form/PropelTypeGuesserTest.php | 2 +- .../src/Symfony/Bridge/Twig/.gitignore | 2 + .../src/Symfony/Bridge/Twig/CHANGELOG.md | 1 + .../Bridge/Twig/Extension/FormExtension.php | 6 +- .../views/Form/form_div_layout.html.twig | 16 +- .../views/Form/form_table_layout.html.twig | 27 +- .../Extension/FormExtensionDivLayoutTest.php | 19 +- .../FormExtensionTableLayoutTest.php | 15 +- .../Tests/Extension/child_label.html.twig | 2 +- .../Tests/Extension/custom_widgets.html.twig | 17 +- .../Bundle/FrameworkBundle/CHANGELOG.md | 7 +- .../CacheWarmer/TemplateFinderInterface.php | 3 +- .../DataCollector/RequestDataCollector.php | 12 +- .../DataCollector/RouterDataCollector.php | 85 +- .../Compiler/CompilerDebugDumpPass.php | 2 +- .../FrameworkExtension.php | 3 +- .../EventListener/SessionListener.php | 2 +- .../EventListener/TestSessionListener.php | 4 +- .../Resources/config/collectors.xml | 2 +- .../FrameworkBundle/Resources/config/form.xml | 10 +- .../Resources/config/session.xml | 7 +- .../Resources/public/css/exception.css | 4 + .../Resources/views/Form/form_row.html.php | 4 +- .../Resources/views/Form/form_rows.html.php | 1 - .../views/Form/form_widget_compound.html.php | 7 + .../views/FormTable/form_errors.html.php | 72 +- .../views/FormTable/form_row.html.php | 4 +- .../FormTable/form_widget_compound.html.php | 3 + .../views/FormTable/hidden_row.html.php | 1 - .../Bundle/FrameworkBundle/Routing/Router.php | 8 +- .../Templating/DelegatingEngine.php | 8 +- .../Templating/EngineInterface.php | 2 +- .../Templating/Helper/CodeHelper.php | 2 +- .../Templating/Helper/FormHelper.php | 2 +- .../FrameworkBundle/Test/WebTestCase.php | 14 +- .../Tests/CacheWarmer/TemplateFinderTest.php | 1 - .../Controller/RedirectControllerTest.php | 1 - .../RegisterKernelListenersPassTest.php | 2 +- .../Fixtures/php/deprecated_merge_full.php | 1 - .../Fixtures/php/deprecated_merge_partial.php | 1 - .../TestBundle/Resources/config/routing.yml | 1 - .../Tests/Functional/WebTestCase.php | 6 +- .../Tests/Functional/app/Session/config.yml | 1 - .../FrameworkBundle/Tests/HttpKernelTest.php | 2 +- .../Tests/Routing/RouterTest.php | 22 + .../Templating/Helper/CodeHelperTest.php | 2 +- .../Helper/FormHelperDivLayoutTest.php | 5 +- .../Helper/FormHelperTableLayoutTest.php | 1 + .../Resources/Child/form_label.html.php | 2 +- .../Custom/_name_entry_label.html.php | 2 + .../DependencyInjection/MainConfiguration.php | 2 +- .../Security/Factory/AbstractFactory.php | 56 +- .../Factory/SecurityFactoryInterface.php | 8 +- .../UserProviderFactoryInterface.php | 6 +- .../DependencyInjection/SecurityExtension.php | 11 +- .../Resources/config/security_listeners.xml | 28 +- .../Security/Factory/AbstractFactoryTest.php | 82 +- .../Tests/Functional/WebTestCase.php | 6 +- .../Symfony/Bundle/TwigBundle/CHANGELOG.md | 1 + .../Bundle/TwigBundle/Command/LintCommand.php | 2 +- .../Controller/ExceptionController.php | 7 +- .../DependencyInjection/Configuration.php | 4 + .../DependencyInjection/TwigExtension.php | 6 + .../Resources/config/schema/twig-1.0.xsd | 1 + .../Resources/views/Exception/logs.html.twig | 4 +- .../Controller/ExceptionControllerTest.php | 4 - .../DependencyInjection/Fixtures/php/full.php | 1 + .../DependencyInjection/Fixtures/xml/full.xml | 2 + .../DependencyInjection/Fixtures/yml/full.yml | 1 + .../Controller/ProfilerController.php | 41 +- .../EventListener/WebDebugToolbarListener.php | 13 +- .../Resources/config/toolbar.xml | 2 +- .../Resources/public/css/profiler.css | 5 + .../views/Collector/config.html.twig | 31 +- .../views/Collector/logger.html.twig | 8 +- .../views/Profiler/toolbar_style.html.twig | 2 +- .../WebProfilerExtensionTest.php | 2 +- .../Symfony/Component/BrowserKit/.gitignore | 2 + .../Symfony/Component/BrowserKit/Cookie.php | 2 +- .../Symfony/Component/ClassLoader/.gitignore | 2 + .../ClassLoader/ClassCollectionLoader.php | 37 +- .../ClassLoader/ClassMapGenerator.php | 6 +- .../ClassLoader/DebugClassLoader.php | 2 +- .../ClassLoader/DebugUniversalClassLoader.php | 2 +- .../Tests/ClassCollectionLoaderTest.php | 4 + .../ClassesWithParents/CInterface.php | 4 +- .../ClassesWithParents/GInterface.php | 7 + .../Tests/Fixtures/php5.4/traits.php | 16 +- .../Component/ClassLoader/composer.json | 1 + .../Component/Config/Definition/ArrayNode.php | 1 - .../Component/Config/Definition/BaseNode.php | 6 +- .../Definition/Builder/EnumNodeDefinition.php | 44 +- .../Config/Definition/Builder/ExprBuilder.php | 4 +- .../Builder/ParentNodeDefinitionInterface.php | 6 +- .../Definition/ConfigurationInterface.php | 2 +- .../Component/Config/Definition/EnumNode.php | 2 +- .../Config/Definition/NodeInterface.php | 16 +- .../Component/Config/Definition/Processor.php | 4 +- .../Definition/PrototypeNodeInterface.php | 2 +- .../Component/Config/FileLocatorInterface.php | 2 +- .../Component/Config/Loader/FileLoader.php | 2 +- .../Config/Loader/LoaderInterface.php | 8 +- .../Config/Loader/LoaderResolverInterface.php | 2 +- .../Config/Resource/ResourceInterface.php | 6 +- .../Tests/Definition/BooleanNodeTest.php | 1 - .../Builder/EnumNodeDefinitionTest.php | 2 +- .../Definition/Builder/ExprBuilderTest.php | 5 +- .../Config/Tests/Definition/EnumNodeTest.php | 2 +- .../Symfony/Component/Console/Application.php | 2 +- .../Console/Formatter/OutputFormatter.php | 41 +- .../Formatter/OutputFormatterInterface.php | 12 +- .../Formatter/OutputFormatterStyle.php | 6 +- .../OutputFormatterStyleInterface.php | 12 +- .../Console/Helper/FormatterHelper.php | 3 + .../Console/Helper/HelperInterface.php | 6 +- .../Console/Input/InputDefinition.php | 6 +- .../Console/Input/InputInterface.php | 30 +- .../Console/Output/OutputInterface.php | 16 +- .../Console/Tests/ApplicationTest.php | 4 +- .../Console/Tests/Command/CommandTest.php | 4 +- .../Tests/Fixtures/application_run2.txt | 2 +- .../Tests/Fixtures/definition_astext.txt | 8 +- .../Tests/Formatter/OutputFormatterTest.php | 15 + .../Tests/Helper/FormatterHelperTest.php | 13 + .../Tests/Input/InputDefinitionTest.php | 5 +- .../Component/CssSelector/CssSelector.php | 2 +- .../CssSelector/Node/CombinedSelectorNode.php | 2 +- .../CssSelector/Node/FunctionNode.php | 2 +- .../CssSelector/Node/NodeInterface.php | 4 +- .../Component/CssSelector/Node/PseudoNode.php | 2 +- .../Component/CssSelector/XPathExpr.php | 2 +- .../Component/DependencyInjection/.gitignore | 2 + .../Compiler/CompilerPassInterface.php | 2 +- .../Compiler/LoggingFormatter.php | 1 - .../Compiler/RepeatablePassInterface.php | 2 +- .../DependencyInjection/Container.php | 4 +- .../ContainerAwareInterface.php | 2 +- .../DependencyInjection/ContainerBuilder.php | 2 +- .../ContainerInterface.php | 22 +- .../Dumper/DumperInterface.php | 2 +- .../DependencyInjection/Dumper/XmlDumper.php | 2 +- .../ConfigurationExtensionInterface.php | 2 +- .../Extension/ExtensionInterface.php | 8 +- .../IntrospectableContainerInterface.php | 2 +- .../Loader/XmlFileLoader.php | 2 +- .../ParameterBag/ParameterBagInterface.php | 20 +- .../DependencyInjection/ScopeInterface.php | 4 +- .../DependencyInjection/SimpleXMLElement.php | 2 +- .../TaggedContainerInterface.php | 2 +- .../Tests/ContainerBuilderTest.php | 1 - .../Tests/CrossCheckTest.php | 4 +- .../Tests/Dumper/GraphvizDumperTest.php | 4 +- .../Tests/Dumper/PhpDumperTest.php | 4 +- .../Tests/Dumper/XmlDumperTest.php | 4 +- .../Tests/Dumper/YamlDumperTest.php | 4 +- .../Tests/Fixtures/includes/classes.php | 6 +- .../Tests/Fixtures/includes/foo.php | 2 +- .../Tests/Loader/IniFileLoaderTest.php | 4 +- .../Tests/Loader/XmlFileLoaderTest.php | 4 +- .../Tests/Loader/YamlFileLoaderTest.php | 4 +- .../Symfony/Component/DomCrawler/.gitignore | 2 + .../Symfony/Component/DomCrawler/Crawler.php | 2 +- .../src/Symfony/Component/DomCrawler/Form.php | 2 +- .../Component/EventDispatcher/.gitignore | 2 + .../TraceableEventDispatcherInterface.php | 4 +- .../EventDispatcherInterface.php | 14 +- .../EventSubscriberInterface.php | 2 +- .../ContainerAwareEventDispatcherTest.php | 6 +- .../EventDispatcher/Tests/EventTest.php | 1 - .../Component/Filesystem/Filesystem.php | 21 +- .../Filesystem/Tests/FilesystemTest.php | 16 + .../src/Symfony/Component/Finder/Finder.php | 6 +- .../src/Symfony/Component/Finder/Glob.php | 2 +- .../Iterator/MultiplePcreFilterIterator.php | 1 - .../Symfony/Component/Finder/SplFileInfo.php | 12 +- .../Component/Finder/Tests/FinderTest.php | 5 +- .../Tests/Iterator/RealIteratorTestCase.php | 6 +- .../src/Symfony/Component/Form/.gitignore | 2 + .../Symfony/Component/Form/AbstractType.php | 34 +- .../src/Symfony/Component/Form/CHANGELOG.md | 32 + .../Component/Form/DataMapperInterface.php | 4 +- .../Form/DataTransformerInterface.php | 4 +- .../Exception/CircularReferenceException.php | 22 - .../Extension/Core/ChoiceList/ChoiceList.php | 2 +- .../Core/ChoiceList/ChoiceListInterface.php | 16 +- .../Core/ChoiceList/SimpleChoiceList.php | 1 - .../DateTimeToLocalizedStringTransformer.php | 1 + .../DateTimeToRfc3339Transformer.php | 80 + .../ValueToStringTransformer.php | 67 - .../EventListener/BindRequestListener.php | 85 + .../FixCheckboxInputListener.php | 2 +- .../EventListener/FixRadioInputListener.php | 2 +- .../EventListener/FixUrlProtocolListener.php | 2 +- .../EventListener/MergeCollectionListener.php | 2 +- .../Core/EventListener/ResizeFormListener.php | 2 +- .../Core/EventListener/TrimListener.php | 2 +- .../Form/Extension/Core/Type/ChoiceType.php | 34 +- .../Extension/Core/Type/CollectionType.php | 11 + .../Form/Extension/Core/Type/DateTimeType.php | 176 +- .../Form/Extension/Core/Type/DateType.php | 219 +- .../Form/Extension/Core/Type/FormType.php | 48 +- .../Form/Extension/Core/Type/MoneyType.php | 2 +- .../Form/Extension/Core/Type/PasswordType.php | 1 - .../Form/Extension/Core/Type/TextType.php | 12 - .../Form/Extension/Core/Type/TimeType.php | 57 +- .../Form/Extension/Core/Type/TimezoneType.php | 4 +- .../CsrfProvider/CsrfProviderInterface.php | 4 +- .../Csrf/CsrfProvider/SessionCsrfProvider.php | 2 + .../EventListener/CsrfValidationListener.php | 2 +- .../DependencyInjectionExtension.php | 8 +- .../Validator/Constraints/FormValidator.php | 7 +- .../EventListener/ValidationListener.php | 2 +- .../Validator/ValidatorTypeGuesser.php | 55 +- .../Validator/ViolationMapper/MappingRule.php | 1 - .../ViolationMapperInterface.php | 2 +- .../ViolationMapper/ViolationPath.php | 2 - .../ViolationMapper/ViolationPathIterator.php | 1 - .../src/Symfony/Component/Form/Form.php | 91 +- .../Symfony/Component/Form/FormBuilder.php | 38 +- .../Component/Form/FormBuilderInterface.php | 22 +- .../src/Symfony/Component/Form/FormConfig.php | 39 +- .../Form/FormConfigEditorInterface.php | 57 +- .../Component/Form/FormConfigInterface.php | 61 +- .../Component/Form/FormExtensionInterface.php | 10 +- .../Symfony/Component/Form/FormFactory.php | 287 +- .../Component/Form/FormFactoryInterface.php | 41 +- .../Symfony/Component/Form/FormInterface.php | 56 +- .../Symfony/Component/Form/FormRegistry.php | 164 + .../Component/Form/FormRegistryInterface.php | 76 + .../Form/FormTypeExtensionInterface.php | 10 +- .../Form/FormTypeGuesserInterface.php | 10 +- .../Component/Form/FormTypeInterface.php | 42 +- .../Component/Form/FormValidatorInterface.php | 2 +- .../Component/Form/FormViewInterface.php | 32 +- .../Symfony/Component/Form/Guess/Guess.php | 2 +- .../Component/Form/ResolvedFormType.php | 213 + .../Form/ResolvedFormTypeInterface.php | 70 + .../translations/validators.sr_Cyrl.xlf | 4 +- .../translations/validators.sr_Latn.xlf | 4 +- .../Form/Tests/AbstractDivLayoutTest.php | 34 +- .../Component/Form/Tests/AbstractFormTest.php | 6 +- .../Form/Tests/AbstractLayoutTest.php | 88 +- .../Form/Tests/AbstractTableLayoutTest.php | 39 +- .../Tests/CompoundFormPerformanceTest.php | 48 + .../Component/Form/Tests/CompoundFormTest.php | 116 +- .../DataMapper/PropertyPathMapperTest.php | 1 - .../DateTimeToArrayTransformerTest.php | 12 +- .../DateTimeToRfc3339TransformerTest.php | 122 + .../MoneyToLocalizedStringTransformerTest.php | 1 - .../ValueToStringTransformerTest.php | 90 - .../EventListener/BindRequestListenerTest.php | 285 + .../MergeCollectionListenerTest.php | 1 - .../Core/Type/ChoiceTypePerformanceTest.php | 38 + .../Extension/Core/Type/ChoiceTypeTest.php | 18 +- .../Extension/Core/Type/DateTimeTypeTest.php | 209 +- .../Extension/Core/Type/DateTypeTest.php | 317 +- .../Extension/Core/Type/FormTypeTest.php | 12 + .../Extension/Core/Type/PasswordTypeTest.php | 1 - .../Extension/Core/Type/RepeatedTypeTest.php | 1 - .../Extension/Core/Type/TimeTypeTest.php | 201 +- .../Extension/Core/Type/TypeTestCase.php | 29 +- .../Tests/Extension/Core/Type/UrlTypeTest.php | 2 +- .../Constraints/FormValidatorTest.php | 23 +- .../EventListener/ValidationListenerTest.php | 3 - .../ViolationMapper/ViolationMapperTest.php | 1 - .../ViolationMapper/ViolationPathTest.php | 1 - .../Form/Tests/Fixtures/FooSubType.php | 32 + .../Component/Form/Tests/Fixtures/FooType.php | 29 +- .../Component/Form/Tests/FormBuilderTest.php | 9 + .../Component/Form/Tests/FormFactoryTest.php | 473 +- .../Form/Tests/FormIntegrationTestCase.php | 49 + .../Form/Tests/FormPerformanceTestCase.php | 70 + .../Component/Form/Tests/FormRegistryTest.php | 177 + .../Form/Tests/FormViewInterface.php | 16 + .../Form/Tests/ResolvedFormTypeTest.php | 285 + .../Component/Form/Tests/SimpleFormTest.php | 92 +- .../Tests/Util/PropertyPathCollectionTest.php | 130 + .../Form/Tests/Util/PropertyPathTest.php | 52 +- .../Component/Form/UnmodifiableFormConfig.php | 27 +- .../Symfony/Component/Form/Util/FormUtil.php | 10 +- .../Component/Form/Util/PropertyPath.php | 163 +- .../Form/Util/PropertyPathInterface.php | 16 +- .../Util/PropertyPathIteratorInterface.php | 4 +- .../Component/HttpFoundation/CHANGELOG.md | 7 +- .../File/MimeType/ExtensionGuesser.php | 4 +- .../MimeType/ExtensionGuesserInterface.php | 2 +- .../MimeType/FileBinaryMimeTypeGuesser.php | 2 +- .../File/MimeType/FileinfoMimeTypeGuesser.php | 2 +- .../MimeType/MimeTypeExtensionGuesser.php | 3 +- .../File/MimeType/MimeTypeGuesser.php | 4 +- .../MimeType/MimeTypeGuesserInterface.php | 2 +- .../HttpFoundation/File/UploadedFile.php | 2 +- .../Component/HttpFoundation/FileBag.php | 2 +- .../Component/HttpFoundation/JsonResponse.php | 6 +- .../HttpFoundation/RedirectResponse.php | 2 +- .../Component/HttpFoundation/Request.php | 19 +- .../RequestMatcherInterface.php | 2 +- .../stubs/SessionHandlerInterface.php | 12 +- .../Component/HttpFoundation/Response.php | 13 +- .../Attribute/AttributeBagInterface.php | 12 +- .../Session/Flash/AutoExpireFlashBag.php | 4 +- .../Session/Flash/FlashBagInterface.php | 18 +- .../Session/SessionBagInterface.php | 8 +- .../Session/SessionInterface.php | 38 +- .../Storage/Handler/FileSessionHandler.php | 116 - .../Handler/NativeFileSessionHandler.php | 41 + .../Storage/Handler/NativeSessionHandler.php | 24 + .../Storage/MockFileSessionStorage.php | 53 +- .../Storage/Proxy/SessionHandlerProxy.php | 2 +- .../Storage/SessionStorageInterface.php | 24 +- .../Tests/File/UploadedFileTest.php | 2 - .../HttpFoundation/Tests/ParameterBagTest.php | 1 - .../Tests/RequestMatcherTest.php | 2 - .../HttpFoundation/Tests/RequestTest.php | 6 +- .../Handler/FileSessionHandlerTest.php | 106 - .../Handler/NativeFileSessionHandlerTest.php | 49 + .../Handler/NativeSessionHandlerTest.php | 39 + .../Handler/NullSessionHandlerTest.php | 1 - .../Storage/Handler/PdoSessionHandlerTest.php | 1 - .../Storage/MockFileSessionStorageTest.php | 12 +- .../Storage/NativeSessionStorageTest.php | 3 +- .../Symfony/Component/HttpKernel/.gitignore | 2 + .../HttpKernel/Bundle/BundleInterface.php | 24 +- .../CacheClearer/CacheClearerInterface.php | 2 +- .../CacheWarmer/CacheWarmerInterface.php | 2 +- .../CacheWarmer/WarmableInterface.php | 2 +- .../ControllerResolverInterface.php | 4 +- .../DataCollector/ConfigDataCollector.php | 14 +- .../DataCollector/DataCollector.php | 1 - .../DataCollector/DataCollectorInterface.php | 4 +- .../DataCollector/ExceptionDataCollector.php | 7 +- .../DataCollector/RequestDataCollector.php | 49 +- .../DataCollector/RouterDataCollector.php | 101 + .../HttpKernel/Debug/ErrorHandler.php | 2 +- .../HttpKernel/Debug/ExceptionHandler.php | 4 +- .../ConfigurableExtension.php | 2 +- .../DependencyInjection/Extension.php | 2 +- .../HttpKernel/EventListener/EsiListener.php | 2 +- .../EventListener/ExceptionListener.php | 12 +- .../EventListener/LocaleListener.php | 2 +- .../EventListener/ProfilerListener.php | 2 +- .../EventListener/ResponseListener.php | 2 +- .../EventListener/RouterListener.php | 3 +- .../StreamedResponseListener.php | 2 +- .../HttpKernel/Exception/FlattenException.php | 9 +- .../Exception/HttpExceptionInterface.php | 4 +- .../EsiResponseCacheStrategyInterface.php | 4 +- .../HttpKernel/HttpCache/StoreInterface.php | 14 +- .../Component/HttpKernel/HttpKernel.php | 21 +- .../HttpKernel/HttpKernelInterface.php | 2 +- .../Symfony/Component/HttpKernel/Kernel.php | 12 +- .../Component/HttpKernel/KernelInterface.php | 34 +- .../HttpKernel/Log/DebugLoggerInterface.php | 4 +- .../HttpKernel/Log/LoggerInterface.php | 16 +- .../Profiler/PdoProfilerStorage.php | 2 +- .../Profiler/ProfilerStorageInterface.php | 8 +- .../Profiler/SqliteProfilerStorage.php | 1 - .../HttpKernel/TerminableInterface.php | 2 +- .../HttpKernel/Tests/Bundle/BundleTest.php | 2 +- .../Controller/ControllerResolverTest.php | 2 +- .../DataCollector/ConfigDataCollectorTest.php | 5 +- ...ainerAwareTraceableEventDispatcherTest.php | 4 +- .../Tests/Debug/ExceptionHandlerTest.php | 10 + .../HttpKernel/Tests/Debug/StopwatchTest.php | 1 - .../Tests/Exception/FlattenExceptionTest.php | 7 + .../Tests/Fixtures/KernelForOverrideName.php | 30 + .../Tests/Fixtures/TestEventDispatcher.php | 4 +- .../Tests/HttpCache/HttpCacheTestCase.php | 2 +- .../HttpKernel/Tests/HttpKernelTest.php | 37 +- .../Component/HttpKernel/Tests/KernelTest.php | 8 + .../Profiler/FileProfilerStorageTest.php | 4 +- .../Profiler/MongoDbProfilerStorageTest.php | 4 +- .../src/Symfony/Component/Locale/Locale.php | 18 +- .../Locale/Resources/data/update-data.php | 1 - .../Stub/DateFormat/FullTransformer.php | 3 + .../Stub/DateFormat/MonthTransformer.php | 9 +- .../Stub/DateFormat/TimeZoneTransformer.php | 2 +- .../Component/Locale/Stub/StubCollator.php | 2 +- .../Component/Locale/Stub/StubIntl.php | 10 +- .../Locale/Stub/StubIntlDateFormatter.php | 8 +- .../Component/Locale/Stub/StubLocale.php | 54 +- .../Locale/Stub/StubNumberFormatter.php | 14 +- .../Tests/Stub/StubIntlDateFormatterTest.php | 18 + .../Tests/Stub/StubNumberFormatterTest.php | 1 - .../Component/OptionsResolver/Options.php | 2 +- .../OptionsResolver/OptionsResolver.php | 10 +- .../OptionsResolverInterface.php | 24 +- .../Tests/OptionsResolverTest.php | 21 + .../OptionsResolver/Tests/OptionsTest.php | 1 - .../src/Symfony/Component/Process/Process.php | 23 +- .../Component/Process/ProcessBuilder.php | 19 + .../Process/Tests/ProcessBuilderTest.php | 22 + .../Component/Process/Tests/ProcessTest.php | 27 +- .../src/Symfony/Component/Routing/.gitignore | 2 + .../Dumper/GeneratorDumperInterface.php | 4 +- .../Generator/UrlGeneratorInterface.php | 2 +- .../Routing/Matcher/ApacheUrlMatcher.php | 25 +- .../Matcher/Dumper/ApacheMatcherDumper.php | 5 +- .../Matcher/Dumper/MatcherDumperInterface.php | 4 +- .../RedirectableUrlMatcherInterface.php | 2 +- .../Matcher/RequestMatcherInterface.php | 2 +- .../Component/Routing/Matcher/UrlMatcher.php | 4 +- .../Routing/Matcher/UrlMatcherInterface.php | 2 +- .../Routing/RequestContextAwareInterface.php | 4 +- .../src/Symfony/Component/Routing/Route.php | 23 +- .../Routing/RouteCompilerInterface.php | 2 +- .../Component/Routing/RouterInterface.php | 2 +- .../Routing/Tests/Annotation/RouteTest.php | 1 - .../Tests/Fixtures/dumper/url_matcher1.apache | 8 +- .../Routing/Tests/Fixtures/validpattern.yml | 1 - .../Loader/AbstractAnnotationLoaderTest.php | 1 - .../Tests/Loader/PhpFileLoaderTest.php | 1 - .../Tests/Matcher/ApacheUrlMatcherTest.php | 30 +- .../Dumper/ApacheMatcherDumperTest.php | 9 +- .../Matcher/Dumper/PhpMatcherDumperTest.php | 1 - .../src/Symfony/Component/Security/.gitignore | 2 + .../Security/Acl/Dbal/AclProvider.php | 2 +- .../Component/Security/Acl/Domain/Acl.php | 1 - .../Security/Acl/Domain/ObjectIdentity.php | 2 +- .../Acl/Domain/UserSecurityIdentity.php | 4 +- .../Security/Acl/Model/AclCacheInterface.php | 12 +- .../Security/Acl/Model/AclInterface.php | 20 +- .../Acl/Model/AclProviderInterface.php | 6 +- .../Acl/Model/AuditLoggerInterface.php | 2 +- .../Acl/Model/AuditableAclInterface.php | 8 +- .../Acl/Model/AuditableEntryInterface.php | 4 +- .../Acl/Model/DomainObjectInterface.php | 2 +- .../Security/Acl/Model/EntryInterface.php | 12 +- .../Acl/Model/FieldEntryInterface.php | 2 +- .../Acl/Model/MutableAclInterface.php | 30 +- .../Acl/Model/MutableAclProviderInterface.php | 6 +- .../Acl/Model/ObjectIdentityInterface.php | 6 +- ...jectIdentityRetrievalStrategyInterface.php | 2 +- .../PermissionGrantingStrategyInterface.php | 4 +- .../Acl/Model/SecurityIdentityInterface.php | 2 +- ...rityIdentityRetrievalStrategyInterface.php | 2 +- .../Security/Acl/Permission/MaskBuilder.php | 2 +- .../Acl/Permission/PermissionMapInterface.php | 4 +- .../Acl/Resources/bin/generateSql.php | 1 - .../Symfony/Component/Security/CHANGELOG.md | 5 + .../AuthenticationManagerInterface.php | 2 +- .../AuthenticationTrustResolverInterface.php | 6 +- .../RememberMe/PersistentTokenInterface.php | 10 +- .../RememberMe/TokenProviderInterface.php | 8 +- .../Authentication/Token/TokenInterface.php | 28 +- .../AccessDecisionManagerInterface.php | 6 +- .../Authorization/Voter/VoterInterface.php | 6 +- .../Security/Core/Encoder/EncoderFactory.php | 2 - .../Core/Encoder/EncoderFactoryInterface.php | 2 +- .../Core/Encoder/PasswordEncoderInterface.php | 4 +- .../Core/Role/RoleHierarchyInterface.php | 2 +- .../Security/Core/Role/RoleInterface.php | 2 +- .../Security/Core/SecurityContext.php | 2 +- .../Core/SecurityContextInterface.php | 6 +- .../Core/User/AdvancedUserInterface.php | 8 +- .../Security/Core/User/EquatableInterface.php | 2 +- .../Core/User/UserCheckerInterface.php | 4 +- .../Security/Core/User/UserInterface.php | 10 +- .../Core/User/UserProviderInterface.php | 6 +- .../Validator/Constraint/UserPassword.php | 2 +- .../Security/Http/AccessMapInterface.php | 2 +- .../AuthenticationFailureHandlerInterface.php | 4 +- .../AuthenticationSuccessHandlerInterface.php | 4 +- .../DefaultAuthenticationFailureHandler.php | 87 + .../DefaultAuthenticationSuccessHandler.php | 111 + .../AccessDeniedHandlerInterface.php | 2 +- .../AuthenticationEntryPointInterface.php | 2 +- .../AbstractAuthenticationListener.php | 91 +- .../AbstractPreAuthenticatedListener.php | 2 +- .../Http/Firewall/ExceptionListener.php | 7 +- .../Http/Firewall/ListenerInterface.php | 2 +- .../Security/Http/Firewall/LogoutListener.php | 16 +- ...namePasswordFormAuthenticationListener.php | 6 +- .../Security/Http/FirewallMapInterface.php | 2 +- .../Logout/DefaultLogoutSuccessHandler.php | 47 + .../Http/Logout/LogoutHandlerInterface.php | 2 +- .../Logout/LogoutSuccessHandlerInterface.php | 2 +- .../RememberMe/AbstractRememberMeServices.php | 8 +- .../RememberMeServicesInterface.php | 6 +- ...SessionAuthenticationStrategyInterface.php | 2 +- .../SecurityIdentityRetrievalStrategyTest.php | 2 - .../DaoAuthenticationProviderTest.php | 1 - .../Http/Firewall/LogoutListenerTest.php | 12 +- .../Serializer/Encoder/ChainDecoder.php | 82 + .../Serializer/Encoder/ChainEncoder.php | 105 + .../Serializer/Encoder/DecoderInterface.php | 4 +- .../Serializer/Encoder/EncoderInterface.php | 4 +- .../Normalizer/DenormalizableInterface.php | 2 +- .../Normalizer/DenormalizerInterface.php | 4 +- .../Normalizer/NormalizableInterface.php | 2 +- .../Normalizer/NormalizerInterface.php | 4 +- .../Component/Serializer/Serializer.php | 99 +- .../Serializer/SerializerAwareInterface.php | 2 +- .../Serializer/SerializerInterface.php | 4 +- .../Tests/Fixtures/DenormalizableDummy.php | 2 +- .../Templating/Asset/PackageInterface.php | 4 +- .../Templating/DebuggerInterface.php | 2 +- .../Component/Templating/EngineInterface.php | 6 +- .../Templating/Helper/HelperInterface.php | 6 +- .../Templating/Loader/FilesystemLoader.php | 2 +- .../Templating/Loader/LoaderInterface.php | 4 +- .../Templating/StreamingEngineInterface.php | 2 +- .../TemplateNameParserInterface.php | 2 +- .../Templating/TemplateReferenceInterface.php | 10 +- .../Tests/Loader/FilesystemLoaderTest.php | 6 +- .../Symfony/Component/Translation/.gitignore | 2 + .../Translation/Dumper/DumperInterface.php | 2 +- .../Translation/Dumper/IcuResFileDumper.php | 2 +- .../Extractor/ExtractorInterface.php | 4 +- .../Component/Translation/Interval.php | 6 +- .../Translation/Loader/LoaderInterface.php | 2 +- .../Translation/MessageCatalogueInterface.php | 28 +- .../Component/Translation/MessageSelector.php | 4 +- .../Translation/PluralizationRules.php | 6 +- .../Tests/PluralizationRulesTest.php | 124 + .../Translation/TranslatorInterface.php | 8 +- .../Symfony/Component/Validator/.gitignore | 2 + .../Symfony/Component/Validator/CHANGELOG.md | 7 +- .../ConstraintValidatorFactoryInterface.php | 2 +- .../ConstraintValidatorInterface.php | 4 +- .../Validator/ConstraintViolationList.php | 1 - .../Component/Validator/Constraints/All.php | 23 + .../Validator/Constraints/AllValidator.php | 13 +- .../Validator/Constraints/BlankValidator.php | 7 +- .../Constraints/CallbackValidator.php | 7 +- .../Validator/Constraints/ChoiceValidator.php | 7 +- .../Validator/Constraints/Collection.php | 27 + .../Constraints/CollectionValidator.php | 19 +- .../Component/Validator/Constraints/Count.php | 45 + .../Validator/Constraints/CountValidator.php | 63 + .../Constraints/CountryValidator.php | 7 +- .../Validator/Constraints/DateValidator.php | 7 +- .../Validator/Constraints/EmailValidator.php | 7 +- .../Validator/Constraints/FalseValidator.php | 7 +- .../Validator/Constraints/FileValidator.php | 7 +- .../Validator/Constraints/ImageValidator.php | 3 + .../Component/Validator/Constraints/Ip.php | 2 +- .../Validator/Constraints/IpValidator.php | 7 +- .../Constraints/LanguageValidator.php | 7 +- .../Validator/Constraints/Length.php | 46 + .../Validator/Constraints/LengthValidator.php | 71 + .../Validator/Constraints/LocaleValidator.php | 7 +- .../Component/Validator/Constraints/Max.php | 2 + .../Validator/Constraints/MaxLength.php | 2 + .../Constraints/MaxLengthValidator.php | 21 +- .../Validator/Constraints/MaxValidator.php | 11 +- .../Component/Validator/Constraints/Min.php | 2 + .../Validator/Constraints/MinLength.php | 2 + .../Constraints/MinLengthValidator.php | 21 +- .../Validator/Constraints/MinValidator.php | 4 +- .../Constraints/NotBlankValidator.php | 7 +- .../Constraints/NotNullValidator.php | 7 +- .../Validator/Constraints/NullValidator.php | 7 +- .../Component/Validator/Constraints/Range.php | 18 +- .../Validator/Constraints/RangeValidator.php | 15 +- .../Component/Validator/Constraints/Regex.php | 2 +- .../Validator/Constraints/RegexValidator.php | 7 +- .../Component/Validator/Constraints/Size.php | 73 +- .../Validator/Constraints/SizeValidator.php | 153 +- .../Validator/Constraints/TimeValidator.php | 7 +- .../Validator/Constraints/TrueValidator.php | 7 +- .../Validator/Constraints/TypeValidator.php | 7 +- .../Validator/Constraints/UrlValidator.php | 7 +- .../Component/Validator/Constraints/Valid.php | 10 + .../GroupSequenceProviderInterface.php | 2 +- .../Mapping/Cache/CacheInterface.php | 6 +- .../Mapping/ClassMetadataFactoryInterface.php | 2 +- .../Mapping/Loader/LoaderInterface.php | 2 +- .../Mapping/Loader/YamlFileLoader.php | 2 +- .../Validator/ObjectInitializerInterface.php | 2 +- .../Resources/translations/validators.cs.xlf | 12 + .../Resources/translations/validators.es.xlf | 12 +- .../Resources/translations/validators.fr.xlf | 4 +- .../Resources/translations/validators.he.xlf | 22 +- .../Resources/translations/validators.pl.xlf | 16 +- .../Resources/translations/validators.pt.xlf | 16 +- .../translations/validators.pt_BR.xlf | 22 +- .../Resources/translations/validators.ru.xlf | 2 +- .../translations/validators.sr_Cyrl.xlf | 34 +- .../translations/validators.sr_Latn.xlf | 34 +- .../Validator/Tests/Constraints/AllTest.php | 41 + .../Tests/Constraints/AllValidatorTest.php | 2 - .../Constraints/CallbackValidatorTest.php | 1 - .../Tests/Constraints/ChoiceValidatorTest.php | 1 - .../Tests/Constraints/CollectionTest.php | 73 + .../Constraints/CollectionValidatorTest.php | 1 - .../Constraints/CountValidatorArrayTest.php | 23 + .../CountValidatorCountableTest.php | 38 + .../Tests/Constraints/CountValidatorTest.php | 195 + .../Tests/Constraints/LengthValidatorTest.php | 233 + .../Constraints/MaxLengthValidatorTest.php | 6 +- .../Tests/Constraints/MaxValidatorTest.php | 8 + .../Constraints/MinLengthValidatorTest.php | 6 +- .../Tests/Constraints/MinValidatorTest.php | 8 + .../Constraints/NotBlankValidatorTest.php | 1 - .../Tests/Constraints/RangeValidatorTest.php | 152 +- .../Validator/Tests/Constraints/SizeTest.php | 98 - .../Tests/Constraints/SizeValidatorTest.php | 216 - .../Validator/Tests/Constraints/ValidTest.php | 28 + .../Tests/Fixtures/ConstraintAValidator.php | 2 +- .../Tests/Mapping/GetterMetadataTest.php | 1 - .../Tests/Mapping/Loader/LoaderChainTest.php | 1 - .../Mapping/Loader/StaticMethodLoaderTest.php | 4 +- .../Tests/Mapping/PropertyMetadataTest.php | 1 - .../Validator/Tests/ValidatorTest.php | 13 + .../Symfony/Component/Validator/Validator.php | 18 + .../Component/Validator/ValidatorContext.php | 6 +- .../Validator/ValidatorContextInterface.php | 6 +- .../Component/Validator/ValidatorFactory.php | 2 +- .../Validator/ValidatorInterface.php | 10 +- .../src/Symfony/Component/Yaml/Escaper.php | 12 +- .../src/Symfony/Component/Yaml/Inline.php | 18 +- .../Yaml/Tests/Fixtures/YtsErrorTests.yml | 1 - .../Yaml/Tests/Fixtures/embededPhp.yml | 2 +- .../src/Symfony/Component/Yaml/Unescaper.php | 2 +- .../src/Symfony/Component/Yaml/Yaml.php | 8 +- vendor/twig/twig/AUTHORS | 9 + vendor/twig/twig/CHANGELOG | 532 ++ vendor/twig/twig/README.markdown | 17 + vendor/twig/twig/bin/create_pear_package.php | 42 + vendor/twig/twig/doc/advanced.rst | 835 +++ vendor/twig/twig/doc/api.rst | 510 ++ vendor/twig/twig/doc/coding_standards.rst | 101 + vendor/twig/twig/doc/filters/abs.rst | 18 + vendor/twig/twig/doc/filters/capitalize.rst | 11 + .../twig/doc/filters/convert_encoding.rst | 22 + vendor/twig/twig/doc/filters/date.rst | 65 + vendor/twig/twig/doc/filters/date_modify.rst | 18 + vendor/twig/twig/doc/filters/default.rst | 28 + vendor/twig/twig/doc/filters/escape.rst | 60 + vendor/twig/twig/doc/filters/format.rst | 16 + vendor/twig/twig/doc/filters/index.rst | 30 + vendor/twig/twig/doc/filters/join.rst | 18 + vendor/twig/twig/doc/filters/json_encode.rst | 14 + vendor/twig/twig/doc/filters/keys.rst | 11 + vendor/twig/twig/doc/filters/length.rst | 12 + vendor/twig/twig/doc/filters/lower.rst | 10 + vendor/twig/twig/doc/filters/merge.rst | 41 + vendor/twig/twig/doc/filters/nl2br.rst | 22 + .../twig/twig/doc/filters/number_format.rst | 38 + vendor/twig/twig/doc/filters/raw.rst | 12 + vendor/twig/twig/doc/filters/replace.rst | 14 + vendor/twig/twig/doc/filters/reverse.rst | 23 + vendor/twig/twig/doc/filters/slice.rst | 57 + vendor/twig/twig/doc/filters/sort.rst | 17 + vendor/twig/twig/doc/filters/striptags.rst | 15 + vendor/twig/twig/doc/filters/title.rst | 11 + vendor/twig/twig/doc/filters/trim.rst | 24 + vendor/twig/twig/doc/filters/upper.rst | 10 + vendor/twig/twig/doc/filters/url_encode.rst | 14 + vendor/twig/twig/doc/functions/attribute.rst | 18 + vendor/twig/twig/doc/functions/block.rst | 15 + vendor/twig/twig/doc/functions/constant.rst | 9 + vendor/twig/twig/doc/functions/cycle.rst | 20 + vendor/twig/twig/doc/functions/date.rst | 46 + vendor/twig/twig/doc/functions/dump.rst | 64 + vendor/twig/twig/doc/functions/index.rst | 15 + vendor/twig/twig/doc/functions/parent.rst | 20 + vendor/twig/twig/doc/functions/random.rst | 24 + vendor/twig/twig/doc/functions/range.rst | 38 + vendor/twig/twig/doc/index.rst | 17 + vendor/twig/twig/doc/internals.rst | 140 + vendor/twig/twig/doc/intro.rst | 160 + vendor/twig/twig/doc/recipes.rst | 368 ++ vendor/twig/twig/doc/tags/autoescape.rst | 71 + vendor/twig/twig/doc/tags/block.rst | 11 + vendor/twig/twig/doc/tags/do.rst | 12 + vendor/twig/twig/doc/tags/embed.rst | 178 + vendor/twig/twig/doc/tags/extends.rst | 187 + vendor/twig/twig/doc/tags/filter.rst | 21 + vendor/twig/twig/doc/tags/flush.rst | 17 + vendor/twig/twig/doc/tags/for.rst | 157 + vendor/twig/twig/doc/tags/from.rst | 8 + vendor/twig/twig/doc/tags/if.rst | 43 + vendor/twig/twig/doc/tags/import.rst | 79 + vendor/twig/twig/doc/tags/include.rst | 86 + vendor/twig/twig/doc/tags/index.rst | 24 + vendor/twig/twig/doc/tags/macro.rst | 91 + vendor/twig/twig/doc/tags/raw.rst | 16 + vendor/twig/twig/doc/tags/sandbox.rst | 30 + vendor/twig/twig/doc/tags/set.rst | 32 + vendor/twig/twig/doc/tags/spaceless.rst | 37 + vendor/twig/twig/doc/tags/use.rst | 123 + vendor/twig/twig/doc/templates.rst | 745 +++ vendor/twig/twig/doc/tests/constant.rst | 11 + vendor/twig/twig/doc/tests/defined.rst | 30 + vendor/twig/twig/doc/tests/divisibleby.rst | 10 + vendor/twig/twig/doc/tests/empty.rst | 11 + vendor/twig/twig/doc/tests/even.rst | 10 + vendor/twig/twig/doc/tests/index.rst | 15 + vendor/twig/twig/doc/tests/iterable.rst | 19 + vendor/twig/twig/doc/tests/null.rst | 12 + vendor/twig/twig/doc/tests/odd.rst | 10 + vendor/twig/twig/doc/tests/sameas.rst | 11 + vendor/twig/twig/ext/twig/.gitignore | 30 + vendor/twig/twig/ext/twig/php_twig.h | 2 +- vendor/twig/twig/lib/Twig/Environment.php | 2 +- vendor/twig/twig/lib/Twig/Error.php | 12 +- vendor/twig/twig/lib/Twig/Extension/Core.php | 268 +- vendor/twig/twig/lib/Twig/Function/Node.php | 2 +- vendor/twig/twig/lib/Twig/Loader/String.php | 4 + vendor/twig/twig/lib/Twig/Parser.php | 5 +- vendor/twig/twig/package.xml.tpl | 64 + vendor/twig/twig/phpunit.xml.dist | 25 + .../twig/test/Twig/Tests/AutoloaderTest.php | 21 + .../twig/test/Twig/Tests/CompilerTest.php | 33 + .../twig/test/Twig/Tests/EnvironmentTest.php | 35 + .../twig/twig/test/Twig/Tests/ErrorTest.php | 136 + .../test/Twig/Tests/ExpressionParserTest.php | 217 + .../test/Twig/Tests/Extension/CoreTest.php | 115 + .../test/Twig/Tests/Extension/SandboxTest.php | 209 + .../twig/test/Twig/Tests/FileCachingTest.php | 70 + .../test/Twig/Tests/Fixtures/errors/base.html | 1 + .../Twig/Tests/Fixtures/errors/index.html | 7 + .../Fixtures/exceptions/unclosed_tag.test | 20 + .../Tests/Fixtures/expressions/array.test | 61 + .../Fixtures/expressions/array_call.test | 14 + .../Tests/Fixtures/expressions/binary.test | 46 + .../Tests/Fixtures/expressions/bitwise.test | 12 + .../Fixtures/expressions/comparison.test | 14 + .../Tests/Fixtures/expressions/dotdot.test | 20 + .../Tests/Fixtures/expressions/grouping.test | 8 + .../Tests/Fixtures/expressions/literals.test | 22 + .../Fixtures/expressions/magic_call.test | 27 + .../Fixtures/expressions/method_call.test | 28 + .../Tests/Fixtures/expressions/postfix.test | 21 + .../Tests/Fixtures/expressions/strings.test | 10 + .../expressions/ternary_operator.test | 18 + .../Tests/Fixtures/expressions/unary.test | 12 + .../expressions/unary_precedence.test | 14 + .../test/Twig/Tests/Fixtures/filters/abs.test | 30 + .../Fixtures/filters/convert_encoding.test | 10 + .../Twig/Tests/Fixtures/filters/date.test | 56 + .../Fixtures/filters/date_default_format.test | 14 + .../filters/date_default_format_interval.test | 16 + .../Tests/Fixtures/filters/date_interval.test | 16 + .../Tests/Fixtures/filters/date_modify.test | 14 + .../Twig/Tests/Fixtures/filters/default.test | 150 + .../Fixtures/filters/dynamic_filter.test | 10 + .../Twig/Tests/Fixtures/filters/escape.test | 8 + .../filters/escape_non_supported_charset.test | 8 + .../Tests/Fixtures/filters/force_escape.test | 18 + .../Twig/Tests/Fixtures/filters/format.test | 8 + .../Twig/Tests/Fixtures/filters/join.test | 12 + .../Tests/Fixtures/filters/json_encode.test | 12 + .../Twig/Tests/Fixtures/filters/length.test | 14 + .../Tests/Fixtures/filters/length_utf8.test | 12 + .../Twig/Tests/Fixtures/filters/merge.test | 14 + .../Twig/Tests/Fixtures/filters/nl2br.test | 14 + .../Tests/Fixtures/filters/number_format.test | 18 + .../filters/number_format_default.test | 21 + .../Twig/Tests/Fixtures/filters/replace.test | 8 + .../Twig/Tests/Fixtures/filters/reverse.test | 12 + .../Twig/Tests/Fixtures/filters/slice.test | 40 + .../Twig/Tests/Fixtures/filters/sort.test | 10 + .../Tests/Fixtures/filters/special_chars.test | 8 + .../Twig/Tests/Fixtures/filters/trim.test | 12 + .../Tests/Fixtures/functions/attribute.test | 12 + .../Twig/Tests/Fixtures/functions/block.test | 12 + .../Tests/Fixtures/functions/constant.test | 12 + .../Twig/Tests/Fixtures/functions/cycle.test | 16 + .../Twig/Tests/Fixtures/functions/date.test | 25 + .../Twig/Tests/Fixtures/functions/dump.test | 14 + .../Tests/Fixtures/functions/dump_array.test | 19 + .../Fixtures/functions/dynamic_function.test | 10 + .../Fixtures/functions/special_chars.test | 8 + .../Twig/Tests/Fixtures/macros/simple.test | 22 + .../Tests/Fixtures/macros/with_filters.test | 14 + .../Fixtures/regression/empty_token.test | 8 + .../regression/simple_xml_element.test | 17 + .../regression/strings_like_numbers.test | 8 + .../Tests/Fixtures/tags/autoescape/basic.test | 26 + .../Fixtures/tags/autoescape/blocks.test | 12 + .../tags/autoescape/double_escaping.test | 10 + .../Fixtures/tags/autoescape/functions.test | 83 + .../Fixtures/tags/autoescape/literal.test | 45 + .../Fixtures/tags/autoescape/nested.test | 26 + .../Fixtures/tags/autoescape/objects.test | 26 + .../Tests/Fixtures/tags/autoescape/raw.test | 10 + .../Fixtures/tags/autoescape/strategy.test | 17 + .../Tests/Fixtures/tags/autoescape/type.test | 69 + .../tags/autoescape/with_filters.test | 131 + .../autoescape/with_filters_arguments.test | 23 + .../autoescape/with_pre_escape_filters.test | 68 + .../with_preserves_safety_filters.test | 50 + .../Twig/Tests/Fixtures/tags/block/basic.test | 11 + .../tags/block/block_unique_name.test | 11 + .../Fixtures/tags/block/special_chars.test | 10 + .../Twig/Tests/Fixtures/tags/embed/basic.test | 35 + .../Tests/Fixtures/tags/embed/multiple.test | 50 + .../Tests/Fixtures/tags/embed/nested.test | 42 + .../Fixtures/tags/embed/with_extends.test | 57 + .../Tests/Fixtures/tags/filter/basic.test | 10 + .../Fixtures/tags/filter/json_encode.test | 8 + .../Tests/Fixtures/tags/filter/multiple.test | 10 + .../Tests/Fixtures/tags/filter/nested.test | 16 + .../Fixtures/tags/filter/with_for_tag.test | 13 + .../Fixtures/tags/filter/with_if_tag.test | 29 + .../Tests/Fixtures/tags/for/condition.test | 14 + .../Twig/Tests/Fixtures/tags/for/context.test | 18 + .../Twig/Tests/Fixtures/tags/for/else.test | 23 + .../Fixtures/tags/for/inner_variables.test | 17 + .../Twig/Tests/Fixtures/tags/for/keys.test | 11 + .../Fixtures/tags/for/keys_and_values.test | 11 + .../Tests/Fixtures/tags/for/loop_context.test | 19 + .../Fixtures/tags/for/loop_context_local.test | 10 + .../Tests/Fixtures/tags/for/nested_else.test | 17 + .../Twig/Tests/Fixtures/tags/for/objects.test | 43 + .../Fixtures/tags/for/objects_countable.test | 47 + .../Tests/Fixtures/tags/for/recursive.test | 18 + .../Twig/Tests/Fixtures/tags/for/values.test | 11 + .../test/Twig/Tests/Fixtures/tags/from.test | 14 + .../Twig/Tests/Fixtures/tags/if/basic.test | 22 + .../Tests/Fixtures/tags/if/expression.test | 22 + .../Tests/Fixtures/tags/include/basic.test | 16 + .../Fixtures/tags/include/expression.test | 16 + .../Fixtures/tags/include/ignore_missing.test | 10 + .../Tests/Fixtures/tags/include/only.test | 16 + .../tags/include/template_instance.test | 10 + .../tags/include/templates_as_array.test | 12 + .../Fixtures/tags/include/with_variables.test | 12 + .../Fixtures/tags/inheritance/basic.test | 14 + .../tags/inheritance/conditional.test | 14 + .../Fixtures/tags/inheritance/dynamic.test | 14 + .../Fixtures/tags/inheritance/empty.test | 10 + .../tags/inheritance/extends_as_array.test | 12 + .../Fixtures/tags/inheritance/multiple.test | 12 + .../tags/inheritance/nested_blocks.test | 22 + .../nested_blocks_parent_only.test | 15 + .../tags/inheritance/nested_inheritance.test | 16 + .../Fixtures/tags/inheritance/parent.test | 12 + .../tags/inheritance/parent_change.test | 16 + .../tags/inheritance/parent_in_a_block.test | 8 + .../tags/inheritance/parent_isolation.test | 20 + .../tags/inheritance/parent_nested.test | 28 + .../inheritance/parent_without_extends.test | 8 + .../parent_without_extends_but_traits.test | 14 + .../tags/inheritance/template_instance.test | 14 + .../Tests/Fixtures/tags/inheritance/use.test | 44 + .../Twig/Tests/Fixtures/tags/macro/basic.test | 15 + .../Fixtures/tags/macro/endmacro_name.test | 14 + .../Tests/Fixtures/tags/macro/external.test | 17 + .../Twig/Tests/Fixtures/tags/macro/from.test | 18 + .../Tests/Fixtures/tags/macro/global.test | 14 + .../Fixtures/tags/macro/self_import.test | 17 + .../Fixtures/tags/macro/special_chars.test | 12 + .../Twig/Tests/Fixtures/tags/raw/basic.test | 10 + .../Fixtures/tags/raw/whitespace_control.test | 56 + .../Fixtures/tags/sandbox/not_valid1.test | 11 + .../Fixtures/tags/sandbox/not_valid2.test | 14 + .../Tests/Fixtures/tags/sandbox/simple.test | 22 + .../Twig/Tests/Fixtures/tags/set/basic.test | 20 + .../Fixtures/tags/set/capture-empty.test | 9 + .../Twig/Tests/Fixtures/tags/set/capture.test | 10 + .../Tests/Fixtures/tags/set/expression.test | 12 + .../Tests/Fixtures/tags/spaceless/simple.test | 12 + .../Tests/Fixtures/tags/special_chars.test | 8 + .../Twig/Tests/Fixtures/tags/trim_block.test | 74 + .../Twig/Tests/Fixtures/tags/use/aliases.test | 12 + .../Twig/Tests/Fixtures/tags/use/basic.test | 12 + .../Twig/Tests/Fixtures/tags/use/deep.test | 22 + .../Tests/Fixtures/tags/use/deep_empty.test | 10 + .../Tests/Fixtures/tags/use/multiple.test | 21 + .../Fixtures/tags/use/multiple_aliases.test | 23 + .../test/Twig/Tests/Fixtures/tests/array.test | 24 + .../Twig/Tests/Fixtures/tests/constant.test | 12 + .../Twig/Tests/Fixtures/tests/defined.test | 108 + .../test/Twig/Tests/Fixtures/tests/empty.test | 45 + .../test/Twig/Tests/Fixtures/tests/even.test | 14 + .../test/Twig/Tests/Fixtures/tests/in.test | 48 + .../Twig/Tests/Fixtures/tests/iterable.test | 19 + .../test/Twig/Tests/Fixtures/tests/odd.test | 10 + .../twig/twig/test/Twig/Tests/LexerTest.php | 249 + .../twig/test/Twig/Tests/Loader/ArrayTest.php | 97 + .../twig/test/Twig/Tests/Loader/ChainTest.php | 63 + .../test/Twig/Tests/Loader/FilesystemTest.php | 52 + .../test/Twig/Tests/Node/AutoEscapeTest.php | 46 + .../Twig/Tests/Node/BlockReferenceTest.php | 41 + .../twig/test/Twig/Tests/Node/BlockTest.php | 52 + .../twig/twig/test/Twig/Tests/Node/DoTest.php | 46 + .../Twig/Tests/Node/Expression/ArrayTest.php | 51 + .../Tests/Node/Expression/AssignNameTest.php | 43 + .../Tests/Node/Expression/Binary/AddTest.php | 49 + .../Tests/Node/Expression/Binary/AndTest.php | 49 + .../Node/Expression/Binary/ConcatTest.php | 49 + .../Tests/Node/Expression/Binary/DivTest.php | 49 + .../Node/Expression/Binary/FloorDivTest.php | 49 + .../Tests/Node/Expression/Binary/ModTest.php | 49 + .../Tests/Node/Expression/Binary/MulTest.php | 49 + .../Tests/Node/Expression/Binary/OrTest.php | 49 + .../Tests/Node/Expression/Binary/SubTest.php | 49 + .../Tests/Node/Expression/ConditionalTest.php | 52 + .../Tests/Node/Expression/ConstantTest.php | 44 + .../Twig/Tests/Node/Expression/FilterTest.php | 85 + .../Tests/Node/Expression/FunctionTest.php | 90 + .../Tests/Node/Expression/GetAttrTest.php | 64 + .../Twig/Tests/Node/Expression/NameTest.php | 51 + .../Twig/Tests/Node/Expression/ParentTest.php | 42 + .../Twig/Tests/Node/Expression/TestTest.php | 67 + .../Tests/Node/Expression/Unary/NegTest.php | 46 + .../Tests/Node/Expression/Unary/NotTest.php | 46 + .../Tests/Node/Expression/Unary/PosTest.php | 46 + .../twig/test/Twig/Tests/Node/ForTest.php | 201 + .../twig/twig/test/Twig/Tests/Node/IfTest.php | 99 + .../twig/test/Twig/Tests/Node/ImportTest.php | 50 + .../twig/test/Twig/Tests/Node/IncludeTest.php | 84 + .../twig/test/Twig/Tests/Node/MacroTest.php | 70 + .../twig/test/Twig/Tests/Node/ModuleTest.php | 196 + .../twig/test/Twig/Tests/Node/PrintTest.php | 43 + .../twig/test/Twig/Tests/Node/SandboxTest.php | 57 + .../Twig/Tests/Node/SandboxedModuleTest.php | 172 + .../Twig/Tests/Node/SandboxedPrintTest.php | 46 + .../twig/test/Twig/Tests/Node/SetTest.php | 73 + .../test/Twig/Tests/Node/SpacelessTest.php | 50 + .../twig/test/Twig/Tests/Node/TestCase.php | 58 + .../twig/test/Twig/Tests/Node/TextTest.php | 42 + .../Twig/Tests/NodeVisitor/OptimizerTest.php | 118 + .../twig/twig/test/Twig/Tests/ParserTest.php | 180 + .../twig/test/Twig/Tests/TemplateTest.php | 377 ++ .../twig/test/Twig/Tests/TokenStreamTest.php | 41 + .../twig/test/Twig/Tests/escapingTest.php | 324 + .../twig/test/Twig/Tests/integrationTest.php | 322 + vendor/twig/twig/test/bootstrap.php | 13 + 1551 files changed, 157774 insertions(+), 5177 deletions(-) create mode 100755 composer.phar create mode 160000 vendor/egeloen/ckeditor-bundle/Ivory/CKEditorBundle delete mode 100644 vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php delete mode 100644 vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Upgrader/Upgrader.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/.gitignore create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/CHANGELOG-2.1.md create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Configuration/ConfigurationAnnotationTest.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/CacheListenerTest.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ControllerListenerTest.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClass.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClassAndMethod.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtMethod.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/DoctrineParamConverterTest.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/ParamConverterManagerTest.php create mode 100644 vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/phpunit.xml.dist create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/.gitignore create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateBundleCommandTest.php create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateCommandTest.php create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineCrudCommandTest.php create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineEntityCommandTest.php create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/BundleGeneratorTest.php create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineCrudGeneratorTest.php create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineFormGeneratorTest.php create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/GeneratorTest.php create mode 100644 vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/phpunit.xml.dist create mode 100644 vendor/swiftmailer/swiftmailer/.gitignore create mode 100644 vendor/swiftmailer/swiftmailer/CHANGES create mode 100644 vendor/swiftmailer/swiftmailer/README create mode 100644 vendor/swiftmailer/swiftmailer/README.git create mode 100644 vendor/swiftmailer/swiftmailer/build.xml create mode 100644 vendor/swiftmailer/swiftmailer/create_pear_package.php create mode 100644 vendor/swiftmailer/swiftmailer/notes/APPS create mode 100644 vendor/swiftmailer/swiftmailer/notes/CHARSETS create mode 100644 vendor/swiftmailer/swiftmailer/notes/message.xml create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc0821.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc0822.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc1341.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc1521.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc1854.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2045.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2046.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2047.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2048.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2049.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2183.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2222.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2231.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2234.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2487.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2554.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2821.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc2822.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc3676.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc4505.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc4616.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/rfc4954.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/rfc/whats_where.txt create mode 100644 vendor/swiftmailer/swiftmailer/notes/smtp.txt create mode 100644 vendor/swiftmailer/swiftmailer/package.xml.tpl create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/CHANGES create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/LICENSE create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/README create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/config.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/index.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/CliReporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/CliTestCaseReporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/HtmlReporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/HtmlTestCaseReporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/AbstractTestRunner.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/CliRunner.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/HtmlRunner.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/TestLocator.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/TestLocator/PearStyleLocator.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/LICENSE create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/README create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/TODO.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/VERSION create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/authentication.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/autorun.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/browser.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/collector.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/compatibility.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/cookies.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/default_reporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/detached.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/en/docs.css create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/fr/docs.css create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/lastcraft/README create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/onpk/README create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/pkg/README create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/README create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/favicon.ico create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/book-domain-driven-design.jpg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/book-guide-to-php-design-patterns.jpg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/book-the-php-anthology-object-oriented-php-solutions.jpg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/quote.png create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-contribute.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-download.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-external-bottom.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-external-middle.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-external-top.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-internal-bottom.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-internal-middle.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-internal-top.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-logo.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-start-testing.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-support.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-in-cli.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-with-1-fail.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-with-1-pass.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/index.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery-1.2.1.pack.js create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery-speakers_coaches_consultants.js create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.heartbeat.js create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.sparkline.js create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/simpletest.css create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/heartbeat.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/photos_stream.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/about.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/authentication_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/books_website.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/boundary_classes_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/browser_documentation.xml create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/changelog.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/coding_standards.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/display_subclass_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/download_website.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/expectation_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_dom_tester.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_intro.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_recorder.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/extension_eclipse.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/first_test_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/form_testing_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/gain_control_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/group_test_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/group_test_tutorial.xml create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/heartbeat.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/ideas.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/improving_design_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/index.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/intro.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/mock_objects_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/mock_objects_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/overview.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/partial_mocks_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/photos_stream.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/reporter_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/screencasts.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/simple_test.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/softwares_using_simpletest.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/speakers_coaches_consultancy.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/subclass_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/support_website.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/unit_test_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/web_tester_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/writing_extensions.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/authentication_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/books_website.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/boundary_classes_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/browser_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/display_subclass_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/download_website.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/expectation_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/extension_eclipse.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/first_test_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/form_testing_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/gain_control_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/group_test_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/group_test_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/improving_design_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/index.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/intro.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/logiciels_utilisant_simpletest.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/mock_objects_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/mock_objects_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/overview.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/partial_mocks_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/reporter_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/simple_test.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/subclass_tutorial.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/support_website.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/unit_test_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/web_tester_documentation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/dumper.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/eclipse.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/encoding.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/errors.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/exceptions.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/expectation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/colortext_reporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/css/webunit.css create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/css_selector.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/dom_tester_doc_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/dom_tester_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/support/child_adjacent.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/support/dom_tester.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/img/wait.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/tests/TestOfWebunit.js.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/webunit.js create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/x.js create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/junit_xml_reporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/pear_test_case.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder.php create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/sample.php create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenese_tester.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium/remote-control.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium/test/remote-control_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/testdox.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/testdox/test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/jquery.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/test/treemap_node_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/treemap_recorder.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/webunit_reporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/form.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/frames.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/http.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/invoker.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/mock_objects.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/README create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/build_tarball.sh create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/bundled_docs.xslt create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/bundled_map.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/extension.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/generate_package.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/lastcraft.xslt create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs.sh create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs_with_xalan.sh create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_lastcraft_docs.sh create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_phpdoc_docs.sh create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/map_onpk.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/onpk.xslt create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/transform_all_onpk.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/package.xml create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/pear_package_create.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/phpdoc_docs.xslt create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.ini create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/index.php create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/integration.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/map.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/package.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/template.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/content_without_section.xml create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/en/synchronisation.xml create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/no-synchronisation.xml create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/synchronisation.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_download.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_overview.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_simpletest.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_start_testing.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_support.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_unit-tester.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/map.xml create mode 100755 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_changelogged.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_milestoned.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_with_autorum_php.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_with_php_code.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/site_map.xml create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/transform_all_lastcraft.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/page.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/parser.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reflection_php4.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reflection_php5.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/remote.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reporter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/scorer.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/selector.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/shell_tester.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/simpletest.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/socket.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tag.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/acceptance_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/adapter_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/all_tests.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/authentication_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/autorun_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/bad_test_suite.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/browser_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/collector_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/command_line_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/compatibility_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/cookies_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/detached_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/dumper_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/eclipse_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/encoding_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/errors_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/exceptions_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/expectation_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/extensions_tests.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/form_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/frames_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/http_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/interfaces_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/interfaces_test_php5_1.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/live_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/mock_objects_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/page_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/parse_error_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/parser_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/reflection_php4_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/reflection_php5_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/remote_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/shell_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/shell_tester_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/simpletest_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/.htaccess create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/1.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/2.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/3.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_change_redirect.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/base_link.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/form.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/frameset.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/frameset_with_base_tag.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/page_1.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/page_2.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/relative_link.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/cookie_based_counter.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/counting_frameset.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/double_base_change_redirect.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/file.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_data_encoded_form.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_array_based_inputs.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_false_defaults.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_mixed_post_and_get.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_quoted_values.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_radio_buttons.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_tricky_defaults.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_unnamed_submit.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_without_action.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_a.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_b.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_links.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frameset.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/a_page.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/index.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/show_request.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/link_confirm.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/local_redirect.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/messy_frameset.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/multiple_widget_form.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/nested_frameset.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/network_confirm.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/one_page_frameset.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/page_request.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/base_change_redirect.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/network_confirm.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/show_cookies.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/.htaccess create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/.htpasswd create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/1.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/2.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/3.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/htaccess create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/local_redirect.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/network_confirm.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/redirect.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/savant_style_form.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/search.png create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/self.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/self_form.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/set_cookies.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/slow_page.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/temp/.stop_cvs_removing_temp create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/timestamp.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/upload_form.html create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/upload_handler.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/socket_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/collector/collectable.1 create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/collector/collectable.2 create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/empty_test_file.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/latin1_sample create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/spl_examples.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/supplementary_upload_sample.txt create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/test1.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/upload_sample.txt create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/tag_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/unit_tester_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/unit_tests.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/url_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/user_agent_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/utf8_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/visual/visual_errors.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/visual_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/web_tester_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/xml_test.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test_case.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/Expectations.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/FormTesting.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/GroupTests.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/MockObjects.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/PartialMock.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/Reporting.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/ServerStubs.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/SimpleTest.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/SimpleTest.pkg.ini create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/UnitTestCase.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/WebTester.pkg create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/unit_tester.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/url.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/user_agent.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/web_tester.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/xml.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Action.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/CallbackAction.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ReturnReferenceAction.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ReturnValueAction.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ThrowAction.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Description.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/ExpectationProvider.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AbstractExpectation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AtLeastExpectation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AtMostExpectation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/BetweenExpectation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/ExactlyExpectation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Invocation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationHandler.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationProxy.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationRecorder.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matcher.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/AnyMatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/BoundsMatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/EqualMatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/IdenticalMatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/OptionalMatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/PatternMatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/ReferenceMatcher.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/MockGenerator.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/MockObject.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Mockery.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/NotSatisfiedException.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SelfDescribing.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Sequence.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleDescription.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleInvocation.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleSequence.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleState.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleStatePredicate.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/State.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/StateMachine.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/StatePredicate.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/States.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/mock.tpl.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/yay_convenience.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/yay_mock.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/run.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/sweety.js create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/css/main.css create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/darr.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/group.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/htmlicon.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/loading.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/network.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/rarr.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/runicon.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/xmlicon.gif create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/js/sweety-template.js create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/suite-ui-noajax.tpl.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/suite-ui.tpl.php create mode 100644 vendor/swiftmailer/swiftmailer/test-suite/xpath-legacy.js create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-2022-jp/one.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-8859-1/one.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/one.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/three.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/two.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/files/data.txt create mode 100644 vendor/swiftmailer/swiftmailer/tests/_samples/files/textfile.zip create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance.conf.php.default create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/AttachmentAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/ByteStream/FileByteStreamAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Base64EncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/IdenticalBinaryExpectation.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/SwiftSmokeTestCase.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/SwiftUnitTestCase.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/AttachmentSmokeTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/AntiFloodPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php create mode 100644 vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php create mode 100644 vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/.gitignore create mode 100644 vendor/symfony/monolog-bundle/Symfony/Bundle/MonologBundle/.gitignore create mode 100644 vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/.gitignore create mode 100644 vendor/symfony/symfony/.gitignore create mode 100644 vendor/symfony/symfony/README.md create mode 100644 vendor/symfony/symfony/phpunit.xml.dist create mode 100644 vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Bridge/Twig/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/BrowserKit/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/ClassLoader/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/GInterface.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/DomCrawler/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/.gitignore delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Exception/CircularReferenceException.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToStringTransformer.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistryInterface.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeInterface.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToStringTransformerTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormPerformanceTestCase.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormRegistryTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormViewInterface.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Routing/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Security/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/DefaultLogoutSuccessHandler.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Translation/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Translation/Tests/PluralizationRulesTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/.gitignore create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Count.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CountValidator.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Length.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LengthValidator.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorArrayTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorCountableTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/SizeTest.php delete mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/SizeValidatorTest.php create mode 100644 vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/ValidTest.php create mode 100644 vendor/twig/twig/AUTHORS create mode 100644 vendor/twig/twig/CHANGELOG create mode 100644 vendor/twig/twig/README.markdown create mode 100644 vendor/twig/twig/bin/create_pear_package.php create mode 100644 vendor/twig/twig/doc/advanced.rst create mode 100644 vendor/twig/twig/doc/api.rst create mode 100644 vendor/twig/twig/doc/coding_standards.rst create mode 100644 vendor/twig/twig/doc/filters/abs.rst create mode 100644 vendor/twig/twig/doc/filters/capitalize.rst create mode 100644 vendor/twig/twig/doc/filters/convert_encoding.rst create mode 100644 vendor/twig/twig/doc/filters/date.rst create mode 100644 vendor/twig/twig/doc/filters/date_modify.rst create mode 100644 vendor/twig/twig/doc/filters/default.rst create mode 100644 vendor/twig/twig/doc/filters/escape.rst create mode 100644 vendor/twig/twig/doc/filters/format.rst create mode 100644 vendor/twig/twig/doc/filters/index.rst create mode 100644 vendor/twig/twig/doc/filters/join.rst create mode 100644 vendor/twig/twig/doc/filters/json_encode.rst create mode 100644 vendor/twig/twig/doc/filters/keys.rst create mode 100644 vendor/twig/twig/doc/filters/length.rst create mode 100644 vendor/twig/twig/doc/filters/lower.rst create mode 100644 vendor/twig/twig/doc/filters/merge.rst create mode 100644 vendor/twig/twig/doc/filters/nl2br.rst create mode 100644 vendor/twig/twig/doc/filters/number_format.rst create mode 100644 vendor/twig/twig/doc/filters/raw.rst create mode 100644 vendor/twig/twig/doc/filters/replace.rst create mode 100644 vendor/twig/twig/doc/filters/reverse.rst create mode 100644 vendor/twig/twig/doc/filters/slice.rst create mode 100644 vendor/twig/twig/doc/filters/sort.rst create mode 100644 vendor/twig/twig/doc/filters/striptags.rst create mode 100644 vendor/twig/twig/doc/filters/title.rst create mode 100644 vendor/twig/twig/doc/filters/trim.rst create mode 100644 vendor/twig/twig/doc/filters/upper.rst create mode 100644 vendor/twig/twig/doc/filters/url_encode.rst create mode 100644 vendor/twig/twig/doc/functions/attribute.rst create mode 100644 vendor/twig/twig/doc/functions/block.rst create mode 100644 vendor/twig/twig/doc/functions/constant.rst create mode 100644 vendor/twig/twig/doc/functions/cycle.rst create mode 100644 vendor/twig/twig/doc/functions/date.rst create mode 100644 vendor/twig/twig/doc/functions/dump.rst create mode 100644 vendor/twig/twig/doc/functions/index.rst create mode 100644 vendor/twig/twig/doc/functions/parent.rst create mode 100644 vendor/twig/twig/doc/functions/random.rst create mode 100644 vendor/twig/twig/doc/functions/range.rst create mode 100644 vendor/twig/twig/doc/index.rst create mode 100644 vendor/twig/twig/doc/internals.rst create mode 100644 vendor/twig/twig/doc/intro.rst create mode 100644 vendor/twig/twig/doc/recipes.rst create mode 100644 vendor/twig/twig/doc/tags/autoescape.rst create mode 100644 vendor/twig/twig/doc/tags/block.rst create mode 100644 vendor/twig/twig/doc/tags/do.rst create mode 100644 vendor/twig/twig/doc/tags/embed.rst create mode 100644 vendor/twig/twig/doc/tags/extends.rst create mode 100644 vendor/twig/twig/doc/tags/filter.rst create mode 100644 vendor/twig/twig/doc/tags/flush.rst create mode 100644 vendor/twig/twig/doc/tags/for.rst create mode 100644 vendor/twig/twig/doc/tags/from.rst create mode 100644 vendor/twig/twig/doc/tags/if.rst create mode 100644 vendor/twig/twig/doc/tags/import.rst create mode 100644 vendor/twig/twig/doc/tags/include.rst create mode 100644 vendor/twig/twig/doc/tags/index.rst create mode 100644 vendor/twig/twig/doc/tags/macro.rst create mode 100644 vendor/twig/twig/doc/tags/raw.rst create mode 100644 vendor/twig/twig/doc/tags/sandbox.rst create mode 100644 vendor/twig/twig/doc/tags/set.rst create mode 100644 vendor/twig/twig/doc/tags/spaceless.rst create mode 100644 vendor/twig/twig/doc/tags/use.rst create mode 100644 vendor/twig/twig/doc/templates.rst create mode 100644 vendor/twig/twig/doc/tests/constant.rst create mode 100644 vendor/twig/twig/doc/tests/defined.rst create mode 100644 vendor/twig/twig/doc/tests/divisibleby.rst create mode 100644 vendor/twig/twig/doc/tests/empty.rst create mode 100644 vendor/twig/twig/doc/tests/even.rst create mode 100644 vendor/twig/twig/doc/tests/index.rst create mode 100644 vendor/twig/twig/doc/tests/iterable.rst create mode 100644 vendor/twig/twig/doc/tests/null.rst create mode 100644 vendor/twig/twig/doc/tests/odd.rst create mode 100644 vendor/twig/twig/doc/tests/sameas.rst create mode 100644 vendor/twig/twig/ext/twig/.gitignore create mode 100644 vendor/twig/twig/package.xml.tpl create mode 100644 vendor/twig/twig/phpunit.xml.dist create mode 100644 vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/CompilerTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/ErrorTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/FileCachingTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test create mode 100644 vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test create mode 100644 vendor/twig/twig/test/Twig/Tests/LexerTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/DoTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/ForTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/IfTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SetTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/TestCase.php create mode 100644 vendor/twig/twig/test/Twig/Tests/Node/TextTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/ParserTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/TemplateTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/escapingTest.php create mode 100644 vendor/twig/twig/test/Twig/Tests/integrationTest.php create mode 100644 vendor/twig/twig/test/bootstrap.php diff --git a/app/SymfonyRequirements.php b/app/SymfonyRequirements.php index a630af0..cfd55a7 100644 --- a/app/SymfonyRequirements.php +++ b/app/SymfonyRequirements.php @@ -429,11 +429,11 @@ class SymfonyRequirements extends RequirementCollection ); if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { - $this->addRequirement( - (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())), - sprintf('Default timezone is deprecated (%s)', date_default_timezone_get()), - 'Fix your php.ini file (list of deprecated timezones http://us.php.net/manual/en/timezones.others.php).' - ); + $this->addRequirement( + (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())), + sprintf('Default timezone "%s" is not supported by your installation of PHP', date_default_timezone_get()), + 'Fix your php.ini file (check for typos and have a look at the list of deprecated timezones http://php.net/manual/en/timezones.others.php).' + ); } $this->addRequirement( @@ -492,6 +492,12 @@ class SymfonyRequirements extends RequirementCollection /* optional recommendations follow */ + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.4', '>='), + sprintf('Your project might not work properly ("Notice: Trying to get property of non-object") due to the PHP bug #52083 before PHP 5.3.4 (%s installed)', $installedPhpVersion), + 'Install PHP 5.3.4 or newer' + ); + $this->addRecommendation( version_compare($installedPhpVersion, '5.3.8', '>='), sprintf('Annotations might not work properly due to the PHP bug #55156 before PHP 5.3.8 (%s installed)', $installedPhpVersion), diff --git a/app/bootstrap.php.cache b/app/bootstrap.php.cache index 5be374c..cea92ba 100644 --- a/app/bootstrap.php.cache +++ b/app/bootstrap.php.cache @@ -13,7 +13,7 @@ namespace Symfony\Component\DependencyInjection interface ContainerAwareInterface { - function setContainer(ContainerInterface $container = null); + public function setContainer(ContainerInterface $container = null); } } @@ -35,37 +35,37 @@ interface ContainerInterface const SCOPE_PROTOTYPE = 'prototype'; - function set($id, $service, $scope = self::SCOPE_CONTAINER); + public function set($id, $service, $scope = self::SCOPE_CONTAINER); - function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); - function has($id); + public function has($id); - function getParameter($name); + public function getParameter($name); - function hasParameter($name); + public function hasParameter($name); - function setParameter($name, $value); + public function setParameter($name, $value); - function enterScope($name); + public function enterScope($name); - function leaveScope($name); + public function leaveScope($name); - function addScope(ScopeInterface $scope); + public function addScope(ScopeInterface $scope); - function hasScope($name); + public function hasScope($name); - function isScopeActive($name); + public function isScopeActive($name); } } @@ -79,7 +79,7 @@ namespace Symfony\Component\DependencyInjection interface IntrospectableContainerInterface extends ContainerInterface { - function initialized($id); + public function initialized($id); } } @@ -340,13 +340,13 @@ class Container implements IntrospectableContainerInterface } - static public function camelize($id) + public static function camelize($id) { return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id); } - static public function underscore($id) + public static function underscore($id) { return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.'))); } @@ -356,23 +356,6 @@ class Container implements IntrospectableContainerInterface -namespace Symfony\Component\HttpKernel -{ - -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; - - -interface TerminableInterface -{ - - function terminate(Request $request, Response $response); -} -} - - - - namespace Symfony\Component\HttpKernel { @@ -386,7 +369,7 @@ interface HttpKernelInterface const SUB_REQUEST = 2; - function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); } } @@ -405,55 +388,72 @@ use Symfony\Component\Config\Loader\LoaderInterface; interface KernelInterface extends HttpKernelInterface, \Serializable { - function registerBundles(); + public function registerBundles(); - function registerContainerConfiguration(LoaderInterface $loader); + public function registerContainerConfiguration(LoaderInterface $loader); - function boot(); + public function boot(); - function shutdown(); + public function shutdown(); - function getBundles(); + public function getBundles(); - function isClassInActiveBundle($class); + public function isClassInActiveBundle($class); - function getBundle($name, $first = true); + public function getBundle($name, $first = true); - function locateResource($name, $dir = null, $first = true); + public function locateResource($name, $dir = null, $first = true); - function getName(); + public function getName(); - function getEnvironment(); + public function getEnvironment(); - function isDebug(); + public function isDebug(); - function getRootDir(); + public function getRootDir(); - function getContainer(); + public function getContainer(); - function getStartTime(); + public function getStartTime(); - function getCacheDir(); + public function getCacheDir(); - function getLogDir(); + public function getLogDir(); - function getCharset(); + public function getCharset(); +} +} + + + + +namespace Symfony\Component\HttpKernel +{ + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; + + +interface TerminableInterface +{ + + public function terminate(Request $request, Response $response); } } @@ -502,12 +502,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.1.0-BETA2'; + const VERSION = '2.1.0-DEV'; const VERSION_ID = '20100'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '1'; const RELEASE_VERSION = '0'; - const EXTRA_VERSION = 'BETA'; + const EXTRA_VERSION = 'DEV'; public function __construct($environment, $debug) @@ -516,7 +516,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface $this->debug = (Boolean) $debug; $this->booted = false; $this->rootDir = $this->getRootDir(); - $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); + $this->name = $this->getName(); $this->classes = array(); if ($this->debug) { @@ -706,6 +706,10 @@ abstract class Kernel implements KernelInterface, TerminableInterface public function getName() { + if (null === $this->name) { + $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); + } + return $this->name; } @@ -975,7 +979,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface } - static public function stripComments($source) + public static function stripComments($source) { if (!function_exists('token_get_all')) { return $source; @@ -1084,28 +1088,28 @@ use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; interface BundleInterface extends ContainerAwareInterface { - function boot(); + public function boot(); - function shutdown(); + public function shutdown(); - function build(ContainerBuilder $container); + public function build(ContainerBuilder $container); - function getContainerExtension(); + public function getContainerExtension(); - function getParent(); + public function getParent(); - function getName(); + public function getName(); - function getNamespace(); + public function getNamespace(); - function getPath(); + public function getPath(); } } @@ -1348,6 +1352,7 @@ namespace Symfony\Component\HttpKernel use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; @@ -1450,14 +1455,27 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface $event = new GetResponseForExceptionEvent($this, $request, $type, $e); $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); + $e = $event->getException(); + if (!$event->hasResponse()) { throw $e; } + $response = $event->getResponse(); + + if (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { + if ($e instanceof HttpExceptionInterface) { + $response->setStatusCode($e->getStatusCode()); + $response->headers->add($e->getHeaders()); + } else { + $response->setStatusCode(500); + } + } + try { - return $this->filterResponse($event->getResponse(), $request, $type); + return $this->filterResponse($response, $request, $type); } catch (\Exception $e) { - return $event->getResponse(); + return $response; } } diff --git a/composer.json b/composer.json index b6aa797..cde69ec 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,8 @@ "sensio/framework-extra-bundle": "dev-master", "sensio/generator-bundle": "dev-master", "jms/security-extra-bundle": "1.1.*", - "jms/di-extra-bundle": "1.0.*" + "jms/di-extra-bundle": "1.0.*", + "egeloen/ckeditor-bundle": "2.0.*" }, "scripts": { "post-install-cmd": [ diff --git a/composer.lock b/composer.lock index e374eb9..3938730 100644 --- a/composer.lock +++ b/composer.lock @@ -1,5 +1,5 @@ { - "hash": "ab7ccf177098603cace942212179431f", + "hash": "0890891a613a13d9980307e458190353", "packages": [ { "package": "doctrine/common", @@ -8,20 +8,23 @@ { "package": "doctrine/dbal", "version": "2.2.x-dev", - "source-reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730", - "commit-date": "1341779435" + "source-reference": "b961a3fce6bf220f1dca47d7d747b9074bea4730" }, { "package": "doctrine/doctrine-bundle", "version": "dev-master", - "source-reference": "c9ea46d1f0c48bb88bb87b44214fe44e03c0c692", - "commit-date": "1341405737" + "source-reference": "c9ea46d1f0c48bb88bb87b44214fe44e03c0c692" }, { "package": "doctrine/orm", "version": "2.2.x-dev", - "source-reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4", - "commit-date": "1341676080" + "source-reference": "5d2a3bcb3b467f41ee58575764f3ba84937f76e4" + }, + { + "package": "egeloen/ckeditor-bundle", + "version": "2.0.x-dev", + "source-reference": "ca9d4a631577d7195c6517dd89ae8a3cc02b85ba", + "commit-date": "1337272707" }, { "package": "jms/aop-bundle", @@ -52,8 +55,7 @@ { "package": "kriswallsmith/assetic", "version": "dev-master", - "source-reference": "d6f89a3170c5280ad554347dc113eb25fdf00ad7", - "commit-date": "1339515714" + "source-reference": "d6f89a3170c5280ad554347dc113eb25fdf00ad7" }, { "package": "monolog/monolog", @@ -62,20 +64,20 @@ { "package": "sensio/distribution-bundle", "version": "dev-master", - "source-reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25", - "commit-date": "1341741741" + "source-reference": "5886adae1613c0a72fbb95259a83ae798e86c0d3", + "commit-date": "1342347850" }, { "package": "sensio/framework-extra-bundle", "version": "dev-master", - "source-reference": "4f54e5d5fb3b54fb107892684018f3704934c48d", - "commit-date": "1341126219" + "source-reference": "e9ac8f1a911ed29e30296c7f1549f53d4c94eddf", + "commit-date": "1342084432" }, { "package": "sensio/generator-bundle", "version": "dev-master", - "source-reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36", - "commit-date": "1340138445" + "source-reference": "c17dbddefe517e3adfcbeaa1ab7cef3e572d29c6", + "commit-date": "1342195488" }, { "package": "swiftmailer/swiftmailer", @@ -86,25 +88,25 @@ { "package": "swiftmailer/swiftmailer", "version": "dev-master", - "source-reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75", - "commit-date": "1341746460" + "source-reference": "8b2aa953f87da228ba413e8fb1372e49c1374050", + "commit-date": "1342198037" }, { "package": "symfony/assetic-bundle", "version": "dev-master", - "source-reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc", - "commit-date": "1340234971" + "source-reference": "ed933dcfa45f00b6bc6d7727007403f3ff429e5a", + "commit-date": "1342126277" }, { "package": "symfony/monolog-bundle", "version": "dev-master", - "source-reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5", + "source-reference": "v2.1.0-BETA3", "commit-date": "1341078487" }, { "package": "symfony/swiftmailer-bundle", "version": "dev-master", - "source-reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e", + "source-reference": "v2.1.0-BETA3", "commit-date": "1341509614" }, { @@ -116,14 +118,13 @@ { "package": "symfony/symfony", "version": "dev-master", - "source-reference": "v2.1.0-BETA2", - "commit-date": "1341820358" + "source-reference": "151b79a6ce3f459e2fa8815cd9f2786eef750993", + "commit-date": "1342376835" }, { "package": "twig/extensions", "version": "dev-master", - "source-reference": "feb6d3f10c411e2631997c0a905aa581c80305c1", - "commit-date": "1337599699" + "source-reference": "feb6d3f10c411e2631997c0a905aa581c80305c1" }, { "package": "twig/twig", @@ -134,13 +135,11 @@ { "package": "twig/twig", "version": "dev-master", - "source-reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf", - "commit-date": "1341423205" + "source-reference": "d45664045194ef62573c153c424508527105041e", + "commit-date": "1342424564" } ], - "packages-dev": [ - - ], + "packages-dev": null, "aliases": [ ], diff --git a/composer.phar b/composer.phar new file mode 100755 index 0000000000000000000000000000000000000000..6a0974fb1448c7752b5f33376c4c8441debda4bf GIT binary patch literal 533673 zcmeFa3w)%>RUf*9jXn-2w3GZuQXUu-)sPO!hjh2HxFjw{EjKt9rTNPGiVU zbb6bOVXK+o7eC+V4Trs5_G;)|Ww&N0CRTPD{kgf_#vcEu*EYS=d-z$KdT65A+G=-O z_1gL6ODoH3i>n(8i;r(Sac=eU(&a}tt}I3dc_x&RJ@E~(psPTv097I&-~0kc#hZl ztdd$w%S+v1tH0IQY_Y*NJV&eY`MmE<&U)1(Ulk~W*_uS1PuBf>YnIP%`S8~+dEM#C zy8RZoVWr=Db8B-L0jj@1k>K+)e)|2t;(+d}0(9<1Z$Ad`?mwdd_WgBLrRtN^!jSyzHxw5tBqy(W4RL0J9-g}~>9$3AAmA=IiMEOiINMyC^j z_{NV@5PZI5|G)fG2T`vA@pz-t&Y|%^@F+XN=O=#d>Q_08N;DQ)d#!GB5TS7}p&Un z_z01I^GVtjJ}>>zJKo_SPF5lESgW(w>d!8;8=c;^{vf0OZJW+~zVi#e;-wC!lD(F? z?U+4Zi6P{u@cBb8_`aUkpUUI0(7WC3^eD||AKx6Lzlg*&a2A2^`L5GnanXSksG3%r zy@0hO{YfZ4{)q~O&(}Wkz`t}TqflA9)y)EV!=F_keE#HDzUN~d$f*(iSpk=p`h(s1RvUIc zf9uU({LKzydIXGf5Do2HIVSuDo7#L{{*BpRcR-_h^v3pH7MuU{@k(4iKXj`*7LZ5V z!z_@W{|p7f=j>blXxcF;aNlYRN?02_doX*h-)|hGze$-*%q9*rpI4i|_g@`MVM3(U zWNr=)2E*2F`jW7|^kWqkpP%+6f9sONdR3mvX|>rW`t4!kMyHj&%5d~G<7hsIm;TKA z9b|zI)B3ZVujx-B_HnjK^Z9?i?uXy)PzuAJR+~-#jOOZ|jU1o<{ab(SzyTG+a$1|> za2BKY*#3=$KKM!I{Htv6`24mnSgt#q2S!lJ;5^bE-q_!~*&3$M&f2QQ=fC~YcYLoy zD==jds}#uhK2Haa&->q5e`;JH6tSUSfA3Qj2%qo#nc44lAcysfONIc+4E}l3jrjb% z3-A2{hgO*Rxqe~x2aMiqwBhrqAAiB?9mZj_2^f)oK5UH5=fzKb;1LIM`jFvzY`bK% z{^utvjrjaGe`ogt4(#P4fSJnGYL?94pGQ5;U_RgWj>(^Oc!%^br5Stp$)Bb``25SC zcQYtHg_R?%HoMYk3~5uPuL$WoZL#OGbMlA2%+Y!EINjr_UnW`JWqsuH@ric^9ksAV zrns1;(jG>lh4?L)1n2Xwf8UR6I)0x$4t^>445Pl?(Bt#d-}UM}hdGLRQ1-+)PC*j8 zNn=+&Kj#B43i57LM=9@SRU2+~HxHIz=n~XhOmys4K@2S1PaVzLY4(6iTXs;dgy80)f{4FCDpC3H?9lz^PDv>cL zf=mkLcVDQ3$LB`(srNaU!ZMjdW)%)7dzAuvHFPy{0-wM6u^)fNfxR?8d=BhVYZp4M z{bH}4^J0a-=a2u$Z~kM4Q1C4|go{1sRU%cM_vf`LpFfk-s%Z*y7lfoE@p!90fc-XW&s1#xCmR?(fB$1HE<2?A zsxUd%X*UKDDz{Cqk-vqgClA6zJpY%*vzzfr{0;EwV3-tF4Pd=x1|Lu=Eo^w?cVh2+Yvuk^;O-%UB z^c7L1?B@vb`88|b@IM{u!(&3tHj-hk7uuBN^H)Fo_HS{}SeUa`@%hH)j`&Nz-{{8Y zkNws+|DM-)Fkd5G_*Yx-@4{r6UFpF+4$UHRzka15z~>{M{!RbH!4+gi3Aok$PHU|t z%jDlQfzRh_4?g(^9Ly`nz-mp9dt`q*OE#)_*=fwD$h% zj`Y%z0AFhKZ;Jd3Mq8$lpD^tCeDdlW8{WwLks2}B8OX7@{OG zW)z?A{r3OxHyrTmj)ZccOBmHwGt&E`J4mVNzQnRG^eAiF@y`ajEvpyJVOIRNqvlkdR zKA-uW9}UY*!OkcVCPCoA-e`+Ix@|1T=gx0_!%6RFLC-CLmUi*{E0p?t{_2UX6^Am` znuR@@)l^>0LnttX zpuaZkw;H=p(1xuihY=CZ8{znT$s2}q4&_8C9*g~cum2dfkvnQByugGOpYMLn7ymzA zyTDS4!(Q{riyDxy)NFNWBPy6z8ZYqq-dDaS?6YBDvg(|Ixh0e0nhgP;zx#!of79D8 zRB~SviT1Uo>GJtq-~H>s^;{S?nuxRf5B%Tly?r?QROBofs(ilq1G69YR{v5S)c}B_ z#-`7kQo!f)e=TL1f-)6q+CDLqij1Q2fJp;BUwz{*pLP`Byv$MyqrKJMX4`*YhBBYO z^%F1tpjRnaFl(Fr_TF%I@fL=M75|5|#pk!Y=mzlT0?j`I23?|H$&VfD@G3H5*3@aOZ|^FA}^inTng;*Kx02YXaFl{w#T zhAf{C-~0aR#nUyO{_N#mZ!i2J8DD5@$LDuH=MP`#-6$+nq1NoB*08as4w>+hpuWun z2cLiUU0cCcE3Du{{_UAqmRNca~4Yg)1_#?a^m|wD9@i{+t`n}$( z5nwL1Z}b~|*isTip#=U%=6&b$eErkIUS7e{54C3PFVT~u4XPi4-m9`oX=Z7`|}^?weHK$K}UU78c&^J-)L$cpMR(Qp$|C# zF7Ex-V0M6YWxAcNC~t-d=aQh_Tlq0e)yfi zI4QWy5dF2&Zlb|0H-3$LEK> z_`f~Rn|#f2nvB?=-FX$JDv`|s0M`24`aUk@uY z_x^I4>*1^B+D@w@-s1oKT!qT#PkraF|DY4+k>fyBd2eE$9QvfKl6?NipZScxW(MB??6mMsK%3uBAU?Ck#CRu;f;g|O4 z>uoLO^9R4?C%)Bt^twCfQAt<+zRe0g|Ju(@f4etxtf^;R$q!nE`24!_zZx9GchXGITC_d(=9_F}`23v@zcAPqi^mz6OmA$L`F*B* z^Z9jediBu9U#OIg)=G^xOJFAWEHvRulfBgg7i}!5*=GESdyuFKe(B2wOL(oAGxAP0uFFupUzIl{QdKmp3 ztZb-YMHxb8Dt7E8#K!Z5;>T`qt^HK1f{xQBwfOvlSANcCd2?^P13JRS z?(8>P3pmWkGcyOpPJWxU%IEuDbNUy()yMCkRS6lw0ne4qehI&PyOEX82WI|J*d$-M zgBH*44{$cL*t>P>9iL18^1)!Clq{iR4 z!IloJB|cAl?hC>}vyw&d2rXsX_!4V_&-rh-9_$)Mx8!u`!`fKe>yX(!Zu$3YJox-4 zHzvQ=>BPthhm1qvvvgy3+VCawv@(uoHf0YJk#s|Z6X{uOIRZ?Kxc2e+M{oJ2Z*q7D z4Hy?5w<*&g%P)GV0_5{OKk-X%bAYGD2Y3;FbcsLxN;BX1{OqMqTyR(n@EWtTL<}}< z#?SegrbO`hhwqvDR}MB(P2UVz*6uQj{YLM$5YzStgr4m2nrs)y;ctz0A7lypRfv!DO9 zVIT6(r+^!_4NE*;WO(rTjsKu=&GD$E#Wy{lgxA}kc7x~x>;n?SdyH6oKL4}o!3A{R zC=i?6xoZS8l35s|M%l;@?b z#V4^rGN?~(VKJPVczU9}mDKt7Ml1d>l{}5aA;bNC*J~zHHI=;drODVJ00sY_gFqacZKOhZLvKIX#X^$| zTEk?2PZF$PQ<$`7Goyes61@-#AtMV2 zXtXs7K4i&n(s7#zY#Y+vtS>DiKg&My%$O;@ex40+qZ@xou*15zBlW*Qo<4L)9rX#V z=Uh*R)l!ebx<23*0c!eBCJT_ZTrNp_7seC)_=6_wL$< z0E6Gc4`Cb-IgfaIAeb^*{#L8bW}UmD)`3K}ST(eT)@BdpMXOl?OA#fos8ls59FDnx zlua?9I`RW`rjnR4)AN{Nx|vb0;d}_IFx3&}NlABa4<{$qyC;&lq=wu|bzv}cz!9iKw1=)#wrt1( z`vJTt_|=8GoMShULOwbos7-l(Z+ieySQpTcv;x$c0fWQhujA3)+ZZ;su@WekLBA zlM?t1w|!dU)bHl+HzL8@J?x(X|o#pG8EFLM^POOJch`+ zbKSx1RzK~Q&U|va`4s9ksv}PO=!Q*ShGqp=B>*9%QCZ#H210CPB@8w%dnL+N}@3^c`rUtxW+= zVU&R&6VQ5Qa?V;OS@!9z!6XX^Maq`6BPivS-ddcEQ0YrqhHxLCbt3+l+&4(3HfF!B z>&j`3xpFR}hQ|7i@orX6ty&*;8iNd^Iy&mL>sd6m` z?E2UpdX~{h9)=)irwSN?yHuaA!S3nPCc+e%7hMT+$~iH-tLzXscO+fGQQiRlbhx0g zYh|UQSVY&&k1V@3cqB|-d|@vT5`>coUvS`4#TTCO&;P;hL6K_o#HZ?*>|+Wa9k zA|oL+OGefyXpXLkVK7`BDYpxbrfz@sDbA&GNSRp=eyG;c>`N8Nj;CcE4m6{sq=KBH zka;kVt{IKhWR>1xqJ~qYiV!6-D&>b@v6qj=I5N>t7|B_A9Lj{6!TIQrIb6sK4!tVB zkVph*37XJ0=W3CUhe!cxi~LtC7N&i5k!YTKp#q>oXLhJrsCwk7oq{Uq(IM0Ou)0|b zCz^e!m=Hmgfg_|X^b45WovEC*l^;HBqIBwdrF@nAL>bVV=Ku1A51pOWRrBo>CS-Nh zJ6q2wrN)_9@UQMRx=o-#ud8@lp@pd16@RFUG3!i92MqG!82>&2d}>k{JJBW88w%FQMu#?rWufc-`*V zaO61v!{{{N2uiYX8V9~w)3)K-AjX90QQn3aF^%*%MOLd#-;)CgXEH7;p7ri#3rW-? zniHfOjNS~vMm5EmQpA}`Ski(kOIq@t5Z-X7-@Bc_&6up`4;a-aYUg|Voo3SQfz&Wd zK*C0mS9BWy$ev6Ne7BL0lSd-Y@OAmN2bK9uI9aOR<~9ydZX<% zKb@j2ja4Nl`NyiGyCR1*vMjr02C%gdJ+(G|q* zBQC?~B3rmRSUyw=X~3R#6KExaHsYvHq5^{%xPAZl`8E84(^aox!7xUYb+r1yhc=Ck z{ZV+u5}?5tRXD$EJy}1O4eBg7g_&%L{X$KlOcT&rD2cPm6IE*}kJ4$r<1xVc6(HHJJ{b zNv;_p*NsXO6IXfx)qp?($M;Rf@;lz5&Dp%u7L^$+`edImlk!G6c_QlOCbI7(Hx3dg zrohe1X?JSVka6)`^0C|MG`44wbDcpCvw#;1O*ERf+5|=ucdNq;WTHB2(YRI8Kmz=xr4eg|4SHIbY9O6wdBJ z`krApdF06YQxl?{VU#VjBrGi4PufS^fC%ic5+4@XLG>-C|EUaL(E+Zz@@RVQ$q5bd z5DTNYUO+gNeh+L&@l{&FMRxYP3%D$=l$YUfmVZgfD&i4BMTwY;kFk;Wp63)@ahuDk z$d#H-Q(s!4f$KUjX`M)4DBf$bT;Q#^?@-lRT4>#}MKs>tO|iWSDI9s|o4feswvH$P ze#3<&w5d}cH#;(JS!|HzuBaI+GV2thy18*+1HdSzUV;Wp`JS88*?wN$yLpGP-d+2Yo@q16WC}+&~N)I{^|YJ`$)AOx6>ORX-tSHnJ`4P}s*V z6_D#>vU2XqV@sDWEN?8n{t5yKp;OpKqKrX=U731ZC)!ja`LO_+AM+}tkUWd!DM1jv z3G}G|qsF;z``Z-+YekoFn2J_|l#o53XoCyAMNmhESm0`*Ro0+i>WbIgCu<0Bub;3l zu}nilsyWUikHPQ4b&lq~B)if3>abivrm-8;5@t^5T$+TSYswW>vT>JoZF-*P7M#uN z*bs{6kWCn4+Iu4?Ij=-@CsOAG8wxsb+|Y?+2A&n4oCtPOcZ0w1FEbheC8MbkpeehD z$u6vp((Ry;PgGH`>VwPLCnXWy6K4nA%1nA~%M4SN^gpMwrzp}jghK;qwm2<1- z@F(7iPkv*sw?`rYz7iI@^ahucKc(`uQ`e)t_~?Udx`%Q^myQYRDA_g6Hf5_fG*6Rc>}q!Y#r=fr!}hyFL~mx%#gP7b_-NI2aPz!jx+<0!%v^S%gL>^P>*pd`p z*Hg~IkTrM7Yx$}S$`or%gql|^^$KLg9)f8Y6TBDsY>3OJH?Jdvv7Fbp1Ly^VK%TkD$Zz^fKtE?8LELo+%DVsa^9?=odv3mj6 z@vZ3Q$<^iMD;}D3wlZ>Op zvwUOB$!E%P!BueU5=D}?6zLc&f%tIs`<418N|lP79wZLGEzOB)3%xDs1RRt}D=}>* zTDhijJU`)Bex;xRAJ?_SEd$+Ih_9f$D^8vU@3c()F_CWvmsR2_*vQ^bq-=1vd!^VK zuCfoMrt$s6vt>J2V7E#APS;IzMM^b5F#B|}V!kO=RcYOerG^+lNAV2SCcd8!wXi{u zI^<_&<5^nk?mgcr`{jKG}njOx$`I+8#Vn&r&ITB}uc5YPQZ$%sh;Em?E206OmfJqbGhSadR3aEmy&0r+?!>zr zIbnUis?PCY(;>lO=7Uln>7L!b zHZE*0?-m7Ib5)>mx%So=U}XsD%f!0fO>z(NfE72>xY15n*Z61>n#oJjz zNSo2JX$I+jCiF%Zt99|L;M4%#8Rt?PQFEC!0&8(X8yY$3Vz#y`d0C?#0P?7L$ILA1 z(}z*kRE7d>qSH_*ff>*=pjdqXRkX#DPLJ$iP)3C)sT^}(krE46I5j%yN6`&~za@Ye zMRU>RWi2++hFV8$xO9+8B)bn(Xp|O8#8Mo&F!EK7D6!=>c3be0JG?-Ac0_DpqyET_ z1me+m1%uE>nEUSL4VEIHp)K;R?w2~h0&8;*pB>S|FR6l6yWC3;VA3H5&1D~I4$L0P z7M$#q&75HUoaC;VoCFOsUmV)BxOsGu#sbY*GjBI;whrL7iZPc?6$U3m^1DRvY^!uC z*fEG`s-!EA^#}I*Ti=@8%TqEqtzj=kWN?y|y!J8~u6C)RErFwy?)W3a7Wm!gMCUMz zW943l#(5Bh(NsFD!oDf&$yBJ6^lGLi;W0A0c39A4fSi_Kws#XDF}BwK5qQTykmlni zJ+2gPrBHD6LE@dDU|@`uIi>l-Yr?m(>XpG?4u}VUZcP!K$Uwtarr6s4HqJZZ?6wO0 zJm=$#qM8*0D`%DiU661V>8TVSjvPQeilX(f1BVcMjAH|{N5ogYrAcc6CFz|CmWjBq zw4OQ@AfLrL(D8ZZh!ldy;ueld9fP*?j^k|a@EBFWz8xkDAj)Q~+eCBHaTQZnSB9{{ z_d-^iD;Osss|_J3sY4pc;^}$BPg?ox`$QRo8P#&iy6Y@%4T%p4pWW~fyF zO5q&Z_dyH_QEK%G8qzB}XJUQDK@L{Ge$8nnbWw-q^{EN?6K|cpV z=zVSeEEIkc9E^bUGy4d40rQQ69EF~hlVJ}NM@PJBG&p1EW5q-cv!Rq;ENI(Y2CFy< z4oulc#{m

y&lUd8wT0<>Em`1RQ&F03S-=HK%umm2-s3b8&IaO_EaYpL?)zGIxe2 z$^!m4@Kd{1S|yC)OzpayEvw<|VJczfQr-hh9v&X{aM;ff7XFCMLTD)`*84cSEqX_Z zvfzSAPae>2h0w`w9Y;#@5?6v?>T>aum0?-pucG(9I*Mx3W`I%jF^o9Bp2VIR7R-DZ zktXyd>Iu%$rSO)8@yK}lF11w5>?*~Ibjdm@OQ9?8>Gu@4iN7!tfQyAO5%aMmo;tT8 zA)v9qBiDEGxOXa=k)rcV?zFdeuoN1%VA66cDqiM_Wbk!dut@u9plML>IHvvd36}0~ zR&1}>DaVE*fPOnQvhZ|xN*Om*gpSI$D>`Bk(;8ta z*fqlv6=ecT7v+cQEnNf-*iw}6A5NA+jc_6e-E>z$LPxnSg z;>pPpm@-V35o5(kV-|RsX|cCQwV+&eh%5^!X7m|lSQt2wsX>F0lhz{Yip2Lpmnknb zWLwf-Qy9$XQExD?h{J+?gcH7UW7A>1z)@o-*{QyPN4B93MN(~7INcaWusY<}qjg?{{ z8+u4|CWsW~bB?(JdIqq_RZE(4Yz1vs8Lg?hYzfMyiD@bWNUOsTiRXH*N#hk&?@ClV zSs{Zw{-|0dg+a%Xb+|d(8WT(X_BX)n4w)40X zMSUt#nCqf9COlr8BnH+?IVTt+_-n09!>7#hiCkHCac)d9L(3H?Bk07iJwz~d6vgQ; z>)|Q=wz->?0V4~G#_BWBwXaKfw_*2guwiGb*&03mCPDBer#Oc}|*_eNo zN?!RQe0-(BxN@j}MaLLxN4$>6Q6A82cdc|*=5dAN|J}hc)g?32?40V|4GR%=&_sjd z?QKUD-1s`~b~u?;Lr<>CrR(SQnA~02VBQyq>2`4xe4>pF^!!1bR+9U++*^QO4>qaW zh1f8_wu8dc_;%j=jN8yHqNcCo_hoGQRcoBx2%av z1F15@Ss_KSiSqklffG>e(lR+kv&@^Z zWt4(re++aM4VszMdMFB!JE%Qvn*?E#y1bok4>`7Z>o7Uxu->oTZ0~8`wU6jK57}_+ z4G3CB(1e`J$?vQw3s>*T>&m7K<_i!tdd>{&6W|!S?8*7O(Cs<^)k9$THc_%)2mXYA ze!z2M*p!JT8PdBVDDxIRAPC#Yr-n zVoaxb9w1>^a&8qNQoQ72Sr7f(D>H*oF1nC)(=2S(dc{XhcqDQ#@+oj?pa%#o;8!!*VyA)sF`$8JTO_6cO!gzTr>AU z`wj;Xb5Ymhr09?`YkSQnZDVGsi30=etu}L2**`U$t+`h9+KA#M{!%@5TA7|hPEx`O zPM5LBe)cvYAF_5tTDo%4^8u;XC?|>raAf9+ryB}3>_P6 z@Avxivg5)!;;+NZveiznxrZ{}Klbyzs!hN8hrHIs2nd$Fg|A1TY!Yg__n^W@w zsG_}tAzgaBIb-TbKq`2py+uC|#){yehl5UX_{)AfBk2uMb#G{H?&7)EZ>*hvZ1K`L zkUU13p+$J3;BwVjR9>M$E%yuz&>>S$6SDMMoCra%B$F+URT|LI61Sw%(}LD4kv+@F zMubyP201eT*XXPFVP0X*fWb~8u*}tLpwxRU!#N+K*GO}DHOPPwmaM2px2Sh;J>RF% zOs@UBq!&l1kG7J@&Gqkbvp%ZVYPLyUyRLhs_S47=$AfZDsSqX;$mD^)Sa#Y&t?79g zLWoXWY+(#kXv(=;NaZ`y6E&0dOiXU`s*wn^WNl^P^>9Q;Qwbs|Z7o2^b9&J0_U+p< z1FRTwv5l1-%+eP~Zv_`JI5Xh!phrUh)lN>34>xdpR}NB^p=%lF{IvaK26IMeJ5mE2 zcH#O&?<2FBz=K0^i+m_h4I#vv$idPhx2R}?&9l9MOh21D_1e?d&P~7Z`ZEyf5yiLx z>LX)8s@#Xdph#8Ukf}Xge|WBbtug)7^{KkRnR=@|^`W1p2)(wxetLcV!Rht&2iDhL zUfLXHV74)dOTz_2%m=Mv$9n8COg2#r@!_bhLST|wfK8^N9k0#~`9B8KP5?+tXQST=N< zi`z3{X##r)UzVud zaR#~eA%*Rj5>HUcXb^5%VY$(!Iiu;9;Z7I`Aq^s)s7V2d&d}XwJ!fMa z%vhm#x?n4zW;D?xC-!3izdHm^dfKg>Rp&9Eb0hZfaw1^Woi zsCVwL3M0LjYN0L2y>$ch6bo!~q`psLUQd^JYEIe56v!Cnpw}sEiN=}yY?A~s z35#Im@mkrRXDk#Kef&=tLC4e67P^_~`>ffoz6*=$7qQo$5Efj$SW!WNq;7-2T`D;< z#1WW6J5el(?WzzH#zzcbo0gfU2opqL$>{T~nj136T-B{C>q>LP{+EqpFrS0HY(o2w z)%7OZGRzwz@gKqV3L%qaA+^4|QC5m6lN!+ON>8_kxHKqO34Iv}I7No?FX*~a^%Z5j zGOV(dxlV+CXju|*htzclD2Wgewu}O^r8^_8CUjYuOXbYn2QCoh4h5f9BpO1Gjc-!< zg7=I+;$}BM_?3PmD64SbkYS5HBw}{1hT{*HG=)W7kKTs&a&Q#w>2%5<>;sriT_T(= zbkO(FB9}w?OAc9Z!ONA9_ZphxBUU&KkXBJV2$X-x`pG}gF}=7+UPA`R5i&9N?3j*n zMwr}oMoP@cu}(%_?INKTG7UhTA`p=;jOdgGp`V-8C;0JwWyo7m%#ed4s@U*P&s$_w zzJj5S@G2oLu^}B~ddXPupm_*|;+nqoPMFLMf6~;+YoJ z^I|fH8hI!ogrOtAX9Yg2;emcs4a9@2+`AQVIt#!7nwyDvp>Wi>C|x5n`h?;MpOmxG z_r|kZLZ7^@%KFz%Usr~WIz{D7g9r-+9*<)PZF@+xIF>whUDY~K%2NOj#4W_pYQij) zs6H?iaa&q}cAM~Sdg8#|bXb2MX;AnZ*SE2){o^K+v zgR!Dgu_DioFEIXj{amLV4z=bsF+v_6u6C;EuC*Hd%^d(aRL>0y;vvfDKp>`SWV8pN zjfo-b{F9a&L*2w_L!6Lt<ku|S_-SBkVd-&)d$s5MH&f& z+elr~g_o-`6|&aEwT`=6z3xF!?Vfdw?uhA4TrHrA5Oh1|E=yq|GdyIr7+aaRSj^+$ zQAw>P=M5l@Oof45p~D6^@Kb zOb6+cCM++uy4!Fco~5@VU9^Nx4$(A4i!$k?F%_CJG8U`!trQM_Tb)=366F%&G8}@B zaIvn6B1^HxsU_;_N^wVXCze4>8 z%M_H%Zi+I{tvWNPs&I01ErCx>K<_!jL$MwFZz#U1!z;5UHbV3^?9dfL!cDgU6hMy$ zDtTERR;;O7mz-$|nww~wNGcOnD)xWuv+cU6G=k(2;2f=^FA>S3w_{N`Q~t<=Ez~Zh zCG1e+Z=4(|;dG#{hQmaS)K*U^|ANaaYC+#eFYp=np<}A*7yVnw&wJ7{O~n=jy|OY- zw4VH_4%spx0J*@8y{vG+SZH&QCm~Zs@_?$TxN6gzJY#WTZ@ z<;Tqfh9XW?m;?TUBj9JCE~Iiu&QhmxK1EgnK>|BT8%o`y8&|I3RptI15%_d>?Xpo` zdAC(MTN;`Tr0=4=(%G8UF#psT2}?n}rY*|Fa9Ffj{h7U;hFlWEEvf9Gqi~?8JR+3o z0<9%e{zG&V_8d2HtPXw>SHl?*Ahre+W8_zc$A$+iLYQ9>^x6DdTByAN?fi%8Csi2ohi;{}zuMItk<^5_tRUl9Jq) zS)&>zu80O23nD1MKQflsSy)`U_Hi-&?p{;~ zm)=W5W;OX2kV$x#Ien&CMSp=LO5@Gm-a#30bLdmPMeUKK8osr;v)gOdGasS9yy{i2 zN?w}0ZGV^dz6v=YL^*?$AJ$j!ceWBCVj~+D6=D6ySNulOKz2oUj|vZ}Hfj#xbPQCWsmEEXS&`-Dr0+a2eIb zyEnNc=2`!Q#YZJYMqKBP_0ql|U2v`u9I%dC`3xLwcQ zL4!K_R2)ocBMacB-4x^)oiVb#gNG9@RNyzd-1&AjYfa&^vtQ5Q#{~kFV2P+C+tlkZ%*975mb=T zsmSz=Txg7_+_Nq}bc*;oY-;$Cxx>$$UU*in{wv!pr?4~hgBWVu5u-edddgPW%@L5~ zTa3?!ZD-$2A5k5G>yN}2%NoOyM~VKP5!i7y)r?$r9sl@|-=P7EP8}!eyV-7ZdfV)9 za0FAM#bq8$t{}ay*R+sk`d~<^E$9?XLK5j1m%*?;03Hj*A=$4h^P&Bw5=MP0 z#srW;)JPa>E02bNn0Fa@$kHFzph!vR3CdiDm9GvHQpn!tr~vC9HgViAFYFQsQW7=I zW2jV98-}z$&$}Hv$Tv)K1D$*a@G1tB{sd;?QA`~Vak+S}Ph#6lT#CY+ZzH&g;$$*n z0|)A434-Ct!vJZNVQ%+v6t^BKqUYEEEhs9Ma|K!yXCdYk!YL64iQs7^P16(;;aTjC z_$Xx<9gCxw2G7!g>c>Ayj!COkJMz$TJoKPAxXqkdzIRh{#<{p@U&)oW8_zMfC@h94 z+|Dv1y*zZFn|u)I3L_7BhRhf=2EjY#xl#i|0;NqSilkDcDUp>F04Gt(?X*zokvH{1 zm^{@5$meQEK&5h}YkD55*+tR+jbJJQQh!whfDnv`VvwrSWz z1Y%SfR6BxFdU_1GZjfGMb9n4aI2GF?xR};;)c}d9?^f&dT5NqmmL2`UVR!_r5x)Z* zi_VM-`o-4y(qNtFpTzWTre0hS@N@PN*AJgceex~#7pQDW-pMwSxMXtB+QX099Msb= zcA*rvSR_g5!xQcxFd-D20m-$Hk~q$;c>TTsv)Y$5jhAS1Dw(SUS**$mM;;v;78iIU z&5d%y6aVHR0b=gv*IB5Es|2xZ-#RoHm3Maf~qQyv#^6J$6Nstg@j zWu>vk8VEIsyZtchaTDr8LC#_!$8v?C%riJHQXI69LJ@a%t-+Dj-NwF!{30Jyiph~2 zak|%Qvu~hS)#Vd=e8@T6uY2nm7wW zB7()Zy_qxAxi}HaLN1`-?OtGpqPB=qqb`Xe)6dmxq3hvh>1A*r^B>W>WD978Asx^M zuN;x3MJ7%_}@(h}fPTI~}X?dw3#{cF1Xr87%HN zy;5`3l$)r!GH1k|4rig+IM1S!HR!KxmKvq$=G7l69J+7PvNfWT~C4iu+qQrUylw|>Y2my+Q6;((3j80Dg6u{_oc_Euza`$^W^ z>j76G_l&66R$+kXnp{!Y^tPRhvQJ{fYTvGf9us;VA)oEn;ZX1+658}?8SX1{mX>w=WI#Pam-j5txPiQ%jc>lq-4>VSKL>34!fHMl8y4*egZpa+kSmx$H(+CoqBzEL&m z?_v|RYiR@_9cu@;Oa_mKv5v?AebEI9i22qGlwp~lxSq6+NdNdSp&M@EisQ&}Ve|{7 zedNa>N_)GD0Iv&NR&i*d)#xy12KIiS-RUPGJ}IK{3=&n6RuXSZ`ZEgyN)v*pW+PbQ zDpB&Pn+Q&k$8o~D*IyDmFn$3arHxxdfLwc`x8G?BbvtdGFy*?eLQNCmnXpO1eO?KS zVLdx8E`KeXV&mmgn+U^`re3}NFx+j*R6fwvtl((I!>T<54wXGrD~X#@Wt$&&U?NjF z2gOp4>7%Z!Yx0RBO3g`~-q4&gK#OkJP>x(v;Olt8g_5|RL|luHVE^=Hz4k<_gSjt< z&pE!B0wM>v2?A5YrxSvuF^z6)pS^*-(ucOT&x#zyJGvaGFzZBSzK;>JzIJ6tHavBf z$@%x~edIa!bl5HbJipSw`NKixv97MNqXI46sPRwxUQP?P&K-54< z%69M>FN@@@>sq9&Z-wZS;-7F6-ENw6GLei?zE;D3cJ^<~z^T#qMZ&=szsrP_(;h4X z{!0(d+x2f@PyZ@5_b;Ejw3r84QlJ_tMB|3(>Knw+k}w;B#joX%;Hbh#davY3!4mgF ze6U_3ny=@&O>C&Qn@p$S90_^vB{HJhRZjs^KciA*epXFU9?ujMz+O@K9ZW57oFvE4 zocr#V6HkmtODmE(YzRMf99WS#n z)IRX56X1~s^M@ntkQbH)c&Bj-2_UfhNUvk9q@cL4$$(Ic%w%w~V-~^H6-=%2=@S*e>Vu5o=Gn~G^zmmL z$YE>|S!^7Es0kd&EyX)3lCM#e1*+ebcgJ);kq2Bh<9W~NG(*Z`f-;Rp;hT9WRG5TT zf@=_tyEFF<=82%li3ncim4ng63PFkpuX12Vzs1BR&LX01wkTSv*!qn0Oe zWyoqovk`fBkhW)&x3kNFW9yA6*S=k+Ypg93@sJ!vhs`TmNWLR^pLGq4Q3*%cryxqy zqYs4}_exhPyE%MKMLGH=tIG&CE~vQUV!xsg@dBWG+%{(}Z1L5|WC2%yM96n5Gn#>f zk_2E}G8R$4Ta*+B$YInpFG-$)G6rS3EPQfJTV7$AQfkrj>swpdlQW()NcCrNDT|pA z{l-YqUR3QcbC#9_5{MsJ_#uU`S7vK&z=tG*K4Z7wno!W(0Pxy~mpzgc!h2rm+9XOuE*BWjyHGEm zYDID+6BvQUvttW}kul9e1fmHP7A)f~!OA=sZe>=|!U8WrG2WIdTAV~`M=@j)#!b@- zieS`BsDsfj(u`}ds%T{UmCV3y*K_14D6*Yi37wimqsYP$ z7)RTMJr}~e#J^hT;x6|&I9t%8QtGhdVvqY&@$Se}ft3kANnJD!?zZ~mipL{M8|7W4 zjO^;@$ru$3S)pi?(z$gLSCu2?*eWT65z0c)RW8UC=j!W7_kDfF2PHipCXN}CYY`*s zD5VBT`OG3AvoXa(&iVCl`j!o$>=vaob-8i<`h_>Q%3ozd*pf{IiO zlxK1%{e&17o>hS1DMMStsU`wK^JX$|6@wYscTg7L%>@9r@q9qgJ2NPYQ`fNpV6EHSEQaM$+dMr|F4HoiCxa|aw-AP8(Ho$lW|9W!G zc8af`;5=d4Jd7!fW(#EG%?zz(cG1yJsj^bi{p3@`!3 zNr`;iiNrMm)+1PsG00k0Z>+}QA4UjpC^nHBQ|qs2m`gpZBUm-CoYONr-9ZQ89%>+0 z+D@y}!I7jo9UB0xm!|@X#Rvi>`$V|Y^Xa)jpfya#Z`1Kof1|?V*cdsGGwl) ze1(t~UX*gzOv1a6$l)JzsGBoBd~x3(X7c|^_;bXL4Z3b#LnwXvmjtTG>c-*k_!mcly-0_jMwy_9 zPD_bsB6!?mD!0>~l~8oV4p9|FL&PWubmD~S>Z1r8mzQ$j&M3Y!+H|wIfopzG$T37u zc|fI^aj%jDVEVL96n{xApEby7=(MzujUY{1;QTOHaQ54%;lf2!#{jVYI5C|Ic72Y7 zuEBE|Hi|;#p_SaBZ4HU@{iJm{No?Xor4o-UWgsmruP-eJdpGw{>R$k34GysK?}BXj z*SJAr3E6NpknZu#L5io`I@;3pE`1xoL(ZnGfs3#hR0p<}3~!V8lM*WPjzkV^=i}`* zIJm%Np8>XMA7EVKhOJz$p-(G#@Djy5W=8-Gkt}Cr@mfrGl`ML*7jbk&A^-@m;CdIg zi+)KdY&BBs(JC9U@@dl|wLsH+*TA`UL`}Bi^+NADu`?-B(@Vy&d8+~~55NyQ*7F<^ z3=6O*cfko$M3-xsVsI315Ql7tH0H|ayPCB})!ej`f(4_SGP`i)bH`DRQ8C3OoPw&@ z!47ea+lRt8{ZAxFuV9p6Wwik1Qq#CKRjx7f{D#w{9?Y&n;T4c{co39st%dDba`F5W z=WAg&d7g$B?=7^Ez8#7$f?$M}p=h(`+#mc}PVZ2r-Sb|FaaKN#8p~fYiW2_U03R0z zcnGbag_{C%lVz2Rnj`14I8{`X=(J76U)6k}IuS_~ zTqHPb@21DX>$UR|48wf=n2@kX5!7~oeFgrZ5@xu=JfIRggiazp)>da(snVq?U1oyU zBbuVcDU=%mUHCGKUnxXmkRrUmF~v`L7CIdB(QI(1s>Mi!z|eR7BP{HP=?xi`qaweF zcH9q~aE){s3d>58_#aQNKsJkNokAMTFP9b#%TOO_#|^&VdB!yr}N z{$7^JiG*rJgKqFl8g+W9T&ZAVmFh$+myp~NmwN@7zxX6jlD#NsMws;yamXcysGG&v z8j?3<9rE6|sAi3i4wVH?Lsd#a-xT-sU0rAmeC-}6#aa@-NKz8-S)?w=NU^5@Fn*Ah zBn638w1C6c+^AON0THaAK*0Hk7)ZOOWq?o}xf=&6r30kUmkT&JdW?~*O`uvD6A4z} z0am%;g;6{RYs1l0g#5r242!!Z`y*ZYyl=IK2d-^uN}&DSGCp0~X`DVUDTDTRona?K z1-Q52GT7N5e)ZY_W$7YuY^OBWjh7ym7_!sjm6#|27YE^@D{ev9feki*JwW`onbck7 z$KPAnOyv5AX@Dis7RAatq!4vB?t=Z0E!UcbrCh4q6_wR6G94+>xbk|oUNDOt?2OV| zCGiYiaTPYPu!#^mhgQ1jN8erg@ zyYkr5O!P(y=2=RbAw;9aDQ`T5_B>jy-}zq~4S6fK*R4&Ba6 zU-d;?RXqXDeTmD9)rf+#0;rcQ!$~3noW>CLn3EG(4@ChA*vz1`Siu2#NWI`-5b9TAi}fR`1 zw|X<#+-Y>TTaYg^@C?H@JYyGXcylTNIIqIL5)thEmSi57C+HxXfZh{0Qsea_j>IJ6 zFR@7WG28hYTUR#s>k%j=vX~yKD+URLYAMmnnnd&LIvx&$J5lho@fsCL9FeAv%S%+d zvvZVpU?MmhGy0+nSl+P+9VnOHP0#Y)xd*<~HLjziB69`F>`l*DWX4$f3Bk0Ugq8e> zgTIsg9#(-TaJm6wZpEoj!*#XQeiEain{u_iojouv(%vGe^pJny8cVJi0iGzE?ke|2 z5%UiCOHXx1nIv6YXbc-3YstQ| zk5-HmDd3)M$5#?L^#k}~W`%LmnT7cdyfJL~s!<~OA%F_3P$;K_-T#`UnoyTAW$^l-7xGG zz*3GYaY<%@kyA@erYARBa*Qdb5>`$Q*Ai+M)KG&CXe}i%kr^9?PxlRGl2s&@>~-hx zHy0}%VPei7ZsxQc4N;fF6~ExzQ$iOTUXS= z&Yu+>_6#~=6@?GA*&%<{n2_6Nj}^vleA?N9<=|=&cVnI6FvW+l z?d#O&?V=S+t0A*PgLP$s*xZmnMVSf#OTCibHh;+}*3dPC_DD#rb4(3MMi~VgN@QvZ zCt|(tG?6zs0>f2C(gZWytJ7lC-t@ee6CKCeGe)h0iC~{1TGif9&vP1rneBIqX-U!0 zmf?oNV4iq7(xxvv7d(AuO*$B`mNeOTtCqfBF=7+ywa} zNUhKv%)w-_QZ!VInHqb0or6`K6FfpfRwEbb8v*CS#QEj0J>sia!1neec|@W&iHD@Z zY3d<8+n0(2Ul84xRZK+g7Gz)s=a){xz<>ono-e~Xqa4KrWYvmZh{&)Y+UBwlG5QKa zSyNPlpPPdAAmO>0(M6``arMx6#Z<5$b~lwHhr_l?$e9I0hwCWtk?g4K0Na%%vesk5 zmU|&U(y#0-r)Im0R0h7fWqacSl10-MKZBGPi6^(vRmX%iiB-*Lr}9I;1@6xt&QE)< z#r(`G7#6Nj+~yPnvVU)g_82J<`T=?bXNf5h*>|dWP@*>EG+HDF)jM@Zh+4LrY?DFS zf+Q0O-5t+N+`wV5nEDW~{>>uz%j7R5 zH~W*Nv)#jIZ?&GF6}Uv^aw&y5<&?zyi>;x@1xm8J*{(+uBw`-5;|Rqj3V{;o7^vwN zK0Zo!9h6fr{Sxd~vf82JEv1|ytdS0JmO~2N88!4EpCb+Ov77g{yBo^S@NV<$Q{YP4a)7QrFS^;eeAXvwsrJ|!YwwzZZ1SJ^sGuT1lrSp=S z*5S2wq9*p16t)RVj!_9R&dQk+Dmk4d;tLQ}6-eOz5fmySKSZg|^ZwXE#ifPPo^$Vy zO_l`m{_)EarXb~&bS_OJxh<6CXR=s4?VXbSJCP-a3WbVE!+}d@8PLitBB5FkPNQT5 zyl|m{cPnKOZAZOQVI9mZg3%EA%|(0IP{92`dou`MnQac6@Hqp6P;Y|El*7xzp`Cj%L{HvjXHjJ}JpRBC!N%pul?i z=h%^=@fMm_ztrf$LlN(uAqb5-*I~BX(IeMth2n+Hu&^;0Z|uM?r~mSMNtr#evgXDQ z_RQ7JAP>2t$_S-`qD<)%{TdO_S=`yf!RM8TGzhARe#vgHwidr;d+~3O#20rKChJtt z2(9@TA?w-X@L&(RX!<4$IyBgDlu405Ni<8Bspl18WlCYiFD(zlil4*-o4&2a5vb;e z65i$%DMj-TEL1iPuO{o;gHHI}b+WD>=+cX9NV`=y!5_QmO z?c$DloLi8~P>dwlB|-QGF7-j`D2+o<)3!)44H!*%ppyP1ZG`8=-gbL4O=sX+j}u7P zs)3SVJwz*=;BHYvHU&W9m@gSDyV>Y^>@DK}Am{|PTdmVzz2iz=_`Av5K1myI5 z{1zfid6W#5pF%OKp&(~XS+SJ)ZGPSByu|>Th1RXQWYM`dE8fKem$t2mcDxChgJFU} zuq~;0h-Wj*A%y!=8U;sv)R(a!X!AK3p;^N{$F!A`tA?J2sFKY5l3)bO;iyd_7_YU7 z0BPi>2p!1Ijp}ArY}@FtCYab96v{PK63$Y!tD5p61!pu}Dnw$L6n9Plga|;oV1zi@ znDt2#U&Kom$U6$z4)aTv5ucKh4WUfTm-fldN3l;u=|JLGfl9G5{yJokeA>l;<7sC@ z<;Ap<(tKP>Ckpt?5%lsg*xaO7P+l+soGr)kV)_;Cwevh@X6EZm9di-%P#5M6&mLTa zP$bE-8jd%Z;~&#cgpmZT3?aE1ryUbf;b@o3nv!wObF^_~0qY!M=@_KEcNerD ztkyM1i!iP7YttA<4U|G01p3BP?C*j!@PiX3dh;X$+Rv6PXktbV+DHn$g`gA!djQ>) ze|egL%}bUg@P+-$mv@qlT>rTtnSv-72X`dm=(7c<9iP1`9s!%IpiAs*XKM>LG} zvv%AgpU^1ii;xGpD9Y&%QVHG+NXNq~tfmJWSd9!*T2DlSEr9uR51n3@XGO+2CjwWU zTw;-C@~Q1?BSA{9+oF|)|Htn5W;40(fl2ujANTjfnDR3t%F^r~@a6h?N(~S6w<@AvxJk{afiaQv5- ze0TR;OMbXrvly2>3gzztcgVRNvInA9!6An=QNkc(2WJLco!Lo$1=cX8NKY00No0+? zcCN?08MT;lFj$Kj(MY!`2JzcL8YP=L#qCwj1})AL6+A~h%Hy8)W2{3*5Yn7-xin0L zg*b@q3s_)MX>RLt?m$S>bhN`2DbzHG_OqvlfAwsza1-3iA8|Zn&7c*L^ltMNb!JehPt8CnY>J4+SP8{b@Ss4ZA{WT?s|;8S z7mbC@N!hNna1!lQRFUBdGw9n%>u>H8zUV%sXgnBHQb6Wpdijfdg5`zqJWf!@ov&@& zLQq7m5;{TEsK486r$N{>t>k^_K@PS+A_@br2@i=^y&aWv$(_{Es%PIzSW@|cbF)PK z#aea2x!*LfU=C3kmN;4GO-!=v9v@jpPD^uyg^^|kd!3EmjW+|u4W=FlQ)+5z2IM=! zvFgRwUs=4owzPa114qJ>U=^J}znG$p+8B?z(ro1*-it|wV+554tD(!#U60)!NeV8@ zSvXnEVBf0mbF;HZZpn*(uzuR#Z1QZ`kM&qRjl}ly^r5wsVk!(LTU5Tun&hi)i#sz&G62q2!bySw%|0M|HXITb$k3Pv6z%E> zJwk*e2)qvXiKWX6%TKKNwZI#XTwS`jVC|;5Yi+;F=4vx}ja=k5_PwT?B_E>|UMG6q zum}g3ttBvP(WucWAlx4)apHVP6w_>>GNi%)r|8gWQwX3Mrs){a&m6TtPIEUW(z6+! z!JfE_CX%2#N=9f`ROU{Cw#NDxWgf@I(AkTy(@J-TScZ(f9^ym`xiqba2ympdFz-p; z7_2;^XanK~o}VVP7BCz#z6C5ZhgNNrGq}J2=0WdRWR=W`Lz>0x(1ZdKZq6=KOm8AO zH=@tn9Il{VeErhem9;sSmToVc;KG~KaGEk{bPxmGJivs(KF(lwudN}coBd5%eGzO&0%Zrz<6aiiCC4>FV9ho>J6@nH($V0HYy!^(cl_D$|0y~S< z5QsKS4{p9(i!YdU5v~^Qn*UyYVZvdw9K&kQyge?c&Y*POD#z-?v&wUJ^cG!7Lb` zNUVvpD5-l;opxAPaip`=y;ZM0x^!jZ+}i6_&aJJTZEf!Ks8qwm5+u)KW=e*j^ac)9 zrtNw~0KwMel|L$)u!%b=c-Z!rf-eyV#}Ik-uC+7Wtv9| z2HMQarsnvc*8o#9>}H>7M@e=txREiI`h7qKz44>{l*Fva)d_AIdL`T#5dM6CX#${y z=eZbkc6I#jPP~dKRz4q(I`InpCi5C*g2-i3yvhggwt?Hx$(XKmGDk&&ZV^oM2jhY65d(wDBQWDc;F6Z(h!2i6Vq-dthtlaOSb2N5XDt zNZXyMO=dDkO^Ayj^e9{b4*)5)8MXz%e0GZ4jzlcVafPVo=DBwy;gK0@Hl6G~Aqrhg zml@UAHT;A_NYSFX2zaHBJ92XHU5{T*Zv;sRA^kS;o>fBH@dP+<>JQJo33okCzZHM1 z&pbKxFmGO*oDv6(90$^h1vpNFLz6Vx6efk|9XENI7GZnMhqyt^(A!M-*< z&FoOrlm2))E7QADs$?cn=oU8&$|X-U#eI$)Tlg5CrfQRH^TeVNJ|-BD+uT>L!*9>K z7n0jJsoife-!HW9he2cb?QuCn9}cn`2fEO>(gjeN;f2t^oPl0VhJdc{5uM}^SS73L zVMz~D3Fm{8RoX)0L+lJ~wmQ56Qe*}aqup#Zr)e1v&USm1DxDAFC~kK#8`wGTX)5}{ z(|j~GW$rBOAl*FjJ>ElQ^qpEx4JxL+)@+ki$Ydl&7`0$Q#B!U7|b7!ql@?jHlas#gG{sxuw zG7}UHP>vb_ZJ*HR@TB7{rx|P0%4Nh!Z(qVgC>eB*m%QmEG(I3`@ZbD8nb&AQ1C9j; z(T)dTRHfItEXd@N{DmHXTHHhwITN-WMc{-ey?UfbXz-Av=n?d5k}4SEbyD*MCp@Y_ zCg7P89oG0F4DGK5^6>Hmc#Z13ehQs*5|N4|W?tPKZwP!a$CMNCa25F(-HHrC8i)^1 zt0oMSSenDF=MK@Kt03MA|M@bzA3KGPOn(793 zVcLiB2YtAU11?JJuI1@z`3Qzp!rzV7bo{I3%bhO6k?`PFXD*;9vyA!4(8(M7TQJBy zY(UOFiX7#tCrL)K1dk@hVX-*|+HOP_Dwc1+<_O}#(0XG#v7^mIu`H*jEe#l#jpAlh1GN#T8c->@@PAj&~CW`K)u7|7JbQ*kIl|oP>_!r z!Z}jwbpk14a;ZVY3EFlS8jd;!PwzN!EoI>wS#2h(%;2_HgmFyG>hs|#F*HFY+>I$p zjz!LtIHY66M_thrOsE=(7-Zg#L`*7h9>DF=CUERx)}U;2h-?c1T^G+REN?V`+mzee z7!JwWT5!KB26WIESA&#{rHS1#yG+=f;U)YQ2ZWj@A)3-$2GU$0@$aDSaD4p>mNP8Wx2k z=mh~22V96QOG?R(L8P)$(nLzDe;1uqe?+T3HiWGAVavkh2-W_afQzoRhs!|Y3QZ!g zRj45LOKAeu-BeW5BXDwmUO@m_C==AWyTBY=}~J~-HCA->j)wY0ZXNJ0OHIl)>1Xu;Co{G zVDZpOFpoe!#VwN}fUnq5l_9AX?&JX~4(skxox2Fu`-r=aMe>-4Mrct?q`S~;)wqyX zP8RBp{ z_FMK_+P$%;1aqusZ3gCypp!$RBEqF{8xa$lW<_U?v88GJcp?Aty^W^5VGx8-;Aq!a zgymvA(jp=3bMI3+JNg*ra z2HpLe%;hbS&dzF}5n4K#oTf-sf`?(oOv%ra%xYqK@-gOv&&nJ!Y`J`XYIHnjpfQDK zAkTD0<{AN%FsL0=mMIA^xt76o>I)MPcdBB&7K!`U`JW5$vsUOE9Iv7xs6NPecpq-xM11Pt`Btp>gf0@Cgw+0zY~m-LmkEA+Vni1Vd;>9VWo-}2dil_ zryw$ryO(gHF?QKwqCNo4j+u&rJUelN2a76aa0DjI-N~j*g_sgLA+nTE%4URFnQ9yo zu4sTTq8gA(I-a;fIqbhS$grurA*2kZJqv~JiXd81)uhCb zQ|Zv=MVN9vf5c1=f}&gs08+&uRf&X%c?`iIRl+)s?(4ri>~U9PtzWFI%*X*4=LAIB zWx&fAzh%c8&Rdw3)7vd#f2uu_6XIzT>%1*${XBe+-BxE6@`hG)rcocyONd_VAK0&4 znF@GIxLq+<(xD*+02!f68{(()2x-QteejC+BYl&rCdWcnb9W=>%AoRAd)tSXgRE;5 zJD=hnm@c3 zepm@BN8z)qZEVavcHw{tgb!rE26DE;_X^X~Y)o9tvdgu!&T}D;FRt=v7&gdWG4tTe zgWM^bKdZ&>P3va%WXK2C23JQd4xJD->UbSw^I}1p>07q#e`c9f%Nm6jG>TwYhyt4Md5nkjro5 zk~!gH5HLP-yU}OzhWR|U%vPI08A=rliuAT=(SVxRqAJ`RI8!?_>tLyUMK)7dy4eFo z#xBm$;9C>7@OVYNh5e;PGb0MXqt&*k!_jK$7@)dtFjLY6QRh=XDaXnNNroVcVTQ4C z(o{6DY@+$BsulIsv{?1eW}T4>xag4l)$6ing}$es1%^eaxwlO*>RVy9zr zr0?ssvuC-%S(rtH;nWf1hSjMuO2kf{=>Vaur+6)EVA>uQWQU4o(`4egV#4aS4REi8 zZMrNCI-ROZW$mK3C!P+%H&l3LOilx9Ge&uIZkI4mg=iu4r=WY6{l~gDAUS!hAJeV=>)nEE zWepiJEaPfLX%v927d7;ZR8FCh!Jc+IhL}VPyZn^$&#D)Y0~vd|)X#;1G0#QGjTShr z-+=4SOGF+m`GQo~r62oVL!(`Tn(8BnQFV~#nX)|_(H%-<|Z-Sch(x zbM=qhDhi)3y(QoLqs>|!F_I4$VH>Gj*TzD3Ne>G3@Zx|hCyKlA4iQMd@`l!K8UfT* zes)n7v8%J5&YtlwFT}bCc?^$?C34gbIW_@^U-ss}F)1rLSwsqQ0{wA$;1J{`-3f)U zfdgVSuvb0(Gji&uZATmtUSg0`B84{yS{p%9jWtLcg5eD%30+i1ViO!;Y|>#dajQIq zZ8N}b6v=xds}sbh4a&tGe%H2Nn%ZiLJx)}Vf|EMm!CyJ1Jjh}YoJeAQX)P7~^dJYP zLip2q8IdSITQWf=(pX9&PXDq&$RQ>3l4a9o@~wz9U}6PBD4TN5HMt(+b2S`bdoe5a zj=)4Yftj7n)olXze48Xn7X2LTYG~erjCek3Co+|f+K)`-l97D7W5Ea;SWJi_Z|H0f?)b?~Z9RH}?3>*1i{7L%EAyHu9WpQU050cPT)Ed9 zF3E8f+=r2ci@2|)!2pMgGZosf@`WZ~zDR@c4TQ<|U-f89LgXrT02Xh zUva6(?>$8M`(E-U1a()$fUh(2-z-nLS=6??n41b=;XEl6#e~0v-YOMA*fqf48U+sh zS6>RHImP^7N%)ddJpKFtj;wh_3GP-OCWFX5^F$~hql&6@gb6Ku`Dyn8N-Dp_bg$QT zdbq65FnE_!ZH_x(JYtA{{)zwwi)z#J2)tALX z>Q)*D?>k!5lc2Z`BaD%&wqJq7b{CN0XUKCThC8v=dnUTS^lb#V(ilK-ly>*%UnMa ziWcOV5X3EOsWkMZbWq{c1&vGXw8vMaa0AY@(YHLR76VW{r)noEN=>1qFHV#j7Uxwb@|x}M&`XQM0_rx2GIUj%&jKq$i*|MvzL2J0 z(bTF5CUR&KE{G_!qV;^AHz`RGH*pQq(rz*^=+*LQ!qrvr;qsBrj^y-Qz5=KNQu`kX z1kfNV%VjSBZkcKC-bG>!)5+u?jE zmSm2JjN*dS1Kv4_xC(-(+dy>57wPV??~}V;Mq1`J`Bt%KjZ1 zEWtEeb$Jn7dyibyF>a+v;lbG`rLfF!^A0|=f}~+n7LW8+^5T7)khsFE5j^iw;FEWQ zqN|PWGHnkU>A&<}h@;^H0{qZl4v%yd8tE~;IO9bvEULtC;#_gQm}h!&fNLA(GR?s$aXF2b=rL1u7UmhH^-hmEVITW!9J7HLbR46(SxPXJ zm(scMRabaYus)Nh5pqRqP%FFGmxltlW)Whzz5sKAj{Ou3K)_U}{FgDxfLm2rml*R} zlmG!Ntb`IDqc=s*B8nwUW+gb521mPn`VRXqW&1^*qqe}zuKFQyv&A+$_!CF*6?qf^ zwDHN8lD`PAU|iirrl9HFH;C&Ju4!}E$~W&pop(utps#6-sb@s8;st`bFSHpt=y+J%8@f`69+uIvGru4>skX}AOx9ka&I^g&<1`UMm zg`X0HGNe8XUW~wkqhd*gQD;>vC&+aK%k)uSu!qCs?%J-jSY64ZS(sU8V-AxSvgG@8 z%?V*1AX65SogsTVPXR!Z?)~wGrJ^XccfO2we*R9PoN_R?Z}V$%4yKU=>gGCp9B2;- z3wm;SD=c0~(=|HPl*dVy6`ZCAr@>K^h-gUQx?-#&m?1$A^7IyA0WaN@Nz;Pu7rdhYuvZk%1#eaqq4m= zz+CapR(i=-3)%ikl7&BrS=ThvNOrueBuRF@><;Mtp@+<7at9vLTHp`}oJ`Va?*#U0 zZ#vejBpl7WGF%3;CL@8G*5pRaP~!Q0zPhV8(W9YSLYJmN-jex%Ifj^S2{hw`=wV8| z#jj}DJ_t*3nHj#iD=(K;C7dL*9hTR>UScKVgC+uj>VP6~bnw#&f&N?S$s49aRuh6G zSt%JBbsgI#)PZe>Qp;@*&WB-3ufp%Jcx$q=~|cCef+a$c1%*iN8{=UH*jLFOcH`HZ`a+sT(M=S z+`YeY54L^W4xY<{1J&ts3Ai->EUgIY6m7qQ7S2TiV4Jhn2@bQx+0;+o(7f8k448bw zv72;CbnDN^lDEV;vxOH>0+l^ksI87V+v15Vo#)rGr{LX~>GZd0b*TFV*W~}dmM)mv zzEwVR*$gv9r*$sJ3{X@YR4~@*t^a3r=Fjcfo@+E;iCS=s=Wf?eb91YK<6crOB6O)G zLnL^)+O&k%6Qez7gcb*Ei$l6qn663Lkv=%)hGQqgn#bBdwRJHJ#>y^1-t9oG%xUfL z^(DLwCuiz~vVMp8vfO70;Di;n0Pd{Rq1JXVt%r@?ax&taPtMOJwAaTKHv12DA!^t< zCLrm)vYKd#FHu9dWp=`#+vjD3*W^De8Q?b7KY$6|G#R14|IuE-8c!U{UBhvH)_Bcg zZ2S^lKi{SaYQ5WLg&p!M`Sl*V5iKb$e=YakFTHr0<1S1o5`6|Ug3f3~hSisOG#ZPp zd|5?Zk*$8BxXrg(5;J_1hlzz50aMatR#2SERjyZ8N7D_)cG3d2DZ|Ch9<5L#*yHJ*tE)g!X>g{b8{DcU&B^ z@=`AxS5Awb_7(#qbE`=l**dQ@eQx)~z-gcQh~WEhb|W3+YwpM~wl0n(2D;&WCDnRPQ(@ga zSF=$PaU$aM{Iy&zW%tM}FQ1I$=GEU$>$zREHA-mXnvz`7xv@K&xiq?XhfNR?QPCza zK+#~fk`djV-H1rzHRmu6bfBP6+W)yS88>t5d#I(!cFY68HNRo2ljBj;FEwq=5dI?C@g?vx2Y{KvozCk$3tQ=<{uy?(R%^KRmzNCTO(qi69zQM z>3A8pLyYswugbAx=1&^R6-2ReuaHXoXYj0;&*2tS1NStjqI{|n36Hz%{#wrO=!5G; ztHP*|Econ)y<5H8i+kI*_38_)gcgz{(AJSGES1A4MgkYES9g~9AkJ!bu=2&P>GRR^ zhD*+2T}PFnq~4Q%jN8Z7jTGe$s;yZR+S53*lrAu;wJW(lf>!_Sbk+R@8jsi1*fBgu z4sfc}1PS+n6ChI0P2Y@v)TtpXU+JLqmhiJ2MCzW^56&vubK8)HjwRuV~pweR4Kp~2qqLcU@R(Qi5 zLBHfcTZ8kso1eMQ9 zJehK}bZdxFu35{ATe7C`qj7KI)A=a+v4i-Me_Xx1#^rVVb*3zZr2< z(3B=U4c{27BNtNE)|Xy`*G_TI9$n{JVN;*h-wzLPvVS5A1{B5Dt`#SNL67R~mv!MR zhcBzh5%+r)yfLz5=8~|jRLt79$qP80It~zr^DmdtE(Zs25?T@C~%HQ=0cGyks3Jz zfTS5?3O~eqf?r7uR=_|yeark6bhN8tjIDa~qrL}fcY60Q76Ao=A+B(QqG;i&$K0mx zPO*11zX!$;q%Gz+7fUMZNjOO**j9K@-x;@o*H_wf)FlHLYndxi(5a(NeJ9r-G>mbO z2HG#45z07(58S5e*= zXVLMR@G;iIHtgScVkVW=Fa%5Mu4*5n6&2k}tsBy*>!%+i%46|Qdxy7|9^Ta%I--c- zq3cUq&pO+PLyZA9o-7s%yz@YnH4%~A`mwoEP-H0Il_ zqAyeWkSPY9aaPU53H%6)2L1gGv=Tz))_9nPiP6j;wix}{3_~|4S1*}Rd;iAxtbh@;8iELU!YF&|jJ~SN|8}N$s)?};pu*c=mY7d8;7jgHM zn3=2;fN|qv>Vu2e|#aH?Y$uw)?fvFXZGyG5(tgy(WD+|hk2#McXE#hOq>(a9~ zy(No^m0P;Fz_V(rhTITC^A4y2y03?L9bj4!%y}NSnytLZ39c%^k-^;!Fd1^hRy^2yLWp!eZvR-UYW~V@R=T#!hXSL zU5*3OKwPMa~(CI|MV?c^?A@~Y{TZB3=E&;Lh8_CkI=sj>z_@X^1r5F7#Sb9&mc+2nOARkyNj zK)MuLTX`HTm5xF?Vzyd=N_&k3e0$M~yP>1u7j$U&_a-TEzRRh^kc(_DF4l4ml;i$# zM_4IFpDse5=-aGGpvGc-do-W7Q4QCq3={8r@-pA4pVP(IA?H-6wyHTfdotp2PWP-x z9?vY@l=xv}MYr+#2jQ$dYVxhnIFVAqh)-_ag!GsNC4cI~2{%s8;x%BA+9It+Jb`ET3eSmv$TD4GG^UPU7xNm4A;ULin#=T6*W?-Es+|Rmrlwn z8OudhF2%`YI3MxOM`tjFcnbL#t`4N*XK3@!H)V0Hf|L@Vu~-O=bnS-bC~{b+0PWtB zEwjRto0pbZxlT#Zn;>5?TSp_KLj8(nCIe=teW{0cVBa=zy+RusE)AFR8}2ff9%YD( z^Z{QAmvT(d(jrBT$tcp{)4j>mDf5SSsCEc~;09b($G`*HTb@woz`TQTJe;&ee`GqR zIYy)JR}_*%<1{MR>#{Pu=CDxKh&%;%7i6*O>hy|`{iG!a{z)+%smhhuj&$(RmH2V; z`rzL`|C~R6zNyrjrITmUCn)TC>_@%`|Kk-LmhtQ`47oMt)hu@g0?ma3`I!BsT#T^j zz~RKvbQxKt5iyJK*<^TWA0t|zU{YY2ucmZGFa7|(^WGGW=e_A|Y<#RPuH0H$SQ6Dd zID%-3L(e99Aln(0V16HViZMtycf_&c_KFfp68Kcu!%7``I9k_GLhMXAMY$70CMSQm zI%6EdFUuTlCGbZdFToF)V-Z#TnB+9!zKBM&PfHp18pxM5l z>I7xl{zEmw4%avDW6s{EwIrr2=bqAJqfJS*U_K;{GFNude?&fB$4YBPq(&CifisJ8 znLzfkTx(??U%>IPx0$=&iZ~J}Qr@tMF3aD5X`GO$0`dFEVt%z`1t4d(G7BjkvbTC` zg8RNO)o52?l$blr1t+Uj<`Hqci9GHg7#w3w^a_`e#e`7lU8L&jYGj5|GJ7KYJ7wro za86QmvEqWHlxWx&anR|61tL%j2rW!y2Rf7=8h2+ZF<8vWlCQ4##jH1`zO9TW7zBz( z1=A+>2BQ=T_$|g54E1$UmyZLwNcZ1u7%jdUkKyz)l;-jw1s7d&Gu)ECL@#CZJgX2V zKGoo)M5CUJ!8B#aeYLOmRxb9($c#0e9;*-6P}iJM8dH$I(l?#$L98qC0ff}#jq~g}V-H(W>{QJw*-97x> zeYvEmXbIuEv|pE>sZ?wvt~-&!8OZs(N&jm3QY3J8>F&dY|4El}`E)7BAV6~%BNm!Z zGnGMsRu_>v=tM#J*bT=6MD1%d5r%`S*UY0$z3fex$&OTr+2Qk231s!#bS)5iacv=V zb9hdoqTT`FYT0kS8~+fm$+h%=>XiHnEcfYwZeA$E%sl2suqk9-H_?`<@PBfloO3ZT zFSY(B7Yh7oBLvsus+f6c_CL8$R3(`aSNbie=*4H@YP)NQ|4%Ly+V;6sN&-08oj1jCSO#$S^YB+nbbMK_PxMLX>g6deEFK&qI_S}4GWd`Lk9c;H^8E-qdq^9I zD=m7VZmgE3h{Ou1^mk~iF_)Y5bvy2><}IyS;0j&K+)bBpX2l*bhK2vHYq`*$!cVoS z7wYbPKb%aF$khMU8>m~#ZlG(!$(|5Ye-{PIHD=ZuEWX3dqrv|b(GGW$75oCJ<5FBb zKFPCX{dk5w_RN!o%gz`QoxPjw6SF%tod`)gyo3mnSBgXG{u)sJbcLc_z0;fN3$r>p z*5qs;JYb2RD}Gq;pYSG0EksJ;oFdLA>TNu0epW3~R0QGA$@OpjJ5pyk7~eCi292P? zWB_JXi=`1=*j*Z7X|eR1qj_=r_Namy_LMm%^xJ6R(K6@;z0kJiu$9ULi&y2_u53%k z3)UJAL<$4uDcki-E6QC}h){o+$^q7@yu#`w6L-El(5!CAAHMv+gp@{9p`ybI_&^2? zOXx2#9!e?10#<1l4jC9~x~Mu7P0qA!(khX8sheav48t<5RuGuzYv4dns9y!Dus}O3 z-1T=7L8!QL9j|p;a!=#vyr3qXij#eYwVZ+0Vqxn^A6HjHC|45$pEL{PwWdeoTp#wB z46Yr2i~bQ)Pw{pZ{BpfOKcdnL-reGiC~mgG?1?m5c|LJou1=jxVO16eCG2t#KP4h- z!BEC2b~lL+ZNK^U**Kag7f9xPK1SyL)5GIo@B6jwG~ZKjE>I>!)FOJE`c&H+ZNJy) z&}V=Jab7c!i?S~>lTLgRpQv7VF|m{-%MTiUd;fqAmw`??1`*akD>{r66m}=8jKHkic|s<^=kzFSkBbux5r`?t1mk$qz?-n$5AUKyd zA@MHxtFqMs;^GegxBM{x)(tF?z;@&*n3k}jy^!7#82b1r0zk23M!x_Ix%=Y1ED|8p zGu}wKcBEJlw@YMdq#{nUCG{!v&;+C7sF#kU*{y41Zl>Z!dt0+D+N`wvfU{H3Ws~8i zMkYW6#jG-pzAWb^6C~X4 zNHm$v4*K3N8N1{hVg13t(_iUK@y{?z)bJ~%u`;-;iq^U~r_NTg1}%uoncgk;B_ogL zHBnWiVRUk&|Hu+#rh5Omde6Iv8ecCbNX%k0#U?!YI zU+G-l=P*7}&jT_j@=B@2)G%tl4-Pg0xtA|~V) zmba!f7yGo74+oP&&aZ3Z2^Okiai!Xu0adS$fs+wuZwrrLB37ya(M4_Rk2Z*N0+AC2 zLc$+SxY!4$DU19X0@c6AePe6sl8u5rV1N;!kPv)W#xzKRcMA#&Rt3ds<9K;?Wow(j z01n6peXF-T&M64thDnzUxmmJ*09R8VS4#3r+p)p@G6sf5-%yg+qaUueZ^9n z=xvq#5rpX-!I$-)u04PDeN--at>e+F_a}l?S#9I#X zj{Gu(ecZor{0e)Ji+x1MK3uhHbCDbfIY@Wq%7fcW%tHG2mk*a#ZqW=4+IP{;`NTc( zkh_Pzy)xGsHe>o+UiOg|YH>Wlg4y%_EcKRqfA}|9X5Q&N-&}u&i+jCa`#bA@-2ta_ z;+)|g*cwICu1SxW?_1F}Rk^mc?w}h`FD^!hRj6;yTnzeBrcv`f;;Ac?Ca1PHc3N2# zE_b{ElT{sez0XCe)fTwoKn>=}jOoVPlopZH=2d-c+bA{}Og^-YY(lu`c!lAm`pqnjfVO86O41v!YMPyUKLjQ#RmsTxm{_K-?8?-!McM^PAKvO}+z z<&a}H-IY~r%BwCkM3*?%INR+b8fLQ3S7TNV18BrV|X9 zq01T*f~wcpy{tVMU?zmu(;Xh3dN*`ow||2siGp&4Q597Kgfnl)iDtUKCSAC0<@8+i z#KQR)!DS#XuA#p)VYTk4h>qAp9>)uDE| z%r-vFL22>EZApLB6+su))PI?b&IhlKlUXF74&GkZRHhsA9nonfVSA;d6<&m{LsW8* zzbLZ7lhTAi&`dnrQgh8ISRJ8^TgH`6P}j#-jBC&oJ11Qau6smi{O$K zH5`$R4;avL@(?w#{A+yX;Ap-@CCe$=sDL%Rq;?~IzD$AB0FKM4+!}|`vj1)XCj^hn zn@PXVjYT+)785TD;QVgoi3#EbV`qJ9|NBQ9PoF&6 zS>J!LwITgZf@s>z@x{J{*Yv=A+>7;Yc-n)O3wiI8C>k!Gnyu?hWo}GZ^@#5Tm4bBH z2Ld-Gn6U>A0S|)UcZO#=DCWz+JGz8q$nmT!*7w>(mNtqP*s?SjSuDb4T%OlD%c=;Q zV(T{cL>>+2Ao<+8`OG^aG%l}OG5 zYZ&Gy5VGxO6;akx>5A&rwE}#Sqw|r3lZb)gKFRbo_-4!Szah=M4Ff+=>D&Ei6ryho zoO;qA4w!Oc@ftX7P8M<30x%Z{o3;_7)zPAevbj!dOGZ?=@01k61qj7(Ta+9Z51~@^ z_yW8iyfTIE4@OPpFoU$B8%io4FdWMvsI2TBao$(vYn+YvZi3sPbZfIu)ERP4oPE|# zh`z9{_wy!1b6PQm7}zGhJitu#|AIthVNul?$!MJ- zhFj6nv?|~gnWt>3NOVz443rHyDS*ty@~=a{46dO-o=Z!G!dU=OlsA$Smwmq3( zpQBNBPLWkJO7y510&=1*V()LIxIIYmfYnvHfKD_p?E%NUj{I()U&(3k!HOI{QI(Vlb_P+jlo!WT=V=jL)y4Z-8W^&mP%0mO7z5V ziKWRUOmf3BQK(_{gPfsiO~p@%Cyky4%1|S)8O9?xY?}4 z=)#u344F6lLP)@(;Nzc+AOxChnd1z0f*$n!Di+D2h70;TNBXQRxEJ?TWsO!2G)u;&JVfi z8{07Iq%fpctPZ?h!`eTe_EF#KkbtOeiwqF4fu&85L=tDNRHwkEo(`>!h_#}d6a|L2 zfSLp;1@LQQtjZ<>__ol{qKHP`U%^!(^OVbteu()3$X?BGVE1l$w+d0*W&aY^y%bwH z-~=4Q)^RAPr^zTMx{J&x32Xx5J1^-u9UgNW0&c;Pxh@98LXbF$n^Q4)}0yf##4Y(&{O0j zsKc%T=4Dq#r?6vMA@i)dW_w{1`ZE=ogiYk4=?HPr<_bKDr>(>LQ!sk8(rytu@qN=9{K_&coGQK!- z9mx#Zs#i%97S+!(HWEcgeHwL=4^IKjK--|Y(l3OOp%uWV+B!v#!ufhGG=IG&|KEOYHGCUvVYLVCokS$aN>$9mzOOz^jH*ApWoFZMp z7|dri-NKT~^T1#&NoPscI7Tn>zwwlf>Z(ff>t5s+K>*>_XP-m>NRS+^k?XXY;>?X6 z5DO-A*6&39P&1nA4<4^oFBf!+)f0nXmNp`{N0j(5r?@cjlg)RD0mrX#2xNmI47cp9 zSc7xOIpudjFtIs=P;}lJoFiNED=f7Ah@o!y`ZC@J7tSAt`gZ)d`YGV4sIi~E-u4y~ zPIf{fN9GoAtW2YTyo4#2ayuT|Gs(XsXcs)f^uGnV_wM757o7wY@OiT!M!4%ynLS%9i*zAI&>@GA5U6Yv- zCLGbfVAd0r2Zx%>eE{BWEyS8pV2MOSsRBxBQC8J%1O`l9FV3&kYt7C(lef>~?R=b1 z!TtSo6g3?9~!ivR|5OAXYrSQdXGQ2K5+y63h z(Xj7irBst^F{&_~(eIltr9Yo*DSa}sv>&>9J{i2%Rk5y^hwsIwtFL^a{7!eC;`R{+ z)B+AtTu7{!E_o&HV2TiEE`DK}06n!f3an6-OuI*W&a|pRl0~rTM_B^u5fPhUw9Iaw z*sCwP_~3}^N88ho(rP&ZpIs;(?HvkX&h&1HPJsJ>>$}93Go^!L71C308&VStfC2~7 z@)F3g^qk0jH5)l;+mXu*WaAX0-^XyUz+ktYlL}-;po?IGGH~@r^W6)xbX55ERusPd zh7;|)Nmvf_LI!q$hpeWn)DA~(bf+%P@79b3dtD7I#7`%7SJ4d8;C4;_4tzvT7`p=6 zoPni-D|cczc}z3sArS9yvFhPZ_wRi1^U~tpid+a?{;R2m4GK_@@QLA6x4Y~$r#pMU zd;jH)l|^6u`%7NE3MWf^l%VQ+{iRCTFY>ZqNb;MNdf6}YvR{U>m{D!4I?Y6zx_yHn zKY4DUpqa&{%H$vFGOOKmqTL5ww3O^Zsm4j1Z1=);@zJv!`LAu8f|6Q%YbXT0CBd$;esfTf52aTdPWNX3 zUh%hUTk5K>I_n=1>qp+Y22Pg+>MnWcJu|DLu19&@n}P?_S3qKY*= zU|}N0!r}b>{nq05^Wwg{qvcbNJFa(J-`=^85GR=1z9E=^b4#_}z2uwq zOcH&$pfspR^z;f(P-_9FUMTE3UC@DzF8}r9*y1~G-aSy?=L*W*1W9meC-b&0!g-7k z0p#IF0UXPdQS4>5FK~C~cKPI0R*%2s@MneF_3H`GgJWkE?M4pAaMmE&`?|B`$Nw%PsDIhIym z_kVIr;OG9!n_$a1ia};|i!JMeGy@s-)=X+`IS}gw_logG=KaMyPR=YOIB%Sr)IxD6 zM`*agPnZMtIIqo2x$0yi){SoAZ>syUG#C=$N$dub8gegri!C;IVbeELT(g`WpG^uQ z?8Xn(CU3C~#_UtU00Dws(~~oWh(uwwCqsuqS)hSeN%MH}W)rI=={N^t@<_>$WQPeA zSR{E2MGOai4%D&QB~mO?z6)>?bXhKW3`M*T{O-SfD3>&Z;j|Vfn2H&cbyw9v1%}BC z>0N=5(W4c{lPCuj7+FVKVQd%ttpI9LwiVijig5)c(P1U}0j-(2J9niAUvXYh# zgHKpdQU>hoh!UHI+58sY1(0I@AGlrXKAooK8iX00+*373$;aIQCupmCJI zw*zB{N*YEiNQf!36XIp~Gn3rrE^aH9;}(FonHz2Dfy$5O8Zv8c486%1EB} zHG?&Ir-yX|4k(-tkK`T-Up(jr#!&R{PAZPXxNcZev_JUQKuGEi`$ov%S3#V{hOifR zP|9Lwol-XCPSBCTs1^3ii%=W8A{ys!&{rHC!LboommX5?-=$Ycc>M^mcw`+TJ@8LT zrnpQDEDyw?^-SUjo91A)G5WvuHy^G2=c7M^-%p=?^Lz%=5z$g`{VbY^5mWIe8u@Wz zmJ$-!CcbG`!L%-g6|LNHjS+a0!%mu)i6nWRZ)Kt4UZp}hXQ6LVptDAh66OG%vv&>Q zFUy{yY%~JfVZz(ku>LxcfQg)%ft_U!=}`!ZQV+Q6QUrX8BR<1Dj(k)^R6;)Z1F$5i zQ0yEf02#;yL)ZI{B!m6eJzkAFu|q0ljYFW5AS%JcQOaVQI)^Mj@X(SZ_E=&{>{*)3 zL89*x6=x;PQDNKNj%tw7U`GRq`RO%~C1y!6GykG%r0hJ&WrenJqIGmUI?sJNN>%dR zP03yVmGpy?-<41IN}zXc#Fz)AgHXkaIVjEL?9+Cw1U&SWFaV=d4AIrlFrP}3 zx!KT5>^baCC*ulFHgfQ*wBKbTJFFn_!(?i!e0Y9{>kg;q zD@e{@Ge5>qfYUk~&xGe@gbkDtSRbGgyD+^!+nxyvxEYv;8DVU#Z>&Gs7L#xu7(Vm@ z9)^Qk7&BoQ5~z=1;{y$w16(D9ONE0)kPf8Q{RuZUU#lyXuoAn!3DkV@YkHs$M=~d) zqtU4>U14X@=7TARj@T(}|IDM=*mcK0`0p{C^d~$Qdj1C9JUO)OCj?P5VkGBlttG4= z99DAH6O)#D!6Bup-KH#qOf&O5OOp1s47o+*TEo{dirkrOqu$E>~i zi1k-)U(OU;?$)!79xq9iAd>m>-2lcgPW* z^X>hg-%kI}5;qlua5)>$6SCl{tM*K1&ba7F<|_M7bCGXbb^kwGTH~6G`GypkF&;;x z=uL?g5r2v;GF+Lt5m6J7nV=vlDw!CfVb$kZ6F`D6dM7gLcM1_KEVqt+Sy?K~wyqJ* zR56(+&oI1>rKyw2hPJQDd{GIC&a*ysQz?#XV_I0Zz?N=NED(&mKazwaWVf#7XZH(< zXg$!RKuTD5?7LnnWBri(qd|jkp3(f zZF_6XImg^xG|%;~bPCLsf)e=oUs*rNR#@gtpcy#>L!^x$7*^_?aYVh=42 zFntYtIy1sV+cU*a=A<*Vyk!|@zuDzHg^Cx#2v-1Uww3siowzQc*z|1=%T1^<8HeAq zuJm|8K%#7fLFyy26bXc=A=lmPL}BFBJg!dbz}}OK6XYrY`c*|kkC~M$5)pd+Iw5R( zSO$Q$K+!0q{18odr#xF=bRqbyLV2VAYIKT2jglJxNxksIqo?ZhMX(ssZDG@!|Kj-P zWWXPG08-L==?xnawwb+Owi`K6+}z8oIk-Ufu!%rTVovzw&G=+^h6KF)4g7vYmTxJB z8dy6FBvIJJ6B`j(l(Rf5oB)~F0La^$0?GZYTH+KAk3Q-T^ov8pe zQnQ7krZn41n+3-GZ-Z?W(hO{}50bW&)KbGJ{kStgZrSrEBW$Y6c-5Rl=kj*>a5QP6 zlGG5pMQp7Uq}wRii_L)|uUZpaRvLMNd6(Y#V*kIEPnHjR->!~U77=@wG3LoA{QE6;ng&a zj_4&eZQY1fLMOaJwF@ktcfgBxpwCJf@+Nj(6{(sKpWLJu>un>A)7qQi!CREDeup_D zQBkX_F(7wibo!QLn94Ll_DL)^&cjLyEFs%5%7{BSh}=(oNHBKk4_=QZ({oM4hhtKj zN$};;&nkqWZR|%80vAvG6(vVPm|pJ6TN$D%>5EGuLM)pM+_fZBNT=FDL~|U0;r4|D zXv55jO+tgn%Z!5R<&OA@J|()^B_Rpk5eg}SBT{ZISP5;wOZTXdWuz_u3ru}bQ3b`c zD7A_l(&A(tsB4wTL1`|g>DIE$$3`5?29cMN=7eYK^22pzyoib+QbJd$pcD+NB9_os zmzfpS<|}8#|3F5-J^qLJ^zjjYY69||RtZzPOnv&UGWBtuSd>IxwCF?_naL}?)X>`z z4hQqBNDdYc?n$ah%L1!_^NJ2`byWf=__$a}FG(zz-c$Ys-I9ZW!C^1oW&8d9P#Az zXZBhs7)!u)menR*%$$7}4iG9d1HcjuY%D$xskEgh9 zSsZM*`kF^3?hfll62hy4IB~c7>+BD7<1ubY-WaF zhoVLioCSuLL3Px8ODnsI*Xvr@%;-^_=TMRbR;{p)5#aBVLY=4U5UZf#klmhDv@ZuX zz;CB;7PFXNLndiBu@rPRVz62>_*DbzK;_mFu?z|>aB}1+--nt1+d=tPBwI@EG_mPI zt~CxN6H8BNXx-74gLN3NOie?~2{!8$*r_cK^s*zo-ll)G!6fo2%^``zWDsfP<=R@| zT0*7JZUs*w_S!fkT+(Kn zK*w1YHa5^G~t{7$5r z_=oS(haobA*ZgK@=VSz0MnW&-EAt9A8+JS+8jj6MDJ}t26P56( z0~4n7_6ZAzETQ&cVlv>F8yR~~@OuX(BC)N!uB;FR36;qLe;=O?7qcq=AK&y}?5rVE zJ4&YnPZze*9A(w_7WUSCa{`xIll$VVs}a$C8bOQ-PQ>pGA$p|lkl3wQHi%H6xKrPY z`&cUMGnZE4qKS>vL9{jKt7w^fYUYL)@O7{zxGd0)g=FnJw`JmoOmE!uNn9Z%I(~{< zF>z@ItR)ywKkeP5lHa?z+FMy!xzpRbiT3R2=R13+IDabI{^p$<6~hV%q{bH$x(TqI zC7LS}m~HvElT9LCA@sfwGOfdPeHgZ}iqfK5BQEMI^%93b)UO4_)dSGVHFpr0A##IB zNvjaji#X<)q?;ULQ*HdZxpL!X7thGS(A$Ko>esjgV~rd&wmt!VIa3Sb6bxedjG)xME#q=B$~FFq$TV(}Oq5au}Yy?lMFhrKw4qmQD+7v3qpT z>3z&%{-~L(F9^=MsaLi0mNO)Zf;ECjIx(@e;GN#`molV4xtN0&YXx+J6V{=6q`a9~ zD;6!cSZ@gwWMdkm*l*%hZL^M`_N@{^k@(BL*X1ysU()*|XeXszv-g=8O6~(mh18@6 zx{{Sunb8_&$;G0$69~y~8kg5s`%C&HITxc)Z0f3d@9K`sd;qEMQFUi~rQ2+xY@4Y9^r>E)ARAK=a8aubxbIn2 z;BITekO(rC6=)tCVYZUI^Ud)Pq%}kE5|In(hQuMi4LeJc(un^(ZXkl}Q5DCMA~%Kz zgU3X8pf;g}n4r5ufXLaT6m$mseTNt#_OjIzBn4wREJv;Vs+t3J!sQd6&_seP>8->G z=_6eYair(ykS22HQ$iz*@DdZe$~ck|C*!$Lo^LLWN#gq%`m06I4c|X?r~N6*;sCn{qWu36g$J%PS1);)~3zL_+U7luD>51 zU?7M4GJFeRYdrSo742x-PJ$nYIPs=@*qEA0jv*mhgH6uxSvRm})-~zI9bC>P*Q^=n zJGqCt@NeJg6Uv(BuFoI7EGZhwD&0v_(~BWha{J(ksd?ooBAmJSTk z;pw}@{@U~Ja7P)g*4ujie8=zZ)+^iGy^A(xlt#lrPgrB5qmu6kDW;|-*rB5`E@i3g zt;jSOEBA5ONsc?gyf%g;xrzwg%C@xaWU^9>O(G=IB&hF<%IFV?)jV+6zV+x2uq~c> z`{sCXlz$5Aj_h?%_v-2JwCp%#;XlP%)%aKHC9bYq;TL9=f4139mIH#H5m;>cgLAPG z8I5XP7d1<;w2G`!wJ$lCaE?y8T89?S(@7Zu&8UzA-15MI7Sv)@86XLl#Ag+{m2|IG8p7|^!H&b z;T&QL)@B1Ls1nEn8MOIgbyctELuM{sFA!8G!;iVv1&ejGDf7dlDLGI!NF;cLSwn0O z{*rO0b*=F7gZwUDsUW<`I-cQ>wJx?q_L*yturqG_kbe3c5=^f`m}U4dklHU_vKKB4 z*l0{UW_K_#&;V6}O@-ga6(3@YO=a#W`tCKxJmQ_i#aVZQO)e~S=(4-JtNOxj9F^0yD@Zwu8uXC|g z=e3-%%GX;D|AbxQkU{Sww6I`oIRuktm$+%Xpm}7Y(By3AWDL}6+)ZZ+6iGX@JBL~b z%w`}hCr6tI9KjDl#$Aa{R(DWnA^U_>`tbuL9!ep&V&az+T8b@<)2xR1eJYgw)63iC z5RtWXpBVH0D7r}&V~aWQ*Ybr4I+}iiJ9;lB!{9lU^Ttp) zrsY8gS^^lnaYoD*Ffdne)$lpi*|ZX^L9qk0L7y8J3}19EAM=Y3SNCr9mU_4F1J~d7 zARu>_kd}M<_Q$48$8f9a}!Z*^0%&=MnX+{mFJd%0+FEBF!vp13BT^OXTV>}5RVI&_*Uf7?0Ad^XNUbOA)P)v|o>qrh#^OpOk z&vy2|d-T`Tf>D4N&@@aBa1F9}{@Iq&A-ZbNT2M;%F7Zic?>z`Adnwwi1rx-{$>F1x&lX44^3_&zU0*Xql#Y-5 zI))%o&@qtbgnH(?2zEPKaI-%Hn47vSctk@jEs!>cMS)!3oPJNR;S2(Po@Y+DTZF|XPSW6Mx#!A1c!e~Zfr*YxMNmeNAY@pE0 zbw_BU8htjo0!HhuoS~-OxJ(8f3uFyM5J3)5#x$V2$bi9g7z8O;Rh(J14bY#E^&tTS z%Ssj=YE(2SF`7OZzN_Q|6Jdsq$6x7=XOtW?AYvNuUy{dK<)h#r>akuIUUI3+YHs!@ z&Qcqj1|gEU4P$_aglNJEeQ&Ez^j-IRTm}xtr5*9l(i?whgU2p;nF=9w(;E%6)dxQ7 z5)f^xE75ZaHm>)O!T_6|ZBT%PLTOT@vmROxp~QxOE7JrAe?@}$?+#1?#3nMcY6Bk+ z12%L_c_-LJb-rLfJ8*GmO;l#o1ty~7u@W>)Y@$doiBpGfA9P^i(3+SSn6|o($)Yw= zwoj%Agtq#S4Qaa~ot^d2?xxrbTHDl?JR~?I(;+cQ9y{FN@DsY=9HX*n57MQ9fDT=RDn$e=11G5B96Qc-eCMFVhh&aQ9i&`5Whz35j!Jzh) z09L|iLjvF0>IZ5Bqn6hN+qu~WKA{k?3dP!B2i!unRt!UlHdw&(iP`9liO!ApIXD(z zG)d)9W?(=%lOYLhSQD>jbBe9Ae!X#gnbCHjQk_S{BNUmJL&PamYQZdgpMhVx{DBW0 zCy@{AByvHmv>*{pi?+1^X(Fy^)fRNqA`Y!;Hf0-rkmtDSO7KlzD^X)HhhCawz%_&2 zWOxd-1B#iQm5zoLWvgMQI=vl&YIXbWI8^DhVaG;n-nCU|LZi4Y#TLF@WYdb5Lu(SH zs9VLwS2b<~_$n*G#$PG7bP?wLt8z+Lx3Hl|20f#{#&k08U%0`-e?!YKO zY+~e)yml2MEVfF4!b;0uC3q!oiCXgL@GCq_p*In%z^LN5?ZL5bfZKC|U9y%(S_e&d z(1BNg*hH$VUBxIpV-=2Zh1_xUKP9*&UMXd&+)|}Zs#YD5w$MZ}0qMQ0;u#L#8Rgs& zmSE?vh?@U)m=%r&h)tx*+Et7Yn9Ni;J|xWvm*8V>h>rd2z{a69ktym{ad{HM(3$yP zmtTlUPq0bes?>)<9ayDso0uga9Yz(qcofsUj|pD>ib(lyhgRWQfYn5&tX;*W5iqq- zx)KxI%1^|xeAj_%qpc>+ZP2Q?2j5H<_Y%A^G0dfKRmlh9o)_)FylAP3cO6m{>tJz) zp)&DBiAJj{w(%t~jZYm|CXkyLHX&58!?@Gq1@4Hj=R^uH0Hp}=^4}d;1&B?Y%GyRqCQmFiT$(yY#sO!>olSmNh6W@y z4kxnfHhPCC8C#inqv?1&hB2;rVmN;Imbz3zpTbup5P8F0lLR*A^ugKyOTK_fQvy<# zJxNP^B4&4R{fd*xn&hx9Uft)*C@*m{?1jcGsPc348M=dov1Pb2FTO?E zpasbt#x}JUmZpSFUUB=70NDsPxUH&%@ExK=NR&C1z!1GcwX+=JjeWQ_nUByHBsYE| z3oW63L@Ra%XUq;I?Nz=Xp_F4_3XAUc`D`KbD)p6lpB)`~dUM3S6vPxrBt%4`ppHim zXPab9(3!$zZ9+y42Yw*Hl5RM9Tlq%xMY3Jv#0L%5z&7(?hzuh5cXapBl+P<@5Lzt z)_dn;i2mSEK4TcTs1|nC3bFz5T^pa`FFmc*NuPjaj%zO!J~2NGoL=T0mm zvhNS$b#p99GYwpkc-SNUP2#0ocqyn`PGTY-jR4Iv8hPLp3fg&UIz0+mLPwcKa)4@$ z} zgwHID0^M04c+c0g9K11Eo?fB0?s*4a4(UnwJiDN0Ix@m*X$^E@i})z9&nCQ;b(}O} zt4zkYg^{Yq9kAQM)8Z5;UgM)req7y=v11liwm4vMJU;3zpWer@3N^XD{_O#ymf?jR zAQAJMA=a^zqtI%-&rCk6XCj1AxI#{3R%v)JJ~41Umie7s4OQ^YOK=|E&~#HA1furF~f)o86IkMK9Lq(buk@JkWE@8@J=r% z23VNr9W|kn3J8hX1yJl1owQuwec?gHV)PAxBYoqDfU|3+-f| z*ytOem7q+IdSm5hkVe&BSAiHU*-^@(8QV&bEQ$Y3HLgYKwABG}l{&3mMe$UTcR>Shl#DWPBl#;Wa&NwKiY-&rp1r+X(W zZDt$F9pz$}b4Q`L7wm=F_#_+kU9@<_)k0_YbU4i}_u_PfOWC?7vHkt?@iwfu)1x_> zoTFgaI-^POk1_~sZBm#Ie$Fh~7nignGK(dO?A|7Jhv5A_iLYD;D%YR;x=AimK0%74 zY0V-rd4(6?d~|@_a!uwolq`UpG2+(24bP(^%O&+|;4DZ8sgT!R20qN5U#7y9RD938 z8Xf@F3CRmJK*bM)h4l#)W+x~s(|{D-6VOC;Y9}Bo(*P9SDsWX_ zc%+n!;?>X@@$k(jnLb+Jpav0ePIP zx7MoPx7P6O)$n{!{Yw1teQSovtU%5`P`R~1@#B@gF#S`p{sR+5FmTLc&x)I?H2&`+~aH59*&#Tr#9yTankHs&*V<4!gEl)D&wy}bOuo1p{AEc3OnoL=mI{WZOBfqTJr z*97K?%QF;dVX(N}$Zhc<>B%^38%v4@;wSzvQHHXRkBCV!HmQ{0rFTggJzYG&viSw% z*TKgyOdQR{g^CakNU-Ujijbtr3H__cV^Tf-tlQJMd_>Tcjdl-i|B>(Jh--Fydi+6d zKRG;v{~OyrxC0^XdVbIiACs8a1hrv&@}bh~&}izmQH2-zhSht6w4iRd*30A;V3G@ z`6@MZyIVIJrDvb@Tsauv8)9w|o{SH94aQ_^cr<(ug7tS-_LpBiM1q_}nspyvecW36 zCcKq>diTRFJSP&UjmX;nO=aD?ZkXw3)tgH5CW62r|7EjyhcHrlm zPe270%+Wr$Nk;yI*MHQkz9$GaU4JN#r>sLj2%% zHixc)x&N}q{=Cv2hnHyU*f6bNpKH$c!lPhX}Wv{HZ}D}lDM_{f5o(Y$ZAxJWfb zDGs%KpsY4RYOW75vcnU^BDJ%_d#<>w#TZa7UFuH``iRny1q`-1LX9qjU~PcFHgwuG zKMg2k9Xep}D>K+%$gvdRVcZ_{jY#gSj!yk5GtB#Ll@ zc6Bt>wsj(;4HSyBx6*^6#ed;Gcl2@JoLyXzR#eOq54POU@oy3o*jX;v+0X;!d>XhN zvs&ciUUw307?H6W7?%yf8Tm=eF-UPvG)ovMA_P_N4_B#5pw=F)))Gv4Moh;t9WQCB zGigAEUZR=eLeYsH@D(MMs-RTby|GrT-%%a^bpOs5KQG}f3~FY)$p3BET_Y|C0wPMH z;Z(PL?KPy_-y;F*jg?$iArTs~r!pc+w39qyXR(i*)k~GK(1B^$FJ5+({W356Whjd^ zHbVDg=7J+6UXhv$i_+!GpJmco#jFJ?eg5+jDD`jIJE7derK`{g>D!!m&8cheiKIwd zCWW0gQ0xivpC>%EyN@bu-CWT)Fjd$qg4va$5`mY2{pQmvh~!3x}Y` zJms1o$i&1HL`(_?Z+eU6g>W)8CQGsxr^EM%Ou!vL-w%#2hA~F9|MXO@uIV{Hpa|fa zr-5v5*i2z(1p}*rn|KPSW@Sn4*R9A~C|Hs?&P{w9<{?#nln>4oZ~4P=>=hGJK@{D4 zRvZaFCHrrFkO6s{N(w^~dg|lu`&-~AwbhIl3%?OPr8xRv$|V7U3n9Q9jtOpradH2T zh)wQ&1qUnsy^W04AcIpCQe(p{ikFBb$Q^CZTkQ6G{Kp%_@Ixu;w)dI5WwltLZ<7J* zI^VGREaj9IAeW@0 z?2ry=abK+P21N{DDIK}IS|PxrN*x|gha9^RE0m^tvsgE$J@RHmo|2k!Pr;@PmTleh zv_wX0k#yN#!wdw|b&0c3qST6UtwyVx9UQ+68_kCzBsXe1?PMMGAd;XRlQ+sP zk{dQuQlD=4uE{m*Je4I{H5kBAf6)kzPof%si3k(ZMr&b4XmQ9|IrkcG$}Kk_C;rq2 zn|l6dXD&8sW_#99`7Nn@VfADs2aFkd4!3@~5gzX|6I37ywsDmdN*rTZT}$$s0R-_i zwQTklz$7v*dudBYY>FgpO@@pfAD$lOuVZc)As+ry`i{~a`c2*U2tIa;9)JEC!@y{W zUm4}-ON3B0ZzD6Ri97C@Y!Puh*myBu96*6LZUv=$VS%i4A;^H0; z;6&BLtrJA?`@XY!D&=Ox@Xq(5???qBZUS7Dmr~DZ3yERB_z$-4mLK?gntiyYQC~_C z(nb&yi?B)OFh)pd9~%7aBLY?r&qH5{;tL=FDbTWb5WKRmiK`ReTMCy`vfY0)OoV`U3Ej7#;Yl!^y+O@JzOO-NJ_no0|Gw|zIGQacRXj`}(< z+A%29PQ4FTNc{}dT|rbZcU97XIEI_f6qV{>gml#33{gc;-DU{dDD*MaQF|-I5H)K1 zDD0^HBx=VB_KEIv7@W0A!C_!@G5yL#*Sc4f_lS2^+N>smN)-bqpj_TU*iGo8X#;pO z9;pQD=$5GZ_((fTPg-4?P+Fx@P_5T#Py>~ApkC9`#!VZ4G6QQ7He5lmEBAH=Bt3Of zh18ZmJB1QXr8FUQok)SWmHp}}-qO|D;gyCUr`Xmiw7^a`9XnyB1v_EY6VImTDJVO^ z(j+K^LrWwZj&q=vl&;|ix|dK9u#_Yq&c|TDx4T}gCEy>A@pK{{i*>-6O;3X9q9(s5 z)R~D=QnmxHH2dw0flLJQ;w^B)@uE%~L#Y}R@aqw0cf_-bbzqh&d|d4?lR9eWqI3;5 zIP0)Gprxf+poHT}?KlBSDAfWbp7H4f6N|OL$xi`w!pe)bz{7MKu9cY~8F|rGc*!B3 zPV};Lo-NSg>77ncu~-Y7c%-NkPAt{}Cp&f22`Veu0xcdp>I4;wwZMrd%{t-4Vl8kW ze0sjA6HF-80wtUw>Vy(X)u7bF7^4>;9(sa5dr{PXZ~U4rCSB}>2>}B$7~r@PRsEj- z@PkdI7exI|?s?)`4Wvt4FH=e8pLt{S#**w6Omo{k%3ddjiM*YPQJOkw7PLLCr^Oz- z(<4e)6&U!$dlTE_5??QHP8!5ZES+(_3a1p#$8>z^q9?+#YShriJ8c~A(ONj0p)aEs zMG-3s>C0FsLoRVXCcc<(&I+KArY1awA{BfaeV_!_tln*5TScjAZ`!Ku2+=Fmw0~{Y zB26n*BPrUd>$;!-LI=O3pOH929a|+u=9Uz zql*cG*qL?Y4RROZBF?g@-qGmY@N|W8L|p9HLv9O}b*lZX>z7Ob)41kDFw)n`4{D&G zcp{x$+tdU@X>EI$r7}RcqsWcDPi>d%gRHtTNC=USDsUFg6_l$GFRwC-bDOSo)U94@ z`}UG^lr2goSA~(lxf@#9t|avq%Y|sFWv`4^u#us8reOAts-;sl^9XJa57ZGl3vSB!A2VhuYwlO9uRO2UK~DP>8G z^tlQcb8ZHhuwmkCg>~k_i z15^~0&dXUlWSeDl{;O1e46S|5K~%#_O4nSBqLG~Ci{I-ORb+jxkrqzJ>pU*?{0xMe zrXh6PD3%i&I!FRNKw#HC&t}&3lFJX0`n-}lHcA;#0^|*$oze8!_%taA_P3VYG&P$P z4}hCk2ym~`(nzfqw&!$XCdUm&1@NK?FJV3Jm3G`D#aS$GuX)q633e%z5f%GlMo`%9 z0;@nAafL(_b9y4DUlh57>!Q_liVFNp@D5W*qQ$R(UNK^2n=sI_(LD~2oD`a*&3GK8 zNeX)PfW8!N_CCsb(!VfkHs;K7T5T9}sqTkD%_l3D_tY#ix^d)QD*U0vs46m4_>fPA z`ehBQd;)HC_)@lx$cwWkJr7w}f#k&v99uoVn4Cu4l-N3CBqcipaRvR8LKSgI_-f*l zE5lGzM~XEXM7*>a|23>64znBAB5;UJwM1+!)-KJ8;#l?kG6VagsM}5dX8DHk*({Qd zS&qXw(%fK0ksT_1`h4%{^WX;Y^@gr+B=>J>T#d%S!LLN%zFzV;lzhEB*`X5H=znTv zB~41X|RxfrcXjVBwQSuhN+Cmc*cZE`^;#HAc z#0$)LEGraAecU*7y8FXm`S16Z|FH5>VsvpL2BeZY7R;*Mb2Kp(^W(layp|Vmh zQ7Tdtn8Pf?P(c2llv<&J>h}gWElnD`|M5!h36W*dryXEh+7+;9(>r+`wOtp$p^GKTlPw4j1KLn^ft%1 zj_^Ym`4weX7)B*P>~P&_WQ>C0501FGfQhLbDNJ?$;*4oq4IWY(jK{~AEAiiuFM9+B zE$%uQ9)34Ct2J__!FLt-I2w&p4Oq2vi`8#in4=BzqTt9c){n=!4>yN8tuq7*8P%X$ z7stcx;d$yC+Iz|tutI%wbcC@0Lfq-?A?Wl}vLJyCH+mRN$lbK_Uz_Xun~&E1^UMS&8-!QtT|`-Rjc_%Fr_IpeDHGd&AoNBo6n)~rlSiGTX}#rgBs zkC`ohnjGAFar*Xj{3Gs;U<0grr*k2W@QY|iqV2fuD()RhY_&^22~e68*^eaq*imZCJ?_F(_RDfC1%2y zt?1URB7j-^v%zfv)_4|$P}g_=MpRRRJv3yGEDQTzjRdnHX8<*F2r z`ZK%zml3wAFK}M()4J|`tMt3Gmlvm4nBc-~^4vP6C||v2J0zvZhxQ2+Pt_UDF=(68 z;oW69vh2byiq&$aC7dm#mj)+J7pfCVv3CX9)NDS4*+G=p(PhFhB zB$6H8AU;Btw)$!4c?}AMsrjBVOyM^DG}Qb~wStMQ?yGvyAjX-nB&ke+F{}Wp0a-`n z@b=fen|r4>Q>+uE6(&7e1u70Q+N>^4D$}8Qh6_|uUYf+*>HRyFVLe%d-CXTuZKz<9 z7W`Gfly@tN76RO3V|XRFLS?ve(vKW@e(Y!5SN##N+Uw zVJU#Am9c=-h10>2OyM!ILoBn&#liU^k{@URc60|5AzC^Zo}J?|+TM>K%*hz$-tp+| z5E;-823VdS_FjGH4SKIGj^GsP(VIV>4ks%h$jXhIn-Y~IsnI6qz4JFi*o!A8+-v?Y zzUWN`r&z|~0zGO}bTN+f>Fx6rb9A|Y}4oT%M9zQF! z7Iv2~6$Ht6GJHKiDlA9*bd(1@rNhC^ajCLo1l+ zZ0*)s-4ZYk8a2aci#V9~(mk>eaM!% zn~lR`-Y`1s`c6BRf^d|CYaxaach%{PUFs+(>T6jG7ff&qV=}%t+pzWWV@ZIk%Wew; zAHp=%MLklhq|14nTMCQpl#fai$v5!7Vj1Ct_$naG(lm#-UZP@fYS*YxQLueFIWR;j zh$OSCm0Ny5ZHEJTk3Trq=IoKO%KEi4Huhrwm3P>*eSC$F;&6oMC>F1M6v9Jy9*6;+Tl_+PJgB6Up zc2*gc8?SKt=kY%HHrZ!l12g>lY7k0V2|7QWFznEco(X~j`F~ar$bR<7hrV}6l}hmB zgoF=Av&Y`%EU#K%n>b0Fu8@u3+lb=mVkAn`9>kKfYSgimsy0#gDx$blA)~kHdfeOJ zbq=$XTj-`4@^2}okR$>#(?3-=yVzIcaY4~IOA1g$3X708qt{sa)SHH^c`a}uEc5Gy zb&9a^WLjdjdJW}e;jEgeaAvY`voV#lx@AX4NX#_Eyup-~AfGHCeA%?1wm>?oXn2BJ z7wLO)-U0`-l5#XHu5Uy{2C4zLGqf;BH#u{&ZQ)f??p1p^Svm!n5`5q_6OE2^=h!IJ zw3E1i%|WAhXeTLcg-wbO+>jC~>8&l7{8*n|+0_IjIF^O!7$1mt%|^N7h-NctGOKq= zOFk!Uz;_v?3sa1YDXH_7n}S;7A(Fl$sgWjrZyO#-eH|PTIX2T;O{IbjW!1DXgW*oQ z+=LN7KPZ8eL~cnWR+3K>uh8YJ1GLZeFM5cBKAbp9nxjD@O>3J77Gw?UCMr5D?e>-3 zp<`N4Gs+8Zj}iDQg*?Jp`K1sOB?p9i3G3o2-Zg!)hHq;5%DkSc1J_TQdg~P?@C`GF zf@%y!G$+ym3mJ(x9A~I&%cK;kV+u}FLLs-A9Isc+3Y9?0*rk9Yb{Z>)^UPM`JIw`~%IL2gLu4RN~#ipGH zT~k7eiB1bm=Bo+tZ1`hjSvXpjPH%OFZ3TVdHtXQ@bpo0LHuILr`2q^ncBwL5KFM!Uh15oRNh^q-+Yd??opGuH^h z_BfG*6+uDCOq)=c;%N@=gd!Jv)G@tS7bpsuvZ+l~UY0S3fnaRw6=FEv3WPSK<3t@w zIOp4WpRb!L%+C0V-L8!>mQG^gfF(AgBy*YzjjC~Z2`+wiYBgK7vWyC^8leb65bs~_$@<#U?WfP5?c)lm^{q!6AXT^vDty~of3*Gl z89u@GOZ1tjhHN|k&=5dONA>;xz8GF`SrT~I?R2N=5zVHPH6NXoWzkzunyb zetnBQ!i4g>l`mGlWLWqEpS~4Pf+pb6`?|M%cKprg{qXS7WHR{RR;{W&D2(q0@5TJS zjbwdbS6C|6z)9a23Us`PXnRvoHAsj^6Xk@lP`dSq;34+OZ4dy=G4BS$zdydweD&Hg z!VH|}jlzI!jeB>6`XZ4^e+vf*Yz`t2jXn<<31wUqPz0!WR=E=YDZ){vuR%xafH2XN z>{Ce%oi5qIOJ7a|4;GdV_mZ$^?*arXxCovezLZiQKgL>L%~cDf7_U+xJO+hileq%s zE;L=Ja&c-TLAv03yukj(ta{!huLr^`wP4StakWlB{`tf-^V36ez*TEQYBLW?TInSx zL|u)REJjSq^|yvF`g&{DmN_l2vx6XKRT7+y8yt8u8WacAC8%1LJ#TRfd#G&<`s~~o zL@C!Wo}!7DqooR%JGE-sdz+kj#e7c&DVQN0^D?`buyA!>Pz9zgGUot}CF>Ma7FN9> zaVpVbQhT&A3->z7n5@E9&>MpqUcAfXtp)(nhb!69%Zx|B1 z7^K3d{{6Et?z^uMPz?P119kpC1Nn zNAph3u;H9^rh^mWxwKiX>4oaFAwjIxDF@1q-i6`2(fDHe#PmJ}L_yNRWYZYUW<44j zGPKOj+4g`Y1E&_WecT!A=P*qI7soSVP*gEnD6JDiZJV(|i#KlWOg`{N4BS-6fpv&z z-W)l^(}-Oj%yZZZrwE!EUmU%GA3+z%69405Limq@Lh6WV@8$|F#W-K0%OR)Y%FUIV zX5-1MY|YZ#ZBdZk8jWH)&1kh?479IQGBX;N$A&7`uo_Kc}mHVTfc z?m6lMHtbjId9!!6@8rm1+3^KMNY?_QC6ygw=K>h|l~|9V8cjxf&{0YOW7`3%dUfri{H(uCp$}cW?H3n@RvqEx3vZS4(*Jbn69jc>clXPQ^Lx-BO6t z6+uHdE}}2!2*ak9+vaup__=!-|&!>8XIPY&)LB2m=ElnR>}(h&hX8Dj27Nc-`WVZNe~xfZZo<JI&da`DPJ`Lx0p~ zZtb^i(y?U(UP@{<63aQ32}A)o6NE~C07rR!qi-r1$!%cG*~6V1eQi(QT1?IjWK<-_ z^rimRv!aOX)FVRk;07rT5nHs3cCBxb+Q802Z^Dwt0Vi7qS@{{gX+fMe8%AN9gEbAD z`BY)|nJ*07*$Y~;v~_vY`%3+nH%z|f6I%$_4LhM)(A@BeMAVR&R3ThRZdxd_REQE{Pn5-VREPzY`rr4HxEF@scI5RHKHODHv!;k;^tmV@~|VK4A7w24{-_ zvLEZfq{va~nCW?Xyxa|=i$3f-zR0A`PPW=xJ1<*9I2?kNBCh;&6hzINGuH1)6&#g= zQP5;esCQPsW8m3W*>doQAOj#SHJA&GwHw3$?g(kZ;9lUAt`Y}KGPvZAtZEz!;p*wZ z5IJ%sqF__~D5O>g7{N%&KYy*3w=04;RILRmx`k7DBRGZaEI7mc*aD0K*le&K{X0l# zBB-M;KZVkW5=6hkyR~rkNDxYNMxzlfuP2I8TR;7?8hcPd&g4Msz!bWG3T;@KW)i*V zY_gu(xWcKnIKo0JD4WPA1hlP;4eOV5WEHx;XqsJ05DX(ZZBr#xRhSk4dexGj528<_X163Llc57CJ;4ZLmHw zq#8K<^ABko0oFMi%yGmaAkc>O}G_8BI>8adRlk!C7>Zk_y7SS%(zUG{7y z0J&Gw4IRH}c|Jo&L{o>f$hg+h1>W+5xJcTxq2il8wrp%RlFw;w=o7Yb!3SO7dd?O{ zg>!-a77X15tD$82AwUrMh@ADZs&hm>Hq;g*D4AsyfW6fdkycAub6rqbDP%Qe7tuT9 z8W6JT(p!boCe2njoYMgzRr>~y=N$6kEh}G629vj94LtR**$Q;Qr)gjcr5P0#*429k zCA??@R#D4JHe{!AH*VIuxmtfAoJ<<8z-psyn0YEFyFdBr)P3P|m>dPwffD;SKYat7 zq?3kK0j@&fxp*x;*3$g1aQeH3;CvEFp<`77T^gwb+$^-N8d941@~W;uQ-~q47$z6_ zQ?Fk@F(4TB0CbNayhraNH=`~wXr(JO_4bz-gvCS<7ARdt7g2#!{q?3_fVx}v(MB=B z6X_LXN>u2T)#5d$tbXaN{U763%%GCi?qB#&(hSpRxNJ7f1&Mx{!s`cu)3qHkd{P9DJ`=qddostd z9^DFGOw1}&hNXcm4W{+5!a>sMNfY?(hs~}ofjR12ciI~m;yS5iJzxQS(J5+AGlHZN zXF&62J7Mj}WgkYA3aAXfPDs@OApE|x^s`nb`FV$~FaUA@90v>m>917T(1edHIWtCB zMyFq4oTYA*Tv>O_cJqz5GuL)=Xzdh@e+7-*v^y>)+11;WngPzQAkUjBbU`iWGF{s0*DuIr`~M2UYyxvx2{vM1zYq%| zznl$gHjk%?+8j)fm82!JRLO1^Hv}bPp8zSi(g>Jf-KJ--!pk7Cx$UdgsKagAebFL` zJD_gf+BB{pXcRawtj6W91jq2GwrKREZZyrq-bHRMmShQ|fJV0&r$%Na@9Js}z)gPh zeO)bnVfJz*opzkW%CRu}1rvIB7+7`vY9mD?5bNsp;+bkevfO@lnq0=NirF?#?V7F8LkWpsh%{?xcuaZJ+{rbrJX& zH|m;fw&>rD>_W%la*;rUqH@e;vloBPQJ6_6c*pE8)@p}rv)}MA7M`PtP24d_O&BXV z9I3D6qt{{N>13mUmAV$O_`pQ3QuMt2iQ{#pxjN`_c%< z8ZxG8wea2P6l)kS+U9#4@Q9MO7=H#yrO9v>ql@{FZp2hZgmj1HWaETCWDT&zHzOpz z2TvGs5RV^tS=$KVqs;o)J!X(Xc6i06BLv>#v{k|~!BTgtq<$o+K(}^vn}ly5oeRVF zLmZSr3sO1lRdWzBl(kW;dxT>Y4{=8cGyOUZOqF?Dfpta*#t2rTV()}xnnep9p1|L- z#I_3tDatJzgr`}*@C!JH;ES4|>@Kj?mrFMgHkO3}%@o6>B?F&T3uubarO-QuL#XtU zc?VY!|alUw&36nhbm zFE#QRFWy`W(b|YQ9!{W(hmuiP2IvRe(xND>^cYVan*Jcil^9cvn=3|BR74b!M`B}I zTG2GXZr?A5u0`9kF((8nD<_lXLCH^Q10HjYz$!GiWDIeUQP&<325h4eOdiEUskqF& z(d+?7qDMU``$9JAQJ~Cpc8P? zZOGLW`Hi7ULZivxNZRIJb9f{`*&_~bl3UG`MoHdc4am`kbj*Zm#39)W)-r-v$p_nd zPV%YxW;96bT0kPt_Frs1d9oT$u2U1=Jw2G!RfLImEKQ1{B+`=x#GGV! zZ5INc9R6;Rd8BZ5cd>tmnVB;+gd6SU!rZe0)V@`4{Xp;|Ns zyTpUy1k;26vP)SlwLc$~hE(xs<&nS3R%)9Zbi}%a=HleA%%nT^Mcaultqnozg%C$R z7vAo?#KSS|&3=J32FHJwhWr6_+E@E>R&kvWv;L3|8S-DIpW6-2#WaZ0T;XSFaHOg2r5wNRAz+X^Q# zIOuJfdBuAb#H}?!@H-mQr=g!E+52?0Rvk>%C)noTfxNt19%i0OG*sm3VFQF>u@)t> z)L=k`rg{n^la>zkgliWr;$*0m#Fw2Evw;Ma4#*Xn{U92{k=O3u#N#Z)DjndRVUa?4 z<&m`m4HJk;XJ73#7^cv>1Z|U_1~~r>o-)ps%@P7~3Rk7wb2MF(SPMbqa6-t|H8brZ z$}euKx&-#s%U)QYt_8#0^5T?+R250>FuUZB>CTvWn(^h^)t0qTzCj$*5US>iqsb}H z@(`P5CujK;kM(>^sb1U_*Au#zbKYspN$F@Jvm6|tm6gzY&cQIQZyA7>mI2s9T~o(kADdu^>Y-p$ z7Ian~bu{(hfT|_0Sn94O6{bTS#@ZrSh*Tg&BroMPC6qTb^%%R<$qZ0AyFHbxLNyQm z42Fgl-Vi8aaI|Um^Hg_I4rL#-EMr1yfQ=L0|AhQAChzdjM^K2|8Xr#SKsK!~S2LF?HUr z7(h`!s~|2BD3;CTG~ZvNb`;JV7p=LP!JPSBS1o#CZTBeFl307rCO}@rvMzvXIpO5mrcff_eXp5~ zf3_j!r~QjpRiXkeucf^TQ=)v4s~G6KR;Nmnw79dGCZ*nQv=_FjC{)g0{78}QkY&hrHfF>N*yhO#(wk!|+#Pz|>{`f1sm%$q2cTZW(mm-#=eaq#5K`BB}Xg`i@Zw4wPx#}rP5 z9;<=qn^WM2|MjLnZi@|fV$C5+`W2?u8O4ZOTQbr%ify6o`S7BR1;O7(vNwk(Uh)<* z1t@;B&^9)Wenf(!PE0EImMJU5hQBX21jE75|A{ZNQE|Ds7w@^xs`6`0*~vTEimP6& zzHBh)#0$BWbr(Z}OTeU(p2kXFBtVzjO`DopsQ& zIzn=Bn+XV81bol*A8|C^=GMuHd zuB^Guhw?H?PGGhKRZTPum2CQg6wJO5TEx1WwU%Mn<;YYNM*&iaul3DKFeBA~p3LZx zi{l;IV09C8mbL&nHXJ#sv^W2-e&Nc&^=_G=)57E$P>Pj$P}x%$2j3UPPnFh!6`IOnYGun zmKSuE3VRo#^1~64LykejD&-tYf&r&3IS%&bn?e)AvI0_eN%=4h^dx zGH-b8nL3e*Pq@B+dOl+M;_UreM-ts8QdHPI^AIzOiZ-PJl3{*`wwKiPNfl1tu>8yZ zZ>|K3x-2z3pQeD(Mf%Ri-V}BrM9qm2$)C>9Z&0!0(B2`@G_Y9{rsPeB=pa$rpo}Qx z3yIRv5P3GN9J53+yg90QD(x~CWKZ>Lp-=8cYP;b5@Eh^G0DpNHobXIm%8%NW^B=rcM56-^AAmp`ZJ#@jZcJIrJPx(oiwHlw5*HTgb zv$@KD2AsT5BKGOPQwAP$+x8qJ-nXJ@_N6m9ongK669Nk$zU76WDGhSvQB^hO%`t;K z>7CA}osajoHlE2{fgcN0brX3PKJ`TtpEa7$z2wwT%ZTXx%*UZ|)H=VIR=8}A5slA# zshwCp1*LR9>%u+-H_2K^S|HIF4diJx&4APP5F&xU&!kq_=NEI<{j{$8saSi|2D3TT zh5XkqM7COQ^9o`dBg&6Z$2FG4k|fGYx!FcfFy3Sq)skJXqjx_Qk)-y8QD)QLd##z< zc7k=)%k-}9Y?Y>(Vav7glzq_Vtr^vNg2{N*tUK|}=^=O@2sPC64VQ$!UL z%xl{wgTEqwtZ(DZZn6zFOb#zXIU9lR%kKnbCj2sKE$|z5mE8-l*(5q-G;Umw+tMrP zD5Hz%T>v{B+lDBtpSvKF)Z%kvj&nepup&dJQBYxtI32$sw)~WEYG`PFwh#YrMrP1* zD+@O69VFpVF0E6>I`HZ;OW;kCV+BT(S&4$g@8 z&vu|ImFvSu?)fvSlLl*o#Wf#qkd!;_12o!mIuHP3PBjHtN? zWWyYrTz9_NUw^vso!=sTpa?HNZGFGRqcl8okZhO;Tq#~vAvR&87i+W-WaCX9%u{?+ zf7d#LLh}B7ZxxWK>Vyf*V9{E%RNKFcR`u=pxO zsWy72O|Gvw-S#q2#4qs>pE>9G45L)$<%uXRIIS#f3O{g%xbh^=yq4h$mnU!f5fZwV3{m!S5rvw9oE8xtuy{vlUqVdM~G@xc5 zEv60ZIK@U2GR90T1Uu!_`1GAcS%t(ZfwCN+)-Tf0e?LstjR)vDntCBCsF87wouOS(f zDvIG|MV(hj4S55_K^41VCQIHl+7X&9p=(k@s+H!op7o+kWFDC^ z`%XFt?Zx@7xLDcAUqmLmA}_f-q=_?aCkd_GTy5(S7>RaLElH<6R)T6Ju042BP8cV4 z-jp1C`zG0RQJlU;_r!-cOfs=pC0Rl0-emWI&O-bkh0Wa9QcVK;TB#LO%XfxyXSfq= zp{?HmZZ2X&Z)qQvAB21B7N;IX=xVi^nwe{z+OTZP?;f$4 zqeYr;l`WLaP3htafm{F704!wLV>~p{11k+DF7d+@N)IGW*{?$6(2t0bVgMgBVFaki zk4yzZFS1KzUxdK^==(Y*fm_I*VqMYdOy#>;n|@1LK1Phg%aiA%N3G6BtbU;$2>=v} zy2Yl22xQnYIi)51BxToRJlhbn%rxMPwo}iRvIj*oLPB49IQOT&6jc?H2nQ09*}Dy z8(d76>q5N6Y6jT0c-O37W+)Y>yef9q!^>EaPi1I#N;n>-+IDZ9_g zrtUCZm>3PY&a5a>zOhbnd__kwPU1Lxj;Udxvq)Db+nDqiHA7uYt@KS4;GXUy!!4J| z1kuVPdo9YaEQlzc0YEacwKS#&5aSRzZ_id*q8W?77D(_)4Kb*0ylI$#m@lnK2jW}V z70*H7(Cf>Rr$pgsN(1pXhe-90K>iKWc>!N<0P~TI%;cq5VcWE zLPiK53Cp7k&CN?3jH-E&womZrm|mrmef~DQ@~l) zjncN4MXQRG9gIR2IHUc7urTf^wx|%e2cg?$qPF0U1Pw4O-#sr{OC_0%>G`C8@oH_& zJv?;dyr7TWCJlqJZK%AFp2=*+T7rmX{)ksX)uae zij)s7a23kZ?OBN&QKD;MY&*w}=mQ zNol<#H2O#dK5szpP2z@Ryea0jUV^^4d7W0Dg~h}1E%QDjH@;FVe+`Br6k|`nhe(m- z)IN6md3R0ySrE3mxVlKullD;K$Vl6ISON1CPyiE>zRa9n+LfY$fa7qW$=^;N!tnEn;*WUxlf&}4un@Mj`M!CIn3 z)Ws6-D}sEKH!UoG(LcRjAD(Ti$rq$*TdCf&#EPK(S=VifGp64>_&(GZ>f+OvIj3Y}r#)DC87etlwNzL9<>iZ2FZ&=K-4}Xv zQU{w^HhdurYg7QeHjfyhtg=&l759M_aaGCW6~cRrAcP(Y&kg0X+5ALY6#&&JztmC) zNVDTzOX6Q|K;d*PbC+NN#@M@NgIT)ZICLVptR|uCa+1DNErhvFMP&5#94jVm(AE!t zL$n`}DR4-4@q{rf$?09OkN^fG%9sb8b!4uQ+j|4m%Xk7Tjs{Bzs1nZBdn+qC8l4|m zv6jMsHr9+u8)z zQ0D}TzDk!Xy4HqFqu04cj!x%7UFQm>OpBQJx_!2?0z^m0L}-H$lI@YI35SMwi~2K7 z37gS7=r)ujpxkc5Y@uEI)X*G3StV|21tC)!l0zDFtkmtuf2TPjtFVGsZk?e0t@VT5 zry9{i4G|S)ioArlVldq9nS%p1LFvpK%d0a<#%x3KusA`3kmn*|(`^8)D?YBt*m7M> zToIaX3KteXs>B$PDI>nbHb#b$A$RcGI*e8%0v$_c0srHmHjRRoxWkd+}u` z@{9MO^f|@nmE@yt{LqkKJ58NZB(#p_2bo-BaYGN@Jtq<{{|*}4$#f(uC~K$7Y}Df3 zUg8oPl~xtEuMShjMi5l4+=-K{9ZXATiSkppYwq#eRvAfh0k+5W&3GuS_$W03^Z;s~ zWI9X3&$giQ&J>)6irN@aub4kfbFP%C%SusWl)I--^YlMA7Av^Do*}p1qC*y{hWe$# zU8o>$tWs$T5-P}hcelHA6)iVz} zY+HobGLVxF+nV&8Q``o>WdsLC1f9*xELu87C$oij|C=TW(sWef?m7_gayvvYC_Pc1=69K5=}bD%S6L6f z3023k6c`}<73a{e2-{JBv~QS$Eb0h@rR}EG+&aa}u-yEcCd=H^$=T8MXP+Zu+g5+} zHVvl1{u)AeM&lS%OD35c zWkU>&SF=PC)JFA!ErBO{L9m1zvUg>Wf&gCkp%ziDTuUQmF&=-_fn|wDr_fg%gSuCZ zCvU_DSp>{@7FANesJ4yS9pA{lT(NKhPvUq@G}}g(5ZcxMl5rzGqMTAgOds4_T_Gw4 zR#ZzFC19P4g3QJDg7)atnB3wLgiCjGnDHwYlceypJ-G)3%u}0^GM{cx(^DcS&sSaa zQZu7@!oW+MNP0yyA8%eQXhrGw9W@o!E>^dsLyAvSyASQ$vF5OaPcrqc$Ca2(-1(`usQhQMr9 zW0vavjLCxo6?>{>$^8N3n?~DHwx5D>Wt^4YM0iS?FJV9jwzd{n5^oWihE#k1U-*p|VT`^E+UDX;g{~ND`MSMhoh!ZE=8?;8a!y9)(#TYlsl_j%d@Q?a)AIijhpLM7N?g zfwnx}9;2o2m|?U-#N8J(Of*awK8sxDESF_8hYzQ6bZBA1Xo39H1O=1qTPa`4|7&zLCQO9*!wnH3&1%w;G3n zCgipLONHB*u^j{neFqORAb@N-SXm+RZQoiKL57t<^9e?C_<8&ra%>90>zNl#383w; zVIe1{eJ-s28^Jwv^EVe-rw$>2wA;bWhYQ{?Cqkjbp*Kn@3G_J9mIlS^z?vTl(mILU zLK#-jQ)~)5HZQWWS;9-zYaN225j+PtznKau95jkWtQ@832qwJLIN;qp*Wu0NL&=y%6OgBD%m)t3Fv) z9^mnNZN!nGGsb$HAgyoH$ky>PRwAs5b;G7BMl2n3rM>HAY1SL!Bp$GX7u+ zA^9w2A!f1#7FGGG26*&uBPs@F^VTp#*nxAXPArY(Z%SeKJxHnUobcRnC&Hyt`LE8enReLT4)HLtWu3r z7bK)WS>u%k7rItw(iPF~PxlwPOcW*WIIt*3P>Z5MRVW=4VU^?)RybKPe^kv-CPQoxl!2^1}%$$@NFY03P-hwC-CYS`C2Li?OFB2&0L_NT^ zfXbfcw?ZQ1pC`Jb0?MGTL;h-M0aBzqmJ>N1Ffi`~~&w$|O^v#w-K> zI)AEQEA~)hLDNvQ1A$W7PaB$b{E(@TFRepB?c%N&nNDan+0m3FGDW~zlX!cIlM}~S z4#vl1&SRy7uKaU+*&n}-i;t1x0}JQ`n})uga)rd5T0ksUFw?fIWhhUuXe^qLPF!<^ z!~TI4Ba16LzZs9=>B>JQ8%ImI?;O>DS=0%iIuT86OqNf6qcVkmp9{%jj~xJnsOCqD zEtMic{%XamcCNN5WXJ$#iY1X(oazv!MJBW^61m_~MNz@<6Y$vGW7@Md>!m;EX#3-_ zxSmkFKjgg(#}}g$o;JjtxQH~w^1`=xnf$C6}vh0zj*8eo~OO<_Vi%7^oMjtIcjta zo>V6Zr^69%A~Ecw*Vx_A3le3xc27xcWlsUX(AD`6U4#BEbT|Jc(tXpdt=FE=Y{qrE zlatrwiR4U+cWw~JUfiAZ{*)-x;eDz(s5}GwX6U214cE0gN!(tb?8tLjQbM(~8X~4( z|AO(^iTuy^lwv9tWISPmiF1#0lm2yl4JDAd4Prk%33O{gqQ7i#*?JNBNi|WZKl7xV@#L)Y zV77905%ud-FGR`^Wb@iOYa>8FIFuO?d4Rwl_*d7()mO{I++X}Zs@&X~gg1A|NHP-UTXEba3;G6c(h;2zN-gpqgh zN7xn63z>&ZCYZ|N3#2pa;N(8g74M5Bh2QPPwTT~K%)TWg{ZEyoCn zpAfr9Kb1!qO9Ly9vP}+|MS$vcT-^3;{8&s1Iv+hUYQ=iV&f@bBt~JGnr}#1Mmn9Aw5rU~WVtO5SyiMCW7Jv)b0 zGq3XBsa2CyNrN@B1e+(J8jDbd2^vN=Tj=z9lzz+5!PR$2vZyj$mZc&yq?wNMZpg@( zI-dpmXXAK5&SyhpjJC1~o_0Aohrgb)eoHdB9zR+C6sqRd_x3i|57%M! zBQNm-M;>()-}9^i(0--(DsJT!WSdT78*}#{Df`F$pP`4t#~~fE@zwL|lT)HHL5(%+ z_-p`~%0j~Jf4F=TFL0Im?|%0?sH>W>;O)X6q~WWZ>tl)%xOLi_hYw}5KfJZ0j!4_# z><+m&cx~LXArB(;u?TrV^&{g?#nL0RM(pVjD`{5hS6H1PP;mw)$Rjr zV)ZYeX+j}FkL7VsmZC=&sw;SL-T4+ze>-`P-H8^G~8>fRd1!K|0W zO{hfW2Sz>`M{!jaiC>YN){ZzR6j>;vP_C_&tiy3=ov|E_(cgm+>!#yMN85TRcYXZ& zhM{oj3~%@F94@br^0d$fh!XAeahq}pjl&j)^N?hH+#jB5UJ|xR_u=GR{ABQv0awx?7;+Uf zc+F&DGQ)J_y@rk@OkvYyaZCj5d6z|Dv{!TX!9cvcK~kFY6I=*>(qUH}6Q4G3L*42D zzHm}o^Njy283GCzZ^jn@5q2NWq`i*()ZJhHbbft(HTin&!GpI07}H&DSm~&&#u^>x zlG4yL>a5wx^Ck9fYJdR3i(@|%39H;;B|uf6q$c?&h8>00cPT{(P3G*+R;3_&=P8x% zHJhW=ixK?##^q@zQ5P+W0CA4zrG$6OTBcSsB$tRHk}PI`zVhK~D4VH2mzfG1g&lE` z6#$R53gxT_vK{gKc(rho=VH47p}q}CO`!6gbPJ#qq%u(RaRM-0m#ly?RLlIwb{edx zha+O*kyTzf{Ygx&v%O5+!e&FR@D@Q4etR^zx+VYx3IK&icO} zA8dTL^<*98%USFcYp&2=Xazviw3R00u<8wYo9JR;2@>vXG~OIYT(C}!$n0KMzpOyl zq0Cu&IT*H;!fP)A-Kx?=*VbUI9S$!0qnqoV<&-G;z+6(@TDjITP`dyVhNbI|s{eB? zKCGq{u$j3-R!oZm1kNP{LX6dVku4|=oQ$@ozPY0v?n{l2_D7@e*2)`eL%}CP%vp!( zKq~7XXa@fl%x4{)QGqb%bU2%%pN1@LtFdsk4t>xloBOMye89nRJ0aUpHjJIcF7j_o zsQ~qhN~9i$8@%QyiqD3F*3*OS-KWb7U&mHxS@t2W@BJJ)1$*c&V0q0y(^6TLFTf=K zg%Vd2C0|OeH5V2_X9Df4g#yU2;ot9Ep8fWiQnwrjSuUUvBH0lLwEg}VpOeEr3ab2( zWx450pT@DdRw}Bal4EF)qFsxwEeoIN@UDlGM`YSb!UUSC1tv1lPLVLpu-;x=^v@_Q z)T5G`uh=x&7h_um$b*45V1~DFp-~|C@8n{$|6|o+di;RhAD{Jq%s{ZcgW7O!U$ZK9 z7UNh}IwH&004$~c)0YhL?wRtge}Zi5Dmhklza3m>WlZ;NtF3fc)js%fIA3icz^d|h zuji}#*TEI2x2pV~gRA*!L)UE9K0F!ESNrO`t@<9`&R3tyL9=@jb+dkO-q}pfQ(9?T z-kZ|iec7NF=cut0w`|Wl$za`4?-#W8QZv=%i3?G-t615H<`s%A;1e?TYwZpC1oR7E zInq*nzi_LN7AY_Wn!Gz&6z-2F1P~*Ldwd%&Vii+Cpeb#I`|oII4}yJqE8Q!6Ub)cD zM2)@+uxKlORG`fR)RX@8i7jnKGpy^fq$!+B{VbDf>1QFLqvP)&5dWSc8boX75&wF2&saRQHNH@%90&9O6b#H|Nv-M-78mO{)% zy@KdQ4Gc(F?$~F*PP6~y+zE2s(Vo5#jRw31L;+hYI&&xCn`hfQo3@jHa1vl>g7eJ7 z>sP(*_!4b*9vpNY{9ETEDs^xToZ#BA^ZvyJ;!S$+a$Zo`&!H1aj*W&!gPoP}tJb!% z0V*$mMka7g1D@nlGIN>n34PhTp>BSO6vhnOlwjS?DG#~RxIbl{s$xE^K?HTiCPl)X z@LxR(2)(=+_ctB&Tekm^YR#St;+`u;Y@DQuoT|)8vVVhp)XU66ixuB{g=1BB7T|n6 z>%fuC`Qu=&Xck4#6mb%)5Q>vQaH34I9E0P*7V)c{1+8^e=%*@M&S8XI0ZqVCZV z7^V9_?lHuFQ4xcjR)@oHsUcjOqeTRyfJxW!gR`5<%UiKc#fhv;K0uViB^ZLmlp}yw zePzfn+0b2m&|Q5AS73b9!NJ7791V$IVY*R-hhTuvJkc(_W+e4JpwSrb_^|jIir z;-R!SV+6?bJ{20?M0#@~T0_CH z{Rt7!^SE%OB|v@AN0Q)dj2tAW3N59V8=5^8rMYE+ohR($V2Z(5Rd1-~>qFkC)L#up z3~92hXWd~$!!m4H$nc-LIGv3L<@}$`?LbN!pEo$%%9XrL+>;(ngpk_6m1)7wxt)QB z$H$x7`^U!;uYY{}czb6H4=n^IWN4dC==lHfsR*zPu|J-SvHo6R?ZF`wkamO~>qMvd90`@oziU3^^??X<4i;JTRq*|V>3c3YH(V(1rflyxU zWLTx}#?{+V$Z#ofxoE#O7{b)86$Y;J)H-aD^vU9DC{ei1LMNKtVQnZsBkI*ZuPKwZ zxY&S^&|gzO^n=*z6p!?dCIzFa4sI`BjfS`CtQ{i!!K0k~-`w=5Is`NcUfmdjbkZ#* zOyWO1q-vc?EWrpsGQ$4u%{2mdzR17GIUaxSOGI;#NXk1@2`FCoJOAGjw!F|9y3=Tr zC2W`4182oIgYus7SyxTY=`qlYScuoKT9d}|DB!Sn zbv5{ZeZLUh_y(PjFOYF@@e+GsXbTn@pETXQj)x@cLtC>D7y%6HxR&@19bWWx&(Oev z6@0^G-&&5PLkCn~Uv#XtekqTXvI=de2YiXQXOZIvdqr|?3H1q z*G6llU~+XaKv?dOhh+^fi356+tJp_I{(Su=0=3JCCXX2cGm9Q6?Ldz_8h?E>d`tOb zttCFMyT*8n0i=GLBbQd{2DAs8B}g*FmZ0C4H?NRr-K`XBs+gIyAV{-vjks0I`!RM4 zv6RzSg4L%K zOR74Y0|W7FYj7x1_Gr#pZ1%$-+W^O8?_S=*-h6T*7mZpmgt)yP44;kjVl>g4Z=S-K z%Gy%rLG}V1^%^fFYk@V+91wf)TE$;YPI&@@whaNZW@$0X0Au}Pb9G~gSlR)4;>Q0TQapJ*QR zwRZi;dl!DB!K=ZkY*J+5x6&z=LSO2>?O(%X!nqV%Ns;JdktNOf0|$)8IEB+&S!o329bp#2Rlg( zuoA{k=q!@k4u>;B3TpA>3P;=f$L9$0?T;mwID8tV|Kq#E!@UPb2cL94fB3n&K&I7| z!3J!We2;7d2=K5+32pa9@rqL1vl=?+7#HlaA`b&ER zZD2|oJRL1-bH>WiVgktaD-usCbMx_Q?EZB=HusO!ExT6FHLDJWH;};Tv~$_Gpwe(C z7}t;#oEa&GAZ|$^CjH`&+7Wro_2t#cxZh(Cng!Q`9)G*~`RYUH7u`o+nQJ_zf;h!4 zFni%X27T0|BzJi;7|R{kM7HRqh6szb!1u{2n?Y0^4ym53ogjOs@y3G@!ga4#pb>$= zzMzxtpFh8^-nxJOJPXW~ZiRx=0B3Rwj(v>pl*%f?w{kiS;|PX!V=O-k9~cC+^&t>h_hY70F?clSGs2xB(dUhU%cC15@a&V)ag zV+S$P#cM?=I}L-zRWcmuI+xxur2GYirNSl>q=Gsx$*La!_A?89>z}C~I$v$uR6aCe)l85LH5V5Op@1)NqD=lYfJYbJth#lMSPn=Z z9O71nC&y2B54Rux$MNI!?VV@)TWfP-Lvc8BJ`+wDwl02n9}Gj*X&czsI3mom<-lr# zZvENecgOo%|MqNqe`|A11li{gEuU@PhzU8*KRCd4N?V!f;nz*ZBGRS5`(lprl$>dE>y6tqHSpmd214e8OPbNQ&#`FPX zz@q&6@a#LB3S1vfn6Swz?^$W9tjJ~uForlHXk334-NS(n6%2IZpy8+Y3J6?x6#p&{}k^L%zqvfgr^CGtlHk@91i8fA`z{ zt%E7ulnDj{eD>%MOar0Yt+KA_K)rLO0v3r`md5ozIB~2XW@4rDz%du~Kki@^QYvNh zp8GX#?xW6c^>)YnrEDB2EV-_mN$>nM$ttT2g43!cN6b(z^V<2EnJbrR#<2s>b5?6k z0YR3yWl>mG##UCuBpab2VrInS_pShFB(hUF?9~&!6G1y1zh%mxG9* zIq9qIr@Q;*tNkscr$5;8m)tSt!0mZNaEFsiUJuTETet6z>v4Y7#yz-iOsr8FX8Jsmj zGc(7zSOBor`Q~JTBc|SU8myb;))*1+P97b47Z$Kfj|3)qz_rc90|ok@8Tl>Vs|_ms zFahP57!x4~OyC*zY#+M)JcoW3@ic&lX3V{l%oVT&E(AT0>^d6)LV zF=XAp{|AqB!DWBXthFd1HVv5Y=UY3M2HjmA(O+8SW>=$ox3xjIEYpVqmLN`VS^88O zl%LcKzKSg1^6Gha!lN%dK*t`dce>XhRQ7<|v-+LQfK%)wnpHU;O|HvE^o=wDWRfe( z8g$JWeu{P%*F>+ecC{3S7P+Zpu3+JC4?WCJDGk76N9A|bm;vnK+V3AipQ&1z%xvcO zZOwfC`9HB8kgH)!kqWyij`b-C1(-1QND$Ijr0VNlpYrSzEy2m;g1_)7&_FGL2#XYO zviq9GD0S5SzSk6Wqbr0LO>mT%(k>}*M~zsZZm5EK^Mstrvf9b$r)2|?qX)izzU@%2 z>&S@IXlMwU;3_1U6ef`4r2##%6lz8(T4!aXzhD?8__C$)u#QB6d1>;|&>6p;)@D4$o<&cOM-_aDGf;zW;hLcOqD7Vy9 zNsNl`vxMm4Av-R%Ws)r#n4&4`#<^^Q;Rp>A8e z#*aBzG~xhS&(%)K*BP$0QtDQQ5mTp)xHf2M9+o&CHs zIE6&)Z=cZ)#w{mfC7syffz@Xpu<7E13pakgu_DTYDfBoBn_9%~a6(U`2|s2EI#f{D zj;@G)%-%nUhAO+y;7Z+vj!G)#5YT{#F7b}(cUf;3v?nQttRY}GPDBI2)lx7$WO02w z2HA~XF^~jwi(CeF(jUGLj?jUj3|2s}Cl1x23uj3rX6rCjpfHypUi>Cd1Y$oHq)X%1 z$INz#4Mxvux9QuwfQOONwGoWDnSc?*0Pe#=(M$r&TL%W#90Lx7XT)`d*JgQw3{|_j7FahnZB;vH= zK~TdCwnVm^4R7AFfjDrW==!d+K{2WXC?e3KO_HeLVlZ?nO`kEl4JZm0nB8ZMN#f^v z^agB-p{N1{?O`OULHDTFWy0!Hdx8&cp*y;`pG(YzVgZOD&k4kSN`+i%D=q$<)7{&B4DBW zlcv<}9!;b;BIwu-Xo*HAZtsR72H1lHaL9o|Du{&$lL3;V&AhQY4^WMPFk}ILgX3gA-c&1B{c1$81k4jmWH*cT=I_9*mCawMu)|ohnSF3nnWn^57sN7mKa;! z5U{tu_3iQQ)Amk)Sfho*zU=AhQzfpu4c-R(u{^<+dGcb^<(vI3s5^A%$xS)Auq{}N-PEf@1mhSB zhzc?h`*T1sjcJ*;$R-;Eqp3*2f95ijPHF0TpBXXQmL8S{0}a5KL(-Z#Et;V}?Ni## z-j+t&EBLe8#ckt7yAS~eo+CmaBowX97=qYy;K~qUE33U0kDp^Im@bXeyA!+@AW{Bg zC~E`b^$7D1G35DP!Dv<`-2YRhv%%EX>;iJ9L)?gfTf_Y^V+CXOgr$K%{uBd&unV7} zHhhd1#vXvH$mP+T9>MNrc+Wthswnn1 z8t>#p(MDC;6klGTTxv?KaFFO5aDHlIx(X?UeS-Q>9UUc6cPfiuk;Z+ zWG@UJmh+#;6_y1)=7Fbzi1eR2n5P-JsYA%ZH6gwjG>h&i;qU}U#7mescp(%i$~lf7 z!!BU#C&ALOK-aT(c_gM_NLmCTMTDS9PlQON`kclkvtrm8qCzEQHK?`-+S3K!BTfOJ zVJDc4!ylX-k>BF#tukWI1zvTC^k!`Va#9(L1I=Y|dQ?$aRA$3p?Q= zPZ1~HE^QKK%toX_qVLDHGW%Rb;T8g3unow5XD!JFlL!pA^n<8d_gZJQhRacqt&9iQ zuxlv#Oa>VDum=3ff3WD=mg*&AM_?iuB-}{W(`^6;Od&{c`ESz1Hhq?uq|5`#gN9`* z`{3p!W>PMG&`Is|ez6Gxo4#H48GmzF6F%q|i3~S&|m7P{SD_-oJ1bGq??iS1D z7S+zR4x4SOp0-zV*&x-|i_PQ3z1TL+L2Qxp85IHuY;hpm6dE9?sJDo7jZ6ZT;YJ#u zS_z?-4eaYq?-u6b5XXKHgCBYtWR_i0fF36#r z`@m5=A2;Z?Wmj~g0S<_i-L`V0HLZ!+y(3p~7P>&j$_ic5VuArLD=SVjbUqY#AU|*D zQQ{^70$b0lF$jYhrJUSQ%B6~|wCzJqrERE9S{HkZt867%cSf%Vr^#oyi2Eb3lt_#T z^1CT|S4r||8q963Bg%+Y{qKy#ux+E6C2SiB&FWwK$P%{x5hH7&EtfENkX{IRgOtct z>s9e!--&;x=i-Aj4@Mb46s0{y1Bv{j>$t7YD5tR5j!0{hRBaf)s!g{{hf}sh1+Z^# zQ~UC5NBKay_wARKrkpLZrnE**IyRbGvO5v9(?G^oKy5kDh5&}&QVv2=X031)Ur`Y& zXRYQkEg)!tmgI}J1QSP*ngTii@;%fks=b(|_^M7g>|^^uvgY1q*|IDVM^)5QU$o{= zsmgjVb2Af=SrqCqcegsQ$3U>_j)iT2Ji7n#^7s8$r~d-<@X!5Txc6DsF+<7KqS&P0_Zi~&?6}s*fZD~R7EhY*bF!u zZMT5jXnI5T65oKgLVAIxYvTfq2e6vvkK3Vrg{eb;V^IOB+axk#Rr!Qe2A+9f3NH!?W zybmxws!q5qxP#w$$|+7UJ`^=Ar0k7C=QmLnvjZtui$La_#f7%vnla(4Bf;QKV3=@r z%;YYnfU*Ac&LGf#?P&7x(J#N@M40yCb0?OFzC&M6(B8lHaaPVeLHYsPGBDz7!`s&m z*^(#uV!WCP6mX#)5aH6NK(5pUX8);$Z9#`MueFGdVCOe|9%3=kLwP}$ zKt&0^I4MwOH@hsT;*P=8#Gx(DOCHVX2KdX24F)a5DAMdDLgQX~$R0XF-V zOU5qlG>n)Q5E*7v>aTWRh=C}+Zi?w&nq2%vwl~j8a;6d8$SQz%AX!HGxM5mv@2=5T zKhK%u{9{KAzEOsA26RSE?F;}S?jG!$Rb1OsN`RShYT7NTjZFMmAPeR}-t>DB>4LAExJ4-nM%-PQq$ z{PX8tS&ATP}^pGuo_WR;;!B z{t9JWH$7^cA?)B4_r}D#iP0N{n4=q72|E+{ATBvQFp3(DBi9lF9apzV#d;%Zx~|U3 z9k}Txeh?1f)eT6+0K$$B_quS>lnydKscBH_P&gvtNz8A(sEKC+i47?lT^=Y;=}5t* z@>kdMJEu}Lh)YI;Le&**h1FHewAM#REN&%1?d$O^e3;_M*NOmEgx_Cis(@?btt5Wk zFg-i(23()|%r-lN$*n1ZS00Pb>ItlG5hWq#OPl-w8Az~Z?TTevksKb+`zE*;&0zOF zF%DN^a(PWKuY2q8ECl0uuztNn79R#!;s(QEpXZ7YB#ax!am^Q|>It^@;YfoYpEAr~ zJqnrdt6`kcTj)m`o3^$lUS-NQT#$_a7L$-oe1qcjFu1J0+*_U?&dH<5G2Nek{(Djd zQ;6Zovx8-LMANeU0&>Gw$p9;C#g{U{Mwx7(=C`SrK1qM?neTK~rqeq+eCJ%JGQ{#k zd!jL>cY{;rG}$vHexdV4+LG0T{(c3L2Fs|B=)|@K}RFQ9b}5q z+AESVwU52!vonPKk8pl&50?bvwq?y_YkS;zNyrxazVe9skBkGB_&`R&n311>zVaxq zpqDerS-Q4*^h_9fA=os2IdmO*b<$U4wLb5k!U4lM1MU-uoK~IKdwFpSMz(MVi2+SP zz^D^3uIf)gHm`t0WTwQFcusK*Aq7b+X+zI>fVHO&*l|=8;aDCIyGe=sB?JU`Liqv` znFlMLckMuj9u!Ke0|ldD0J9Skx(6>pxhgDnLI#NOFHxZ$RNoS0FKB`VlW7kwl}V@$_nAkkQd~fBRGt~ z_InKV<7{Z|jyVJsDlgq2w;OYVKN}8kAeZbqyM9BT%o{mCfG2_{-k}jwYdH*Am5Q-I zAl+*KSiH0j$GAn{IcqKmq2Mtd#2_2>}ob-(+VLvZILj-qy-9X?+9Jw?H@ zjf0iXzQOgu7+Ez;r{EN=2#2c9P5@8Z&Ty}|;WiJ}@@XM6`=av)U@g)x>d zFur&pY?ZZUawNk~6qUvrburjaJ`r+P;qgA0$ksUht$UEwrwNMKYBxXfq!#lSL0 zX1#`+a??LBEjDX3AEDsDRk1%p4%2_cqnBUCq(Mp&k}6O0O&hq*SdM>D{1VR zrOt?h+=r&xnD-HS808W6?U3vl=8d*YhJzKZ$S6&52)*p}CNA0;Tre51u<~3Nv~YUB zS9BqUqR8daZyi!P~0@Nr-$D#37u3hO5lR9QqrweP0zf~6DBS{_8CzH!6~{^H)R z_+%O=+-=BRhcqv1ZEY!W*S*4hu|<^`xIx2C`f9v7sB=19bL4DD>9Q1 zp=g36sK@`>fs6POHQE&K08t{1a8z0v@wePTmKWK*i3?r$2=ygBhR72Ubysm$E+Er5 z+3=Nuv?cs0UPSl`K)8ccIBi&xbjGwH;MF}2e*Rw(4k@GM^7dOw=NL#5uqGY764zWt z+Oq;fQRQKU`u;hv!yz(g6cRh_^fW%p0#^-2y72w$Jk3E~4h-LDOki(=CLjM)n5se< zWce2-V!%ZsEj+DxnF#Nu9gu1{(+<+|5nO&+l1};phU<&L>WYcTY4$CjV-lfwu5jAf~ix@(jq{o#+G&hEzU zlf7LW!p4bdTn2-?PDV&g0ab-R;owDAFf&$YYaEL|($@~VI76{*9rQ44Gz*W;@JD1U zLN277bDy)Z7c^gB98p^^XwOH;a1_TETid;(ojB`Qu4@ieTWy_wnY-rf!EYN#w6*EQCy7Fq9F5=zZDu?h)H`fzNh$PvBC%Hl9KfrTtpXcQasTxWNHTjH-6X*Xlb)i+>|S`Tqr z>W?kZ?KRglpx?8(ljYHL{>r_))oVYyDP>jl2z(Su5u2R=wERp6Gudb+ zY(7kP1r)W6D?Z}3w?4ybPjC18NZJd1;%FC(tAuW+U)$I!vtuavNcQx|L;FZjFvKQz zmZZrvAq|D({eo{##=2I_xtFTLf8LK2OiC(k3n^?4CW!99HlBvb zhr=PQ1yD8I3qdiTJ#usmaI(L8k;;k0hmlshM#ch8|NE_u4e~s*LFF_LHIi)0WpfTX zG(gTqjvu*UdTM(W+#pt6`z0wrP?Y+S6k9d29AqFW1WpEWhMWqfDHQ?)pU8Lt-pN$U zG@YUGWF4rqP|OJk%rHYTrYUM;gqFVJZw+F!pSE%ls_S)Vdor&)FSim~ObC%vg64dq z$qPt&PuLBx7@>w*EvWlzOacJzzw9F=_u16SQ)=Q$yUz%o*!R+XsNez2+@U7j4LFN& z))!kL{6Sc-uk5$$8vk>!aC2H30S<%}gcwDMX00BA)Uh>8Wmp}b0v>EvA9upQ{J`O! za3DyaGwdbcyxn&O%woLKfY;WtnMm_LJ)+5z4`Rv}RTt!WX-P~0f39qq<5}?2!Af?C ze8Shr1%S%}&T)S*7GdUW#y&N79>o&1A!epe6yo(!e4J9&QZ~4gy(_AH3Rvx{)8C;xMQGE4*75#3jPMIHSL+*h% z+L?Y$fFSIJ)_urUgpU{E$7TiHvAoK5MO+0O4!wg~cVuCtb=)Y=h#SwGiD`ACditEs zuZGy5WkoJ@h=k}PFLRdOg(_C57>44O)6Kr%i_q&l9gVKM*|9{PBggdcdeVuP(SsT2 zm4z+YOUKs<&4=)gbG0$##O4qBt(Q$+ogwA}_Oaqu%hBYZBPMGkVMv>6kT}) zw~dvK`B!dg14DuM^&p7cp8^m`rpzI6*R| zCK9jZu2$l3+5oI_y?RZLnzl}SH68dg^PCH!V+0hPk7->RP%}|xWt7QC*A0xhdHJ45 zyHc}j7HYf*0rgxzz6Me5f@x*BGeCX&2e4$er5A<94Yt=8RS4Vi3A zwTB4syUx)I4QxuRualyPb-lN>X)orFfaHIXw-0W!BUjJll zOtJMd4#b}}y-!J5`k>083PScDV+;T3&fw+vWPBSRR4r^Hy4;0SU3A;N4I^jsp_6y7 z(DMqeM`TA`uD-3FMe)zL{Z;clvnUo28cXDP1Dk?&fDk4H@VXz_Vlzd<{B0 z#-qN^ps^}vmZUrf6rV6|9*Jty0w%g1r^HCZ>4o@}a53rt-V%dLwb4xJ`d&XXGau$R zQb4SaPtS2D$lWMgrFzEmfxM?LG)n1U6MnyExZ)3n_ul&9ciT@N?;d}H3%s7LKiNWG zOGHgbCGA@OgnddhuZ5c5f+It3rz;4QC^5NU zRW9uzbr4ONLxs*K9Ba|^w05w?cr@}}N&x=`5`}}YUw3YBQ7&c7%@D+c!!xESrqMxd zYvExG3CwmfW&ntxsNIZR0`W+(`H0?0N-ll!s+bOC0YJ*ZGOjWlrCx~bi$ND*Mq;i! zM%l?Ne7=|4Op1yn2Y2>mAl>gAHH)mR{p;3$9Iqc7^AbZ+Nat_u#WtSp?{7Ul^rEDy zWjSz95Y-#}$O92zP^ob!aS5C!kyT<5Iz$ruLw=)~;ccjWfq8Ii#Y@ZD&@wqDpfiD( zEji7Ph$tsQ+s^)>Cjbey$|W2l_MNcBDaSK1Ki}@1U+wW;A(88Jil3e%`K{6LWNZTpllSidhqY(02*nS6gzGE?qL}-!-`WSTt5dVE_=o=K`G|*XNvZ*K2@_0fNyT|F$me7}W7YhOQF zsgG7yaSnr59kLtVbc(JzsDAL(YP^2DyWe@R+4<pO1ab03+=cA98JDa~H*;6K=h1{|!_|3fsHo-I`K-Im#H{f#Qy{U9#+tRHs)zQ zT1t&R`1lK))zebMEX2ffA_z4tB=~5t^WqEcM#!0Moo$w6nc~SoRYLJG(=QH>M(;NSq-U`-iYP8&+aeV|XVg{Z3 zxj`gHi>pUVgac47{Q>1wG|m&;wQVjt?hqG7jjdiSp5>xgX2@xB1-70GQ&iGGoW5s%`UPE(d>(I-Yn_t|3cXtx#88nZmPA=J6w$?#SUw5B`EU0M7{()Huje(J zt?l7`c4}FAHh3=IphD5PW=DYPV2G=TZsn1`2%T0;*D%0Pvwed9{+4w*H#FUwzQ{EH z#u)uG%WMtysd*=v=f9dDe+^hIkX2TX$=P-*!8O|!9+>mwPWX!&0)C2PYNj*GMPOUT z;$m5tTiO@3=3H|m_0r=oV6bxOpDr1-<7$p2BVwmqoi8G&RCn0q4MEAMps`fHa?Xmy zB`aPCqmZ2ua8Lz|4LNvZaS6TrIGLO{paE}C=w!{;49fDP z8C?nRJ4_XacP-BDF^FxS93eP0oesMy=9D7ZMejd&Gswf8V6)3;9HKBeHjU<=~hkl;DvDQvjfBzMI+5p^DPDIYLyw2W3 z_tr|Bx6+CWgnHUi6E-V~8=W%yNXLroa3{H9Gn?iv70_v^_VQCV(=cNV2!&0X+33W> z-fG7CfXdG_IGsBQ=-(?I0!hMbp_!YrZT1xHQy8wEdmjo`i`Gd?-^EesF{}1kRw9jx z&;>)L&OU~m!qS5^h0YY@Vaf&tQX+;SiSRiz@~9?)=-%s#(aYvHcppF3+$4V(U$)mK zLrkNQN}BKKrbD|L8j`A&r?R*Yto=D!4m}_w4=VBHB(3g9{iMP)UU9=h(>}rUDVp4a zO8m}ID4E_C0o1uro;~<{zA%plYlS}tGRX$7X4+u8;pK(IOE2;(>5KttCX1SohHz?r zGC4sXMc&W!F(mP1gY;@K23s;2>J98)*V>aQvN?}+N5d#3(X)AX%ID4d2E@{dfk}WMeNHIc!*9i%2Q$e(v%SjA_b3x727|l zIY#=Uum~(u-*sBE9TH$x{Juf=r~ti7b`)RYf>RY~Y^B95!@Y4Mhca&S$m zZin!#`YwDU|sBnY6-{l9pbPmYRe zCI=WM3SE;!pJ$(4 z7gCn)>Q*_kA^C9&GLaMSg5TO~blQIbFPT^f2B_!_2l-FKbgTG+IOU2j48n@^QJ_W7t8X>?yKEEMc+Fi{;k1g zcYE?twgaclgsk5!BBat{{^unK2as3;(=ba++!JJa=2%u0+Rjw;ym0- z@+WM1_P$=r_dS=t#*62Fdhp_t2g@HbwZhWdOYYo*%y@oPQ}oG_NDu{By(}n_@#RoQ z8HN@~FfZ_LIzhGRjlI^Zo5?wD%#^KMJYthC?P%-s;%asEW{5DGnq{V<e3v|XV^y1RP#Xsj?x^p3xXzeCkd?lOWSj$^cDuvPMl7SQ5$qu+q zN@sED4@f|(nLsJR{t%pr5y@KiG z9Mw!q>bGqQR*=2(`S}9WnY9gyI9UEJJwKB$^!Kakk)rQa`^m}pjZ9?V@YgkiAQ4qr z`)650#SV(~lpo9kN5>wz*Uw@wA&ld*Uf7w1rfJ)?j|vV;AJI5G#E3&S5{$iAz4B0V z@gULE`QTNgw@QFOaK}ShEE|wOHpgELPqOEc2}xs&DaLI7f~k>kuJWh&W}1C@nJ#Y+ zelAstQ=Xv^=s zu7QZT+^)}tZ-($zxuJ#CkiE(2F6mZ=;V7*!I`E@;+fHyX&uwyGuHXPcgPC&*6|Uoe z<(G@PWcO;5?WY8}$zc=I0;qTbK~=fsD1Gd{GON_rC~Ko6pS;>3ForsMtG!MzqW|b= zOzneagEnh4`c3jJ0@qO%jGVF0D9_kor@u)D@m^dNe;mD3_@HGe-B{6pFv`z@(TFR% z8#IGNhiXI+pk|QB7LQMA1H?V`3dv4S5HUxh@ZO1dj4Y~Q5|kEWc-Cza8k$(rpiL(I zj0rNI*o^t97LR)9X2LXQXItGdIR@0H*DR{8)~qB)Ej~KVFU#AbOnaJh@z8n^ZM-Pq zf+uSV%DuUKSx;2uK=8DA$zUO>qdbnZ>-jEc2rCHIFz;m$W;HSKIhhb`1d(^l^Yium z+xIm8B|T{`GR`LLBoL-^Z|ZRteK=VE)7+7u_4!ErF;zfaHZ+u3a$tr&Q}c!O-6Zy$ z%()`m6KLDzywE2_(0qrnv6$5YIL4Q$PIHYgEB~t|_Rf8&sZ*1PS$t%Mw@fzs^itIc zrkuvaRydOnV4GM6qq=|=!MAb+_(xfA380AIYEzkjef=AR+H835CruhttA90JCl%6gA!07tY%;=!3qy%c zYM6|Oex;%q&12wo54PSop4!mrYE_dIV|8kNip5|Gwv%XmzpibL$Z`5t4{UB;Cl~%I zH^fH!k=B`!gPy15&O~c-lYU|M+kCV{t1GfJG|(|W-*HzLR4y2EdpOy<(CBdi7=q}S zTxw%9X(3I`Ekk)f%xcZesiA$^;fh3-DK;?KP5zE!h(nm=_q*f@9bd-;5 zKNCIh>bQ_9*>1+Xnb1YJYSEKUt&Yd0ZaLo!k)i6j`8$jAV$xK^3vvBp<}B;* ze`w0)w$56ZD^^5smCMpl`kLkUW=0@+U`M$dOmy{FM&}koTxd>C{UtvT=$2)%0_y# ztaz2(EQwz!1C&SxNJ<`x9SSA+5GRY}$!~oXUHVinf|EU6ObM^hlAFts5RuI&l)7jC z7?R0e>oByc?Ak&6U!0uwxo;=+aOrgK=-`v(x0k#|ONC))=~KBW4;z2uSBoUMw z8;kW<*1lQ&wBH%E2vZs-fU$+BqOE?IK5K$d&PuxlaTPnOkK z7akX{oVKZ}ub8LX<|$1_df@)1zBaGnv4LdVqYGwKr+Rd7d--ZKygk~W!Zt)!D*Te~ zN9$KthRcH6+nw9jQcdcb$YvsFodOR9q zuNG>Ubr#R>UGd=hmN+dmPT=$sNvGT29(~upfdBPq6RFrnul1o>5=m42>T#JNJRLoj z^e?wn;hCy6J{o?ucdL4GQbu%w?*J=yvrQ|-LMj~A$tFEAzf{Da_G5~?2pv(|%0BSe zM`MA`Ra829b7Nqn<7z@)12;TtK4}O5|GBpI{nq}$_U=>Rj5eiUd^3cymQyF) zpLm9(A7)_Ms^_=ZyNwts<&oT;eKG8HzqE;a4fW#i!711rKi#3yLDL;+5V>&AIwvoY&hLJQmyrK7 zKw{xbWXA7Y4Bqrng_lgK$p}7z%6w^Yh$uXkX1c2xoYd8Cu3nE%&ZyKQg)z1zN5j`> z2O&+6M@&3_w)*7*ht%|Ml5&I~#^o=YTi+l5u)dF+{ofuRZa=|=lG&CRP>5ktz)8HM z&hfI`zt`o0Yu6{Bj&jQNfccR-k2+JE7v514Nl5hszzMmBxXT`SiGJ)z23ZDmVqhXD zIbPJ~MGt59J6A~5f)x$~*jYp-;tZxm+8}^mk`yD#4*`P6FCh7Ka@2rYj&TPLDByXQ zC_dQQc}z=7S6laLI-x7^P9yb(&{OmY*xYG~Tc72!!-jCFv;^9EIE)N)vHSq~x7A^7 zO?AAaYY^;+UYwSS(&89N4gr)*i}sT;G%w+!W`M`JUtBoPrF3GBl}K&8$8tCO1xCq=zeiR%vulL@SRdfJLoN4AoZK87lq(e%;! zOHh(M$j0K-k{VC~$By(lyX-bL+~zDO`@nOR-4JblPtU5)RpXiLsLfUM0GXUl&*v)o z{fS;ZKUZNy=KeHS!F}b8tgOgtMAMy&?M_+?Bs`X+L&wLGasIdB5t%-}2M|#WG{6k? z5Q$SGjG)(9)R(O#VBMv2QSGp_w9;Qz80$_djED^^Mx?=9C)Cx+p^BE3%jWUXx?2@} zRobauJ6OC7>%un`a?f6+Ihr*-D~8OA)P{T2QgRC(rJtdBRfXG+cAKtRr#8oIG?a{+ z%PZ9H{7={2F`;4(J+S57x4m;q$g zq@H1j0inA&z>VSnkGqx^8k6l#o4kcaG%;kjoC5$FHSn6X;*!Md9gp=9)>*B|(Z7U@ z1lOIdAC3-v66fwH1MYqvDeev7D7mcsM9Rt46%8x|guh?&2~E~yvqg}CU#Z#a9y7bs z@iFJyz(m)0s;bF^@vsDLn!%-YkLf`Es`KTSUvBL__T8cf4>~8tgU3;H6@kxCxAe@( zS?A?#*l7z3o~8*smc+%Oe}T`8tF@0MUVtf+is}kmSO6SEAE0{!odik#*`g{gjmrki z(OfZS!PJTWg}IE`p<$4*e3aRZ3D7j)BC*k@EcklaK(>VuRiAgSCgYWdF!Sh63v@A8 zAqH`MF3vT09ItqW1xbr_Vg!(i7 zz-$-1STTWgfj*IeJX#*(-sztK5Rxgv@kbzgX%Ioq>6KCpylRqhtWdH(Rl>Y`QR$eZPn zTt?b7Un^XkBdv;y4Dv zdto(zVWc!cG7*x~uzm~z#(kLD2KKJN)$M~57)(?>9*-{LpwS1C;4t(W(`S;Gx#A{Q z7soDEAlL0;5+88yNd3+nFH7_9Xz5HP?o^ch%!)-Thu41uEJ{2TiLU|POIk(*YLgj@i@Bchyer>6 z2p|QYj;?NdMtXp1Bkd{&V7`L3e3p?mTm`k&Fu$2^#zOco3a!dkp9t}p&=mm5To^98 z!~(AJi>UIp{APL>G$DHOlMwaBbgSN4CgX|*XU};!Y<)Z?EwRvi6J%Nc@%nxQ2IuCK z=#GXlPGb=JGBea?p0?Duyr!$Sxkp$TSAu~YW8zJ5o=;|yMg%~hi=Z}~0$FN!QFy0! z!hU%`D%JnY_<(m=|JQwhEcD!P^oHWvZ>n)vN*3 z_aoBTTk&qLK-;*$8EBEIhQLO1isr@;Dy3eAb1f%8u#^E+SJ*isC@BS6(3^ha$DBM; z4^~^63@ICHwAiyzxF@ZG)vqWHr3!xu5@I6lEZp-XvtI}WS`1u<7T!W3O(6g$p9L_x zgtlFule%ncB7jJ0NdpZ6?VIsL?AjWjl7i#w3<54fZe-}0Dkju>A-4@;(q$VW$uHVn zLO^zsFnUY26_M65rYJCFLIl^^t;CiT_PZcc#+mV|7M5YAU47RLxTV%u;%umi$?s>G z96#imN5^}%Y9tvz^d;mZKm;j&4?d<5Z2UQ$)gN^p3i>k={(JI!J})rSsnTW0GDu>{ z1tgl$AS!98Nk?VNN)t{~KHdhehXs{BMIXm?t^{g7NGac5aPtY~790*@RcC|dso3?GFsg5^`vi%rt=ZBnie~9I zuy#we87nZBTj4WNuN01(m#E_voKFjNJNM=Q^2{qvqXv{1E<_t!w#I}p$a+39t!4FE zpiath2C@u^h-(Ens{#QRJ+(m_j&d(G%}AXg*VoN!Kw6lo%r9X-aqnRNA#@@95;a_{ z8$4|%rTz|u9&|%ADH({04?&QgfEBqKBE3=Z@G3;YcU$Y5Tl+2B60`=U2n3-#vFSXJ zHDb%?8FCcxcV=F|VICHFH66Xvzm?Gn+qIF$CQZUl76F?WY?% z&o;M?c|}xLIxB<@W-RcM!$3@!L`(wP+>W9;z{H<`=X0rfpNdB5U?azJfY?DVKm27h z81@JgqIdSz_ty`1_eD#OrEbEi3kx~;G80067&B?PF<8E|K|K=$Gf|SV0t3KIi!qaPx3+vSqokk zJ(3o*6?Wfp2yP)wQ1F}!2GSA#WcVE)WVkUQ)AY|G66{!5XwPR1OrU>r0tzK-iB$mf zPE%!BRES1=qL7by+2hOp7=c;x?miY@nC7PqM=FL3l(VnOlg3x5g)sJVD{F+kJ z(Dl*e3&_0OCCYxyK}T-lEY2LM+CrFib?2I}#~}->#xOqhEs2NJgx7>7y|kSRkq+vX zKDfGgj3V1|bsdpGAYzTi3s5tSs^q_R*R}s!xwkhx0bG0+zq5=Dqa#w$q(Xp~nR&s^ z#9s<{d<6GoHmS!DO6(tFWV!tuDw36hblXRehA2C1omilv;aBs~VI4Q|ZT8>} z*3e6CQ#3mel9b&sJqy9m3L#KjLZ|vvF$yovk;reh$WcGnM+PQKHJNN+#CZ`#iut!o zb!t*?c27l-IFTFYk;e^)I;NEOcLAlwJrX7Nup#vtJA2os=Qs~?^b$$i1lGTSX8Yq; zh*9_(4(1H5myce)<>`=UUnamHjyZ&v>w5GCF*X>Q{E+Uk4ns&8TtZbi5y3t8qdN6t zcJ>ZI%nWvo5T{PT-0rvS zc}3Rp7qBBcU&=TB{Nxj%6#0ml!`z9g~O02Z#Fz zfxgc!50W0Cclcy0wk%W6KgCeFbd(=x@O-iG5?h3C;Hy^nWu;s5r|qX$yB^DE!U5$nb){S7+MVS-_>Mlh4ddOIss41pNcCV@K{yo z~{@c3MQF_&@@Uph~jd)j!3UxKad zQ^ig!QoZ`Z4=pt~i-j96qqwpe%Q(YXmo1FOQZ28etqN5vUcHK<4HjhK#!EMPYH|Zh zNK$W6uoTT_!gs1B<0RY4qr`0*zh%QJxXD<1`iQHu;k0&(1(mjoT9VdAE;}+{s>zZw zDSMfi=~+lQ8iPySaEzqAxSZ0s1^7YI?IErN*6}6^X)7%qP|JbEJ<%;;4X~bCc(eaw zOL^GP*%}8Jh=Jy^Cx7YW4>(&no&Td60 zX$fb&V8u|<+dRt)qX9Y?JsqTWnyB70F4*1ETL) z!LyOkf#b0u%vy-)wuhr1<(%W$u$y}-Oa#2mF?puzJJCoYcppH7om|D41&cfQ(3e?i z0g(uU_}=}bRtSo_XQ#}?e(O} zc9fU)hEW=Kt7Jev$JzXo$!N%imi4T(iP6Ayh;xmXF|dq&af_oD)K!aKKuD7}eOzZE z{HO)b_%2bum&JAlKWv^{pY+~ELV>7+)B=r^HMabiN*Fh4%^=c>HmWAUeUbqHhhbC} zL?0&drTh~l#Jjw?Jh(o2Ik*^HliVGYyjXmHd~x!cr+8hiW%v<%=_t~ycfX`t^wAGv z=!7`&PRxn-@Jnnf;eE^*#LSecrVFvQuj|snBx@p_1){{G$ZwU%+QSTthOCt}1Y;OnHL25N z(X#|Lqb562_Hhz*f1HU92U|smd=8PBI`wMsqwlbVD1yBdTQ~sn<f|ZI5pK2d?u&S!@WkT$Sc$NqC_W3hC}@&@c8ix*(2D7xxWxaY*N^kBfoMkTC^#&7?Qa8O!iJm-sri zbp#2#IZAX`BQXY%Hpg2K5o6h!MTlQ9Vc2XU0&Sm)4}Zz<0+hfPKM7tn7FZA!?>1tZ z1l{nICy%{?;p`TQh4YI_2kR!IkiyJttfbpIjqiZz&MQz~>&jbbr3uc*u=UOn%mN8_ zFM#C^qYfws$@A3w2eaL<1zDOc(F=3GOm2s#dNH3Q#PM}*^)JxcaMGH|U*a88Mj$&5 z^TS9A82yP{GC9?FkCquHo6ACm$}X?bxXdfe_zBcnFq1n)N?yrjgRMW(hWus=!VU6- zxLtLA@w87JFs{5r-03p*9JiWF&uxVhrxLvxh}Mt%b3A0$s0-YWcGkt_Rkpn|zmTw| zLH&u>g23+<1y0uOL?D{nyVGSM0hALlIsXT7Iwd^+muS#Xs<$KweeIc>)Pj05iWGXv zQ6H-glyIdhFqEp3q(8{!xWw`umWThJy|;mm`?~G}hx&+R*s^t6GqG!@86se2C=nn& zNQvSnAOJLJ^8+S8N;E;k17HY@gs;pD_+d+Dohr^o%V^{5wr+P%){Tz3o9rH^+ufua zrEL<~^4d=7v`*4`olSD0-SsB)vG>$H@rm6=4fglD_r8z+#|#D(r8tQ}0yF>jfA7Bg z?z`{4`|i8%zPN_KZnw+_(&Ws>`-#v7%GHGJE2t_W+9FmwQ=!fCd;RuTB)lC=#*Sk4%E+%A_ zikKKUdL_UQ#YBMlM>*($Wy|t)c1n~#MRf5hS+83s_znb3ElKb;IVbYZSK%|;Owkan zpvq9f*ueGxWajg7YzxdBKnM<-@N+76zLvwiZT_RSwkG?^=rpb%6MM~Kn3R*l&RI!! zbg8g$FB*CnH8*@D_>9^{7g#`Ifvvjxd_<#BV6d-pXIP_oK>`hK@cWQ!%v|=sSofhkJ415@PNxvxv8*2cYK}V-3D8hAw-E-kF@TO=2_lU_}CacLU6ptFTc;n@|=u8{k@99HgKU zRuu_sedkn1;R@Z23I?(NsVYs8BMp zS-3T-h01YwlBvXeC zy&ZfNWXFz(ZZeu|!VWjI_Jd@Q;C8O9rI9bY%V@ ze>@oB5XX9II-gWO1oVj1s5=Cr;pmP))F|6Y@B&LmrEL$Ie3Em;fhIW>Vwbhqyly%~ zm)q-*8nyD>U2ZcXLIazICbN5FlM4eZ99q%MvFYp{8Js5HJM!-F8H7fsm|S0j+$g88 z^OF`TAVZue0Aoa5+pUwd{LBDUoTX zqd7OQHs=-=`Hq}gO#{oH&ta`ut~Gn-u}X3~eV!=LD9%0p7osmI7lBD-f-yMh5*^gDK9fiz*;C}%x( zAQEFw5<4s8P*8OtvJT1kkGIOy2rjk6-YPC1>^&p8do3ut!R&Sj^VvHt5nKCREnFeW z_n4i%$;W#f#SKenzgYZ9aWA|}IE>(u%+d(U)UqaqRJ4->iW?7FT*p*%Sm zCxcVy;Bgg{6SibPOypM;C#Mt|6K6%I#I{P=bTbyQ+U$vv7KGp`PJca)ziAx6 zlxNfy8m^dKU92==V!VPwZo#HSsJgDg-kXsx1Dp}Bv1_}|qn{y{kR2=qb0Q`p!%`}z z&OE-nMi-+P7H~{un}-#QU_l%*gz-G7lw|P}@X^wX^^)d{7CBK-VrMl))g)|P=Y`JI zZ8Pp5NB9aOxDnvcbsJdHM&l*VdhXP(O9$T?i3C=}zqXqk^_MG?VN!cx{iFyA*CqSb zvL(2e{1-SP4T$q(GL4Oj`y?7&es~xjQjd{QIy~+q*J@)7&q%4-$V~2EB*E5aVRE-K z(?L_Q3pH|14cP4?*e%s>yNj~A4F_H_?&Tafa(m8*#nteRUzq1JNt#)FlTyoSGD|w? zDE#s;C{rl#7^}k$PX6ea+=_A%4PFLQbgj)AtPaa~oG^#u4h~Xq!$s?oP8yXHIpX-2 zNVks6z8FiMrO0Lo+JPAlvsq5kgj~<2pUCR-k|{++v?0?E7Pl_#zLSs`uR$skd80xCXTf;3huaN)JQTdF2; zoIs-dMrW8(RYFOLPdG&t$8WY&y=o!l9u?1^V5&-=9#y7kTdD@4mPfCGt5T+-dGC4{ z)ntiVs_LvicZF>}|2^BX#Ji}@kiMmAZCLAvJ0m1QN;wzun0IV|MfKa3fMe&COLm4D za%a&}{S;nAO|it*Rb>u@Ve~3Tcy(J3ZTN{(qI23{R6g)I(Kgi>FE7>Bw3tL1FNMt~ zI?&k+tdVBivVkBo*Z@43ILczb` zZ+iRf24ann1gJ!2vRW-JHk)gW1AF!?p!)UMK1@Y>5G-8GMnm<;FhWsgIF5Covg`l@GyYdoGF6!EqN2%}=%3rRd`m3w;C$zi+!Am{n znrgRUC%cKUT6Z}-lCD*m=39FZJW;ML^ht1xiSd!M-c4Xv zrWTIbL^LXQDorVTf_F}XyQ@iC9h>|#078}61(X@qQ9aLao)p(P2Y*Zf^Z03Y1*x4H_iMjLo~;CUTR ztU3^Vm+m1DM3?1a%pg z3gRx7Dz)?CLhTAWWPQy^7!gB?3kV4eAt$aE8P0AVq!9Sl_~N-0gp02?DoYW!J21mw zl|{7d7`)0TAyTCWMUOaSJQidCP{VWHgNGn&MGl{h)4z+Yr1|zf;a<(%<_$vyW zs20YIGdQv#=COq7KCCDsa$+FcfKi zi>HU)BUEyj4Wk)9Ffj2Wt+@f*G3$FaViS;Ydp83sJ&G1>0@5`+0Zv3U(Y?PojCriG ztWzbF0SoW10kX)goGCciiijR0E#yp)*HWmu9wnK01GF?9xrnq$+f~T5C84^X)N9vm zZV62hf}64pTTJ8bD`l(wct;ACz|SmPUoqI4fL{0LsZg4d^xpV zM`$dF{)XHKnLB-R4ij#X5#7Kfz@Ie7GQhvY28|@D<;-WU>};QoMJdHU>`7y^%?RyO zF>Q2q2#&&Q5vFq#7av9hEWxA-*5F_Wst?~cBrT!BK%7YdYmvF4XctkcW&MK{QJX&X-C*&>(p@R@v@8{2Cs3iw^WVpy61WoS*}{!C ziI#|!zEp323|E>8HkWC~P?1tlRv%7p=DHOdW>Aa$^vC@&^M7hVR5zDuFHAvHv?6Gl zu3FM4i*m$8s4E(JTjHiEC7FX9%uHv39P~LC#Zk=WIpnjBNN0~J>Z#637~Br7w8l;r zB`$_*d=_F^3+Uar(yt{<(Xh>Rag~}m=%kUptt>0eGyqFgzigYgA;AQXF0oQN1 zSMXA5kM1;zPAHpQa*_;VJ6A&~y{0(b}*TA#NuDUQNSu z8${&tRXRFM+S~!&XnFfyn;vt>5=!U;MS~lI7lnnpM~gYN5KUw`=O zGYnbk1dAbqK{-8j@@((Km=u6fc(JN)0n|My1buR#Cnl3n^jUN2cg2R^U730l_SV{* zhwq-<`;n6lsYe|2V)rAHW4(jDqe~Siki;>5?mb;?;yIIyqr6o~*Cw*aPzuD}7SFxs zMhR|oeDuW0L<@b2w9%dnb9;IuDydMGMy!plVWX$dp6H#p4*Sze@4L|vG|ysfi*ra) zHoTR`u`xpd27l3*;NSx=88 zi{d#^TAl#_wMt<;OL;?3(?(M;MpH2O9K#sRg^@vJv^Rr|B_)Biz-e+MgBFsKtsCu? zq$E5fW!jhqmWGrD<6w|({fdW??A%E2nb4Qx;cIntwc*ekAN3v2uZHxv2m?Q=`RLw2 z^KLXM?5FYilE4(^7(Yi>?1g%5US6FGwT3~_PfUtDJ2?^F*mvn~`;Pur z8rk#E9Lt`p&91F1$hWw(aDi~hsmb06Nd96szMR!BwfdP!2kg{|DS5ftTy5Z2z6U_3 z zJSN(JVdumOC=t|+$=Y(D_2g2ux^^8FS}DE0P^pieJq5l3XGw}fNC7^IV7sf!P6C`B zofQ5$ALjcTrriyHMG0O^xff8BvmiaiS+!F9{I-e@9ni%(_VF9cB~w_G32?WLRa_sTIw@6>+uX68a2A!VG;o`!cJ(Z5F zA|kRg?FboYnS@c-H5GfOD`xLe>lxPf0IZvXQ zs)WnCB}yfECPk_gsRIMbm`E1wp2Y5L({(<2+7F2gUY&6G6V>bRE|}-2ZGn`SLDPc= zVZxTPWi}tec?}vVLJ`|zh-kNorPuK&?tudfE020EB%o+%8c5c?xVl_j!zgRrqK<^i zaRXC4clM;P1TBv?hBA}}%fS5xHFmGpYuz5nSd?%>UgcH`I(LNCgh~*1%Lt5M=0!s% z8r-1nypmSy3w!2Q=l1mP?QLLDyIg^r%nuq0(wb%Z7|?Hs8%S4h%mVz+jMYY8KK{Hu zePYBNs)XYatrj#6{;nM z7rPyOi`~l6mjch^apg(#t>ProS3CnzgB=(K_va?8bG+iqRs>T&i|inAlZv6S85ZzH zL4^iPM+c>ubKEkCX=5cwNQjggPnuk(%)>4|sLVfc&+5|Z8dqv?k}X4{m+0V4xZ2RY1^Vau+~TfRO%{v%^16{E zQYF&TF7EXZ@}ADz#j90l9O7Osw4gu`w_!*MAG$^vN4%cu#d*wNq+E1V>ebVV1GTo$ zl2jL+wdYcMC6(Ja@J5D5wwR=$5U28QqTY3zy(Z6$;O09&XSG!xvU69J5o*PM(i}*j z6T8_4Y$uB#95djN?AEa+V>kS7?;+hX*P3Ye~nFRgMfdYZ>I-6-ZNtIlWe z-fYmVHR`?n86-2@nyWqdTq&fd%sv-%MNV~kdZrj@iX^_X?TPtu5nW?V(o+y(3pC{s z0rOOe5-yWP4Xt-jDn*%!T|m=R@Q8NOi!O8C=oS`&GyLWR)1i>;Tn9Njx*_=SKejC- z=>i)jq_h|>1qHE#so7NSOQ+RTcv;@|0z=%yjwQZ|Jn#UFuCax}VUpKIdR%1f6|RJr zz^}G}QjLy#O0UY&)yj1&hBSJqoMoZC`nse*Nyrnw9mp;y+WgGtJ`!qaKq+_J`JS0eCOoZe`WVMf=XOVpC zB4(*Jjp=N5aa|MfS7TAa-~w&>BJrRjT&cs{Nu~4pvQD2EM{J-@;_y9V{Cw4qvU*kr zrZH1fI$%`uo$aMad$lwe8^>*2@PZj1J5U^fUZBRqSfU_I2kve*y1-)0Wr{l0W1kgE z6X(gR+ape%OY9oBYBM?wm7@m26LJ?~sk%^^yY9^5n5L=6Q^R8T0UjZBHK8mHje}>d z>sddWBQX(YM#XIsXFZx0HDehv@6w zOzqRxvz1X_DjWTUbfs4PI&|dg)W)2Cd`+7e_o55X|N3_%HcK$6;t-g>B!DKG*J}E7 zW7Ajmnm0JztFKLaJJ6p^7tJ)-sdz2SEt{D~+V9bN;9D|BCiiA((lX@JO0b_X!VYGO zUD>>KJfi1eEtVmO2YO3}NV>s5^QYEyg79(V5WXnYmYd4m0rlL?*F3~gWPSOy!}}P) zcR=cn@x5AmqW0RM`zWB_PHb!Sx!a8FiL;|PT8&^w)g>{|8aHDZ2!*6R2cIPD3c!}L z$1>f{)@Yof+uR^y^4U6EZ)JJo?p_zZ*D5n>IX|v8v>OwxI@>D2o_R=BfJDBOkL zjg3O#1$^>nSpK&Ea}%%M@&o_uErnlv<8SVGVcW^y+#!p1h`9wu`hXz{XT7;r<(@li zhGSM_v&*=KkE=E0wR624$LGPH9sR^TlKy$i|0VnU9r-*9n*(9G7EFv63MaSSUHIgw)iW;b<-#4? z-n8wFg+donzE@NC|4n?}hujbfPTY2A{kkZh2_(K zFtPBl?m}ULUxoqtd-x^wgO_XDkhY^xcvtFG{J01nFZ|Kl zhYL5ap?@C#(~a%-6o(5>SHD=e@r`H4zc_JzV|xJ!H^#sC^vi$7r@QdJ-$0Ys6=Qp-b;M>!uUfB>3Q+OD9@#b;V z{L;aD3;n}|^*jFLrLTVSjzVGaBin(~^Wf9xmWGB4pS!DPFJ5o#Tg1cj{JPk~KV|+Y z^3C?2A>_}z?fHH@ee}hr?s@#4o4*Vez3|fG_buMj4PZZjK{xb!&s=(C{yDPijkUX; zx%8D^`v?F|o_};>dq2t_e5v`4gP&c$XXsClJ+uCmuidwJ6A(7G@5QUH{hvsD?n&fE zhOWnd;N~=ef9;?oee}ik-Oudf%f)XX@8VbR=jP8sQe3$3(HEQF_qp*`{(NI&;{{09 z!dL$Qf1cTQ2v|C3?_7MDg}%%}OH$}_cN5kf$ocT4udLrQ3H0{k?Ze;y6G(2pW04;> zp9XOVzH9RFJ0>@_GwnGN<;K1L0(qa=wy}>-8~aG3jeR82&HI4H)1P_s^ZW7e@b~Y= z-}Q$kHnzWr{5QtGe&e1SZ+zy|%M$4wW!jJ5yG+zJeTYu^J z+kfOgya^+}`A&S^fwX`7^b0?VcE9Dy7lwZQ;UE7tzJBd3PhV@k<;uU{Gbfz4{=HA# z_|)Uuo+tVn+t-T2g~vBGwlCrH!iDF56jXTr$MI)l`xlUM3Jk!}$Bgy9zIU?(Q*pi($m!^~^`Vj3Uq7C0~CZUpKbD3(a}{ zV@P;>+s&hB(S^s+^db@$-?f8O=)u>g4>Lny{T}3bC-W>4_Qv)y-hmx<+*!hp}W_cy`Mqag|97O(EnHD-KVRsSoV!CA>YP6@&(GE(96$`zdZ5m_*W)S?#8|)g*9>W z9Ev?N{`(v2U)lJQGSK?V8(*S8VNv7no17bOjQ{@4w*#G*P}w_JnKm8ZZk`53zxCyJ zzWA*#UpRgV$>(2qWyf&gSNZ4B8{ax`t3)b9lPi4AN|uS@4WHUn{OO{^TGd6f8&kE z?z!`K5B^!b>yf8lEFb(*{pQe%GatB^0H^po{^yIwf&O9@BWM0O5UDWn^w;l!Totw( z82|Rr{|=geWBz%*dZv04^yIfi3WJ;XgKAHI<}MKC9Qdb~X%qTpLf+hiHwSMF_k8N+ z4}1&L&^GIg8>hZ8|IEDva{)-*_joW#i!In)iP6rRE#I^~L8o;J^04 z^Uscd8^iSwntEgXm7(=-Z)|@vz7Kt4WBYyf`8N4PTafSV%s2kcq494FedFM_*5B}} zX8`$YZ~Ew;tiR#LXFv7weQ)~4GyB+pZ++>ReXQUEGZ%jyqqd1+8#}Mb-zVkoN96C1 z%HNO4-@hw=|AGAdBK}UyE6txB>v{77^F40{wVx^9xG7B|xyQe;u})fp9X6gF|E97L z2>ngZ0G`mNzA^NhH~;5vZESq?511L6%FZd&aAT_Ho@XC<^Nsg>Vd(QWKZe&g-t!8+ z{TRNzu+%+V_-X^WLEXQ8KQH`Xq3|2{{eArY_^v{sj^A1Q9>?!q{C+Qf|6{pO_#^!O zHhzB*zn{eK$MO3KyyMS*MA?^npx*BUEd2hhA1V~)@%xYQ`;U;$pK_^C_zZr(gx{O^ z{d4^OZNMnw_d)#r4|qO~&-dfEiQgZ?@83q+Tku=J@5k}`cksJ}-w)vTEPjvS_XvNH zw;!MX8-8CfoLJ|_?;GZa{5<+Mh711%CYZb*wnDEUzF+*wZSVQH9e?_Tubq59hJT?jcVHT>Y4yf5 zLo-j~Ton&dHyhJeY7N{A3(tx5`Pyo6uz#R`dO}ZGHl`PA*jR`8d2QORM++%^YxA>$ zUG@9Wm#Os{UrWk+ks# zSY&YKXWQnxhw(T2!*?%thxD(5uL{LNp@*OL^G)#7SP{GurTq=`|02@ze*UWR_ut$0 z?rL)sryg*igAwKng@h4&<3^&L78?`Vw-ycl_+>@smS?ee+9T^Y1MjJ=$~h z!Lf5kdtfW8&+zy}voSn2+-S}Z51&7ZD~-gDb+wMPfniO)FfuZNR|o-Io14KVI>YS@ zw*Z0RgUkc?`-m^1w(C|UQk4!41H|zA3qSQeM{&1wQ!yCwur{lHV0ffZcn`|fR?B`SUYokx#8*lE`Yn(rGKM+ad6GVvh0 z6<_r4@cTjZ!pt24=@;H`6zA-hZh;r2ZG&KA;B#v7 z{OH8P{W1);Z=0zsHx?N43udx^SeThXm-E;nj+r+KySL5E>6<6FX_m`{naAeVn#XEO zaJMOZ;VymqGbjh2HpI2QQn>35`HI)eg}cM|nQGw>po#lCuJNi?<~h1BEdL*rMQ~F} zdz>}JLH;_db--%=arhI@T%NC8DHQ%C@~q9EG|u#Mtp96$zN}A=1Gg2rKFzGH!lev& zy{s^2aMpf?TQ3;c#j68HPsA%E(775|mOn@E)_ zt4~yCu2z}|9Rn+>P^O8~X_wb#8im5I+;M{KU>((YTyh2o3)RAoyCn2Q;h)8Cc@h9F zfId^9_pT||B+QKTMJ*KmN0FB6b;N7uHB^##j9m)#jd%ghJuxBV4A05l+k(3jb4- zY8WEfS_D+T4qB|--)3oCFZ?g>__Z<4(fr{& z&Uv^8`pI{H{`yb=b{+iO;kG_LLKSg8)L^FaN8i)XgvEV}^u?TXn2G|B2oBRfhUcFd z#v0(xLg6b~LE-bGg#vAI?zw#DUgSDom@LfT?|9)XzMUwXDV)ah3H&{V@BI0dyZ+su zbK$JNOyT!J0qU;&5WJ>X0zQ5W^=t#YW}#lF6;=uhfL6l_pbE$hfg2yxF+}>DBKG;6M(adn%6P3Tk#(2M&ZRmeDtbw`_j{G_C-%&_8dy>z~|ph;jax>Fj)M zd1<9_7*Ro14rm;XM(=Ws!DUu2H+!K$9H=yw`>qUhBRIoK?J`a~oYycRhr1ai?#R8^ z8a{-RMvdkPhU(}H+K`q*$p*Z3>$T=}fx~U;Lp)`HTB`FCb=)rk_w8!Kzl>jxi^DJC zm7L_MP561^@8RxBjyvS=hsma%5^h1W$no*F$@J zqm>4@Z4$aB6f4)3LoTH`VzdtRIO?B3fhL+Shr|wdBc#^QV7DB;J=}fD^+MnIQRr8r zXQ#T|`Sruy5BK%=4G#1VGA_(4 zq6a7Z;cc)x_utpQqkm8T{{CbAC;O-RKhQtlztaEV{%89Ce*bg*KiB_{`+uSTh5ldZ z|8)Q7`@h)#mHv(Xdj@`Rpm$(+;5`Fp2BrqC419RtM+cr6`1ruj4*dMUFAjWu;5P?; zXW;h+{;z>Q9{A?Ke;l}TuzT?S!J)y22S)}^4bBWcKDajc%Y(l*__@JG4E^h&e>?PtLpO*1WN2gPuDx&D`;NUouy^O)gL@y@dt>iU?fq}} zKDYOid;izHpWXX=d;e(fpYMI!z8(8Muy1bPkM4VB-_Pwk{@|$xXC8d&!Jm5Y?>|_0 z=zAWz_o4eAy86(Q4}I#PuRQecANo%Z-M#nnRiT&sIPw$`Izqo&8e{=tb z_J3smPw)S~_uug_1b3108TQluoBdz!f7d{9pgC}D;9Y~o!QsK_!4D2D4mLSaVWxze z1U|phe(c&gf9i-tyuB?Q}#e&i5fabj`J-twR=MqKYQs>k|Vv)rSnY8Ybt>OA77>$RzJNUPX`RX3940hf5<0s$>ne3o=$jCbixpG`-9ykzJrJz|4Kmj!V`pOM5k_;Ro*Sjk^(~TpRIFba)=;Rcd z&5NZFs#|{2jfN!vB_5&u;W{qUSzL>*Qp7u~c6mVNBy3XpHbBY+2hS@+N{1y+?gR@r z$TFI?+~RPU0s9#>!0u=b;3clPgaofF!81)V0v|NX@~0cDm)GmH%h5&UXR!=Mhxj#i zxpYpifP-r%uPzWjH=G2s6F($VpI%39^|WlZh3$5om}skz_^GZ}!`{l->CTJz8OIk9 z^t9MhYdorufddp1r7`$0hXp4MdA%P91HhhRW(@7~uZ0=Y z;BeYc!C??fnH(T`XOq58aC90N8K&GrA%!t$u@gAZ5KYTb2zEHy@X93w0bQAq%j#-% zy(0p5p!3$j37FYXsCsQ}2}ZN>#K_d~_>u<{#<0(n$5qKV)tI;)4yGQxu_^`(M^w3e ziXFlpt2Jg&4x<&d%9s)`@hw&U{;(*Fy}xY%W!YRSkFEpDC@j6V+{$27GFuVB@KIqH zno+$j$~_Swk>#JeWx};>Gop}KrCr6NMMot|I1my59^{s8^qc{5=iC^<+d|~lkfX(N z3~&6gDXF6qWF+sd;sGa>JgXu}r-TwYJ?bjQxa=t7NOV=mAid0&_!4#EWvpGwu7~)p zFQ-L)(hGeaF1n+f8I?~yneHRP-X+Z8I*BQ+liUT{j^Q=^)rht(yD~A%(K6K*$IqTc zPnBSUE*a^~##$k+wGq&54xFJW)-aTce7`5uC@js;*k z$JF@QQzuUI=rA*RLp1aGim>>=%YKK=NUIU5^{RL>-`GG6A%X5~?&w&sA+c5!*H{ zE07qlQLeSx8gGO2bB$FRrEqFmm-}*Lnut3rCKI_#t;aDqcIPA45iJQ>?Z>7%6URMl z_$V44q+u5(nj^*1nfI17hz73Kkvb@;r?7ubKljTxrp$5E%KZBB8c?bW0z=xG6A0q7fbDo5g`}Pe z>xC2@68Jo>Qr$BPay}s&Gl&RK(dzcfdmDYl$}A4HV|cLAee&iJ^qtTRQCWERFv2QA zTjG7Nm;iBho+sf^7s#d&B%2-P6j0z;{I3=v@@+?Cc{b$c8DNzf}$kr_Mzv7>Q_ z8fpwPy9=kFI%>{YUlS}N}fwA_M-(sL5!P0^KzKnSb7itt3WrR$POsX3)s(aQt5 z8`3y=tu%cEhoBbfa&fN>{9>hv9U?@+Vvr$(I0S)k@h_rDG+~J8nyk@1_>5YKyFSbCp!E=C>1 zo{&laSr#A#2H2U_y>irN1dj&SR7j`Vp8QE`tg#Z`6HQCd;#w|cZ3!w< z5@tVpv>6Ern=NapcJ6Q&4RhbR(QK4UWR@8!#i|UqU7}6l%$*ZYx(>oQ4Teo(NO=cm zH$u-avz6Gd?}08 zhcBuK%W`%Hm$R7IskgahYHS^d6+vW^o3I$83v*YG#FI%DyjYgVE!S}uEplA~mLWm1 ziz?=IXvLXuwbS_4En=x&u$87~SaRr7XSMK6Z=(tT4yGHZ9R?+3+wf}#(|>tJj-h#H zWJ+n^lD;ES9*YTW-i#;|KAkp{VBg4DA;J{^7JV_yaMji2b#KV4*tpStWF*$>MzMHp zNTo3tFF4Yia;$W|3V)@U=D;zU)*3Kez?p8L1A~SeDGaN%MCpr2 zQd(FS*{+{d|3iHxsJMYK&@C=4GS%37DoFFAX2D4`7j)-8;%rlIxx@wjqbE*}oq2R} z=KT2C$rEQz&pdMO#K|#R04wDpwGS05mzeRuDcInU0goN*8s(q?lYX10KYemAa~nOF!s3tteGFz_bDllU_@M}ixb>B~!AT6unp!VM( zBK`LuX8eCw(ZiRB9Z8!hh7D-Q-jTT}GPTMiKoFPbmJr6&w-aR>yg2n> z*ZNA-ol>=?n+z1lJ))>hu#g{)*1J)OR*-ZiI*D)*a=qtL6_#RcsbYsQFJI1Fz6?~5 z35)P9O!!dP%2Ca1MW;hSnB1tTEJgj#7N7~)M&6@PjGF_5t}-dK8Y#R?mDB}pJ#5La z@02BMo0fa(;IpgvrM*yVwkenM3GtSmQsrWW_{nmOad**1eTFthT?YBKf8gOk zG&HnR^dqZ7>WlIhA28ygeouh-{Sl|WfN5CRF>mM)<;QE*6S+K5GtvFR$;`H^ctpF7v+4{TEN7?`2Sy`LFqkX4 zcmQgp&O5X(9kB1PEFq7;aukX9MNok;?{anZvZ5jq%8^A{mphWBR*rHt!luM*WIF=+ zgzaD)ol%ocmhaM9PkI58RFkYjB0bBva*MUbn@ZM2tu+-VHEigMzyjSmQd^?wGg4cG z&}8dQG@lkAz`>5W+6bfF#T_me@s>_g*$}lxhEfZ8rPAs43#u3^^s1^iK#!(Vu}e6P z#j2mHA{ny6O|Oj*`|jY@NjEjP{R&V6P)&-~!9|h?ed8hJzi0?vEUDQC#*#~9u6A=v z19sq*=H+rJo@1P$YPLGZi+pJ*tQ5Ob4Hnn3V2Mnk(l8rD>XvPs8AUT+$ zWs(jv<~vjz=$9WE7g7{+3)3JD8@#@-%m)MQtmsbIB~>CN4f*;n6~U5A)u@SWi0;;m zmoOKJiJf~3VP`8Vs4tcr;L;`OCR_QYrvOYJXV#l*>&`Zw?RiE9dE>xXfZ+C}V z+(*i(P3$zS>eE7M8;V*cWmsS9!l?0#-msKYr&(@W)#?gbOP!rJwANCHK|4@F;g)VO zIe4`(v$w)^ytUs=8QmeZN0e(*16osl1Q(1|D_C&5qEcIo~tU?L}hf9IU3MtV(lCJ`jER0>wo+Xze(3(_fBFW{)SAfS~ zfTRGHHJ4P#`cYgbJ{0Ob5{W}+A@iFu1S>fbBF|-ujN+n%xY`MP6I-1_pA>y665kGl zqjV05lM8SV_Et0_fp7Cqb}~gTFp>VJE$wxz)ti)Z7XDssGE&nud-HjWP%+gcXOU&vEC!?iwfyQ6lU2tXXR&vPV7&qrNm9jW8hh=n$&eQv-d-*Ti6nmtP%2H z!kER(`cL}P3E6&x@}Qmgy_Z|rSfI^kQ)sn@*Ip*Tx8)khwd@J!z5&j zIx-~Y^qDs%ruIGJLYwV=WEeq#a=Rz7TLO>T*LI%-8!z1LOi&bqz68e;u25t<1<$&j z5?ZK^(Qd62rKk2*!kY%nEtspq4$G@L2x2FkR8&7gcZ_Ns4B)t_$2phAF0`U=`W&Lq z`6tu1{Il0?eTvtHd`fKvfkA3i95LsmR~E60nJHTyC-A843`FWn{5D44iG-kfKM0Gh z@lVj!44{9bT5CErpbQ+GPl3ao6B>L@{YadHm}*v?QXJzKVQ(u7o~qLF<$%1}l4YEy z$pZlwGUic1&tkYrBc(zWt{kO*i_3<@Dvct^k-@h=5UU2)T)NDjhgT>aD=~kCmqy8` z5s7zE&JJ4vhVsX0)c=j5O(zC)>qR-vK)*Njj_VNWi51$KH(hURP8QI4%9fUH5g4^S zu&I05A%16MNz=07#_6}xcqkqdDkx-KBD$Vr6Tr(WVp@XPRDWy zw}Domd(llFwTAs7j{^6GbcLY6124+ltzscC6L&Q{XB8hP_RNf*J`X#%ZjgpUQ0a0q zV4|__2pk>Dl=F*_xtKvw+RvjRY5kM23!aS%W-GddgEZ5=qd)=qfq@dCf8g(5^snSJ z0h2JKZfOF_)}m7pth;QBuLxew&~$O+b~^KheOr~tfv*)_++3WzzI=Ig<@z*iOKb4Z zUun9d!tT>iDKV8EgX_3NchcBPz7^?4#B;4_Y=D=R^6?~S90CUu9gCD19E$F__egR> zh3p#bu;Tm)kB*Gkp%G8#a%ue9ny%X`Py~s+^Xb8@lUS7_dRK9whO4Dra`7tkKU^|S z?>TJUxN+%Dtj0KZxozAo*~c{-oNn1_U45m#?&+236;*`~Os_y|O8iW(boYfOLLivZ zjN2qxPS#1q&P&JZDmZ~AAjek3U0wKx9le8K}1#fBOIDT`- z+_Gn|W2OqHC6Bpd>Fu~Hnt{?K(P(NX;}XiGvjg99qLmA15Oa1;_+F+F?r znNMY0FkMrm6j5Dl3kCeNx>*^Obkq8AYo#`;!blX6N|XVe=8jjF)+~dc+w3`(K69ST zC=0=tHblXWb-A{H06?NqnvlhrFq}j@&uL0d)`+Zb(5*ZtlvjzqgJ@BVW_X|+YG2~*fdgkIrf{lY2PG3CB_jlTWz}o zTLgtCyLR~&sN%{d zl*Vd}wIyEVEt#>m2qz~)$hDZgP(F0%(D<2SUBvfL4M%g2?6h2cY~#*DdnC~n#Xa#^ zusW|>u>+9S28kgtJT%PlOG37ta&51{?dqa3&wIJy74F+dWg%)KFP2|#P?P72L#zmj z)REp^(CyG3_lQ%P?7R-@mx2i_NP%5lBC>@`({mgcW>kB=Y@dGbFPid*36H~Kdbh6* zVh-=xk=?SekRO7Gn85|&Zqr4gbnSYlu8~*b&1ZffG( z)XdqDM=6s1M#<&?)jLV#c(&QLcG}|l!inKg?aQr5_#i+wla12nIxQ$2w@|?K(iVz% zF50Zj8R^2UP74uNZB_v#PPIO*ACp!1(77L-7mVuh9Dq2zj%TAo{FF`6BZPgWkvR7+ z+YutoqimEZ(W5(<1E~?E=FcBdh6tn3<)^AR`WuH(NCiJ=TwkGcQfvq%Hr0B93hmc! z8pcEqbwpw(G}Ux$VXuH1r@ppxBZ`>{YuVbgFq>CNk90FfqE9I+L_*1)8~Z8}Om6a( z)}+R+pUw@4+YEFdqLpacD3qRXqdWF^{`bYm`7+LXP?hH>Lz2LLfWf*O#*aw(@Ja-`m$o`dc%C$DOjXY%8QK+q z`ESJ@4vdzgOce$8~Y82 zF5%P%k;~3Fqv+>gUZaVxf8aDAp3LO zVAM$y?Xtx1FA#`fp&IdDQXWG|ZXz@Zv^7(yaM~POF**o?Ko@-o3LB1VmV?O?mRt^Z zN?9i$^Tii)DQom#wv?=`X!~Pn?7@gJ2 z)1%md#afceJ5YlTV(sK3#TGw7oVa2qHr!^U-?VDi`+)2xNEj)d~RX-NrD7uCrI$3vm_ zNWjkx3!!0-PzR*bScP7xwuP6fF99?Uzlg8={v~e#0bQwBL4HIEKN2NeAds%CFLAFg zrF@0fh_jyK*mBk=B#JDcv#w+%@+9zu2V-(&T9Y9+nq!M>S3zSDv90FB#nBpc+nQ%J z`Np-V`PH{Fhp!-IPGgCneHO`GH*-WUgKXf6fCGk~ErfC&j|k_Xt}OQ|poBJ(ohZhz z@yo4YTG(Q4im*=dSe$8VXvS4#v5jg;a#DKGnvz}?r8`2C8Z_z0&#fUwy*!703dqwh zjRy!np*xP%c@IH)k65Uev9fk$lt zTB(gw9Yy3{9vgCE)pau#X!?bH6Hb6wqWH+k_h`mQjthM&OyK4?zan?Ax7NWUhFO;D z46DF#IlUaT;TC$1vxGz~a!Fu?X1%stcKf}hosHs7#6NW8mHu-Nv495ML%p)DP3mcw zFunc7v#9h=P7BzBRYav_ZCM(S&&6sZ+K=UGO_53?9HCssR(Az=JfN9sE9okEWA-_| zIS{PbWN)&h=c~{@ys_|VqHy>ezTbqht}^l93iVi~s3tSkm-@W33-%g3$wAowx36So zdqmcuil3+>pqicAY5i3?fE5L6k}-_@taNDC26j-?00xXoU_!#hLl;~8-MfqUTf~P7 zLT>waOCxNkyT)r?4=*u})4ZYZ!1UyCUev_zObDM&(LXHuprLW{e?8g~d&) zoCbCv_~HUwDq-L%m-c+%;s>S=Tza59eL%nLy1!=+C6AQggbzTStYl&-MKA-f+;Us%+K8g4i%x=8}iDxlcpBJB2xGm}Os_6Bf@?e)H3nQppl4{52zq^0ygV4; zXHNI?8^tmh5X(g&18#+@&d<}a#9m8m(rSHI2ejzz1$c)<(tjj}0fA0--pE+cvYaLY zHJ_*57LG^?Kjgi!Tt{h?u3f|hjVRz^D3@8sY(3(I)Yg@QYk_z}4Ku3vbU0H#-`jLm zE_uGfEc~i{KJsdo^~7dXWA?~46deboFn!97NM^dq_Cn|=Zy<}rfvx5It2`QP<|^i? zrOsk->hj>??s*kXVi|a(!dBpMG`V4-0+XI+O2k{4Jg0c`A)*{@;tv^d+-7r)&Y2_i zdgZ!&?JU1!_2Xo-GKtA=tEDC-Dyo7=PHIsrl`dd8$C&XJe&mKCd>uXO_;z5^Yt`7F zKB_F?fk4?{>#Ir_=Tv^9M<s-@@P-^3I?uN9 zz+eL?#d2#K) zo;`Z01V&DY!$;4&wm_1%e&gN<2~-zZyR;(P!?7F@hH)w4m)Cr3<%&3_aUpz_tdP!xKPV)Z95E+NlA!Gup5V?z2TcLS z={M;FnRplHJc{G7&=~SSM;@<;nSyX5e!5B{X|IDaqKyrbqV-I%w%%AQ=hYrHOrS-g zO`+SBjwEXUFCaBy+R3R+%^~rDoSaSV4jXNqY4;QpAIMmI%@r z;$upIft8|I@9SNUnyZfM$?G9Zv8V#x3_;QdDS5FD6dbYuc{ffhZVf z8XF9gaX$<<r1SC`@oU%E=OaC3M z@UT!v#94hD#N%}Y8d$xm&qH{gU0Sc|(_TC+W5W#>$!WqqB+Ol}Sm6ipgs9X_%l#0& z8(QKTZa-^->)sgGy-8g6rf}Vxz;$mL*S!f`_a<@O+a6c7io{##vv3#@5)dce2Uu^& zm4p;Dta%o(Ae7v!)`XN4cnHsQe6CiO^`07B^aX8zCE-XGOdq5)s70J1lOsgxtZE z(JhDVMJz>7w_X#}$>iX+p}H_j$o>}%&c;SCqp=-kg0IfwYCc4t@59-63!%WP9AUFA z?`-gLLalmtmvd2|?ZHJO!PRSxvJU8W=)>INb~Uv#B4ilqiV=s}m3Pf|vYX0EmZQ;I zF?VdOw*tRyy|+TGqatJ-y25_9)>{!euX%5!(a-c&giKy7ubp>~@V3P8caSZ%f#u(9nA z1GUp)f`%Ap4-%d9iIkrF>}Sj)-I&Z}@(}Z6N+y$M$VQsqT~=KDhdaXP{9cT?kyO4- zG|n|lwONOGQ;V9cpu{(t#bamAo*J2&K?om2vp)@XEB)Z1@}8r+$`>oWAG*Xp{k;#* z96s24>49BGkCZQd;LxS}cl}_k0YB1U^zwGlNaxpOwBuinIlo4bSCh0O1Y%`QbR;x> zUjg9hX%18F)3rq6CN2|2()P)y+nHy$zXDSPLe=RV^Q~=VwmyVX$rUKo#0(6&bYOI~ zG`HDuHMcD7x>%jIEpE%(-10xX4$BHyt}OsvN}~y~@+F+em);1Xqy;&~*;p{V`@Y*!H-|M-8hWh}fD>fWIOJ=S zhMAno!%&&Wh|yNwIZ~mnm{5pI-K;kux~_UxdWn@ObWPNrsUFwRMAb))NQ6)pKzX%j zr@6M}bN~!ZDfqG!H0)EgbKdG?1yMQ&iv#>coedCo80mQuMJL$}Epcy87)<7Hl`K2w z^oTOzMrkKfW?Z~?yV@ox4&BAR(pnkwa#BVJB6kj(C%va)n!z0PjMFnLCT%lG7_q4t z#{2|g$XZ8;2PoUao^U~rCGp~*T=FLAdtja6d0BliATRuR>rgL(wCi2lDdv|s%PKUJ zgdfu42<5G@&>yspAypA^TH89Xbm$2B)xDJNB5Ip)rf-VfGc3qLjIbe>-3%vBVxz-8cFLC9?>>B51Y?ObUQ z&D*Bjwp>7@v{;hGb8;(fA*h)?YofK`eFB!q3U@lX6WWr){Ex3HHA&{?aTA33s`J3Dn=QTe&CpW_~i_Kr{_!&MWe*)9kn4d>DL5JF7(S(P6fQ0?sXUvm(kB zTMYu1DAi#Vc8o%c-b$H{`*KvhzdLoQa@pyBLo={Q(gWxcsNj(bI;;-YWog?LK`RZFX|iFLRx32`X% z^m|XAdGs`9`yRs!E%T|=8BATV0RCF@O1mJN8X;u6A}V?`BTCcwV3&aU#TzEgMv)dE`@>hbXaG zloh(_6`txn0@Z7xQb$J20H$iId?@wyR#qA{o@}8)uB?~xGPe_|+P_-{zp}b{4Kf!9 zQ*0f5$~DN}QtzTQf*9@)YDtrvsFr+?hRM_Rn*M~8)8CSEDlj^{Cz%ObFD zg*G*JCP9pqrQQ|S71nc5OjoNhe>=EV6w95;Z2|FxM~19Sa#jdO3DkFgaA zdEtn1X?3C;PfT5ydEdDc<5Rx3x7?YS&2e~w zQ4dPJS8f#t#b*2#$AT#og2MSU3aJpw=*g3-D+{0u)v3gZiheIPbHMj;9>Yildl0Q3mvEo7+TtW;MoOBGJ zbUtguv0ZS+5Iq|VV}8nvTQAbf3Y%W4)rvGs#D;OGm5Rlky@L-kzL10%0u~bJzPA_l zT`eq7WlG)^0^h(LD|$O=5!q1b(V~Np1Q4E!y)}mz(Je0eiHDYU+Jn(Mewq>~BJ0*UG zw<%sW!AMG~911OEIS$dy%A;m4OEZ<5VBVyDSKh4#BWYm(h)4&p(xVUfa60n~)A(9j zPcfQ0Tjg+=#b#a=LbAR}jvV(2M+LVy0iX?Bp`fRB4-p+KvwtvE1I}!6v2#`zr_?mwIa} z-n7^yrdF??357qb8d0YrON<`5Kuc633zK9Nms$i}tMZ&4SzPBw;auxD*D!hviiszZ zd9qz=$q5l0XKfX@N5ymiFF|;c5QBJgmB(X>e2^v_n991Vr z26_+`1j{1aV&7xCi_?bUyh32N4`ZE^Bzl_USZxN9d;JQ^kvj)uP;jlR5^;+)>mq9ZLtU3&+A2-w#VXAcyX8+4Aiuv7JBT2tk}-zCP1KfIe4qr>^jT?l>IBxNZj_!lTNwam&)(@LoJ6jam2xWe`>0$ z%+BIW29f2GfbQtPZA21la$`*{;SwY@Dk`ygPp4Z`^LoQwxI(CkFEzBz?dIFI{o2Kz z8g@*vK9FzJ&PoT1PoaqkBA`pevq;v(R@AV**u!?%=Dz8hYzZvibX=rlL16I;epgnV zBHSp7jt++ri@h%*$M>U`Ho^~NSJpdFJOpXOHsI1hREbKQa#)g1kVDuuu^{N#M{OJ)e>x;Ii05Z16#ZUq*W&{F}ly&8J1QTGy*)LnSl;}&AknGx4uQ0WhYHm_W&lfTdw5K|n zBgCb`H%|tg1Fbz4&l_y7ZV<3rtuKXaorp810|{M-XIj7nQbANfzaJoSX|9hm5nVUe zd+virdxc#v3kv^qfzw^7U^%IwG`y)7D1rsA)|iNfGU@#h3*HM)=u4 z#L$qLJLy!Po-bYZr#UO+i&>(DD$$k=Rei|eJj2dJ1!FXGNQkvM!o0J|(-mObiH%dF zT^*57Xg#T=sZB-MrZg`e*@e>Fj%FW&2oV#wfOEuOt|>^vXJ3rkfDwBu6H%JLt=YMQ z@s)>_v3{PE$jR=dL{LgIS}FbL5>t$U#yJ@Xv0cL~4pUhYYLWJwYqxR^ehx^$FR2_1-+Tw?j&XRO!dim=z#uK)V)M9$V z&S)lj;L=%DxDiJ$+q&f7tRAS!Hqpt3&;zNe zoYliik+=)8?5k1AGaL*d#PD}F%&1iFQX^8{HBy3@q12LZPt1lC36!W(L@3yea=~y)Q+jh(-m?(K8E6tFsKSAZH5| zW5_5^(-fvyzUoo{R}QfM#NaGr_ti6syPr5>7-#T)P58#mmuXRN(NjgLF#<2fJf}!% zJeey6+z`6`;)a2|)kErbURHpsnTcu?W!>LW(73*Qd36Oo4Hzk1J;*4&*O_|`8g0V6 zJ8CG5oZ;p&0EU{=!|ey2++xFmgvgE_pQRlRA(LF?kZniE04zk*VErAq_cjeKkuJWf z5e7ePLpYyNaQ07ZXQ~(cI|mXi2t(Q>rirUpOL&Ur*jRN2BlNUb_uZ%>!n!aqk$t#p zZgr(uTj32EklQIaBc!lmZD?RQk`xFH!r_AqFKP$6i6l#`h|T>?5JD`|uzOa_OVBq; z$G-SuNegpA|9d=r;D7dj0g@UqVfm{B_`-s0aadX5ypBai;l?oWnY@AWLSc{})nA2J zT7zL@g=LxUl(?WzOjYa4wUx@!qf`dPy`c3wX!GbaYAq*DPtBYf zd5ksTC}Pl4P=^;ha#pZ`OSPNj?hjAbVX1wJdW1S{p3*Cdc+V$QH9{f1d|}XVM$5`O zlvC7ui+htL6oG_-Mwg3*&_&^TdMsD236({E)hZuA$R=5!kk%aPUQYn2D-?2wdLx%} zRdFH`7yejod!9Tkbzt?A>H)Ru`$j762?F@)rA3kl)g6k zoMdwcU%N_9;HYOPeVMRvqyf?l&@nt?%0&UWONxXhY~#Zc(90L~hT*C3v9uhgX0-=5e zJxyf=q_s)3-15>1nev(%%4f%sTR4^=miP}HS83X9XgeDR=;|UaVU#UGLkbrV10Swo z{EBAbgVnjoKF!i?hB0JY5%Kvz8B7tRo-*15wnA&zYf@iMsySjii^8%beIRqkyKi60 zs|W3IuWU|90uy~CzFjNKJg1?y0VkQuw$@5p1La?hk(%txTxhoBvRu>n=!w%~XC9rL zfmoS5apv^QBj-+>98(2B^hUbALpKBoA!Dj5SIVW4(~~Dg&zw#u5%D?sa_Pe#C{NEn zune`dmK` z#xY*-V*%e0v!W|NJfne-a1@3fQXJDbOJYFv9Zm_1oIE!^bNbBbalE#h3Sel%b|K5a zl|e4)MC9I_J6L*qv}py+9X8qwAbPOE zJD)lO33r?-eZ$Zkp#=X5o91(ec4DRRg!G^9KT5y6$$AWCGe2DntsNMJpP>!HS2{j1278tZGAmm7^4SvIK( zFGd_w2XOWTuUFT>Y2Wr;#wl7w}UX1SbJ z3zkGdz+YaCr}q%o%=cIeqdsjm-tyqMcjc6jT;9Aq$kN=pS;BWMj%exz++e zWH`$Lkk@{cX2;2h?3t=dW1fFlG*LS(9oJy*mNg2Q)oq#fQ%7+R19(XK<VU+dxsbd|u*_l#4&b7u#yphr8d4!lUWuiUgC+(r z*DuL6vnL}hw#mk7MLnJ~`awH%cIR3c&P!5s+? zUX}|)FgYL;5b22>e|3!(_^lg3k!$!JqxQ4^Y|gKlYp`4CnG1Qm4)5ikQn5op?(i7A*OMtB`N zoFp{u#N^D#*|Q@TkhT|)o&1!}j$)V4q7Xe|NzK?DiIm1%y(Y_eA%{2V8@}m2!-pW#BqE1H~9| z#iR%rUdtRQK1A-9X`&VV+ETadNEQjcbWfPDjJ56vE0HI;Jy>g;tzun?@T+lAC3)aG zxcgc}N1ygXPPY=;x2s@8woD@Nuh0Xx2IxMm74+=EtQ<0>I4h?yao@l}L}q$1a2jut z{UX2pldB80Ilm=PE{#@J$P1{tSfSggu(L=OXdH9ZwI;XPixVzXMqpmyCoJ29Tq3=d zA8HLF5-U!Qh6p3a256t3jgo^wlU+Vh{@XNTB!xSX##sshg1-w0m9o+-F0Vrb&Ef=! zy)pDLGk9ip;UNMn-HVZ!jzdF> z-1cTK2yQHrxC4v>Hl&H!s3>B6vYx({FjGFw(L9+NFa2ErCmG8b7s6N^rwm{*9;xvW z^xS}|$X_R`9R4hqV_G9Ory`roN+^a1oR@qeKXFZwKdq1}m85)|7Km=F=y{sOqr%w1 zXq@vVpoW);E^=HAtsZM(FL6Bwgf4UndC_Oh@0HMGGflWXH94*9@!!RrwKT~^tsk+W z=p^;1xCW<3_gVN0*Osf1m^#hVqbsZH3yXdAigE=oloMCbma7p?1nAaP{LTC`kv|F+Z|Q@O1xixe;UZqM)0sB%@w*(^~= zayk&lSRJO8IW@c3B|R=v=s>@IrukWvkctz^?N0~0)vRsDCi%>a7P=*y`wDCEoOWaz zEzD_T3?n6%ufP(neSQ%m6Xtgq<*eO~&hBV2g@m9R7&5DgWIGyM;ml%LR?KD(z;m=a zH4<-;*R@a%r<-KloX-_PM_iuBdh0x{sBLooJ&(h!OJDG0ONh1&M~}Gp`_7%2 z8Xt?H96ittNZl-a>3+cCmp-4c>wZ9-W?j>zbQYI_JkupsWE9vjBr#xMsUU_o5{v`i4CA7J^&ebGhrXVG_pr~Kn(5-Dj4x~8qmdo8Uw_bC@$m~r^xNN7+e{VVQrNFfF3^FJzY|c zIt;EV^|>V`*)G91eWeF>by!=E5L0jRQk<{_1Qw?;pN3_=n{E8YfzkQTC~1xV{f6Usb<;9 zFGYv@3>h35U|w*9c=48?LU_jtQ6t2{Z-F_><}3sxS17F(zcylbrD*9*k4)d(&;*OyWHRwHV+3HM| zk*1SY$*}O9^syE*3b3Q9jDg&>FUp_B&Ona2l4H4bIcA#a>b2oA*D@z7poqmpwUU~wk^}2D?owP`#8H&>2G1*LKg6zye~C6J zY}9XMi^42@v2fzy1k(;+9I#k;mr&ani>_1=PmojzpPncXW(%2R zoyc-yG=`m#PH_d9m#JDrJ}Px619OUomt7?GZL?Jv>-Z1Vmc5$x|u=h!3ASyaroh4i3vPVL-y8H`iz}( zk}|=vpbY^Qf(`Zd9P321@1oOh&fZEeQCRB~GTGcFyHJ&*o({eoU_wn9boAtERJH%< zD5l}}4WbgA$SZF;xMpSua#&s0u zxY9<7FhxDi3yG^OJ+@lU7Qzwucupcu@RXr$(9F*#nnKJ_Q7{oOfvY7BBWIb2i5Hcg z^nq+eWK5&%RZPk$DWrVtEEv&;^5a8y{e9$>Ut$N$8dfUxg_cYfXa4`&`?{^Tjx5bybIDrs4rz+61PhRmY?m$D zQX@b%T?jOQ?C}Dbl|Ta7N-`-jvCUYXn|Y17o%?x@xtvFs2bfow@7q7|cg{&bQrXpO z4b^Ssi4$kXjvf0icI=4w(sd&~kTe~v>fmSM>q(BI6a|0lsRh>E>TsEt21bxf%tKXm zWowm3zrGofQ=Hc z$c(6C`BFQMEGz)olrV!&@orRF{^5sJS`jKmH*iQU?X^QzW0wN3gr`D31wOR`|0 zl;W3~MT!kM9&sZ=^q|awhAtJYE3svQhH1FJgc@1Zcs(X=kIg*?PZ#(vYg~tTn;BIA zzQ(P(L7GmeSX-6c;1#3MyE?=U#IW^(d(HA~tCaYdf3C76sz`SxsY!IY%M&>#1jD7o z1|5qY@pPdOR#5%SxoPrOhSZ>*UwX2s(sNe(B6msHPjpaEe4n$9BFk_R?lJ`=y?cWL z;XA-|1(0na*SV9RXlNH96vezm8nkRc8m+*;vK(=NCDT0_9ZuG&-B3HmcQ&><261Ir zNnc7MiK|_SV`#1L1RDA2Qd2uevMOGu(Xo-{F{Luk#>nKpjJ*v`i)dG?ldBI!nD0|^ zJGHd@y*DFB{@n={mUVaPI;V?pbH)fCe z7vO(vztR20%u@58e;N*GC|fRt;4GtRi!?f-c$;PO{X}EGd+X``&D;qvoMD zzmc&y)&{c)^90_e9`wIbNmY_*WDlTyciZTi>7>{o^;CR9^LVJ_?o^^9cTYr7E`HjrOZrQyMM2z*h<4^}d=;m&R@BQ;P;QtzHHwj z=**WJSJ~fJh9C1ug_};P`jC4=)mQ_=(97UuMNT$JEaq_;u%#-n=w0H&sKcf0*shx7 zph(J8xuVUG_YhErJkZ;E=ec9!ntCx$njH8F(>`SLms8;4pD>r zqcWy)OJY$hI=9D0pXUSeH*uN5;HZmZkYqV` zOPAqkGh7HH6wAtPo%k}~qA?14O^3zU3mx(i;;wTaV(8^qK^wzsYf6>2Nmvbq>Hx-m zCu0zri*G}_8E4@=60i-Ugl$l6OcmcX@|{<ZUKZ=3#I6CZf$w1)VE_w$L|vA918Z zvG~aT#5z^<;&=$f^YBbb_XI`F*jRQo6GqjM^b;`4ZCQ>@Vn-_rUd1NmVD*ve>7TcL z?jf0;n$@KZ;~+G9k9SPe7fyDwAu>Ts4#W_*w{!FaG?js zG;&$r8KQmfo7Y(g@Sz9b~&?#sJ5F1fZE)Zm28JHSwz z&p{--fYnIRxd%F%a83#Jllw+O8796QV)uB_wPnM@f1xV#i zyc5fvYhmNszJ+N8JLZlbNG*L5#CWX@5pq}w|AQ*AG-R6b+a>uFy|IZ#UA<nNBA!BZ~?V5?IM@;)eS7T8~7J8`^S<4*r7?ieRMccjXTyLxkrk!*Phg zVa9;c04C0;jS-$1Cka=wPA?q}L|k@v-Y4zMx1#clx4wib>3uJ?>LAoKh2ZFsl5AEY z{8_X~I5y~JI&5-$q3WE3Gts?JOZN2HB+6UJ;b12?J)Yx`E)yKlaJ{2kn!t(AW9%)T zOD?j(U@37hM%XlNt$rsPHk%M4$wSI`Y?YU}!>R+1u(t_>#n|CQ>I*reV0wRmyCV2s zxx471b37|MqB-8+PUOb4cuqmtZU84Ikn0#{YH`{xO~D16fc2YSoFZoy^LC1iZpt_) zO%RnQnHj3A3LhzBXs>cM+7jOnvM7Wn&lOB$6>=6zW=DY`1Ej*FWOAD27LscsXC=b^6pN-Z3!JN&tOobo)497Z)A z|9526tTQE>>dP0R(nUosguM^Rcc#XW=nU-~+0I2cuy*8WFnIv|n_L_O#|d{qVXMw! zAWu+`^S%Tz!6TW4$1o=rD?u!^3?vu;r2-T54a%M7Qw_pX7)MnD(pUXJ=U5dt&8{b{ z-bKnw0&&6ujv@SzH-62HO$Q|@pt$gqUs>AVd0_-6eTn$62kCMEg^$Mz1RvZCODtsxXjv10;qBE!$u87P zcz6P3l3Gffq@YUb+S@msxMr(U?SOt3L@Q9#80AF#w2C9APY?>w`vz|U3DyN_^0A~? zBZ78tI2`se^kPoX|8?!HC^}tevtCLkpTk;egOd6jzL< zJ)}NR&8?$W>t>o}B)#QWI|@KjmH{Vf1=X>Wbb{3oOk$^R^chU~*K}S1PUyQ<(5{Ed z<=wjU>LGg#hK9o1_^Hn!DY{yzYL1YqmD#UofW%-=gs&cwt~;e|L5 zsVzsjvRNY4Ig>!Tg-mfvJ(!@l5+H?62nuAvFeX~c**N{IFi*8=%eyLKA3jzA%x8}o zZAJQ;kymk@h`CmAv`xNKg_dC^@9BRx?-z;6tm#WtKB+3JtC=aXx(ZQ^)xD(x)Q0|j zDKSjtJjSLT7!Sy3yq&ocMy#7px|*~|VzgEMf-@KDPTlr_4edg>u$=7G$ZUpN@ROCq z2wt`4Fyr$(T&Ah7I0Foy${f`{uFOq29ZmVcK64gO_5Kc7>M;1Y>7%uyH_z|mx|a*& z6%5AsH5d*1-Tmcw&DobXRFw>){hfFS=1m`LU5#CM!aRY57iSk74V<1}(bsyK ziUGw`65rY2y{rnA450$Vy}zux@Pz*+Lt7&C)mLAwZ9SjTD|oSecEIzVWUbal6;lS2 zkNMX1@Tvt@?W%u_v<+NtN@R#G;#hJM@l>nzaZBE8{)YI_lERlG|sb9>$$R zG6OR&eRRk`hI(fOCv=h!F^Fvy6{AcI5gBUI#N6VhF1_rQq3W~~abzCoZf<~`z&Y-^ zw7-(O9G_(O%XTl%djkm4vC1lrKa@&{Aa=%Aqt>iM@%1~-DcF)UAG1(FPrH4@iAlTS znhACo-&|b|TBabTzVG(YFFA3MXDO<}_|-a?(F9=B==^4C0XhSwy)_%cuuY$RhmCgB zv2*y6LWLLlXq`^1U|Qhl9hblM`4SobkgmPV@y%J8v`bPpzPqT@0a0 z+pm@B(rVF94k@U55=m5XSf7z&SBR%B!0-%7q+=5A_`N#f*zFXK3C~ypx?8Lr{Q;!A zUe_wx>mTO;R>{7_k%Zpd(ac?Lho=3B!=2o@e!#Ylklpg7)G(7 z7uB>Hg157CQn2LL0z|}RL`Y^k&gh`ZCjy&T2ZV*Ff0r8O%MP677fEn;4;ZWUV zQKf{^9v0zJEoA zTQ7lvrpZk+j&XkwnlT4ebaQyCyU{W5(3)J{=$Vt zIs?=8(mSiPBs84P&cfy1$rKAxghgU_ZD~X0@T7C8nE(Yuw?j|Ywx4b7tndDSE6}%J zEN{r<{Aft8@felpD9^W=DASq=C|KQOoYS^sg;b7~jHS4YR&Ei*DTWya2+%}4Aq>ij zWkc!^#!{TT1;3y`RHEn+$0{(H0Ihbdzq1J+9($n*l#OFaT=4#LAB5SW@i2@Dl@jtq z)Zu)E2NBkW#vrq?F+$3P^;R%|aO^I^FxK-ryxx~Ky-{pw0=CRAN-9nw0FeK#dwDn< zVS)lxh)Y=YYGLJ&$XQS*u)sJ|MXF4K2$DvKRU`w*6h=h>h6(36rdXX*UKK8WGDPA* zLRhJWdoe>Lnn|mgF&T%yWVFi1I9cdtvq)kEiZ*G-O7Z$nuh!RgRc;E3McXYM4LG6) z;b0fX8@dLZW?A`ODE8SN2yBEYEj!gW&ND)D&uJ?4A37{L_{+1FBRkU__IlRhFX3H`J{>+~l%58eU!EvL8cP zlDOK6iyk0{F%7j2D8QjAbz-tPvr$2`8HU(N38%Cibi24_tHXH#h(-0=L%#G$?-KJZ z&nNJGlBP?oDs-#<0)^R==$b`ufb+%h6tyvCL@NyH?P$c1`@r3Q5W9hJAwmfGbysmn zFg&3?eg|bL3~LIY7-Y~-`(86Q@lFIa$K?6D=r`~j`yc1t|8inhR;{Bp08CB2BB|MJ zu5PMZ+uG2ja7oT9ZXH5wx48N<-ZCW3n5vgSn&Q1dCnx=@(V0&awe^HHLZO--mV-i% zL!%0->)UH9yIb2oAb$9Ad3zZ@IdjBKXzgh5Z4Sx2SWsKmIhHqf)>pPR?Mh^GGJU!n zR#gzD=>2lg8({)+4S1NN{!3a^=?DAxhfm~OBSqC+C{YlPq4ser&PvQ}Vjg(;N>vI3 zBwnf%CNl~ES4l9F(7w$49lQx3?FGD*6quEYYhrM`1NhfRq;)6XFwv_yfIgxN#_5>@ z8$Ss3>-_MVYT&2Dxvr_uG#RO>TFeog3@J*_?=%ssX#@C17=M@&|X2}+E|5o zeE8=1 z!GQXd0GNWRz?{L5bZ}<1h1elfV=~6=o2ZZct-1%0Is+VMa|N13Ja{F zjUyZ-bxSB7o&&d~E=G<~s5_f^AyteTD%O)C>be-3NXSrm9imY>XhMRTO6uQ~6o9T; zOJ@t{U>*%ppz4+tUe)cU5rCKx1Wct941wv&q1NfDibh0lw!O9U$%6;TX+R!F0uy)ZM=H-RUBhyA6NLo4mz7KZSvHFG8~QAlah%N8o%Vidv` zGGi-&qk<=de2AW@Dh^z!ZHK9pKE^Iqqev%WB6qrSzAEM-`Xjoy_%#||%g&BA7p~e# zNGz_8{`2Sw_x^o#A3w0ChrtQ?ivI?PUScjq;mDTktcX4950BntUWh~KV@|`x7jf1l zrsl2+3hP2t5JBE^$DQJQHiLcByw1CaI#m^Y`T%=$8|g7S-qy0A0_#W z>9U%3n%&|ry88jJbW4h5+ZT3&We~CTCCGiU<|NqB{weNNh_%>>uE5~dgbV-d2&JGf zWEr3RGxphl%Tg9IIy%!S)lBz=JVV*p<_(N8=JPm1Q~|yFGinzE2Pefl7hfeO#M7t;NQsMEJ6d#;HjemGLs+J13T7ZDp_Gl?mTt`SD;O-07 z=i02qRj`z$1>_60?l8z^d4i$x<}kd5ff^yu$fVPd+%pW4bU`_NKwqoNDyZnr zSH-RhL>kFH1hxS*5d7B7q3X4S*Q))2{hxe%MZlfLKR-9A3Jts)p%osuz2KnSCYly> z3!`d^gdUAzDQk$`Lt7rpscS^d;_bO-l_MX$p_)-OexJ2}Tb`-}O&~5s98KeHyzn~B zfI$!koY-e$3j?J5_AX&y9cYNzWRX^{yD2uVlD*pN^oOSkuW-K)il4Rylag7hg=`G33_kY6G|j{?GA1~+o<43_e#R#czW5AZ z6#5U19fYHNn$4XvNIU{EXl9!{{jPHX`5b(Xx~TS#A@I?MpziNq5kA6W+)_sOBSx+x6ka&& zAQu)$DiSdo00ATekqHEYe`?gATvT8=9nvhU*~C>qN#?5yJh445bnSK)1K*a?ke)3Y zxTx8*h58YXQcG#joHZMf@NOeQ9n&RfYga?YI@Tw|1fft3l28zxkA)7{*_Oa;K58=KEdxv%6 z)GtfZlaw)nDgh>OJ;Hnia7|#-di|975`op+--+KR1V3}%gG>}2CekVZu30(CAl%LG zeO}p2qn)&gx$YN8;-LHM%&CW@FQ1-Xc2AL1HQ$04jI|-=y@G(cqOkrARua|@zFXNj zc)q@|wu63#6$N{@y0shLaX}$iPrD@^Gu==`*Clgpv)39dnwknj2yj zK0N95(Ubb`j&Y~_S^cXK^8f4KoD6vq#71xMhVMm{CC!bvA)#8_I~`yyi5F>akFn@k zi!)SgL*vMrkWs1s4r4Oz;0);#`1i2N`HcXrM5_C zLx~^-`YE=LA6FRfEi5QI5?%$qi{dsFI$H!5k1)?iK1!nD7>4FLyyW+*sMKJK5yX@j zn?VnjE{&+HHA$jNdh#a9K3w80w}Y;d3Ao+y^IC^?X6m`BRL0(+cUZe!9`%|T3(F~nbs4ow zDFxaD{0Q#}einUW$=$mZToYjMuH8yugb8m{(QZKtqk`RV_|R-=CKQ_BHIrD{LMYrL zC#CeSq!;~++5MINaC8N~V&+JHB%EoEh`+fb)A8$P*THW$)-jlF!1i}gi|(KoJbt{h zwY_`r3@Q1`FV^0vNt(&jl-|C{-5*}w)MSn{w}YqtnKWq ztsd;I-`H^uXx(r=yIwi#3{Kw%jg@bgH@~?p7WFv1K*ax~_dZCx*jinGzJ6OQDx`pC z11D)BZ)=s23XQS;1a2!knt1T(XeY&Rpmi&l&sd|dn>^MHVh^#1U?2DcV8Rj~pMhgs zQj!V`)Z>STJD8k_M*$;Ir#r`nr+N4-K!{sJVsW#{+{VD>)gXnEhq57p;guvsbd=36$qs^Q^UMIOK}{hJ(Q)FJ z_M8b1obId-R-Mpp^4TB85XIc_f*)~$!3Xq8csK{PT}Ha3OE(%~;`g#80YAjpIS4;; z#~Z4_fS+i?k;xRQ15waD-AwF-5i(u~-riTQA%({GY=lCR!4GQ*rXNE? zE*zQ_=^F7W@JL+5>@ANyPGkd8P51t~X=r|(D=PENeFTHc2 z=~}idfwMkVt}gosPoox73bB;a<<$UkZZ%ntXyX};L2MN(h#yPV91SLkJpdxW6thL3Hv9DJJ*dCe zbE^H|-Nc?+zs#d=-{;afP;ek=Rh__jO*H2mcsvXA=`I`ItsK--p>sSHr_kO(pT57ZxKbHKA*uc|UHh_9JG$84s z>f=T5zupo&>LJ;576VB}_$c&_B*I+_fjdPeBlzDUcuvk@y_~cG9Gv4ezClyunQBuD z3lT)o)ciX%g>TT*Te4@w8GF+LM-ffoe3!@^ZwxGILmK@xq{tat0OIrXUEpLIsovm< z2cv{~L2k%p>|FY#Lk(K6{ih#s^q+jQ*q-?lyYNoRFwErOXUd=DO*J@?A%}`fVTmDz z!gMcx2Io|X4=PH>)o3}JNS6njU14yHSv1S#k=!&}k<##e-Wre9_r}*ZpQrP3q^0?X zGINX19Mo`JKr9v;w1upGE`RZ4Svy0Z{iMxZ`mvYHmow1v%`Q``k-CCBYpkKCX9TpL ze0|Gri|@XY&tl&in_Q?g`IR<#^S7Z%%l;`knNYT=b!9>iMx_+;--+Fq-6psUL56D< zgQZdznt9q<;33FiL}AUso}QF@0*k1}DGXO~o1RQ8@hgvs=mbJCV+P42N%M^qr@7V> zm?W(jJMcl}tn`=CT$do4!7GB4L31F0mPY3xW+79<%NasPIkGhJ`dM@v6&{rp(zr9; ze^S2BLc*xGyxL*D*B#`4A>kndbpt$8laNaX`YjS z3m3{!0)d)XA@C8HhhPLU2GPtR#oKrTR{H4t0_7sj+ucqd3&LkiE1NkiipX>LzhFIb z9CR4y*W4ZlF*j%#+f5NamR-$kwKsyo#hONf<^qO2woGijlGs}LNMI!2@RMLeK3G2s zwz^w~jp$D9WnH_$akEBjE0|2_oNwO?ft3;gE0~NxAsFw4!HW_DD=0BQ6qAv31~uVY zQcgJ1Ih#wl^9kPGDrhJtJ^)_2B-k2v-eC68;bp!Oz(4F9y=h^3(ZTuHNG5F^;$-OY zLT}I#0qgWnkxer`lY=2}SY>e{1embY(OKY-0 zg)dnQEqN@Am};o#wZdZ%IOjydn3ICkO`^K;^U zfu{qZ&a8UNU<+@dt_d)vT)W4!qkKLtG^o;U45A{5Cved3_wU`Z2jJn;hGk6ykA-Z|dMd`;fjI$(?-T3&Xm$ zFM327%^}FjY5PyJKfb*`mrJ8Vfq85Hi848R|Lx42&i_9ME7H}CZ0KGnw1bI)+Xi!l zd6B|T-Iw@?%K&=XU z%@gMD$)!`p?uBOKK9N`b04de*qM|Rru~EIxt2j(0mT*W(01l<~bksAq<8%Gqvz- z3#P>?;q2nCkLG`SI=9z5AN_K*y!z_($20dK3^dC4@4346Sc{O!s~?knzPF@jfiF>{ zkiS8Rx;n%+IKx2RE%1%B2T1ZUrzWVGSdWhqC#ijZZ|`xZKe#%7{JO>P=4-+K2(eeT2*^ew}omJIg7j;u~TdUJ5(B~$_ zgdxeJ%9*;4Gb?hzBdUQiyg*sAk}PN~^c{5-s<@fnb$gqOJq)?yAm6 zDj6iry+`DzaY$GUsDF3cM6XAK`_+EJ>uGuy^29W!j*e1fqMC`kdq>5BLQ3(XH64c= z+9{U-yqOSA`cTX@(F!K1uFeQ*3`2G$@YFeR2+{aC-Eob$QU^>?x*X}u$L5xnc!|p5 zz-n&jpMBs~UTtr$ZSEc{?;N~b-u+eyZih(TF)>rbH1V{mCvEIvn^cHew}ylM zb-3Y7WtpixW{^2MagH!Ate%-Uo26I7{8)9w#SJKX9_)NHN(^`>q@Q(J2~|a%VV-AG zc(kJK7s9hUSBHEdYhPudIuL@(JL#mAuxg%j1C3aG7qn3#yH_^!3}lub#aA`sv%w3B265qu$`C`&M@%yyfx9{kf;Cx_IyD9R8j8 zQ;$@ zQzVNRB$O-_IVyV(xnW@j^E?b4wIgf$aT&AiSDIVYbahg~(~bG$p$~$womu27Kx|FW zHp&nkMIKi?hh*g*HfSM^=yjG}OYAv5G6eng*N8N8*xE88mXH&GFz-tSta!nZNSi{Y zhD68(k_>0@fn<>Ba2IbXpuSR2CK~8M$P5WB3hg2LlG$KMAT}66h7Tkq&imnCRifqo z?1_T&q2xxzWADMj7s&IwM;V#jdvkvJy7yGx{0;(xNCmc~x9UVD5d>$ihnC#PDKx&s zZG}hJxFGU!cRBW%w4p$eP^mR|@$)D=W+QX?Ny@GNW;%oa>b$bHe#Nitu8vO-8q)R~HFDR@xS)>~Std>ZL6xhBcK z@>?jOf>Hosq|$F`18#x>3<6QBICwYWN@EQc;rplx-R#DaQa1}x&^58n;Uuq6KOEl0 zqc_`M@jpnO<4^f7zQ*s5zP3ZX?qs`MZoO|}enoP<#LbqvJYGs_`tN3XP!mC?nD5~- zZo}fAQvs-KGnp_9J3eCKi#F>6XZ4uImsjNAin+;aGFLFGh@|h@dKHLYH9!QJ3y?TE zxqz9(P}q0G=BhQ`#Q^5MVdBRI`Q$`O2J0I_Yrw(yxn0 ziGC4*x&>i=9{qz93b`tMrUNIVnidjvSy7R1QVtO7?Sud|xsNIQW_B*%u+bY}-H2Dr z`Jld%8`97>Ik63Q)$k^0Opsz&|c?tNAdi{Leb9d_WI^G^7x6> zP&ZbJK1I>ys~6AKw&n4&P@~`9kOYgql>bGlZEVQH=T_<2aM|EjA+L>c#p>w_b_b@*?HS!fwCW;d6aUZzFF zn!7BXw3dh{cSPW)qxqss?{x!P`n8-m5`dOV*+XLbSbq}BdHqTB_Vg#wdaXYlsWrU@ zBLIF#%w}|nKxz^w*X-m0U?DhhSV1%7J9qk{1IUD?GE6-r-qRu|)ALiG$de8q9zT;u z9Vk0KNX32{(K~L z_xMv`yvEP07YN%QU&%T1X+O|$?a?D#c8h(u`tWJ`@R#)Ai^hkghx0r+-5@Mw@IKHJ z&`Mgs)1%NH*dlpa%FyIfthw}A1_e*?9rz-l0-qkuh45OmG{3}C z*%--k`mfj4fy+1M6?Tz>6>V$tOTV_{85VJ-{nvmQaM@YAp#1Ea8VR0ES>m z+T@r?qo3o4v=u)41fMCpgrZO9P^M2UVK4ptC@s!A_gTZMhx30SR!Oh4L|IkAT1f(s zB?$)Eo6jroSdzn&lH#i-c%*TTA4_t0Qj)>@q7gqGnXJQ7lta{_3?z!0a9on1&0(^r zfGI^e%%x_SLgjt2h9UUpj z;C<4F-=`ILEXnbck_=uZ4cVKTVIjOkWFF4fj1%h=a8RTjYN^Wi-c<)l1|*|Eb%@dt zQau1|n6zlxC?ze5L{dfF!2Y%#ioRL;q7_jSP=AnK({9j+ypul5DZVuSP=-Z7VfbSg zv!QENYD-m4m!h1Nv?!rFxFKWqM52LG$=fK(STCs!K%bF|GCn|2>`2Ol0F=JUIc%w_ zP^GAVT~(>5l{A-Ng67KFC`vVY4*MZ(SuPMLim(fOt4d+1q#VdoRSPJJFegZbGXBGV zD8_#T`F%IWk6kXvShaggRl}!6IR~ev?+@1qkLc>WlSW7glM5ErV9ub>jE%Lc24pD} z+8mH-os66)g3p>c=C;3dS$*^1TTZD1=a!-MnR=pikx$$xgczHgTF#KAt&M5e1mTwv zwk_yOOuqeCcFuVbS3njy_BP{M0;DW*?(dN@?#0Ic^skI@W-uAF(57TU9PpQbg}%_) zb9f^+ZG^av&ZEOil4j-_$1MCZMwy)FaDB}ylLp+9!?Pan*d3hO0~W}6Fq)nY!MD3> z+uOWWmDv_Em`LFlcKJDq{q8Svg#s50H~3qUuN6yqCyP~bI((#=G&wv1BGd`j> zG0HJ>5o>@_@d4F#@@B9<3X}CN^JJ}I%xDpm2+w}a1QQ~3m4iTg15@F0l8O=J@erT>ce-yO^B~e}0J@i{(lbskT2@b9Th} z>aF3);}$>jE5x|Kfe^D}4GNhwiZ&9VnlOAWpha0ynd23O}=5zzPP`#jhP|)Rj5?tN~m0i}* z7g}eMQdM$76GZ?f!BZ`}{3dE8u9}JD9K7jX`vq}k3&1or5+sYxwj!+S(yrNHW!{&B z*5JkP0ty#5D9V0>J1I^ms;aH9f&LO<=rHCj>!lXnMK`;a!j@vqL8+nAo`^Pv&wLk9RuH%*h7`1Tm z`KX7D;H}OWmJtRE%uW@gW3Wg~BC_wrqU@FX!xCkJp{-6XJtpOqOn`LsMvc94YS2gO z?W9|1g1=zWp%B#ZsjZj!6-i5m5-e-R0&2Tu<+xxPP?0rNZZlcx;)>tjQJjff${4sw zizA#AEi8zMF~gqqujmvg-QY(3<~bg^n*314OMM_0$s`KCXA*#&L9g-u;;n#G@Tsu7 zla?V8%*HfxbF^%Z*K?u?84@A2e2)X>@*ajWl46rf=0rOIc0X6l~ z-0Qs*!fP54tjXOG-V&h1&j>`ZIvVz`&eaeaos2o}fS17tnB5g-z%2rzji)c_W7oZe zQ*^#8&K123P#VfzZIS$-bq}s6TNM7}+k(@>) zwK+P%#R@s7dnp%Z)7nf#*s3q8u9eVrq3!P`9rnb?uNAhC#zkmS-}@J-ZzK zEEAuqgOk*hL6}18ap5-XLPQQ`!cIPaB0t@Nudc7rZC)Pr=NVBIa^NJypYr;(n=^kS zr%(mEVxN+6B$s6g*=+7l$<{+G`u96WUD?#eV?}1$zs^2=%-x53(}yR6%kh2LiTIZP zz1r(6oGdRqN6O*rUqAV6?l)LA)j2YT@R>mkxOj3$*u{`3Aj5&&Vy{h7#8TFxwCS5L zhJxh7$HMUd2GdH}qbURQF19!FyhF_-z=Wq#V=b*A(o(c{(jRulAh|=O8TRR2iCYCa zd{)`_rtLq4@MfUsmDGTDGa+4jB=i@p?OI{-{GRoAIa6mufJrz|B6W!P+^9MsTF)JjBl06b@6XGcf2@Ia+00;*$AZ z<7?6A5%g=!jb#kmZ60`dATzN8o<*3ohgt=%EmcOQ-k*-y zckSs|d>D(5&Ms#^2f6Koll%=9G{dVwd^L?IMJT^a%X!GDff}df<5+$_DZh_mi(7>b zoQ==>xM6(U8(-tTaoj%Moo)a5PrtMm`*P=O*rd+mb3g|~q!EE`Kj4WLUqYi}IiUS& z_xZx-Izz`GR45&tj{!-WT5t@f@X5ib-#ZGoIEmR7(C{-Kwmxpn;O=_LfMnaLmsJ0y zdr-g%zV9G@r0z)lNBYj%laK0pftiw|(<#Ra9|}4)gObY;hvv-#Dcq|ph*Z_bEP*JamL{I;KlfKD7n1Cfi+IS*(q6+ z<*Df-9GZ?iAcm^&xbSqAn+#sR-CM$c<>$S*+5JWPg}2?c*L(LCUO)Ac{X>5LP`>~5 z$LU%64mWxeZ*gAngN6NH9(;lS@8HMM3BQ|uJ@@f69E~Yi4kC8H61c2$@aZ=`$s!G( z_V^^ZD174i2~(1gf~R>t$Z8B89`iw#qwzr7swit742r~(TA9;>6xDo?L(uJ5idZ%mUss#2$>Wh9c42lH6foPRX`$^57DpUwYe z{`2`S=8-nH#Km>4^UhCAW4l!UikCFVXY2zSxAu!mv;w0i^P2%&Dk{=DO+*53x}3Nw zE*eC3e739+b;N;q?1FbXN^KiBs>RqKqN}k+G400sVRg<+^%|$eWCB)` zl4KUk1+AzGKyH~_lxt(7EUrx|!>5mZyTGJf$AKslPnbxi`QoC^+4cf-J)YtI;S8Wl z-hBck=OauwAw++5fqm8D*I!)mY+Z!eEy{kx-#@|ziGHn|y>go=)qYqNl=IGjX`QYX zZc%M5r^DF*C_AaQmJRql4DiueI#A$@d-pv2jrNw^G*MQ*a=ZnTR=J+ZpZSJ@i|nQC6p5ikr$ZRJNaz{o7}CE%qm zF5={QL{BmOT67lXq;-}90^uPe8!AK;p29=qc+~f#;AQrPsxS(TbVK!`W5Wt_IKLlI zTV5YL;%%lQEWHQTv8VE}AY+{bRLWpO2Uy*Ju(yFCibItm4c%mQ8E}b(Du&de>_9r) z3s10!LrSR~NV}4-x9MNy7VvEFcXaNm8%jY!dxRc~4^+}r<@zpfhg_I66O?tLj8#xo zKeJ``SzNAcC-pX68CoN)u#rYaPNL)nPb?KFQ zds>~hG|2Qck!#FWrM@_W@$&Hvbm=39#mxCMi+eAJj;xY}}*`R!!c!|F-)y4#-hZCl17yX^~ zX?#9%EbbFXKh?Q?!2WF8S_(WZ`}q`xugSda5k0eN@FqnuW7X zcOM=08C9^ihuu?NWErTQnDS62-lc{|LRmdDoo?rMtLr2iZ(K(O7y`EeuY+7&!usXL zAOPX4^&J=oOFp72+lcbi(WT(i&QHVMF&xVS?pwp|vVOleLdbXow*BFUgPq;w?OmbV z4?p1d?i%^s%fE~PohB$`HwmR6mX*e~5TvqRf0oDX5O=m-2TPR8t4E^Yv4@KAS56lg z034!|wYfy%;ybT~opW^?MGc(EPBEv&&cs#4 zO8hD#m$5;>7u2zH63Nn|3wWt5?)uv~I_sWy_E&g_(`5$>2ke{vDTzXKGteg11#R#b zlnX#%on{7$2$=ID%|Jk#hlOXJRui9i{}lBY=|R2B(-(%aZ4T2d`BIz~?T!eo1F)_k z&T!d1M>tUqqwy1cdLR+Z&~t@IP4=X?nix28+jsnd^Rp~sBNh~u`@nhNl@gi(YELI=REP|$`%1;w58 zEwIsE1+-+;QgVcIKkA9A8&Jz0H-eMHY@Co?z^>r8hQgb`r94$VKGxalCf2?Shvj(x zg1Z%utD_$jLW%#v6F4^fq>(N`z$4eGwg~A4TPJZjg=|O7P%!3Y_itA?5)6mcGLzG( z981H@1iWMkk(4b&NpLjLIe>v}T0CG07yF{bKb#ir8rNLS%b;jca?8$IA5|qgQ)cu# z?u{_b8vd+f-y8JCf=v=Vgyz;F&JW$fi-b*}v4f2Wm{4aK3JGW~4g1V2Vv%xWg;2O- zTyclDDnr%!83$3B$1j8mOVdiGF0;9%XR!r}tNicX><)>3HT#0g+EvF5mo_rbv?kG{Za8n|c%e&LSjQmeS{DIF4n2yc~|A>BkA%fuqH&8(T_emFa3oq5&LVT@B0?D5Q-kM+sDKwCi*w zm2%g|xf-@x;UogCY9*+nFkt33G|3?AMY)T*BJxAwcjz#o!{QK0Gh)Tqe&iz09FdV$ zfpX;i6nqetU)#7yq}wF(1Q%@|&*P?@F;0rp40Dbw!rwL8&3zQk3@br#AD0@W>F9~) zfIDOWJt1}oy@h3LuONPY8y+Pt6uCs0)Q4x*ism?mR}emBA^dtOx1++`!xcm&@2pK3 z+Ax_o7a@U^u6YV9jIg$Ps3$$-by--#R5vKEm%B#bW9$~(F(PVD4-|MlgA%18Xe2 zAUDACAZSe+mVq^`{%$(mG?Tdrt#Tq!dd{Ybx_WK}1n>5GT?EXkGc!w+mTKh0uqS4= zY(%5?i0q@oqK{N%h=sShk{KfocyGW^jP}kP+w0#%*@c-%sZwHlw}V!}2c5ai*tfA` z%;+GR0vX>eZWTMZZgoyE-@_pzsu$mNeyFZ-qow|UV_NHFVfn9j4hLJDK_jKyXbgg% zP_ev zux50Qdp{v?g)IQju5$|gb3`ergCs`FNUyg-^q_H&5e zt1{*g#R-~`J}5VHs@R*sj!&?y$t2Xu8HNbLD%uZWgVg{FK19$$v4!XhRKH!*`V&9I z_c<~`vtXo4*>SXLK&vv3_{QGmzHi=K(syWiyF<-7D&8l8G+-rT*=^=uap5O`vD4BL`O8bvSs!~1PK-ClQ}HNVsiLVKzD*?H9bD- z;yf$MpcDtHSMNQU3sel5EFp+XFDghetTPCDBYIB}i&#%Wjdw0KpeABSYGR7U$t-&j zfwqo^SSn&2nS!?Busb}&b#%tt&?_Nd1ejo1S~B5|3MZRr*!W4P1>0O?<_@l_8~WH- z9LN!klZ?E7D|pqgK@?A`IdOukW8NKgakMk`SPJ#(2yL)NsDM3G!W@nW9c-M2HEbPn zj0kER2ztXbBK8!17$%jN&n45el5#N&)T9qqgH)vwSc+1uN}$?{qF?!hGtfc@1et0W z#yAikRs}TB)JF|ei)3vkVconZQzsGq1Tw_CFISu9A#1qRHUY4&=32?jNM2<-F%yX4 z16-nJzp=~Mv=Fxu&Ul;df5!Q(#l!5gB>!6?7S-Yc8iO)-bl*8+yFB5NL3G*Iy^MyF zf59Y!o@){hlCW0(4vNU$334$+I>k$OVuCibb#LKQ4_;zjOuLrnGcmm9mTSl-37iwXBY2zkq7=t zrIf9M-J&D>B~Tzu z4nf!MSU=XmFa;>cqazfe9m8t!7S4hcI|<~Qw0jA|hyDpCE!VAxVNe(gFbff%g5+}) z&Cw3g))gcGKt3_2sExUX>ec8e5IN^n^6U!!5ntArGqO=^Pj1~v!s)0{R2GSDM=3KtgAjp~X6f zM>kv@i*35AQ>ZyK(S9@rv`U<6wd`%kTpyO~4RCwbIre8`{%k99VlbFJ9)pviR`8(Q zNVyk2jgSO(U`WUm6Wwo9!j=ie%|?|3Clc$YPIfwrNvPz zSXzsXSk_Wg{jZ2>?v)u`c^iWLya`XFd?8lTI=;HV)`}!0Yr9sRl?O`)RVzY zf;4DZ5}yRgQXS>SnrrmoFHRnUFEtU=Z8(y?AhWxKOrG4e@Fe1#UN$Nulh`9RI5GAp zor+lnXs}K+EsBL^GL8cKTBz4X3w!eeyB9BGATOb#h+$$?fnY|&N&PG6)6i2#J83f2GASyeY$|#+ zp|(zmh;jOvPb$bqcWMo@k4BQ$wi<^^lzp6v+{mHCP1Qhp^wyh_ThgH9B+`p)?9II4 zeh!;D2zz;EgerkbgY9C-xVJ;yWf_uNun#7C@68#GqyYj>VnSzix`(`VhPBy4T~?N< zqs}7V$Sjg;&}n$vlpunW^xqNe3<2+?=r#fGw$ABQ;mNx8>juKt8Y2Lop4{f*P%7$0_OblEav!+yfp zcg*AG@|+(UAu|-B2BlUiE`g0qAg05J+tRIC4r3N#$lC?E z3|Mo1V%iZdOufe_=uG7I7>8QR51$G9#7@U&BH>6gLE3*<1>jD_AoNMiAmkOI2FGsP zIv-+LT$VhXS^(3+$@KUa(Zf>b;hbuRmtW#=j}u-RLB~5RX2EX`RNjAQNOetSVm_@ z8>lT6TyFk@okOuXqz<=XigA1zQnE z8~BMdw0X_r6cy!bf(Hky>)Qth!W!6_F5i=P+V_($7cb5(WW$QjHL;hhe}G}UJRmh^ zout^$4iR9(;jm_G(=en0P6=Si@bqSJBQoe&ix5T{TL^hRvg3{YU<#LC5#5e;S@u84 zW|5Jh9gP7&&<4c)B=pz8yHG^|amnbPjdjeQQCE3JDE{J>s7PfrYKVxXaR6nDLKOhU zPB#u2ep!o3&V?tCKHRUQCtv$G7_A|7sB9B`km@I-v=1+pp2xjQc6Zk3N`5;;Zead0 zeu4K6Tqi%c-Rk=MWH`76FOlTfBskvRe|b4P!m$#%BoUkAK;S?YR=bOJ5iU(=p?|S^=tLooBEdcVFs`E6GktAh=AVUsu-g zWK~?zsM%NM7}7-5efr#1%!y>p=V>3BKnQIp!(1WEQ@gzb@+rt#2G5}V!`DI|oVnq8 z0Ki0bSlrQzlZlTNId$^oJBI^B=07nwam^|R3mBmqkqwcS8jR(z6AZhl$Pv3O9kib6_a-OS4hLNO&Ke$YY$OC%ho3P~>cd{sT_?---X8gem zWYzJd9vW(O30QnbB%Ml;>1xyqhp@2Dd1fV8t)eL_O%|0;bcHUx$~+z1Fkg>1nSs7*0*S-js>nX{01(?zBWc)K%o}^!+ z(eS8;rKe+L4j&gY>z`XYRxiWF}-77Ow-(8xvJagLvhQ>p1*4S+#8<_u@w#M zfgRYAGJ{Rv!Xw1NUkkCd1&M`_9HS`!1>emJp7V%59b=aY{$=*md`m3Z2uU;;PJqUK zHxxnv^EA%^zd}FmBU*u^xjqutE|B2tnZ1sk)FJAi4F=mtgyh~K?$Q{Z=RE<5P9WdC z(HZVrW_PiVW+*N4YF~as%ukRRH2j%e!|ce8RD3)&wToAsL)^(EebLcINE@hH>>AJo z2_02?HNp)fedZIJP|5lqib8kLJ02&7f$!n`8DV$K$;xgnqWy2zT02|McfViWUTdxI zv|es+eYd{4w%VFr-oZ1@Ci{MU_uH*kyDik%Uf$gOp@mDLmN$QB{dIkFb-uOspI>gT z?d-I+wx`x#yxdq{L)rS~%EqfzT+Q5ihVM4Fc3T_kFV=Sfba$)81`X8u8oqnpda<^> z@+}}QKU?2e-~C~J>iPQaCSg9u#Z=2JShC&q73Qk7UcTCXxwW%~=2roBbA9tUFMwWq zv9`Iph*nY7TKf(Ut(|X|H#XSR)bcA}zfJsFD_bvr*k1qU+uhc;TN|ruD15dC%$A>R ztZ7r|)XK*4`U_an $vendorDir . '/jms/security-extra-bundle/', 'JMS\\DiExtraBundle' => $vendorDir . '/jms/di-extra-bundle/', 'JMS\\AopBundle' => $vendorDir . '/jms/aop-bundle/', + 'Ivory\\CKEditorBundle' => $vendorDir . '/egeloen/ckeditor-bundle/', 'Doctrine\\ORM' => $vendorDir . '/doctrine/orm/lib/', 'Doctrine\\DBAL' => $vendorDir . '/doctrine/dbal/lib/', 'Doctrine\\Common' => $vendorDir . '/doctrine/common/lib/', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 007338d..be67e88 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -3,7 +3,7 @@ "name": "jms/metadata", "version": "1.1.1", "version_normalized": "1.1.1.0", - "time": "2011-12-30 10:32:49", + "time": "2011-12-29 22:32:49", "source": { "type": "git", "url": "https://github.com/schmittjoh/metadata", @@ -47,7 +47,7 @@ "name": "jms/cg", "version": "1.0.0", "version_normalized": "1.0.0.0", - "time": "2011-12-30 09:40:52", + "time": "2011-12-29 21:40:52", "source": { "type": "git", "url": "git://github.com/schmittjoh/cg-library.git", @@ -89,7 +89,7 @@ "version": "1.0.0", "version_normalized": "1.0.0.0", "target-dir": "JMS/AopBundle", - "time": "2011-12-30 09:50:26", + "time": "2011-12-29 21:50:26", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSAopBundle", @@ -133,7 +133,7 @@ "version": "1.1.0", "version_normalized": "1.1.0.0", "target-dir": "JMS/SecurityExtraBundle", - "time": "2011-12-30 13:38:12", + "time": "2011-12-30 01:38:12", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSSecurityExtraBundle", @@ -178,7 +178,7 @@ "version": "1.0.1", "version_normalized": "1.0.1.0", "target-dir": "JMS/DiExtraBundle", - "time": "2012-02-25 05:01:54", + "time": "2012-02-24 17:01:54", "source": { "type": "git", "url": "https://github.com/schmittjoh/JMSDiExtraBundle", @@ -221,7 +221,7 @@ "name": "doctrine/common", "version": "2.2.2", "version_normalized": "2.2.2.0", - "time": "2012-04-08 03:46:44", + "time": "2012-04-07 03:46:44", "source": { "type": "git", "url": "https://github.com/doctrine/common", @@ -287,7 +287,7 @@ "name": "monolog/monolog", "version": "1.1.0", "version_normalized": "1.1.0.0", - "time": "2012-04-18 14:27:40", + "time": "2012-04-17 14:27:40", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", @@ -337,7 +337,7 @@ "name": "twig/extensions", "version": "dev-master", "version_normalized": "9999999-dev", - "time": "2012-05-16 21:28:19", + "time": "2012-05-15 21:28:19", "source": { "type": "git", "url": "https://github.com/fabpot/Twig-extensions", @@ -382,7 +382,7 @@ "name": "kriswallsmith/assetic", "version": "dev-master", "version_normalized": "9999999-dev", - "time": "2012-06-08 01:41:54", + "time": "2012-06-07 01:41:54", "source": { "type": "git", "url": "http://github.com/kriswallsmith/assetic.git", @@ -437,285 +437,12 @@ } } }, - { - "name": "sensio/generator-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Sensio/Bundle/GeneratorBundle", - "time": "2012-06-15 18:40:45", - "source": { - "type": "git", - "url": "https://github.com/sensio/SensioGeneratorBundle", - "reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36" - }, - "dist": { - "type": "zip", - "url": "https://github.com/sensio/SensioGeneratorBundle/zipball/43ed45c48db18e4a0e48aec0c098f42e56e22d36", - "reference": "43ed45c48db18e4a0e48aec0c098f42e56e22d36", - "shasum": "" - }, - "require": { - "symfony/framework-bundle": "2.1.*" - }, - "require-dev": { - "symfony/doctrine-bridge": "2.1.*", - "doctrine/orm": ">=2.1,<2.4-dev", - "twig/twig": ">=1.8,<2.0-dev" - }, - "suggest": { - "doctrine/doctrine-bundle": "to generate entities and their crud controller" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - } - ], - "description": "This bundle generates code for you", - "autoload": { - "psr-0": { - "Sensio\\Bundle\\GeneratorBundle": "" - } - } - }, - { - "name": "symfony/assetic-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Symfony/Bundle/AsseticBundle", - "time": "2012-06-16 23:29:31", - "source": { - "type": "git", - "url": "https://github.com/symfony/AsseticBundle", - "reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc" - }, - "dist": { - "type": "zip", - "url": "https://github.com/symfony/AsseticBundle/zipball/8fe7b898b08103c1d6fce64c3e279a7afd61adfc", - "reference": "8fe7b898b08103c1d6fce64c3e279a7afd61adfc", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "symfony/framework-bundle": "2.1.*", - "kriswallsmith/assetic": "1.1.*" - }, - "suggest": { - "symfony/twig-bundle": "2.1.*" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Kris Wallsmith", - "email": "kris.wallsmith@gmail.com", - "homepage": "http://kriswallsmith.net/", - "role": null - } - ], - "description": "Integrates Assetic into Symfony2", - "homepage": "https://github.com/symfony/AsseticBundle", - "keywords": [ - "assets", - "compression", - "minification" - ], - "autoload": { - "psr-0": { - "Symfony\\Bundle\\AsseticBundle": "" - } - } - }, - { - "name": "symfony/monolog-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Symfony/Bundle/MonologBundle", - "time": "2012-06-28 15:48:07", - "source": { - "type": "git", - "url": "https://github.com/symfony/MonologBundle", - "reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5" - }, - "dist": { - "type": "zip", - "url": "https://github.com/symfony/MonologBundle/zipball/7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5", - "reference": "7fe7f711bb04b86ad7f45a9e11a7f8cbaf9bc1a5", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "monolog/monolog": "1.*", - "symfony/monolog-bridge": "2.1.*", - "symfony/dependency-injection": "2.1.*", - "symfony/config": "2.1.*" - }, - "require-dev": { - "symfony/yaml": "2.1.*", - "symfony/config": "2.1.*" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - }, - { - "name": "Symfony Community", - "email": null, - "homepage": "http://symfony.com/contributors", - "role": null - } - ], - "description": "Symfony MonologBundle", - "homepage": "http://symfony.com", - "autoload": { - "psr-0": { - "Symfony\\Bundle\\MonologBundle": "" - } - } - }, - { - "name": "sensio/framework-extra-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Sensio/Bundle/FrameworkExtraBundle", - "time": "2012-06-29 05:03:39", - "source": { - "type": "git", - "url": "https://github.com/sensio/SensioFrameworkExtraBundle", - "reference": "4f54e5d5fb3b54fb107892684018f3704934c48d" - }, - "dist": { - "type": "zip", - "url": "https://github.com/sensio/SensioFrameworkExtraBundle/zipball/4f54e5d5fb3b54fb107892684018f3704934c48d", - "reference": "4f54e5d5fb3b54fb107892684018f3704934c48d", - "shasum": "" - }, - "require": { - "doctrine/common": ">=2.1,<2.4-dev", - "symfony/framework-bundle": "2.1.*" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1.x-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - } - ], - "description": "This bundle provides a way to configure your controllers with annotations", - "keywords": [ - "annotations", - "controllers" - ], - "autoload": { - "psr-0": { - "Sensio\\Bundle\\FrameworkExtraBundle": "" - } - } - }, - { - "name": "twig/twig", - "version": "dev-master", - "version_normalized": "9999999-dev", - "time": "2012-07-03 15:33:25", - "source": { - "type": "git", - "url": "git://github.com/fabpot/Twig.git", - "reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf" - }, - "dist": { - "type": "zip", - "url": "https://github.com/fabpot/Twig/zipball/26eb0a2653eade50dffdd31b11ca454232dea8cf", - "reference": "26eb0a2653eade50dffdd31b11ca454232dea8cf", - "shasum": "" - }, - "require": { - "php": ">=5.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.9-dev" - } - }, - "installation-source": "source", - "license": [ - "BSD-3" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "homepage": null, - "role": null - } - ], - "description": "Twig, the flexible, fast, and secure template language for PHP", - "homepage": "http://twig.sensiolabs.org", - "keywords": [ - "templating" - ], - "autoload": { - "psr-0": { - "Twig_": "lib/" - } - } - }, { "name": "doctrine/doctrine-bundle", "version": "dev-master", "version_normalized": "9999999-dev", "target-dir": "Doctrine/Bundle/DoctrineBundle", - "time": "2012-07-03 10:42:17", + "time": "2012-07-02 10:42:17", "source": { "type": "git", "url": "git://github.com/doctrine/DoctrineBundle.git", @@ -785,70 +512,11 @@ } } }, - { - "name": "symfony/swiftmailer-bundle", - "version": "dev-master", - "version_normalized": "9999999-dev", - "target-dir": "Symfony/Bundle/SwiftmailerBundle", - "time": "2012-07-04 15:33:34", - "source": { - "type": "git", - "url": "https://github.com/symfony/SwiftmailerBundle", - "reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e" - }, - "dist": { - "type": "zip", - "url": "https://github.com/symfony/SwiftmailerBundle/zipball/e1d413ce27fd1696bdc82ad9525f1b874664530e", - "reference": "e1d413ce27fd1696bdc82ad9525f1b874664530e", - "shasum": "" - }, - "require": { - "php": ">=5.3.2", - "symfony/swiftmailer-bridge": "2.1.*", - "swiftmailer/swiftmailer": ">=4.2.0,<4.3-dev" - }, - "require-dev": { - "symfony/dependency-injection": "2.1.*", - "symfony/http-kernel": "2.1.*", - "symfony/config": "2.1.*" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "2.1-dev" - } - }, - "installation-source": "source", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - }, - { - "name": "Symfony Community", - "email": null, - "homepage": "http://symfony.com/contributors", - "role": null - } - ], - "description": "Symfony SwiftmailerBundle", - "homepage": "http://symfony.com", - "autoload": { - "psr-0": { - "Symfony\\Bundle\\SwiftmailerBundle": "" - } - } - }, { "name": "doctrine/orm", "version": "2.2.x-dev", "version_normalized": "2.2.9999999.9999999-dev", - "time": "2012-07-07 07:48:00", + "time": "2012-07-06 07:48:00", "source": { "type": "git", "url": "git://github.com/doctrine/doctrine2.git", @@ -909,66 +577,11 @@ } } }, - { - "name": "swiftmailer/swiftmailer", - "version": "dev-master", - "version_normalized": "9999999-dev", - "time": "2012-07-08 09:21:00", - "source": { - "type": "git", - "url": "git://github.com/swiftmailer/swiftmailer.git", - "reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75" - }, - "dist": { - "type": "zip", - "url": "https://github.com/swiftmailer/swiftmailer/zipball/f51b5f33c83b48faea75f1285f99a2e8f1c66f75", - "reference": "f51b5f33c83b48faea75f1285f99a2e8f1c66f75", - "shasum": "" - }, - "require": { - "php": ">=5.2.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "installation-source": "source", - "license": [ - "LGPL" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": null, - "role": null - }, - { - "name": "Chris Corbyn", - "email": "", - "homepage": null, - "role": null - } - ], - "description": "Swiftmailer, free feature-rich PHP mailer", - "homepage": "http://swiftmailer.org", - "keywords": [ - "mail", - "mailer" - ], - "autoload": { - "files": [ - "lib/swift_required.php" - ] - } - }, { "name": "doctrine/dbal", "version": "2.2.x-dev", "version_normalized": "2.2.9999999.9999999-dev", - "time": "2012-07-08 18:30:35", + "time": "2012-07-07 18:30:35", "source": { "type": "git", "url": "https://github.com/doctrine/dbal", @@ -1030,25 +643,456 @@ } }, { - "name": "symfony/symfony", - "version": "dev-master", - "version_normalized": "9999999-dev", - "time": "2012-07-09 05:52:38", + "name": "egeloen/ckeditor-bundle", + "version": "2.0.x-dev", + "version_normalized": "2.0.9999999.9999999-dev", + "target-dir": "Ivory/CKEditorBundle", + "time": "2012-05-16 18:38:27", "source": { "type": "git", - "url": "git://github.com/symfony/symfony.git", - "reference": "v2.1.0-BETA2" + "url": "https://github.com/egeloen/IvoryCKEditorBundle", + "reference": "ca9d4a631577d7195c6517dd89ae8a3cc02b85ba" }, "dist": { "type": "zip", - "url": "https://github.com/symfony/symfony/zipball/v2.1.0-BETA2", - "reference": "v2.1.0-BETA2", + "url": "https://github.com/egeloen/IvoryCKEditorBundle/zipball/ca9d4a631577d7195c6517dd89ae8a3cc02b85ba", + "reference": "ca9d4a631577d7195c6517dd89ae8a3cc02b85ba", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/framework-bundle": "2.*" + }, + "type": "symfony-bundle", + "installation-source": "source", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com", + "homepage": null, + "role": null + } + ], + "description": "Provides a CKEditor integration for your Symfony2 Project.", + "keywords": [ + "CKEditor" + ], + "autoload": { + "psr-0": { + "Ivory\\CKEditorBundle": "" + } + } + }, + { + "name": "sensio/generator-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Sensio/Bundle/GeneratorBundle", + "time": "2012-07-13 00:04:48", + "source": { + "type": "git", + "url": "https://github.com/sensio/SensioGeneratorBundle", + "reference": "c17dbddefe517e3adfcbeaa1ab7cef3e572d29c6" + }, + "dist": { + "type": "zip", + "url": "https://github.com/sensio/SensioGeneratorBundle/zipball/c17dbddefe517e3adfcbeaa1ab7cef3e572d29c6", + "reference": "c17dbddefe517e3adfcbeaa1ab7cef3e572d29c6", + "shasum": "" + }, + "require": { + "symfony/framework-bundle": "2.1.*" + }, + "require-dev": { + "symfony/doctrine-bridge": "2.1.*", + "doctrine/orm": ">=2.1,<2.4-dev", + "twig/twig": ">=1.8,<2.0-dev" + }, + "suggest": { + "doctrine/doctrine-bundle": "to generate entities and their crud controller" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "source", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": null, + "role": null + } + ], + "description": "This bundle generates code for you", + "autoload": { + "psr-0": { + "Sensio\\Bundle\\GeneratorBundle": "" + } + } + }, + { + "name": "symfony/assetic-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Symfony/Bundle/AsseticBundle", + "time": "2012-07-12 06:51:17", + "source": { + "type": "git", + "url": "https://github.com/symfony/AsseticBundle", + "reference": "ed933dcfa45f00b6bc6d7727007403f3ff429e5a" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/AsseticBundle/zipball/ed933dcfa45f00b6bc6d7727007403f3ff429e5a", + "reference": "ed933dcfa45f00b6bc6d7727007403f3ff429e5a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "symfony/framework-bundle": "2.1.*", + "kriswallsmith/assetic": "1.1.*" + }, + "suggest": { + "symfony/twig-bundle": "2.1.*" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "source", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kris Wallsmith", + "email": "kris.wallsmith@gmail.com", + "homepage": "http://kriswallsmith.net/", + "role": null + } + ], + "description": "Integrates Assetic into Symfony2", + "homepage": "https://github.com/symfony/AsseticBundle", + "keywords": [ + "assets", + "compression", + "minification" + ], + "autoload": { + "psr-0": { + "Symfony\\Bundle\\AsseticBundle": "" + } + } + }, + { + "name": "symfony/monolog-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Symfony/Bundle/MonologBundle", + "time": "2012-06-30 05:48:07", + "source": { + "type": "git", + "url": "https://github.com/symfony/MonologBundle", + "reference": "v2.1.0-BETA3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/MonologBundle/zipball/v2.1.0-BETA3", + "reference": "v2.1.0-BETA3", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "monolog/monolog": "1.*", + "symfony/monolog-bridge": "2.1.*", + "symfony/dependency-injection": "2.1.*", + "symfony/config": "2.1.*" + }, + "require-dev": { + "symfony/yaml": "2.1.*", + "symfony/config": "2.1.*" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "source", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": null, + "role": null + }, + { + "name": "Symfony Community", + "email": null, + "homepage": "http://symfony.com/contributors", + "role": null + } + ], + "description": "Symfony MonologBundle", + "homepage": "http://symfony.com", + "autoload": { + "psr-0": { + "Symfony\\Bundle\\MonologBundle": "" + } + } + }, + { + "name": "sensio/framework-extra-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Sensio/Bundle/FrameworkExtraBundle", + "time": "2012-07-11 23:13:52", + "source": { + "type": "git", + "url": "https://github.com/sensio/SensioFrameworkExtraBundle", + "reference": "e9ac8f1a911ed29e30296c7f1549f53d4c94eddf" + }, + "dist": { + "type": "zip", + "url": "https://github.com/sensio/SensioFrameworkExtraBundle/zipball/e9ac8f1a911ed29e30296c7f1549f53d4c94eddf", + "reference": "e9ac8f1a911ed29e30296c7f1549f53d4c94eddf", + "shasum": "" + }, + "require": { + "doctrine/common": ">=2.1,<2.4-dev", + "symfony/framework-bundle": "2.1.*" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1.x-dev" + } + }, + "installation-source": "source", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": null, + "role": null + } + ], + "description": "This bundle provides a way to configure your controllers with annotations", + "keywords": [ + "annotations", + "controllers" + ], + "autoload": { + "psr-0": { + "Sensio\\Bundle\\FrameworkExtraBundle": "" + } + } + }, + { + "name": "twig/twig", + "version": "dev-master", + "version_normalized": "9999999-dev", + "time": "2012-07-15 23:42:44", + "source": { + "type": "git", + "url": "git://github.com/fabpot/Twig.git", + "reference": "d45664045194ef62573c153c424508527105041e" + }, + "dist": { + "type": "zip", + "url": "https://github.com/fabpot/Twig/zipball/d45664045194ef62573c153c424508527105041e", + "reference": "d45664045194ef62573c153c424508527105041e", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "installation-source": "source", + "license": [ + "BSD-3" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": null, + "role": null + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "homepage": null, + "role": null + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "http://twig.sensiolabs.org", + "keywords": [ + "templating" + ], + "autoload": { + "psr-0": { + "Twig_": "lib/" + } + } + }, + { + "name": "symfony/swiftmailer-bundle", + "version": "dev-master", + "version_normalized": "9999999-dev", + "target-dir": "Symfony/Bundle/SwiftmailerBundle", + "time": "2012-07-05 11:33:34", + "source": { + "type": "git", + "url": "https://github.com/symfony/SwiftmailerBundle", + "reference": "v2.1.0-BETA3" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/SwiftmailerBundle/zipball/v2.1.0-BETA3", + "reference": "v2.1.0-BETA3", + "shasum": "" + }, + "require": { + "php": ">=5.3.2", + "symfony/swiftmailer-bridge": "2.1.*", + "swiftmailer/swiftmailer": ">=4.2.0,<4.3-dev" + }, + "require-dev": { + "symfony/dependency-injection": "2.1.*", + "symfony/http-kernel": "2.1.*", + "symfony/config": "2.1.*" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "installation-source": "source", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": null, + "role": null + }, + { + "name": "Symfony Community", + "email": null, + "homepage": "http://symfony.com/contributors", + "role": null + } + ], + "description": "Symfony SwiftmailerBundle", + "homepage": "http://symfony.com", + "autoload": { + "psr-0": { + "Symfony\\Bundle\\SwiftmailerBundle": "" + } + } + }, + { + "name": "swiftmailer/swiftmailer", + "version": "dev-master", + "version_normalized": "9999999-dev", + "time": "2012-07-13 12:47:17", + "source": { + "type": "git", + "url": "git://github.com/swiftmailer/swiftmailer.git", + "reference": "8b2aa953f87da228ba413e8fb1372e49c1374050" + }, + "dist": { + "type": "zip", + "url": "https://github.com/swiftmailer/swiftmailer/zipball/8b2aa953f87da228ba413e8fb1372e49c1374050", + "reference": "8b2aa953f87da228ba413e8fb1372e49c1374050", + "shasum": "" + }, + "require": { + "php": ">=5.2.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "installation-source": "source", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": null, + "role": null + }, + { + "name": "Chris Corbyn", + "email": "", + "homepage": null, + "role": null + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "http://swiftmailer.org", + "keywords": [ + "mail", + "mailer" + ], + "autoload": { + "files": [ + "lib/swift_required.php" + ] + } + }, + { + "name": "symfony/symfony", + "version": "dev-master", + "version_normalized": "9999999-dev", + "time": "2012-07-15 16:27:15", + "source": { + "type": "git", + "url": "git://github.com/symfony/symfony.git", + "reference": "151b79a6ce3f459e2fa8815cd9f2786eef750993" + }, + "dist": { + "type": "zip", + "url": "https://github.com/symfony/symfony/zipball/151b79a6ce3f459e2fa8815cd9f2786eef750993", + "reference": "151b79a6ce3f459e2fa8815cd9f2786eef750993", "shasum": "" }, "require": { - "php": ">=5.3.3", "twig/twig": ">=1.8,<2.0-dev", - "doctrine/common": ">2.2,<2.4-dev" + "doctrine/common": ">2.2,<2.4-dev", + "php": ">=5.3.3" }, "replace": { "symfony/doctrine-bridge": "self.version", @@ -1135,16 +1179,16 @@ "version": "dev-master", "version_normalized": "9999999-dev", "target-dir": "Sensio/Bundle/DistributionBundle", - "time": "2012-07-08 08:02:21", + "time": "2012-07-15 10:24:10", "source": { "type": "git", "url": "https://github.com/sensio/SensioDistributionBundle", - "reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25" + "reference": "5886adae1613c0a72fbb95259a83ae798e86c0d3" }, "dist": { "type": "zip", - "url": "https://github.com/sensio/SensioDistributionBundle/zipball/9a7dbd867fd5061e4bfd660a175aa66122f53d25", - "reference": "9a7dbd867fd5061e4bfd660a175aa66122f53d25", + "url": "https://github.com/sensio/SensioDistributionBundle/zipball/5886adae1613c0a72fbb95259a83ae798e86c0d3", + "reference": "5886adae1613c0a72fbb95259a83ae798e86c0d3", "shasum": "" }, "require": { diff --git a/vendor/egeloen/ckeditor-bundle/Ivory/CKEditorBundle b/vendor/egeloen/ckeditor-bundle/Ivory/CKEditorBundle new file mode 160000 index 0000000..ca9d4a6 --- /dev/null +++ b/vendor/egeloen/ckeditor-bundle/Ivory/CKEditorBundle @@ -0,0 +1 @@ +Subproject commit ca9d4a631577d7195c6517dd89ae8a3cc02b85ba diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php index d2b2323..2e0e96d 100644 --- a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Composer/ScriptHandler.php @@ -31,7 +31,7 @@ class ScriptHandler return; } - static::executeBuildBootstrap($appDir); + static::executeBuildBootstrap($appDir, $options['process-timeout']); } public static function clearCache($event) @@ -45,7 +45,7 @@ class ScriptHandler return; } - static::executeCommand($event, $appDir, 'cache:clear --no-warmup'); + static::executeCommand($event, $appDir, 'cache:clear --no-warmup', $options['process-timeout']); } public static function installAssets($event) @@ -123,7 +123,7 @@ namespace { return \$loader; } ", substr(file_get_contents($file), 5))); } - protected static function executeCommand($event, $appDir, $cmd) + protected static function executeCommand($event, $appDir, $cmd, $timeout = 300) { $php = escapeshellarg(self::getPhp()); $console = escapeshellarg($appDir.'/console'); @@ -131,17 +131,17 @@ namespace { return \$loader; } $console.= ' --ansi'; } - $process = new Process($php.' '.$console.' '.$cmd, null, null, null, 300); + $process = new Process($php.' '.$console.' '.$cmd, null, null, null, $timeout); $process->run(function ($type, $buffer) { echo $buffer; }); } - protected static function executeBuildBootstrap($appDir) + protected static function executeBuildBootstrap($appDir, $timeout = 300) { $php = escapeshellarg(self::getPhp()); $cmd = escapeshellarg(__DIR__.'/../Resources/bin/build_bootstrap.php'); $appDir = escapeshellarg($appDir); - $process = new Process($php.' '.$cmd.' '.$appDir, null, null, null, 300); + $process = new Process($php.' '.$cmd.' '.$appDir, null, null, null, $timeout); $process->run(function ($type, $buffer) { echo $buffer; }); } @@ -155,6 +155,8 @@ namespace { return \$loader; } $options['symfony-assets-install'] = getenv('SYMFONY_ASSETS_INSTALL') ?: $options['symfony-assets-install']; + $options['process-timeout'] = $event->getComposer()->getConfig()->get('process-timeout'); + return $options; } diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php deleted file mode 100644 index f825209..0000000 --- a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Diff/Diff.php +++ /dev/null @@ -1,91 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Sensio\Bundle\DistributionBundle\Diff; - -/** - * Computes a Diff between files (line by line). - * - * Implements the Longest common subsequence problem algorithm. - * - * @see http://en.wikipedia.org/wiki/Longest_common_subsequence_problem - * - * @author Fabien Potencier - */ -class Diff -{ - private $diff; - - public function __construct($str1, $str2) - { - $lines1 = explode("\n", $str1); - $lines2 = explode("\n", $str2); - - $this->diff = $this->computeDiff($this->computeLcs($lines1, $lines2), $lines1, $lines2, count($lines1) - 1, count($lines2) - 1); - } - - public function getDiff() - { - $diff = array(); - for ($i = 0, $max = count($this->diff); $i < $max; $i++) { - if ('' != $this->diff[$i][0]) { - $diff[] = array('@', sprintf(' Line %s', $this->diff[$i][2])); - - do { - $diff[] = $this->diff[$i++]; - } while ('' != $this->diff[$i][0]); - } - } - - return $diff; - } - - public function computeDiff(array $c, array $lines1, array $lines2, $i, $j) - { - $diff = array(); - - if ($i > -1 && $j > -1 && $lines1[$i] == $lines2[$j]) { - $diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i - 1, $j - 1)); - $diff[] = array('', $lines1[$i], $i, $j); - } else { - if ($j > -1 && ($i == -1 || $c[$i][$j - 1] >= $c[$i - 1][$j])) { - $diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i, $j - 1)); - $diff[] = array('+', $lines2[$j], $i, $j); - } elseif ($i > -1 && ($j == -1 || $c[$i][$j - 1] < $c[$i - 1][$j])) { - $diff = array_merge($diff, $this->computeDiff($c, $lines1, $lines2, $i - 1, $j)); - $diff[] = array('-', $lines1[$i], $i, $j); - } - } - - return $diff; - } - - private function computeLcs(array $lines1, array $lines2) - { - for ($i = -1, $len1 = count($lines1); $i < $len1; $i++) { - for ($j = -1, $len2 = count($lines2); $j < $len2; $j++) { - $c[$i][$j] = 0; - } - } - - for ($i = 0; $i < $len1; $i++) { - for ($j = 0; $j < $len2; $j++) { - if ($lines1[$i] == $lines2[$j]) { - $c[$i][$j] = $c[$i - 1][$j - 1] + 1; - } else { - $c[$i][$j] = max($c[$i][$j - 1], $c[$i - 1][$j]); - } - } - } - - return $c; - } -} diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php index a630af0..cfd55a7 100644 --- a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php +++ b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/skeleton/app/SymfonyRequirements.php @@ -429,11 +429,11 @@ class SymfonyRequirements extends RequirementCollection ); if (version_compare($installedPhpVersion, self::REQUIRED_PHP_VERSION, '>=')) { - $this->addRequirement( - (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())), - sprintf('Default timezone is deprecated (%s)', date_default_timezone_get()), - 'Fix your php.ini file (list of deprecated timezones http://us.php.net/manual/en/timezones.others.php).' - ); + $this->addRequirement( + (in_array(date_default_timezone_get(), DateTimeZone::listIdentifiers())), + sprintf('Default timezone "%s" is not supported by your installation of PHP', date_default_timezone_get()), + 'Fix your php.ini file (check for typos and have a look at the list of deprecated timezones http://php.net/manual/en/timezones.others.php).' + ); } $this->addRequirement( @@ -492,6 +492,12 @@ class SymfonyRequirements extends RequirementCollection /* optional recommendations follow */ + $this->addRecommendation( + version_compare($installedPhpVersion, '5.3.4', '>='), + sprintf('Your project might not work properly ("Notice: Trying to get property of non-object") due to the PHP bug #52083 before PHP 5.3.4 (%s installed)', $installedPhpVersion), + 'Install PHP 5.3.4 or newer' + ); + $this->addRecommendation( version_compare($installedPhpVersion, '5.3.8', '>='), sprintf('Annotations might not work properly due to the PHP bug #55156 before PHP 5.3.8 (%s installed)', $installedPhpVersion), diff --git a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Upgrader/Upgrader.php b/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Upgrader/Upgrader.php deleted file mode 100644 index 76b5393..0000000 --- a/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Upgrader/Upgrader.php +++ /dev/null @@ -1,59 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Sensio\Bundle\DistributionBundle\Upgrade; - -use Sensio\Bundle\DistributionBundle\Diff\Diff; -use Symfony\Component\Console\Output\OutputInterface; - -/** - * Upgrade class. - * - * @author Fabien Potencier - */ -class Upgrade -{ - public function outputConsoleDiff(OutputInterface $output, $file1, $file2) - { - if (is_file($file1)) { - $file1 = realpath($file1); - $str1 = file_get_contents($file1); - } else { - $str1 = ''; - } - - if (!is_file($file2)) { - throw new \RuntimeException(sprintf('The skeleton file "%s" does not exist.', $file2)); - } - $file2 = realpath($file2); - $str2 = file_get_contents($file2); - - $diff = new Diff($str1, $str2); - - $output->writeln(sprintf('--- %s', $file1)); - $output->writeln(sprintf('+++ %s', $file2)); - foreach ($diff->getDiff() as $line) { - if ('+' == $line[0]) { - $format = '+%s'; - } elseif ('-' == $line[0]) { - $format = '-%s'; - } elseif ('@' == $line[0]) { - $format = '@%s'; - } else { - $format = ' %s'; - } - - $output->writeln(sprintf($format, $line[1])); - } - - $output->writeln(''); - } -} diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/.gitignore b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/.gitignore new file mode 100644 index 0000000..1f83134 --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/.gitignore @@ -0,0 +1,4 @@ +coverage +phpunit.xml +vendor +composer.lock diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/CHANGELOG-2.1.md b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/CHANGELOG-2.1.md new file mode 100644 index 0000000..165e0f9 --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/CHANGELOG-2.1.md @@ -0,0 +1,6 @@ +CHANGELOG for 2.1.x +=================== + + * added the possibility to configure the id name for the Doctrine converter via the id option + * [BC break] The ParamConverterInterface::apply() method now must return a + Boolean value indicating if a conversion was done. diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/converters.rst b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/converters.rst index 93fd80d..ca4cfe4 100644 --- a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/converters.rst +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Resources/doc/annotations/converters.rst @@ -74,6 +74,19 @@ option:: { } +This also allows you to have multiple converters in one action:: + + /** + * @Route("/blog/{id}/comments/{comment_id}") + * @ParamConverter("comment", class="SensioBlogBundle:Comment", options={"id" = "comment_id"}) + */ + public function showAction(Post $post, Comment $comment) + { + } + +In the example above, the post parameter is handled automatically, but the comment is +configured with the annotation since they can not both follow the default convention. + Creating a Converter -------------------- diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Configuration/ConfigurationAnnotationTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Configuration/ConfigurationAnnotationTest.php new file mode 100644 index 0000000..2725d6b --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Configuration/ConfigurationAnnotationTest.php @@ -0,0 +1,18 @@ +getMockForAbstractClass('Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationAnnotation', array( + array( + 'doesNotExists' => true, + ), + )); + } +} diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/CacheListenerTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/CacheListenerTest.php new file mode 100644 index 0000000..c7d5072 --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/CacheListenerTest.php @@ -0,0 +1,101 @@ +listener = new CacheListener(); + $this->response = new Response(); + $this->cache = new Cache(array()); + $this->request = $this->createRequest($this->cache); + $this->event = $this->createEventMock($this->request, $this->response); + } + + public function testWontReassignResponseWhenResponseIsUnsuccessful() + { + $this->event + ->expects($this->never()) + ->method('setResponse') + ; + + $this->response->setStatusCode(404); + + $this->assertInternalType('null', $this->listener->onKernelResponse($this->event)); + } + + public function testWontReassignResponseWhenNoConfigurationIsPresent() + { + $this->event + ->expects($this->never()) + ->method('setResponse') + ; + + $this->request->attributes->remove('_cache'); + + $this->assertInternalType('null', $this->listener->onKernelResponse($this->event)); + } + + public function testResponseIsPublicIfConfigurationIsPublic() + { + $request = $this->createRequest(new Cache(array( + 'public' => true, + ))); + + $this->listener->onKernelResponse($this->createEventMock($request, $this->response)); + + $this->assertTrue($this->response->headers->hasCacheControlDirective('public')); + $this->assertFalse($this->response->headers->hasCacheControlDirective('private')); + } + + public function testConfigurationAttributesAreSetOnResponse() + { + $this->assertInternalType('null', $this->response->getMaxAge()); + $this->assertInternalType('null', $this->response->getExpires()); + $this->assertFalse($this->response->headers->hasCacheControlDirective('s-maxage')); + + $this->request->attributes->set('_cache', new Cache(array( + 'expires' => 'tomorrow', + 'smaxage' => '15', + 'maxage' => '15', + ))); + + $this->listener->onKernelResponse($this->event); + + $this->assertEquals('15', $this->response->getMaxAge()); + $this->assertEquals('15', $this->response->headers->getCacheControlDirective('s-maxage')); + $this->assertInstanceOf('DateTime', $this->response->getExpires()); + } + + protected function createRequest(Cache $cache = null) + { + return new Request(array(), array(), array( + '_cache' => $cache, + )); + } + + protected function createEventMock(Request $request, Response $response) + { + $event = $this->getMock('Symfony\Component\HttpKernel\Event\FilterResponseEvent', array(), array(), '', null); + $event + ->expects($this->any()) + ->method('getRequest') + ->will($this->returnValue($request)) + ; + + $event + ->expects($this->any()) + ->method('getResponse') + ->will($this->returnValue($response)) + ; + + return $event; + } +} diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ControllerListenerTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ControllerListenerTest.php new file mode 100644 index 0000000..712832f --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/ControllerListenerTest.php @@ -0,0 +1,85 @@ +listener = new ControllerListener(new AnnotationReader()); + $this->request = $this->createRequest(); + } + + public function tearDown() + { + $this->listener = null; + $this->request = null; + } + + public function testCacheAnnotationAtMethod() + { + $controller = new FooControllerCacheAtMethod(); + + $this->event = $this->getFilterControllerEvent(array($controller, 'barAction'), $this->request); + $this->listener->onKernelController($this->event); + + $this->assertNotNull($this->getReadedCache()); + $this->assertEquals(FooControllerCacheAtMethod::METHOD_SMAXAGE, $this->getReadedCache()->getSMaxAge()); + } + + public function testCacheAnnotationAtClass() + { + $controller = new FooControllerCacheAtClass(); + $this->event = $this->getFilterControllerEvent(array($controller, 'barAction'), $this->request); + $this->listener->onKernelController($this->event); + + $this->assertNotNull($this->getReadedCache()); + $this->assertEquals(FooControllerCacheAtClass::CLASS_SMAXAGE, $this->getReadedCache()->getSMaxAge()); + } + + public function testCacheAnnotationAtClassAndMethod() + { + $controller = new FooControllerCacheAtClassAndMethod(); + $this->event = $this->getFilterControllerEvent(array($controller, 'barAction'), $this->request); + $this->listener->onKernelController($this->event); + + $this->assertNotNull($this->getReadedCache()); + $this->assertEquals(FooControllerCacheAtClassAndMethod::METHOD_SMAXAGE, $this->getReadedCache()->getSMaxAge()); + + $this->event = $this->getFilterControllerEvent(array($controller, 'bar2Action'), $this->request); + $this->listener->onKernelController($this->event); + + $this->assertNotNull($this->getReadedCache()); + $this->assertEquals(FooControllerCacheAtClassAndMethod::CLASS_SMAXAGE, $this->getReadedCache()->getSMaxAge()); + } + + protected function createRequest(Cache $cache = null) + { + return new Request(array(), array(), array( + '_cache' => $cache, + )); + } + + protected function getFilterControllerEvent($controller, Request $request) + { + $mockKernel = $this->getMockForAbstractClass('Symfony\Component\HttpKernel\Kernel', array('', '')); + + return new FilterControllerEvent($mockKernel, $controller, $request, HttpKernelInterface::MASTER_REQUEST); + } + + protected function getReadedCache() + { + return $this->request->attributes->get('_cache'); + } +} diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClass.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClass.php new file mode 100644 index 0000000..619f7fc --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/EventListener/Fixture/FooControllerCacheAtClass.php @@ -0,0 +1,17 @@ +markTestSkipped(); + } + + $this->manager = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); + $this->converter = new DoctrineParamConverter($this->manager); + } + + public function createConfiguration($class = null, array $options = null) + { + $config = $this->getMock( + 'Sensio\Bundle\FrameworkExtraBundle\Configuration\ConfigurationInterface', array( + 'getClass', 'getAliasName', 'getOptions' + )); + if ($options !== null) { + $config->expects($this->once()) + ->method('getOptions') + ->will($this->returnValue($options)); + } + if ($class !== null) { + $config->expects($this->any()) + ->method('getClass') + ->will($this->returnValue($class)); + } + + return $config; + } + + public function testApplyWithNoIdAndData() + { + $request = new Request(); + $config = $this->createConfiguration(null, array()); + $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); + + $this->manager->expects($this->never())->method('find'); + $this->manager->expects($this->once()) + ->method('getManager') + ->will($this->returnValue($objectManager)); + + $this->setExpectedException('LogicException'); + $this->converter->apply($request, $config); + } + + public function testSupports() + { + $config = $this->createConfiguration('stdClass', array()); + $metadataFactory = $this->getMock('Doctrine\Common\Persistence\Mapping\ClassMetadataFactory'); + $metadataFactory->expects($this->once()) + ->method('isTransient') + ->with($this->equalTo('stdClass')) + ->will($this->returnValue( false )); + + $objectManager = $this->getMock('Doctrine\Common\Persistence\ObjectManager'); + $objectManager->expects($this->once()) + ->method('getMetadataFactory') + ->will($this->returnValue($metadataFactory)); + + $this->manager->expects($this->once()) + ->method('getManager') + ->will($this->returnValue($objectManager)); + + $ret = $this->converter->supports($config); + + $this->assertTrue($ret, "Should be supported"); + } +} diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/ParamConverterManagerTest.php b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/ParamConverterManagerTest.php new file mode 100644 index 0000000..ef623ae --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/Tests/Request/ParamConverter/ParamConverterManagerTest.php @@ -0,0 +1,99 @@ +manager = new ParamConverterManager(); + } + + public function testPriorities() + { + $this->assertEquals(array(), $this->manager->all()); + + $high = $this->createParamConverterMock(); + $low = $this->createParamConverterMock(); + + $this->manager->add($low); + $this->manager->add($high, 10); + + $this->assertEquals(array( + $high, + $low, + ), $this->manager->all()); + } + + public function testApply() + { + $supported = $this->createParamConverterMock(); + $supported + ->expects($this->once()) + ->method('supports') + ->will($this->returnValue(true)) + ; + $supported + ->expects($this->once()) + ->method('apply') + ->will($this->returnValue(false)) + ; + + $invalid = $this->createParamConverterMock(); + $invalid + ->expects($this->once()) + ->method('supports') + ->will($this->returnValue(false)) + ; + $invalid + ->expects($this->never()) + ->method('apply') + ; + + $configurations = array( + new Configuration\ParamConverter(array( + 'name' => 'var', + )), + ); + + $this->manager->add($supported); + $this->manager->add($invalid); + $this->manager->apply(new Request(), $configurations); + } + + public function testApplyNotCalledOnAlreadyConvertedObjects() + { + + $converter = $this->createParamConverterMock(); + $converter + ->expects($this->never()) + ->method('supports') + ; + + $converter + ->expects($this->never()) + ->method('apply') + ; + + $this->manager->add($converter); + + $request = new Request(); + $request->attributes->set('converted', new \stdClass); + + $configuration = new Configuration\ParamConverter(array( + 'name' => 'converted', + 'class' => 'stdClass', + )); + + $this->manager->apply($request, array($configuration)); + } + + protected function createParamConverterMock() + { + return $this->getMock('Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface'); + } +} diff --git a/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/phpunit.xml.dist b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/phpunit.xml.dist new file mode 100644 index 0000000..cfa0dd3 --- /dev/null +++ b/vendor/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/phpunit.xml.dist @@ -0,0 +1,20 @@ + + + + + + ./Tests + + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/.gitignore b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/.gitignore new file mode 100644 index 0000000..6852100 --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/.gitignore @@ -0,0 +1,3 @@ +phpunit.xml +vendor +composer.lock diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Command/GenerateBundleCommand.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Command/GenerateBundleCommand.php index 9aa79ee..f40468d 100644 --- a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Command/GenerateBundleCommand.php +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Command/GenerateBundleCommand.php @@ -55,7 +55,7 @@ conventions): php app/console generate:bundle --namespace=Acme/BlogBundle -Note that you can use / instead of \\ for the namespace delimiter to avoid any +Note that you can use / instead of \\ for the namespace delimiter to avoid any problem. If you want to disable any user interaction, use --no-interaction but don't forget to pass all needed options: diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateBundleCommandTest.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateBundleCommandTest.php new file mode 100644 index 0000000..35decd7 --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateBundleCommandTest.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\GeneratorBundle\Tests\Command; + +use Symfony\Component\Console\Tester\CommandTester; +use Sensio\Bundle\GeneratorBundle\Command\GenerateBundleCommand; + +class GenerateBundleCommandTest extends GenerateCommandTest +{ + /** + * @dataProvider getInteractiveCommandData + */ + public function testInteractiveCommand($options, $input, $expected) + { + list($namespace, $bundle, $dir, $format, $structure) = $expected; + + $generator = $this->getGenerator(); + $generator + ->expects($this->once()) + ->method('generate') + ->with($namespace, $bundle, $dir, $format, $structure) + ; + + $tester = new CommandTester($this->getCommand($generator, $input)); + $tester->execute($options); + } + + public function getInteractiveCommandData() + { + $tmp = sys_get_temp_dir(); + + return array( + array(array('--dir' => $tmp), "Foo/BarBundle\n", array('Foo\BarBundle', 'FooBarBundle', $tmp.'/', 'annotation', false)), + array(array('--dir' => $tmp), "Foo/BarBundle\nBarBundle\nfoo\nyml\nn", array('Foo\BarBundle', 'BarBundle', 'foo/', 'yml', false)), + array(array('--dir' => $tmp, '--format' => 'yml', '--bundle-name' => 'BarBundle', '--structure' => true), "Foo/BarBundle\n", array('Foo\BarBundle', 'BarBundle', $tmp.'/', 'yml', true)), + ); + } + + /** + * @dataProvider getNonInteractiveCommandData + */ + public function testNonInteractiveCommand($options, $expected) + { + list($namespace, $bundle, $dir, $format, $structure) = $expected; + + $generator = $this->getGenerator(); + $generator + ->expects($this->once()) + ->method('generate') + ->with($namespace, $bundle, $dir, $format, $structure) + ; + + $tester = new CommandTester($this->getCommand($generator, '')); + $tester->execute($options, array('interactive' => false)); + } + + public function getNonInteractiveCommandData() + { + $tmp = sys_get_temp_dir(); + + return array( + array(array('--dir' => $tmp, '--namespace' => 'Foo/BarBundle'), array('Foo\BarBundle', 'FooBarBundle', $tmp.'/', 'annotation', false)), + array(array('--dir' => $tmp, '--namespace' => 'Foo/BarBundle', '--format' => 'yml', '--bundle-name' => 'BarBundle', '--structure' => true), array('Foo\BarBundle', 'BarBundle', $tmp.'/', 'yml', true)), + ); + } + + protected function getCommand($generator, $input) + { + $command = $this + ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Command\GenerateBundleCommand') + ->setMethods(array('checkAutoloader', 'updateKernel', 'updateRouting')) + ->getMock() + ; + + $command->setContainer($this->getContainer()); + $command->setHelperSet($this->getHelperSet($input)); + $command->setGenerator($generator); + + return $command; + } + + protected function getGenerator() + { + // get a noop generator + return $this + ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Generator\BundleGenerator') + ->disableOriginalConstructor() + ->setMethods(array('generate')) + ->getMock() + ; + } +} diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateCommandTest.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateCommandTest.php new file mode 100644 index 0000000..93d9a50 --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateCommandTest.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\GeneratorBundle\Tests\Command; + +use Symfony\Component\Console\Helper\HelperSet; +use Symfony\Component\Console\Helper\FormatterHelper; +use Sensio\Bundle\GeneratorBundle\Command\Helper\DialogHelper; +use Symfony\Component\DependencyInjection\Container; + +abstract class GenerateCommandTest extends \PHPUnit_Framework_TestCase +{ + protected function getHelperSet($input) + { + $dialog = new DialogHelper(); + $dialog->setInputStream($this->getInputStream($input)); + + return new HelperSet(array(new FormatterHelper(), $dialog)); + } + + protected function getBundle() + { + $bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface'); + $bundle + ->expects($this->any()) + ->method('getPath') + ->will($this->returnValue(sys_get_temp_dir())) + ; + + return $bundle; + } + + protected function getInputStream($input) + { + $stream = fopen('php://memory', 'r+', false); + fputs($stream, $input.str_repeat("\n", 10)); + rewind($stream); + + return $stream; + } + + protected function getContainer() + { + $kernel = $this->getMock('Symfony\Component\HttpKernel\KernelInterface'); + $kernel + ->expects($this->any()) + ->method('getBundle') + ->will($this->returnValue($this->getBundle())) + ; + + $filesystem = $this->getMock('Symfony\Component\Filesystem\Filesystem'); + $filesystem + ->expects($this->any()) + ->method('isAbsolutePath') + ->will($this->returnValue(true)) + ; + + $container = new Container(); + $container->set('kernel', $kernel); + $container->set('filesystem', $filesystem); + + $container->setParameter('kernel.root_dir', sys_get_temp_dir()); + + return $container; + } +} diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineCrudCommandTest.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineCrudCommandTest.php new file mode 100644 index 0000000..ffea942 --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineCrudCommandTest.php @@ -0,0 +1,141 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\GeneratorBundle\Tests\Command; + +use Symfony\Component\Console\Tester\CommandTester; +use Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineCrudCommand; + +class GenerateDoctrineCrudCommandTest extends GenerateCommandTest +{ + /** + * @dataProvider getInteractiveCommandData + */ + public function testInteractiveCommand($options, $input, $expected) + { + list($entity, $format, $prefix, $withWrite) = $expected; + + $generator = $this->getGenerator(); + $generator + ->expects($this->once()) + ->method('generate') + ->with($this->getBundle(), $entity, $this->getDoctrineMetadata(), $format, $prefix, $withWrite) + ; + + $tester = new CommandTester($this->getCommand($generator, $input)); + $tester->execute($options); + } + + public function getInteractiveCommandData() + { + return array( + array(array(), "AcmeBlogBundle:Blog/Post\n", array('Blog\\Post', 'annotation', 'blog_post', false)), + array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), '', array('Blog\\Post', 'annotation', 'blog_post', false)), + array(array(), "AcmeBlogBundle:Blog/Post\ny\nyml\nfoobar\n", array('Blog\\Post', 'yml', 'foobar', true)), + array(array(), "AcmeBlogBundle:Blog/Post\ny\nyml\n/foobar\n", array('Blog\\Post', 'yml', 'foobar', true)), + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--route-prefix' => 'foo', '--with-write' => true), '', array('Blog\\Post', 'yml', 'foo', true)), + ); + } + + /** + * @dataProvider getNonInteractiveCommandData + */ + public function testNonInteractiveCommand($options, $expected) + { + list($entity, $format, $prefix, $withWrite) = $expected; + + $generator = $this->getGenerator(); + $generator + ->expects($this->once()) + ->method('generate') + ->with($this->getBundle(), $entity, $this->getDoctrineMetadata(), $format, $prefix, $withWrite) + ; + + $tester = new CommandTester($this->getCommand($generator, '')); + $tester->execute($options, array('interactive' => false)); + } + + public function getNonInteractiveCommandData() + { + return array( + array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), array('Blog\\Post', 'annotation', 'blog_post', false)), + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--route-prefix' => 'foo', '--with-write' => true), array('Blog\\Post', 'yml', 'foo', true)), + ); + } + + protected function getCommand($generator, $input) + { + $command = $this + ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineCrudCommand') + ->setMethods(array('getEntityMetadata')) + ->getMock() + ; + + $command + ->expects($this->any()) + ->method('getEntityMetadata') + ->will($this->returnValue(array($this->getDoctrineMetadata()))) + ; + + $command->setContainer($this->getContainer()); + $command->setHelperSet($this->getHelperSet($input)); + $command->setGenerator($generator); + $command->setFormGenerator($this->getFormGenerator()); + + return $command; + } + + protected function getDoctrineMetadata() + { + return $this + ->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadataInfo') + ->disableOriginalConstructor() + ->getMock() + ; + } + + protected function getGenerator() + { + // get a noop generator + return $this + ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Generator\DoctrineCrudGenerator') + ->disableOriginalConstructor() + ->setMethods(array('generate')) + ->getMock() + ; + } + + protected function getFormGenerator() + { + return $this + ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Generator\DoctrineFormGenerator') + ->disableOriginalConstructor() + ->setMethods(array('generate')) + ->getMock() + ; + } + + protected function getContainer() + { + $container = parent::getContainer(); + + $registry = $this->getMock('Symfony\Bridge\Doctrine\RegistryInterface'); + $registry + ->expects($this->any()) + ->method('getEntityNamespace') + ->will($this->returnValue('Foo\\FooBundle\\Entity')) + ; + + $container->set('doctrine', $registry); + + return $container; + } +} diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineEntityCommandTest.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineEntityCommandTest.php new file mode 100644 index 0000000..5ef35c2 --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Command/GenerateDoctrineEntityCommandTest.php @@ -0,0 +1,104 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\GeneratorBundle\Tests\Command; + +use Symfony\Component\Console\Tester\CommandTester; +use Sensio\Bundle\GeneratorBundle\Command\GenerateDoctrineEntityCommand; + +class GenerateDoctrineEntityCommandTest extends GenerateCommandTest +{ + /** + * @dataProvider getInteractiveCommandData + */ + public function testInteractiveCommand($options, $input, $expected) + { + list($entity, $format, $fields) = $expected; + + $generator = $this->getGenerator(); + $generator + ->expects($this->once()) + ->method('generate') + ->with($this->getBundle(), $entity, $format, $fields) + ; + + $tester = new CommandTester($this->getCommand($generator, $input)); + $tester->execute($options); + } + + public function getInteractiveCommandData() + { + return array( + array(array(), "AcmeBlogBundle:Blog/Post\n", array('Blog\\Post', 'annotation', array())), + array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), '', array('Blog\\Post', 'annotation', array())), + array(array(), "AcmeBlogBundle:Blog/Post\nyml\n\n", array('Blog\\Post', 'yml', array())), + array(array(), "AcmeBlogBundle:Blog/Post\nyml\ntitle\n\n255\ndescription\ntext\n\n", array('Blog\\Post', 'yml', array( + array('fieldName' => 'title', 'type' => 'string', 'length' => 255), + array('fieldName' => 'description', 'type' => 'text'), + ))), + ); + } + + /** + * @dataProvider getNonInteractiveCommandData + */ + public function testNonInteractiveCommand($options, $expected) + { + list($entity, $format, $fields) = $expected; + + $generator = $this->getGenerator(); + $generator + ->expects($this->once()) + ->method('generate') + ->with($this->getBundle(), $entity, $format, $fields) + ; + $generator + ->expects($this->any()) + ->method('isReservedKeyword') + ->will($this->returnValue(false)) + ; + + $tester = new CommandTester($this->getCommand($generator, '')); + $tester->execute($options, array('interactive' => false)); + } + + public function getNonInteractiveCommandData() + { + return array( + array(array('--entity' => 'AcmeBlogBundle:Blog/Post'), array('Blog\\Post', 'annotation', array())), + array(array('--entity' => 'AcmeBlogBundle:Blog/Post', '--format' => 'yml', '--fields' => 'title:string(255) description:text'), array('Blog\\Post', 'yml', array( + array('fieldName' => 'title', 'type' => 'string', 'length' => 255), + array('fieldName' => 'description', 'type' => 'text', 'length' => ''), + ))), + ); + } + + protected function getCommand($generator, $input) + { + $command = new GenerateDoctrineEntityCommand(); + $command->setContainer($this->getContainer()); + $command->setHelperSet($this->getHelperSet($input)); + $command->setGenerator($generator); + + return $command; + } + + protected function getGenerator() + { + // get a noop generator + return $this + ->getMockBuilder('Sensio\Bundle\GeneratorBundle\Generator\DoctrineEntityGenerator') + ->disableOriginalConstructor() + ->setMethods(array('generate', 'isReservedKeyword')) + ->getMock() + ; + } +} diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/BundleGeneratorTest.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/BundleGeneratorTest.php new file mode 100644 index 0000000..3f5f850 --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/BundleGeneratorTest.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\GeneratorBundle\Tests\Generator; + +use Sensio\Bundle\GeneratorBundle\Generator\BundleGenerator; + +class BundleGeneratorTest extends GeneratorTest +{ + public function testGenerateYaml() + { + $generator = new BundleGenerator($this->filesystem, __DIR__.'/../../Resources/skeleton/bundle'); + $generator->generate('Foo\BarBundle', 'FooBarBundle', $this->tmpDir, 'yml', false); + + $files = array( + 'FooBarBundle.php', + 'Controller/DefaultController.php', + 'Resources/views/Default/index.html.twig', + 'Resources/config/routing.yml', + 'Tests/Controller/DefaultControllerTest.php', + 'Resources/config/services.yml', + 'DependencyInjection/Configuration.php', + 'DependencyInjection/FooBarExtension.php', + ); + foreach ($files as $file) { + $this->assertTrue(file_exists($this->tmpDir.'/Foo/BarBundle/'.$file), sprintf('%s has been generated', $file)); + } + + $content = file_get_contents($this->tmpDir.'/Foo/BarBundle/FooBarBundle.php'); + $this->assertContains('namespace Foo\\BarBundle', $content); + + $content = file_get_contents($this->tmpDir.'/Foo/BarBundle/Controller/DefaultController.php'); + $this->assertContains('public function indexAction', $content); + $this->assertNotContains('@Route("/hello/{name}"', $content); + + $content = file_get_contents($this->tmpDir.'/Foo/BarBundle/Resources/views/Default/index.html.twig'); + $this->assertContains('Hello {{ name }}!', $content); + } + + public function testGenerateAnnotation() + { + $generator = new BundleGenerator($this->filesystem, __DIR__.'/../../Resources/skeleton/bundle'); + $generator->generate('Foo\BarBundle', 'FooBarBundle', $this->tmpDir, 'annotation', false); + + $this->assertFalse(file_exists($this->tmpDir.'/Foo/BarBundle/Resources/config/routing.yml')); + $this->assertFalse(file_exists($this->tmpDir.'/Foo/BarBundle/Resources/config/routing.xml')); + + $content = file_get_contents($this->tmpDir.'/Foo/BarBundle/Controller/DefaultController.php'); + $this->assertContains('@Route("/hello/{name}"', $content); + } +} diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineCrudGeneratorTest.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineCrudGeneratorTest.php new file mode 100644 index 0000000..6a7f5ee --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineCrudGeneratorTest.php @@ -0,0 +1,206 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\GeneratorBundle\Tests\Generator; + +use Sensio\Bundle\GeneratorBundle\Generator\DoctrineCrudGenerator; + +class DoctrineCrudGeneratorTest extends GeneratorTest +{ + public function testGenerateYamlFull() + { + $this->getGenerator()->generate($this->getBundle(), 'Post', $this->getMetadata(), 'yml', '/post', true); + + $files = array( + 'Controller/PostController.php', + 'Tests/Controller/PostControllerTest.php', + 'Resources/config/routing/post.yml', + 'Resources/views/Post/index.html.twig', + 'Resources/views/Post/show.html.twig', + 'Resources/views/Post/new.html.twig', + 'Resources/views/Post/edit.html.twig', + ); + foreach ($files as $file) { + $this->assertTrue(file_exists($this->tmpDir.'/'.$file), sprintf('%s has been generated', $file)); + } + + $files = array( + 'Resources/config/routing/post.xml', + ); + foreach ($files as $file) { + $this->assertFalse(file_exists($this->tmpDir.'/'.$file), sprintf('%s has not been generated', $file)); + } + + $content = file_get_contents($this->tmpDir.'/Controller/PostController.php'); + $strings = array( + 'namespace Foo\BarBundle\Controller;', + 'public function indexAction', + 'public function showAction', + 'public function newAction', + 'public function editAction', + ); + foreach ($strings as $string) { + $this->assertContains($string, $content); + } + } + + public function testGenerateXml() + { + $this->getGenerator()->generate($this->getBundle(), 'Post', $this->getMetadata(), 'xml', '/post', false); + + $files = array( + 'Controller/PostController.php', + 'Tests/Controller/PostControllerTest.php', + 'Resources/config/routing/post.xml', + 'Resources/views/Post/index.html.twig', + 'Resources/views/Post/show.html.twig', + ); + foreach ($files as $file) { + $this->assertTrue(file_exists($this->tmpDir.'/'.$file), sprintf('%s has been generated', $file)); + } + + $files = array( + 'Resources/config/routing/post.yml', + 'Resources/views/Post/new.html.twig', + 'Resources/views/Post/edit.html.twig', + ); + foreach ($files as $file) { + $this->assertFalse(file_exists($this->tmpDir.'/'.$file), sprintf('%s has not been generated', $file)); + } + + $content = file_get_contents($this->tmpDir.'/Controller/PostController.php'); + $strings = array( + 'namespace Foo\BarBundle\Controller;', + 'public function indexAction', + 'public function showAction', + ); + foreach ($strings as $string) { + $this->assertContains($string, $content); + } + + $content = file_get_contents($this->tmpDir.'/Controller/PostController.php'); + $strings = array( + 'public function newAction', + 'public function editAction', + '@Route', + ); + foreach ($strings as $string) { + $this->assertNotContains($string, $content); + } + } + + public function testGenerateAnnotationWrite() + { + $this->getGenerator()->generate($this->getBundle(), 'Post', $this->getMetadata(), 'annotation', '/post', true); + + $files = array( + 'Controller/PostController.php', + 'Tests/Controller/PostControllerTest.php', + 'Resources/views/Post/index.html.twig', + 'Resources/views/Post/show.html.twig', + 'Resources/views/Post/new.html.twig', + 'Resources/views/Post/edit.html.twig', + ); + foreach ($files as $file) { + $this->assertTrue(file_exists($this->tmpDir.'/'.$file), sprintf('%s has been generated', $file)); + } + + $files = array( + 'Resources/config/routing/post.yml', + 'Resources/config/routing/post.xml', + ); + foreach ($files as $file) { + $this->assertFalse(file_exists($this->tmpDir.'/'.$file), sprintf('%s has not been generated', $file)); + } + + $content = file_get_contents($this->tmpDir.'/Controller/PostController.php'); + $strings = array( + 'namespace Foo\BarBundle\Controller;', + 'public function indexAction', + 'public function showAction', + 'public function newAction', + 'public function editAction', + '@Route', + ); + foreach ($strings as $string) { + $this->assertContains($string, $content); + } + } + + public function testGenerateAnnotation() + { + $this->getGenerator()->generate($this->getBundle(), 'Post', $this->getMetadata(), 'annotation', '/post', false); + + $files = array( + 'Controller/PostController.php', + 'Tests/Controller/PostControllerTest.php', + 'Resources/views/Post/index.html.twig', + 'Resources/views/Post/show.html.twig', + ); + foreach ($files as $file) { + $this->assertTrue(file_exists($this->tmpDir.'/'.$file), sprintf('%s has been generated', $file)); + } + + $files = array( + 'Resources/config/routing/post.yml', + 'Resources/config/routing/post.xml', + 'Resources/views/Post/new.html.twig', + 'Resources/views/Post/edit.html.twig', + ); + foreach ($files as $file) { + $this->assertFalse(file_exists($this->tmpDir.'/'.$file), sprintf('%s has not been generated', $file)); + } + + $content = file_get_contents($this->tmpDir.'/Controller/PostController.php'); + $strings = array( + 'namespace Foo\BarBundle\Controller;', + 'public function indexAction', + 'public function showAction', + '@Route', + ); + foreach ($strings as $string) { + $this->assertContains($string, $content); + } + + $content = file_get_contents($this->tmpDir.'/Controller/PostController.php'); + $strings = array( + 'public function newAction', + 'public function editAction', + ); + foreach ($strings as $string) { + $this->assertNotContains($string, $content); + } + } + + protected function getGenerator() + { + return new DoctrineCrudGenerator($this->filesystem, __DIR__.'/../../Resources/skeleton/crud'); + } + + protected function getBundle() + { + $bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface'); + $bundle->expects($this->any())->method('getPath')->will($this->returnValue($this->tmpDir)); + $bundle->expects($this->any())->method('getName')->will($this->returnValue('FooBarBundle')); + $bundle->expects($this->any())->method('getNamespace')->will($this->returnValue('Foo\BarBundle')); + + return $bundle; + } + + public function getMetadata() + { + $metadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadataInfo')->disableOriginalConstructor()->getMock(); + $metadata->identifier = array('id'); + $metadata->fieldMappings = array('title' => array('type' => 'string')); + + return $metadata; + } +} diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineFormGeneratorTest.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineFormGeneratorTest.php new file mode 100644 index 0000000..3255221 --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/DoctrineFormGeneratorTest.php @@ -0,0 +1,40 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\GeneratorBundle\Tests\Generator; + +use Sensio\Bundle\GeneratorBundle\Generator\DoctrineFormGenerator; + +class DoctrineFormGeneratorTest extends GeneratorTest +{ + public function testGenerate() + { + $generator = new DoctrineFormGenerator($this->filesystem, __DIR__.'/../../Resources/skeleton/form'); + + $bundle = $this->getMock('Symfony\Component\HttpKernel\Bundle\BundleInterface'); + $bundle->expects($this->any())->method('getPath')->will($this->returnValue($this->tmpDir)); + $bundle->expects($this->any())->method('getNamespace')->will($this->returnValue('Foo\BarBundle')); + + $metadata = $this->getMockBuilder('Doctrine\ORM\Mapping\ClassMetadataInfo')->disableOriginalConstructor()->getMock(); + $metadata->identifier = array('id'); + $metadata->associationMappings = array('title' => array('type' => 'string')); + + $generator->generate($bundle, 'Post', $metadata); + + $this->assertTrue(file_exists($this->tmpDir.'/Form/PostType.php')); + + $content = file_get_contents($this->tmpDir.'/Form/PostType.php'); + $this->assertContains('->add(\'title\')', $content); + $this->assertContains('class PostType extends AbstractType', $content); + $this->assertContains("'data_class' => 'Foo\BarBundle\Entity\Post'", $content); + $this->assertContains("'foo_barbundle_posttype'", $content); + } +} diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/GeneratorTest.php b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/GeneratorTest.php new file mode 100644 index 0000000..4435b4a --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/Tests/Generator/GeneratorTest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Sensio\Bundle\GeneratorBundle\Tests\Generator; + +use Symfony\Component\Filesystem\Filesystem; + +abstract class GeneratorTest extends \PHPUnit_Framework_TestCase +{ + protected $filesystem; + protected $tmpDir; + + public function setUp() + { + $this->tmpDir = sys_get_temp_dir().'/sf2'; + $this->filesystem = new Filesystem(); + $this->filesystem->remove($this->tmpDir); + } + + public function tearDown() + { + $this->filesystem->remove($this->tmpDir); + } +} diff --git a/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/phpunit.xml.dist b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/phpunit.xml.dist new file mode 100644 index 0000000..6eb1ca0 --- /dev/null +++ b/vendor/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/phpunit.xml.dist @@ -0,0 +1,20 @@ + + + + + + ./Tests + + + + + + ./ + + ./Resources + ./Tests + ./vendor + + + + diff --git a/vendor/swiftmailer/swiftmailer/.gitignore b/vendor/swiftmailer/swiftmailer/.gitignore new file mode 100644 index 0000000..0aa62f5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/.gitignore @@ -0,0 +1,6 @@ +.DS_Store +tests/acceptance.conf.php +tests/smoke.conf.php +build/* +.project +.settings/* diff --git a/vendor/swiftmailer/swiftmailer/CHANGES b/vendor/swiftmailer/swiftmailer/CHANGES new file mode 100644 index 0000000..a6a53ab --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/CHANGES @@ -0,0 +1,100 @@ +Changelog since Version 4.x.x +============================= + +4.2.2 (2012-XX-XX) +------------------ + + * n/a + +4.2.1 (2012-07-13) +------------------ + + * changed the coding standards to PSR-1/2 + * fixed issue with autoloading + * added NativeQpContentEncoder to enhance performance (for PHP 5.3+) + +4.2.0 (2012-06-29) +------------------ + + * added documentation about how to use the Japanese support introduced in 4.1.8 + * added a way to override the default configuration in a lazy way + * changed the PEAR init script to lazy-load the initialization + * fixed a bug when calling Swift_Preferences before anything else (regression introduced in 4.1.8) + +4.1.8 (2012-06-17) +------------------ + + * added Japanese iso-2022-jp support + * changed the init script to lazy-load the initialization + * fixed docblocks (@id) which caused some problems with libraries parsing the dobclocks + * fixed Swift_Mime_Headers_IdentificationHeader::setId() when passed an array of ids + * fixed encoding of email addresses in headers + * added replacements setter to the Decorator plugin + +4.1.7 (2012-04-26) +------------------ + + * fixed QpEncoder safeMapShareId property + +4.1.6 (2012-03-23) +------------------ + + * reduced the size of serialized Messages + +4.1.5 (2012-01-04) +------------------ + + * enforced Swift_Spool::queueMessage() to return a Boolean + * made an optimization to the memory spool: start the transport only when required + * prevented stream_socket_client() from generating an error and throw a Swift_TransportException instead + * fixed a PHP warning when calling to mail() when safe_mode is off + * many doc tweaks + +4.1.4 (2011-12-16) +------------------ + + * added a memory spool (Swift_MemorySpool) + * fixed too many opened files when sending emails with attachments + +4.1.3 (2011-10-27) +------------------ + + * added STARTTLS support + * added missing @return tags on fluent methods + * added a MessageLogger plugin that logs all sent messages + * added composer.json + +4.1.2 (2011-09-13) +------------------ + + * fixed wrong detection of magic_quotes_runtime + * fixed fatal errors when no To or Subject header has been set + * fixed charset on parameter header continuations + * added documentation about how to install Swiftmailer from the PEAR channel + * fixed various typos and markup problem in the documentation + * fixed warning when cache directory does not exist + * fixed "slashes are escaped" bug + * changed require_once() to require() in autoload + +4.1.1 (2011-07-04) +------------------ + + * added missing file in PEAR package + +4.1.0 (2011-06-30) +------------------ + + * documentation has been converted to ReST + +4.1.0 RC1 (2011-06-17) +---------------------- + +New features: + + * changed the Decorator Plugin to allow replacements in all headers + * added Swift_Mime_Grammar and Swift_Validate to validate an email address + * modified the autoloader to lazy-initialize Swiftmailer + * removed Swift_Mailer::batchSend() + * added NullTransport + * added new plugins: RedirectingPlugin and ImpersonatePlugin + * added a way to send messages asynchronously (Spool) diff --git a/vendor/swiftmailer/swiftmailer/README b/vendor/swiftmailer/swiftmailer/README new file mode 100644 index 0000000..dfede07 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/README @@ -0,0 +1,16 @@ +Swift Mailer +------------ + +Swift Mailer is a component based mailing solution for PHP 5. +It is released under the LGPL license. + +Homepage: http://swiftmailer.org +Documentation: http://swiftmailer.org/docs +Mailing List: http://groups.google.com/group/swiftmailer +Bugs: https://github.com/swiftmailer/swiftmailer/issues +Repository: https://github.com/swiftmailer/swiftmailer + +Swift Mailer is highly object-oriented by design and lends itself +to use in complex web application with a great deal of flexibility. + +For full details on usage, see the documentation. diff --git a/vendor/swiftmailer/swiftmailer/README.git b/vendor/swiftmailer/swiftmailer/README.git new file mode 100644 index 0000000..3baef7c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/README.git @@ -0,0 +1,67 @@ +This README applies to anyone who checks out the source from git. + +If you're reading this page on github.com, and you don't have git +installed or know about git, you can download this repository by +using the "download" button on github.com, right above the file +list. + +PREAMBLE: +--------- + +The git repository is structured in the expected way where "master" is the +main branch you should use if you want to have bleeding-edge updates. Any +other branch should be ignored since it will likely contain unstable +and/or experimental developments. + +Generally speaking you should feel safe using the "master" branch in +production code. Anything likely to break will be committed to another +branch. Only bugfixes and clean non-breaking feature additions will be +performed in master. + +All releases (post version 4.0.0) are tagged using the version number of +that release. Earlier versions exist in a subversion repository at the +old sourceforge project page. + + +WHAT IS SWIFT MAILER? +--------------------- + +Swift Mailer is a component based mailing solution for PHP 5. +It is released under the LGPL license. + +Homepage: http://swiftmailer.org/ +Documentation: http://swiftmailer.org/docs +Mailing List: http://groups.google.com/group/swiftmailer +Bugs: https://github.com/swiftmailer/swiftmailer/issues +Repository: https://github.com/swiftmailer/swiftmailer + +Swift Mailer is highly object-oriented by design and lends itself +to use in complex web application with a great deal of flexibility. + +For full details on usage, see the documentation. + + +WHY SO MUCH CLUTTER? +-------------------- +As you can probably see, there are a lot more files in here than you find in +the pre-packaged versions. That's because I store notes (UML, RFCs etc) in +the repository. + +The main library files live in /lib and the tests live in /tests. You can run +the tests by pointing your web browser at /test-suite, or by running the +command "php test-suite/run.php". Some tests will be "skipped" if +tests/smoke.conf.php and tests/acceptance.conf.php are not editted. This is +harmless and normal. + +If you want to create a bundled-up package from subversion you can do so if +you have Ant (http://ant.apache.org/) installed. Simply run "ant package" +from this directory and the tar.gz file will be created in the /build +directory. + +Running the command "ant" with no arguments will bundle up the package without +compressing it into a tar.gz file. + +Tests can also be run using "ant test" provided php is on your PATH +environment variable. + +EoM diff --git a/vendor/swiftmailer/swiftmailer/VERSION b/vendor/swiftmailer/swiftmailer/VERSION index 72ba2c7..64a59ba 100644 --- a/vendor/swiftmailer/swiftmailer/VERSION +++ b/vendor/swiftmailer/swiftmailer/VERSION @@ -1 +1 @@ -Swift-4.2.1 +Swift-4.2.2-DEV diff --git a/vendor/swiftmailer/swiftmailer/build.xml b/vendor/swiftmailer/swiftmailer/build.xml new file mode 100644 index 0000000..c4e234f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/build.xml @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vendor/swiftmailer/swiftmailer/create_pear_package.php b/vendor/swiftmailer/swiftmailer/create_pear_package.php new file mode 100644 index 0000000..521d650 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/create_pear_package.php @@ -0,0 +1,42 @@ + date('Y-m-d'), + 'time' => date('H:m:00'), + 'version' => $argv[1], + 'api_version' => $argv[1], + 'stability' => $argv[2], + 'api_stability' => $argv[2], +); + +$context['files'] = ''; +$path = realpath(dirname(__FILE__).'/lib/classes/Swift'); +foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::LEAVES_ONLY) as $file) +{ + if (preg_match('/\.php$/', $file)) + { + $name = str_replace($path.'/', '', $file); + $context['files'] .= ' '."\n"; + } +} + +$template = file_get_contents(dirname(__FILE__).'/package.xml.tpl'); +$content = preg_replace_callback('/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/', 'replace_parameters', $template); +file_put_contents(dirname(__FILE__).'/package.xml', $content); + +function replace_parameters($matches) +{ + global $context; + + return isset($context[$matches[1]]) ? $context[$matches[1]] : null; +} diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php index 6e61e1f..b134416 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/SmtpTransport.php @@ -20,7 +20,7 @@ class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport * Create a new SmtpTransport, optionally with $host, $port and $security. * @param string $host * @param int $port - * @param int $security + * @param string $security */ public function __construct($host = 'localhost', $port = 25, $security = null) { @@ -39,7 +39,7 @@ class Swift_SmtpTransport extends Swift_Transport_EsmtpTransport * Create a new SmtpTransport instance. * @param string $host * @param int $port - * @param int $security + * @param string $security * @return Swift_SmtpTransport */ public static function newInstance($host = 'localhost', $port = 25, $security = null) diff --git a/vendor/swiftmailer/swiftmailer/lib/swift_required.php b/vendor/swiftmailer/swiftmailer/lib/swift_required.php index e7869a2..a5c842b 100644 --- a/vendor/swiftmailer/swiftmailer/lib/swift_required.php +++ b/vendor/swiftmailer/swiftmailer/lib/swift_required.php @@ -21,9 +21,11 @@ define('SWIFT_REQUIRED_LOADED', true); //Load Swift utility class require dirname(__FILE__) . '/classes/Swift.php'; -function _swiftmailer_init() -{ - require dirname(__FILE__) . '/swift_init.php'; +if (!function_exists('_swiftmailer_init')) { + function _swiftmailer_init() + { + require dirname(__FILE__) . '/swift_init.php'; + } } //Start the autoloader and lazy-load the init script to set up dependency injection diff --git a/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php b/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php index b29fc79..64ec497 100644 --- a/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php +++ b/vendor/swiftmailer/swiftmailer/lib/swift_required_pear.php @@ -21,9 +21,11 @@ define('SWIFT_REQUIRED_LOADED', true); //Load Swift utility class require dirname(__FILE__) . '/Swift.php'; -function _swiftmailer_init() -{ - require dirname(__FILE__) . '/swift_init.php'; +if (!function_exists('_swiftmailer_init')) { + function _swiftmailer_init() + { + require dirname(__FILE__) . '/swift_init.php'; + } } //Start the autoloader and lazy-load the init script to set up dependency injection diff --git a/vendor/swiftmailer/swiftmailer/notes/APPS b/vendor/swiftmailer/swiftmailer/notes/APPS new file mode 100644 index 0000000..b06b4cc --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/APPS @@ -0,0 +1,15 @@ +Applications I need to test with +--------------------------------- + +Standalone (can read .eml files): +--------------------------------- +Microsoft Entourage (can assume same as outlook) +Mozilla Thunderbird +Apple Mail + +Web-based: +---------- +Hotmail +Gmail +Yahoo! +Mail2Web diff --git a/vendor/swiftmailer/swiftmailer/notes/CHARSETS b/vendor/swiftmailer/swiftmailer/notes/CHARSETS new file mode 100644 index 0000000..6a97a89 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/CHARSETS @@ -0,0 +1,46 @@ +Following is a list of character sets along with their widths: +-------------------------------------------------------------- + +1 Octet 8bit: +------------- +Windows 125* (CP125*) +CP* +ANSI +ISO-8859-* (IEC-8859-*) +Macintosh (Mac OS Roman) +KOI8-U (potentially KOI*8-*) +KOI8-R +MIK +Cork (T1) +ISCII +VISCII + + +1 Octet 7bit: +------------- +US-ASCII +K0I7 + +2 octets 16 bit: +---------------- +UCS-2 +UTF-16* (UTF-16BE etc) + +4-octets 32 bit: +---------------- +UCS-4 +UTF-32 + +Variable-width: +---------------------------- +Big5 - http://en.wikipedia.org/wiki/Big5 (1-2 bytes: 00-7f=1, 81-fe=2) +HKSCS - http://en.wikipedia.org/wiki/HKSCS (a big5 variant, but some variants use 10646) +ISO-10646 (IEC-10646) - http://en.wikipedia.org/wiki/ISO_10646 (unicode) +UTF-8 (1-5 bytes) +ISO-2022 (IEC-2022) - http://en.wikipedia.org/wiki/ISO_2022 +Shift-JIS - http://en.wikipedia.org/wiki/Shift-JIS + +A good resource: +---------------- +http://en.wikipedia.org/wiki/Character_encoding#Simple_character_sets + diff --git a/vendor/swiftmailer/swiftmailer/notes/message.xml b/vendor/swiftmailer/swiftmailer/notes/message.xml new file mode 100644 index 0000000..1183eca --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/message.xml @@ -0,0 +1,22 @@ + + + Some test message + chris@w3style.co.uk + mark@swiftmailer.org + chris.corbyn@sitepoint.com + text/plain + + Here's a recipe for beef stifado + + + text/html + + This is the other part + + + + application/pdf + stifado.pdf + /path/to/stifado.pdf + + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc0821.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc0821.txt new file mode 100644 index 0000000..d877b72 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc0821.txt @@ -0,0 +1,4050 @@ + + + + RFC 821 + + + + + + SIMPLE MAIL TRANSFER PROTOCOL + + + + Jonathan B. Postel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + August 1982 + + + + Information Sciences Institute + University of Southern California + 4676 Admiralty Way + Marina del Rey, California 90291 + + (213) 822-1511 + + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + TABLE OF CONTENTS + + 1. INTRODUCTION .................................................. 1 + + 2. THE SMTP MODEL ................................................ 2 + + 3. THE SMTP PROCEDURE ............................................ 4 + + 3.1. Mail ..................................................... 4 + 3.2. Forwarding ............................................... 7 + 3.3. Verifying and Expanding .................................. 8 + 3.4. Sending and Mailing ..................................... 11 + 3.5. Opening and Closing ..................................... 13 + 3.6. Relaying ................................................ 14 + 3.7. Domains ................................................. 17 + 3.8. Changing Roles .......................................... 18 + + 4. THE SMTP SPECIFICATIONS ...................................... 19 + + 4.1. SMTP Commands ........................................... 19 + 4.1.1. Command Semantics ..................................... 19 + 4.1.2. Command Syntax ........................................ 27 + 4.2. SMTP Replies ............................................ 34 + 4.2.1. Reply Codes by Function Group ......................... 35 + 4.2.2. Reply Codes in Numeric Order .......................... 36 + 4.3. Sequencing of Commands and Replies ...................... 37 + 4.4. State Diagrams .......................................... 39 + 4.5. Details ................................................. 41 + 4.5.1. Minimum Implementation ................................ 41 + 4.5.2. Transparency .......................................... 41 + 4.5.3. Sizes ................................................. 42 + + APPENDIX A: TCP ................................................. 44 + APPENDIX B: NCP ................................................. 45 + APPENDIX C: NITS ................................................ 46 + APPENDIX D: X.25 ................................................ 47 + APPENDIX E: Theory of Reply Codes ............................... 48 + APPENDIX F: Scenarios ........................................... 51 + + GLOSSARY ......................................................... 64 + + REFERENCES ....................................................... 67 + + + + +Network Working Group J. Postel +Request for Comments: DRAFT ISI +Replaces: RFC 788, 780, 772 August 1982 + + SIMPLE MAIL TRANSFER PROTOCOL + + +1. INTRODUCTION + + The objective of Simple Mail Transfer Protocol (SMTP) is to transfer + mail reliably and efficiently. + + SMTP is independent of the particular transmission subsystem and + requires only a reliable ordered data stream channel. Appendices A, + B, C, and D describe the use of SMTP with various transport services. + A Glossary provides the definitions of terms as used in this + document. + + An important feature of SMTP is its capability to relay mail across + transport service environments. A transport service provides an + interprocess communication environment (IPCE). An IPCE may cover one + network, several networks, or a subset of a network. It is important + to realize that transport systems (or IPCEs) are not one-to-one with + networks. A process can communicate directly with another process + through any mutually known IPCE. Mail is an application or use of + interprocess communication. Mail can be communicated between + processes in different IPCEs by relaying through a process connected + to two (or more) IPCEs. More specifically, mail can be relayed + between hosts on different transport systems by a host on both + transport systems. + + + + + + + + + + + + + + + + + + + + + + + + +Postel [Page 1] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + +2. THE SMTP MODEL + + The SMTP design is based on the following model of communication: as + the result of a user mail request, the sender-SMTP establishes a + two-way transmission channel to a receiver-SMTP. The receiver-SMTP + may be either the ultimate destination or an intermediate. SMTP + commands are generated by the sender-SMTP and sent to the + receiver-SMTP. SMTP replies are sent from the receiver-SMTP to the + sender-SMTP in response to the commands. + + Once the transmission channel is established, the SMTP-sender sends a + MAIL command indicating the sender of the mail. If the SMTP-receiver + can accept mail it responds with an OK reply. The SMTP-sender then + sends a RCPT command identifying a recipient of the mail. If the + SMTP-receiver can accept mail for that recipient it responds with an + OK reply; if not, it responds with a reply rejecting that recipient + (but not the whole mail transaction). The SMTP-sender and + SMTP-receiver may negotiate several recipients. When the recipients + have been negotiated the SMTP-sender sends the mail data, terminating + with a special sequence. If the SMTP-receiver successfully processes + the mail data it responds with an OK reply. The dialog is purposely + lock-step, one-at-a-time. + + ------------------------------------------------------------- + + + +----------+ +----------+ + +------+ | | | | + | User |<-->| | SMTP | | + +------+ | Sender- |Commands/Replies| Receiver-| + +------+ | SMTP |<-------------->| SMTP | +------+ + | File |<-->| | and Mail | |<-->| File | + |System| | | | | |System| + +------+ +----------+ +----------+ +------+ + + + Sender-SMTP Receiver-SMTP + + Model for SMTP Use + + Figure 1 + + ------------------------------------------------------------- + + The SMTP provides mechanisms for the transmission of mail; directly + from the sending user's host to the receiving user's host when the + + + +[Page 2] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + two host are connected to the same transport service, or via one or + more relay SMTP-servers when the source and destination hosts are not + connected to the same transport service. + + To be able to provide the relay capability the SMTP-server must be + supplied with the name of the ultimate destination host as well as + the destination mailbox name. + + The argument to the MAIL command is a reverse-path, which specifies + who the mail is from. The argument to the RCPT command is a + forward-path, which specifies who the mail is to. The forward-path + is a source route, while the reverse-path is a return route (which + may be used to return a message to the sender when an error occurs + with a relayed message). + + When the same message is sent to multiple recipients the SMTP + encourages the transmission of only one copy of the data for all the + recipients at the same destination host. + + The mail commands and replies have a rigid syntax. Replies also have + a numeric code. In the following, examples appear which use actual + commands and replies. The complete lists of commands and replies + appears in Section 4 on specifications. + + Commands and replies are not case sensitive. That is, a command or + reply word may be upper case, lower case, or any mixture of upper and + lower case. Note that this is not true of mailbox user names. For + some hosts the user name is case sensitive, and SMTP implementations + must take case to preserve the case of user names as they appear in + mailbox arguments. Host names are not case sensitive. + + Commands and replies are composed of characters from the ASCII + character set [1]. When the transport service provides an 8-bit byte + (octet) transmission channel, each 7-bit character is transmitted + right justified in an octet with the high order bit cleared to zero. + + When specifying the general form of a command or reply, an argument + (or special symbol) will be denoted by a meta-linguistic variable (or + constant), for example, "" or "". Here the + angle brackets indicate these are meta-linguistic variables. + However, some arguments use the angle brackets literally. For + example, an actual reverse-path is enclosed in angle brackets, i.e., + "" is an instance of (the + angle brackets are actually transmitted in the command or reply). + + + + + +Postel [Page 3] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + +3. THE SMTP PROCEDURES + + This section presents the procedures used in SMTP in several parts. + First comes the basic mail procedure defined as a mail transaction. + Following this are descriptions of forwarding mail, verifying mailbox + names and expanding mailing lists, sending to terminals instead of or + in combination with mailboxes, and the opening and closing exchanges. + At the end of this section are comments on relaying, a note on mail + domains, and a discussion of changing roles. Throughout this section + are examples of partial command and reply sequences, several complete + scenarios are presented in Appendix F. + + 3.1. MAIL + + There are three steps to SMTP mail transactions. The transaction + is started with a MAIL command which gives the sender + identification. A series of one or more RCPT commands follows + giving the receiver information. Then a DATA command gives the + mail data. And finally, the end of mail data indicator confirms + the transaction. + + The first step in the procedure is the MAIL command. The + contains the source mailbox. + + MAIL FROM: + + This command tells the SMTP-receiver that a new mail + transaction is starting and to reset all its state tables and + buffers, including any recipients or mail data. It gives the + reverse-path which can be used to report errors. If accepted, + the receiver-SMTP returns a 250 OK reply. + + The can contain more than just a mailbox. The + is a reverse source routing list of hosts and + source mailbox. The first host in the should be + the host sending this command. + + The second step in the procedure is the RCPT command. + + RCPT TO: + + This command gives a forward-path identifying one recipient. + If accepted, the receiver-SMTP returns a 250 OK reply, and + stores the forward-path. If the recipient is unknown the + receiver-SMTP returns a 550 Failure reply. This second step of + the procedure can be repeated any number of times. + + + +[Page 4] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + The can contain more than just a mailbox. The + is a source routing list of hosts and the + destination mailbox. The first host in the + should be the host receiving this command. + + The third step in the procedure is the DATA command. + + DATA + + If accepted, the receiver-SMTP returns a 354 Intermediate reply + and considers all succeeding lines to be the message text. + When the end of text is received and stored the SMTP-receiver + sends a 250 OK reply. + + Since the mail data is sent on the transmission channel the end + of the mail data must be indicated so that the command and + reply dialog can be resumed. SMTP indicates the end of the + mail data by sending a line containing only a period. A + transparency procedure is used to prevent this from interfering + with the user's text (see Section 4.5.2). + + Please note that the mail data includes the memo header + items such as Date, Subject, To, Cc, From [2]. + + The end of mail data indicator also confirms the mail + transaction and tells the receiver-SMTP to now process the + stored recipients and mail data. If accepted, the + receiver-SMTP returns a 250 OK reply. The DATA command should + fail only if the mail transaction was incomplete (for example, + no recipients), or if resources are not available. + + The above procedure is an example of a mail transaction. These + commands must be used only in the order discussed above. + Example 1 (below) illustrates the use of these commands in a mail + transaction. + + + + + + + + + + + + + + +Postel [Page 5] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + ------------------------------------------------------------- + + Example of the SMTP Procedure + + This SMTP example shows mail sent by Smith at host Alpha.ARPA, + to Jones, Green, and Brown at host Beta.ARPA. Here we assume + that host Alpha contacts host Beta directly. + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: 250 OK + + S: RCPT TO: + R: 550 No such user here + + S: RCPT TO: + R: 250 OK + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + The mail has now been accepted for Jones and Brown. Green did + not have a mailbox at host Beta. + + Example 1 + + ------------------------------------------------------------- + + + + + + + + + + + + + + + + +[Page 6] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + 3.2. FORWARDING + + There are some cases where the destination information in the + is incorrect, but the receiver-SMTP knows the + correct destination. In such cases, one of the following replies + should be used to allow the sender to contact the correct + destination. + + 251 User not local; will forward to + + This reply indicates that the receiver-SMTP knows the user's + mailbox is on another host and indicates the correct + forward-path to use in the future. Note that either the + host or user or both may be different. The receiver takes + responsibility for delivering the message. + + 551 User not local; please try + + This reply indicates that the receiver-SMTP knows the user's + mailbox is on another host and indicates the correct + forward-path to use. Note that either the host or user or + both may be different. The receiver refuses to accept mail + for this user, and the sender must either redirect the mail + according to the information provided or return an error + response to the originating user. + + Example 2 illustrates the use of these responses. + + ------------------------------------------------------------- + + Example of Forwarding + + Either + + S: RCPT TO: + R: 251 User not local; will forward to + + Or + + S: RCPT TO: + R: 551 User not local; please try + + Example 2 + + ------------------------------------------------------------- + + + + +Postel [Page 7] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + 3.3. VERIFYING AND EXPANDING + + SMTP provides as additional features, commands to verify a user + name or expand a mailing list. This is done with the VRFY and + EXPN commands, which have character string arguments. For the + VRFY command, the string is a user name, and the response may + include the full name of the user and must include the mailbox of + the user. For the EXPN command, the string identifies a mailing + list, and the multiline response may include the full name of the + users and must give the mailboxes on the mailing list. + + "User name" is a fuzzy term and used purposely. If a host + implements the VRFY or EXPN commands then at least local mailboxes + must be recognized as "user names". If a host chooses to + recognize other strings as "user names" that is allowed. + + In some hosts the distinction between a mailing list and an alias + for a single mailbox is a bit fuzzy, since a common data structure + may hold both types of entries, and it is possible to have mailing + lists of one mailbox. If a request is made to verify a mailing + list a positive response can be given if on receipt of a message + so addressed it will be delivered to everyone on the list, + otherwise an error should be reported (e.g., "550 That is a + mailing list, not a user"). If a request is made to expand a user + name a positive response can be formed by returning a list + containing one name, or an error can be reported (e.g., "550 That + is a user name, not a mailing list"). + + In the case of a multiline reply (normal for EXPN) exactly one + mailbox is to be specified on each line of the reply. In the case + of an ambiguous request, for example, "VRFY Smith", where there + are two Smith's the response must be "553 User ambiguous". + + The case of verifying a user name is straightforward as shown in + example 3. + + + + + + + + + + + + + + +[Page 8] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + ------------------------------------------------------------- + + Example of Verifying a User Name + + Either + + S: VRFY Smith + R: 250 Fred Smith + + Or + + S: VRFY Smith + R: 251 User not local; will forward to + + Or + + S: VRFY Jones + R: 550 String does not match anything. + + Or + + S: VRFY Jones + R: 551 User not local; please try + + Or + + S: VRFY Gourzenkyinplatz + R: 553 User ambiguous. + + Example 3 + + ------------------------------------------------------------- + + + + + + + + + + + + + + + + + +Postel [Page 9] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + The case of expanding a mailbox list requires a multiline reply as + shown in example 4. + + ------------------------------------------------------------- + + Example of Expanding a Mailing List + + Either + + S: EXPN Example-People + R: 250-Jon Postel + R: 250-Fred Fonebone + R: 250-Sam Q. Smith + R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> + R: 250- + R: 250 + + Or + + S: EXPN Executive-Washroom-List + R: 550 Access Denied to You. + + Example 4 + + ------------------------------------------------------------- + + The character string arguments of the VRFY and EXPN commands + cannot be further restricted due to the variety of implementations + of the user name and mailbox list concepts. On some systems it + may be appropriate for the argument of the EXPN command to be a + file name for a file containing a mailing list, but again there is + a variety of file naming conventions in the Internet. + + The VRFY and EXPN commands are not included in the minimum + implementation (Section 4.5.1), and are not required to work + across relays when they are implemented. + + + + + + + + + + + + + +[Page 10] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + 3.4. SENDING AND MAILING + + The main purpose of SMTP is to deliver messages to user's + mailboxes. A very similar service provided by some hosts is to + deliver messages to user's terminals (provided the user is active + on the host). The delivery to the user's mailbox is called + "mailing", the delivery to the user's terminal is called + "sending". Because in many hosts the implementation of sending is + nearly identical to the implementation of mailing these two + functions are combined in SMTP. However the sending commands are + not included in the required minimum implementation + (Section 4.5.1). Users should have the ability to control the + writing of messages on their terminals. Most hosts permit the + users to accept or refuse such messages. + + The following three command are defined to support the sending + options. These are used in the mail transaction instead of the + MAIL command and inform the receiver-SMTP of the special semantics + of this transaction: + + SEND FROM: + + The SEND command requires that the mail data be delivered to + the user's terminal. If the user is not active (or not + accepting terminal messages) on the host a 450 reply may + returned to a RCPT command. The mail transaction is + successful if the message is delivered the terminal. + + SOML FROM: + + The Send Or MaiL command requires that the mail data be + delivered to the user's terminal if the user is active (and + accepting terminal messages) on the host. If the user is + not active (or not accepting terminal messages) then the + mail data is entered into the user's mailbox. The mail + transaction is successful if the message is delivered either + to the terminal or the mailbox. + + SAML FROM: + + The Send And MaiL command requires that the mail data be + delivered to the user's terminal if the user is active (and + accepting terminal messages) on the host. In any case the + mail data is entered into the user's mailbox. The mail + transaction is successful if the message is delivered the + mailbox. + + + +Postel [Page 11] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + The same reply codes that are used for the MAIL commands are used + for these commands. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 12] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + 3.5. OPENING AND CLOSING + + At the time the transmission channel is opened there is an + exchange to ensure that the hosts are communicating with the hosts + they think they are. + + The following two commands are used in transmission channel + opening and closing: + + HELO + + QUIT + + In the HELO command the host sending the command identifies + itself; the command may be interpreted as saying "Hello, I am + ". + + ------------------------------------------------------------- + + Example of Connection Opening + + R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready + S: HELO USC-ISIF.ARPA + R: 250 BBN-UNIX.ARPA + + Example 5 + + ------------------------------------------------------------- + + ------------------------------------------------------------- + + Example of Connection Closing + + S: QUIT + R: 221 BBN-UNIX.ARPA Service closing transmission channel + + Example 6 + + ------------------------------------------------------------- + + + + + + + + + + +Postel [Page 13] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + 3.6. RELAYING + + The forward-path may be a source route of the form + "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE are hosts. This + form is used to emphasize the distinction between an address and a + route. The mailbox is an absolute address, and the route is + information about how to get there. The two concepts should not + be confused. + + Conceptually the elements of the forward-path are moved to the + reverse-path as the message is relayed from one server-SMTP to + another. The reverse-path is a reverse source route, (i.e., a + source route from the current location of the message to the + originator of the message). When a server-SMTP deletes its + identifier from the forward-path and inserts it into the + reverse-path, it must use the name it is known by in the + environment it is sending into, not the environment the mail came + from, in case the server-SMTP is known by different names in + different environments. + + If when the message arrives at an SMTP the first element of the + forward-path is not the identifier of that SMTP the element is not + deleted from the forward-path and is used to determine the next + SMTP to send the message to. In any case, the SMTP adds its own + identifier to the reverse-path. + + Using source routing the receiver-SMTP receives mail to be relayed + to another server-SMTP The receiver-SMTP may accept or reject the + task of relaying the mail in the same way it accepts or rejects + mail for a local user. The receiver-SMTP transforms the command + arguments by moving its own identifier from the forward-path to + the beginning of the reverse-path. The receiver-SMTP then becomes + a sender-SMTP, establishes a transmission channel to the next SMTP + in the forward-path, and sends it the mail. + + The first host in the reverse-path should be the host sending the + SMTP commands, and the first host in the forward-path should be + the host receiving the SMTP commands. + + Notice that the forward-path and reverse-path appear in the SMTP + commands and replies, but not necessarily in the message. That + is, there is no need for these paths and especially this syntax to + appear in the "To:" , "From:", "CC:", etc. fields of the message + header. + + If a server-SMTP has accepted the task of relaying the mail and + + + +[Page 14] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + later finds that the forward-path is incorrect or that the mail + cannot be delivered for whatever reason, then it must construct an + "undeliverable mail" notification message and send it to the + originator of the undeliverable mail (as indicated by the + reverse-path). + + This notification message must be from the server-SMTP at this + host. Of course, server-SMTPs should not send notification + messages about problems with notification messages. One way to + prevent loops in error reporting is to specify a null reverse-path + in the MAIL command of a notification message. When such a + message is relayed it is permissible to leave the reverse-path + null. A MAIL command with a null reverse-path appears as follows: + + MAIL FROM:<> + + An undeliverable mail notification message is shown in example 7. + This notification is in response to a message originated by JOE at + HOSTW and sent via HOSTX to HOSTY with instructions to relay it on + to HOSTZ. What we see in the example is the transaction between + HOSTY and HOSTX, which is the first step in the return of the + notification message. + + + + + + + + + + + + + + + + + + + + + + + + + + + +Postel [Page 15] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + ------------------------------------------------------------- + + Example Undeliverable Mail Notification Message + + S: MAIL FROM:<> + R: 250 ok + S: RCPT TO:<@HOSTX.ARPA:JOE@HOSTW.ARPA> + R: 250 ok + S: DATA + R: 354 send the mail data, end with . + S: Date: 23 Oct 81 11:22:33 + S: From: SMTP@HOSTY.ARPA + S: To: JOE@HOSTW.ARPA + S: Subject: Mail System Problem + S: + S: Sorry JOE, your message to SAM@HOSTZ.ARPA lost. + S: HOSTZ.ARPA said this: + S: "550 No Such User" + S: . + R: 250 ok + + Example 7 + + ------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 16] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + 3.7. DOMAINS + + Domains are a recently introduced concept in the ARPA Internet + mail system. The use of domains changes the address space from a + flat global space of simple character string host names to a + hierarchically structured rooted tree of global addresses. The + host name is replaced by a domain and host designator which is a + sequence of domain element strings separated by periods with the + understanding that the domain elements are ordered from the most + specific to the most general. + + For example, "USC-ISIF.ARPA", "Fred.Cambridge.UK", and + "PC7.LCS.MIT.ARPA" might be host-and-domain identifiers. + + Whenever domain names are used in SMTP only the official names are + used, the use of nicknames or aliases is not allowed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Postel [Page 17] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + 3.8. CHANGING ROLES + + The TURN command may be used to reverse the roles of the two + programs communicating over the transmission channel. + + If program-A is currently the sender-SMTP and it sends the TURN + command and receives an ok reply (250) then program-A becomes the + receiver-SMTP. + + If program-B is currently the receiver-SMTP and it receives the + TURN command and sends an ok reply (250) then program-B becomes + the sender-SMTP. + + To refuse to change roles the receiver sends the 502 reply. + + Please note that this command is optional. It would not normally + be used in situations where the transmission channel is TCP. + However, when the cost of establishing the transmission channel is + high, this command may be quite useful. For example, this command + may be useful in supporting be mail exchange using the public + switched telephone system as a transmission channel, especially if + some hosts poll other hosts for mail exchanges. + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 18] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + +4. THE SMTP SPECIFICATIONS + + 4.1. SMTP COMMANDS + + 4.1.1. COMMAND SEMANTICS + + The SMTP commands define the mail transfer or the mail system + function requested by the user. SMTP commands are character + strings terminated by . The command codes themselves are + alphabetic characters terminated by if parameters follow + and otherwise. The syntax of mailboxes must conform to + receiver site conventions. The SMTP commands are discussed + below. The SMTP replies are discussed in the Section 4.2. + + A mail transaction involves several data objects which are + communicated as arguments to different commands. The + reverse-path is the argument of the MAIL command, the + forward-path is the argument of the RCPT command, and the mail + data is the argument of the DATA command. These arguments or + data objects must be transmitted and held pending the + confirmation communicated by the end of mail data indication + which finalizes the transaction. The model for this is that + distinct buffers are provided to hold the types of data + objects, that is, there is a reverse-path buffer, a + forward-path buffer, and a mail data buffer. Specific commands + cause information to be appended to a specific buffer, or cause + one or more buffers to be cleared. + + HELLO (HELO) + + This command is used to identify the sender-SMTP to the + receiver-SMTP. The argument field contains the host name of + the sender-SMTP. + + The receiver-SMTP identifies itself to the sender-SMTP in + the connection greeting reply, and in the response to this + command. + + This command and an OK reply to it confirm that both the + sender-SMTP and the receiver-SMTP are in the initial state, + that is, there is no transaction in progress and all state + tables and buffers are cleared. + + + + + + + +Postel [Page 19] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + MAIL (MAIL) + + This command is used to initiate a mail transaction in which + the mail data is delivered to one or more mailboxes. The + argument field contains a reverse-path. + + The reverse-path consists of an optional list of hosts and + the sender mailbox. When the list of hosts is present, it + is a "reverse" source route and indicates that the mail was + relayed through each host on the list (the first host in the + list was the most recent relay). This list is used as a + source route to return non-delivery notices to the sender. + As each relay host adds itself to the beginning of the list, + it must use its name as known in the IPCE to which it is + relaying the mail rather than the IPCE from which the mail + came (if they are different). In some types of error + reporting messages (for example, undeliverable mail + notifications) the reverse-path may be null (see Example 7). + + This command clears the reverse-path buffer, the + forward-path buffer, and the mail data buffer; and inserts + the reverse-path information from this command into the + reverse-path buffer. + + RECIPIENT (RCPT) + + This command is used to identify an individual recipient of + the mail data; multiple recipients are specified by multiple + use of this command. + + The forward-path consists of an optional list of hosts and a + required destination mailbox. When the list of hosts is + present, it is a source route and indicates that the mail + must be relayed to the next host on the list. If the + receiver-SMTP does not implement the relay function it may + user the same reply it would for an unknown local user + (550). + + When mail is relayed, the relay host must remove itself from + the beginning forward-path and put itself at the beginning + of the reverse-path. When mail reaches its ultimate + destination (the forward-path contains only a destination + mailbox), the receiver-SMTP inserts it into the destination + mailbox in accordance with its host mail conventions. + + + + + +[Page 20] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + For example, mail received at relay host A with arguments + + FROM: + TO:<@HOSTA.ARPA,@HOSTB.ARPA:USERC@HOSTD.ARPA> + + will be relayed on to host B with arguments + + FROM:<@HOSTA.ARPA:USERX@HOSTY.ARPA> + TO:<@HOSTB.ARPA:USERC@HOSTD.ARPA>. + + This command causes its forward-path argument to be appended + to the forward-path buffer. + + DATA (DATA) + + The receiver treats the lines following the command as mail + data from the sender. This command causes the mail data + from this command to be appended to the mail data buffer. + The mail data may contain any of the 128 ASCII character + codes. + + The mail data is terminated by a line containing only a + period, that is the character sequence "." (see + Section 4.5.2 on Transparency). This is the end of mail + data indication. + + The end of mail data indication requires that the receiver + must now process the stored mail transaction information. + This processing consumes the information in the reverse-path + buffer, the forward-path buffer, and the mail data buffer, + and on the completion of this command these buffers are + cleared. If the processing is successful the receiver must + send an OK reply. If the processing fails completely the + receiver must send a failure reply. + + When the receiver-SMTP accepts a message either for relaying + or for final delivery it inserts at the beginning of the + mail data a time stamp line. The time stamp line indicates + the identity of the host that sent the message, and the + identity of the host that received the message (and is + inserting this time stamp), and the date and time the + message was received. Relayed messages will have multiple + time stamp lines. + + When the receiver-SMTP makes the "final delivery" of a + message it inserts at the beginning of the mail data a + + + +Postel [Page 21] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + return path line. The return path line preserves the + information in the from the MAIL command. + Here, final delivery means the message leaves the SMTP + world. Normally, this would mean it has been delivered to + the destination user, but in some cases it may be further + processed and transmitted by another mail system. + + It is possible for the mailbox in the return path be + different from the actual sender's mailbox, for example, + if error responses are to be delivered a special error + handling mailbox rather than the message senders. + + The preceding two paragraphs imply that the final mail data + will begin with a return path line, followed by one or more + time stamp lines. These lines will be followed by the mail + data header and body [2]. See Example 8. + + Special mention is needed of the response and further action + required when the processing following the end of mail data + indication is partially successful. This could arise if + after accepting several recipients and the mail data, the + receiver-SMTP finds that the mail data can be successfully + delivered to some of the recipients, but it cannot be to + others (for example, due to mailbox space allocation + problems). In such a situation, the response to the DATA + command must be an OK reply. But, the receiver-SMTP must + compose and send an "undeliverable mail" notification + message to the originator of the message. Either a single + notification which lists all of the recipients that failed + to get the message, or separate notification messages must + be sent for each failed recipient (see Example 7). All + undeliverable mail notification messages are sent using the + MAIL command (even if they result from processing a SEND, + SOML, or SAML command). + + + + + + + + + + + + + + + +[Page 22] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + ------------------------------------------------------------- + + Example of Return Path and Received Time Stamps + + Return-Path: <@GHI.ARPA,@DEF.ARPA,@ABC.ARPA:JOE@ABC.ARPA> + Received: from GHI.ARPA by JKL.ARPA ; 27 Oct 81 15:27:39 PST + Received: from DEF.ARPA by GHI.ARPA ; 27 Oct 81 15:15:13 PST + Received: from ABC.ARPA by DEF.ARPA ; 27 Oct 81 15:01:59 PST + Date: 27 Oct 81 15:01:01 PST + From: JOE@ABC.ARPA + Subject: Improved Mailing System Installed + To: SAM@JKL.ARPA + + This is to inform you that ... + + Example 8 + + ------------------------------------------------------------- + + SEND (SEND) + + This command is used to initiate a mail transaction in which + the mail data is delivered to one or more terminals. The + argument field contains a reverse-path. This command is + successful if the message is delivered to a terminal. + + The reverse-path consists of an optional list of hosts and + the sender mailbox. When the list of hosts is present, it + is a "reverse" source route and indicates that the mail was + relayed through each host on the list (the first host in the + list was the most recent relay). This list is used as a + source route to return non-delivery notices to the sender. + As each relay host adds itself to the beginning of the list, + it must use its name as known in the IPCE to which it is + relaying the mail rather than the IPCE from which the mail + came (if they are different). + + This command clears the reverse-path buffer, the + forward-path buffer, and the mail data buffer; and inserts + the reverse-path information from this command into the + reverse-path buffer. + + SEND OR MAIL (SOML) + + This command is used to initiate a mail transaction in which + the mail data is delivered to one or more terminals or + + + +Postel [Page 23] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + mailboxes. For each recipient the mail data is delivered to + the recipient's terminal if the recipient is active on the + host (and accepting terminal messages), otherwise to the + recipient's mailbox. The argument field contains a + reverse-path. This command is successful if the message is + delivered to a terminal or the mailbox. + + The reverse-path consists of an optional list of hosts and + the sender mailbox. When the list of hosts is present, it + is a "reverse" source route and indicates that the mail was + relayed through each host on the list (the first host in the + list was the most recent relay). This list is used as a + source route to return non-delivery notices to the sender. + As each relay host adds itself to the beginning of the list, + it must use its name as known in the IPCE to which it is + relaying the mail rather than the IPCE from which the mail + came (if they are different). + + This command clears the reverse-path buffer, the + forward-path buffer, and the mail data buffer; and inserts + the reverse-path information from this command into the + reverse-path buffer. + + SEND AND MAIL (SAML) + + This command is used to initiate a mail transaction in which + the mail data is delivered to one or more terminals and + mailboxes. For each recipient the mail data is delivered to + the recipient's terminal if the recipient is active on the + host (and accepting terminal messages), and for all + recipients to the recipient's mailbox. The argument field + contains a reverse-path. This command is successful if the + message is delivered to the mailbox. + + The reverse-path consists of an optional list of hosts and + the sender mailbox. When the list of hosts is present, it + is a "reverse" source route and indicates that the mail was + relayed through each host on the list (the first host in the + list was the most recent relay). This list is used as a + source route to return non-delivery notices to the sender. + As each relay host adds itself to the beginning of the list, + it must use its name as known in the IPCE to which it is + relaying the mail rather than the IPCE from which the mail + came (if they are different). + + This command clears the reverse-path buffer, the + + + +[Page 24] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + forward-path buffer, and the mail data buffer; and inserts + the reverse-path information from this command into the + reverse-path buffer. + + RESET (RSET) + + This command specifies that the current mail transaction is + to be aborted. Any stored sender, recipients, and mail data + must be discarded, and all buffers and state tables cleared. + The receiver must send an OK reply. + + VERIFY (VRFY) + + This command asks the receiver to confirm that the argument + identifies a user. If it is a user name, the full name of + the user (if known) and the fully specified mailbox are + returned. + + This command has no effect on any of the reverse-path + buffer, the forward-path buffer, or the mail data buffer. + + EXPAND (EXPN) + + This command asks the receiver to confirm that the argument + identifies a mailing list, and if so, to return the + membership of that list. The full name of the users (if + known) and the fully specified mailboxes are returned in a + multiline reply. + + This command has no effect on any of the reverse-path + buffer, the forward-path buffer, or the mail data buffer. + + HELP (HELP) + + This command causes the receiver to send helpful information + to the sender of the HELP command. The command may take an + argument (e.g., any command name) and return more specific + information as a response. + + This command has no effect on any of the reverse-path + buffer, the forward-path buffer, or the mail data buffer. + + + + + + + + +Postel [Page 25] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + NOOP (NOOP) + + This command does not affect any parameters or previously + entered commands. It specifies no action other than that + the receiver send an OK reply. + + This command has no effect on any of the reverse-path + buffer, the forward-path buffer, or the mail data buffer. + + QUIT (QUIT) + + This command specifies that the receiver must send an OK + reply, and then close the transmission channel. + + The receiver should not close the transmission channel until + it receives and replies to a QUIT command (even if there was + an error). The sender should not close the transmission + channel until it send a QUIT command and receives the reply + (even if there was an error response to a previous command). + If the connection is closed prematurely the receiver should + act as if a RSET command had been received (canceling any + pending transaction, but not undoing any previously + completed transaction), the sender should act as if the + command or transaction in progress had received a temporary + error (4xx). + + TURN (TURN) + + This command specifies that the receiver must either (1) + send an OK reply and then take on the role of the + sender-SMTP, or (2) send a refusal reply and retain the role + of the receiver-SMTP. + + If program-A is currently the sender-SMTP and it sends the + TURN command and receives an OK reply (250) then program-A + becomes the receiver-SMTP. Program-A is then in the initial + state as if the transmission channel just opened, and it + then sends the 220 service ready greeting. + + If program-B is currently the receiver-SMTP and it receives + the TURN command and sends an OK reply (250) then program-B + becomes the sender-SMTP. Program-B is then in the initial + state as if the transmission channel just opened, and it + then expects to receive the 220 service ready greeting. + + To refuse to change roles the receiver sends the 502 reply. + + + +[Page 26] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + There are restrictions on the order in which these command may + be used. + + The first command in a session must be the HELO command. + The HELO command may be used later in a session as well. If + the HELO command argument is not acceptable a 501 failure + reply must be returned and the receiver-SMTP must stay in + the same state. + + The NOOP, HELP, EXPN, and VRFY commands can be used at any + time during a session. + + The MAIL, SEND, SOML, or SAML commands begin a mail + transaction. Once started a mail transaction consists of + one of the transaction beginning commands, one or more RCPT + commands, and a DATA command, in that order. A mail + transaction may be aborted by the RSET command. There may + be zero or more transactions in a session. + + If the transaction beginning command argument is not + acceptable a 501 failure reply must be returned and the + receiver-SMTP must stay in the same state. If the commands + in a transaction are out of order a 503 failure reply must + be returned and the receiver-SMTP must stay in the same + state. + + The last command in a session must be the QUIT command. The + QUIT command can not be used at any other time in a session. + + 4.1.2. COMMAND SYNTAX + + The commands consist of a command code followed by an argument + field. Command codes are four alphabetic characters. Upper + and lower case alphabetic characters are to be treated + identically. Thus, any of the following may represent the mail + command: + + MAIL Mail mail MaIl mAIl + + This also applies to any symbols representing parameter values, + such as "TO" or "to" for the forward-path. Command codes and + the argument fields are separated by one or more spaces. + However, within the reverse-path and forward-path arguments + case is important. In particular, in some hosts the user + "smith" is different from the user "Smith". + + + + +Postel [Page 27] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + The argument field consists of a variable length character + string ending with the character sequence . The receiver + is to take no action until this sequence is received. + + Square brackets denote an optional argument field. If the + option is not taken, the appropriate default is implied. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 28] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + The following are the SMTP commands: + + HELO + + MAIL FROM: + + RCPT TO: + + DATA + + RSET + + SEND FROM: + + SOML FROM: + + SAML FROM: + + VRFY + + EXPN + + HELP [ ] + + NOOP + + QUIT + + TURN + + + + + + + + + + + + + + + + + + + + +Postel [Page 29] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + The syntax of the above argument fields (using BNF notation + where applicable) is given below. The "..." notation indicates + that a field may be repeated one or more times. + + ::= + + ::= + + ::= "<" [ ":" ] ">" + + ::= | "," + + ::= "@" + + ::= | "." + + ::= | "#" | "[" "]" + + ::= "@" + + ::= | + + ::= + + ::= | + + ::= | + + ::= | | "-" + + ::= | "." + + ::= | + + ::= """ """ + + ::= "\" | "\" | | + + ::= | "\" + + ::= "." "." "." + + ::= | + + ::= + + + + +[Page 30] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + ::= the carriage return character (ASCII code 13) + + ::= the line feed character (ASCII code 10) + + ::= the space character (ASCII code 32) + + ::= one, two, or three digits representing a decimal + integer value in the range 0 through 255 + + ::= any one of the 52 alphabetic characters A through Z + in upper case and a through z in lower case + + ::= any one of the 128 ASCII characters, but not any + or + + ::= any one of the ten digits 0 through 9 + + ::= any one of the 128 ASCII characters except , + , quote ("), or backslash (\) + + ::= any one of the 128 ASCII characters (no exceptions) + + ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "." + | "," | ";" | ":" | "@" """ | the control + characters (ASCII codes 0 through 31 inclusive and + 127) + + Note that the backslash, "\", is a quote character, which is + used to indicate that the next character is to be used + literally (instead of its normal interpretation). For example, + "Joe\,Smith" could be used to indicate a single nine character + user field with comma being the fourth character of the field. + + Hosts are generally known by names which are translated to + addresses in each host. Note that the name elements of domains + are the official names -- no use of nicknames or aliases is + allowed. + + Sometimes a host is not known to the translation function and + communication is blocked. To bypass this barrier two numeric + forms are also allowed for host "names". One form is a decimal + integer prefixed by a pound sign, "#", which indicates the + number is the address of the host. Another form is four small + decimal integers separated by dots and enclosed by brackets, + e.g., "[123.255.37.2]", which indicates a 32-bit ARPA Internet + Address in four 8-bit fields. + + + +Postel [Page 31] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + The time stamp line and the return path line are formally + defined as follows: + + ::= "Return-Path:" + + ::= "Received:" + + ::= ";" + + + ::= "FROM" + + ::= "BY" + + ::= [] [] [] [] + + ::= "VIA" + + ::= "WITH" + + ::= "ID" + + ::= "FOR" + + ::= The standard names for links are registered with + the Network Information Center. + + ::= The standard names for protocols are + registered with the Network Information Center. + + ::=

+ +
::= the one or two decimal integer day of the month in + the range 1 to 31. + + ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" | + "JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC" + + ::= the two decimal integer year of the century in the + range 00 to 99. + + + + + +[Page 32] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + ::= the two decimal integer hour of the day in the + range 00 to 24. + + ::= the two decimal integer minute of the hour in the + range 00 to 59. + + ::= the two decimal integer second of the minute in the + range 00 to 59. + + ::= "UT" for Universal Time (the default) or other + time zone designator (as in [2]). + + + + ------------------------------------------------------------- + + Return Path Example + + Return-Path: <@CHARLIE.ARPA,@BAKER.ARPA:JOE@ABLE.ARPA> + + Example 9 + + ------------------------------------------------------------- + + ------------------------------------------------------------- + + Time Stamp Line Example + + Received: FROM ABC.ARPA BY XYZ.ARPA ; 22 OCT 81 09:23:59 PDT + + Received: from ABC.ARPA by XYZ.ARPA via TELENET with X25 + id M12345 for Smith@PDQ.ARPA ; 22 OCT 81 09:23:59 PDT + + Example 10 + + ------------------------------------------------------------- + + + + + + + + + + + + + +Postel [Page 33] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + 4.2. SMTP REPLIES + + Replies to SMTP commands are devised to ensure the synchronization + of requests and actions in the process of mail transfer, and to + guarantee that the sender-SMTP always knows the state of the + receiver-SMTP. Every command must generate exactly one reply. + + The details of the command-reply sequence are made explicit in + Section 5.3 on Sequencing and Section 5.4 State Diagrams. + + An SMTP reply consists of a three digit number (transmitted as + three alphanumeric characters) followed by some text. The number + is intended for use by automata to determine what state to enter + next; the text is meant for the human user. It is intended that + the three digits contain enough encoded information that the + sender-SMTP need not examine the text and may either discard it or + pass it on to the user, as appropriate. In particular, the text + may be receiver-dependent and context dependent, so there are + likely to be varying texts for each reply code. A discussion of + the theory of reply codes is given in Appendix E. Formally, a + reply is defined to be the sequence: a three-digit code, , + one line of text, and , or a multiline reply (as defined in + Appendix E). Only the EXPN and HELP commands are expected to + result in multiline replies in normal circumstances, however + multiline replies are allowed for any command. + + + + + + + + + + + + + + + + + + + + + + + + +[Page 34] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + 4.2.1. REPLY CODES BY FUNCTION GROUPS + + 500 Syntax error, command unrecognized + [This may include errors such as command line too long] + 501 Syntax error in parameters or arguments + 502 Command not implemented + 503 Bad sequence of commands + 504 Command parameter not implemented + + 211 System status, or system help reply + 214 Help message + [Information on how to use the receiver or the meaning of a + particular non-standard command; this reply is useful only + to the human user] + + 220 Service ready + 221 Service closing transmission channel + 421 Service not available, + closing transmission channel + [This may be a reply to any command if the service knows it + must shut down] + + 250 Requested mail action okay, completed + 251 User not local; will forward to + 450 Requested mail action not taken: mailbox unavailable + [E.g., mailbox busy] + 550 Requested action not taken: mailbox unavailable + [E.g., mailbox not found, no access] + 451 Requested action aborted: error in processing + 551 User not local; please try + 452 Requested action not taken: insufficient system storage + 552 Requested mail action aborted: exceeded storage allocation + 553 Requested action not taken: mailbox name not allowed + [E.g., mailbox syntax incorrect] + 354 Start mail input; end with . + 554 Transaction failed + + + + + + + + + + + + + +Postel [Page 35] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + 4.2.2. NUMERIC ORDER LIST OF REPLY CODES + + 211 System status, or system help reply + 214 Help message + [Information on how to use the receiver or the meaning of a + particular non-standard command; this reply is useful only + to the human user] + 220 Service ready + 221 Service closing transmission channel + 250 Requested mail action okay, completed + 251 User not local; will forward to + + 354 Start mail input; end with . + + 421 Service not available, + closing transmission channel + [This may be a reply to any command if the service knows it + must shut down] + 450 Requested mail action not taken: mailbox unavailable + [E.g., mailbox busy] + 451 Requested action aborted: local error in processing + 452 Requested action not taken: insufficient system storage + + 500 Syntax error, command unrecognized + [This may include errors such as command line too long] + 501 Syntax error in parameters or arguments + 502 Command not implemented + 503 Bad sequence of commands + 504 Command parameter not implemented + 550 Requested action not taken: mailbox unavailable + [E.g., mailbox not found, no access] + 551 User not local; please try + 552 Requested mail action aborted: exceeded storage allocation + 553 Requested action not taken: mailbox name not allowed + [E.g., mailbox syntax incorrect] + 554 Transaction failed + + + + + + + + + + + + + +[Page 36] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + 4.3. SEQUENCING OF COMMANDS AND REPLIES + + The communication between the sender and receiver is intended to + be an alternating dialogue, controlled by the sender. As such, + the sender issues a command and the receiver responds with a + reply. The sender must wait for this response before sending + further commands. + + One important reply is the connection greeting. Normally, a + receiver will send a 220 "Service ready" reply when the connection + is completed. The sender should wait for this greeting message + before sending any commands. + + Note: all the greeting type replies have the official name of + the server host as the first word following the reply code. + + For example, + + 220 USC-ISIF.ARPA Service ready + + The table below lists alternative success and failure replies for + each command. These must be strictly adhered to; a receiver may + substitute text in the replies, but the meaning and action implied + by the code numbers and by the specific command reply sequence + cannot be altered. + + COMMAND-REPLY SEQUENCES + + Each command is listed with its possible replies. The prefixes + used before the possible replies are "P" for preliminary (not + used in SMTP), "I" for intermediate, "S" for success, "F" for + failure, and "E" for error. The 421 reply (service not + available, closing transmission channel) may be given to any + command if the SMTP-receiver knows it must shut down. This + listing forms the basis for the State Diagrams in Section 4.4. + + CONNECTION ESTABLISHMENT + S: 220 + F: 421 + HELO + S: 250 + E: 500, 501, 504, 421 + MAIL + S: 250 + F: 552, 451, 452 + E: 500, 501, 421 + + + +Postel [Page 37] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + RCPT + S: 250, 251 + F: 550, 551, 552, 553, 450, 451, 452 + E: 500, 501, 503, 421 + DATA + I: 354 -> data -> S: 250 + F: 552, 554, 451, 452 + F: 451, 554 + E: 500, 501, 503, 421 + RSET + S: 250 + E: 500, 501, 504, 421 + SEND + S: 250 + F: 552, 451, 452 + E: 500, 501, 502, 421 + SOML + S: 250 + F: 552, 451, 452 + E: 500, 501, 502, 421 + SAML + S: 250 + F: 552, 451, 452 + E: 500, 501, 502, 421 + VRFY + S: 250, 251 + F: 550, 551, 553 + E: 500, 501, 502, 504, 421 + EXPN + S: 250 + F: 550 + E: 500, 501, 502, 504, 421 + HELP + S: 211, 214 + E: 500, 501, 502, 504, 421 + NOOP + S: 250 + E: 500, 421 + QUIT + S: 221 + E: 500 + TURN + S: 250 + F: 502 + E: 500, 503 + + + + +[Page 38] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + 4.4. STATE DIAGRAMS + + Following are state diagrams for a simple-minded SMTP + implementation. Only the first digit of the reply codes is used. + There is one state diagram for each group of SMTP commands. The + command groupings were determined by constructing a model for each + command and then collecting together the commands with + structurally identical models. + + For each command there are three possible outcomes: "success" + (S), "failure" (F), and "error" (E). In the state diagrams below + we use the symbol B for "begin", and the symbol W for "wait for + reply". + + First, the diagram that represents most of the SMTP commands: + + + 1,3 +---+ + ----------->| E | + | +---+ + | + +---+ cmd +---+ 2 +---+ + | B |---------->| W |---------->| S | + +---+ +---+ +---+ + | + | 4,5 +---+ + ----------->| F | + +---+ + + + This diagram models the commands: + + HELO, MAIL, RCPT, RSET, SEND, SOML, SAML, VRFY, EXPN, HELP, + NOOP, QUIT, TURN. + + + + + + + + + + + + + + + +Postel [Page 39] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + A more complex diagram models the DATA command: + + + +---+ DATA +---+ 1,2 +---+ + | B |---------->| W |-------------------->| E | + +---+ +---+ ------------>+---+ + 3| |4,5 | + | | | + -------------- ----- | + | | | +---+ + | ---------- -------->| S | + | | | | +---+ + | | ------------ + | | | | + V 1,3| |2 | + +---+ data +---+ --------------->+---+ + | |---------->| W | | F | + +---+ +---+-------------------->+---+ + 4,5 + + + Note that the "data" here is a series of lines sent from the + sender to the receiver with no response expected until the last + line is sent. + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 40] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + 4.5. DETAILS + + 4.5.1. MINIMUM IMPLEMENTATION + + In order to make SMTP workable, the following minimum + implementation is required for all receivers: + + COMMANDS -- HELO + MAIL + RCPT + DATA + RSET + NOOP + QUIT + + 4.5.2. TRANSPARENCY + + Without some provision for data transparency the character + sequence "." ends the mail text and cannot be sent + by the user. In general, users are not aware of such + "forbidden" sequences. To allow all user composed text to be + transmitted transparently the following procedures are used. + + 1. Before sending a line of mail text the sender-SMTP checks + the first character of the line. If it is a period, one + additional period is inserted at the beginning of the line. + + 2. When a line of mail text is received by the receiver-SMTP + it checks the line. If the line is composed of a single + period it is the end of mail. If the first character is a + period and there are other characters on the line, the first + character is deleted. + + The mail data may contain any of the 128 ASCII characters. All + characters are to be delivered to the recipient's mailbox + including format effectors and other control characters. If + the transmission channel provides an 8-bit byte (octets) data + stream, the 7-bit ASCII codes are transmitted right justified + in the octets with the high order bits cleared to zero. + + In some systems it may be necessary to transform the data as + it is received and stored. This may be necessary for hosts + that use a different character set than ASCII as their local + character set, or that store data in records rather than + + + + + +Postel [Page 41] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + strings. If such transforms are necessary, they must be + reversible -- especially if such transforms are applied to + mail being relayed. + + 4.5.3. SIZES + + There are several objects that have required minimum maximum + sizes. That is, every implementation must be able to receive + objects of at least these sizes, but must not send objects + larger than these sizes. + + + **************************************************** + * * + * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION * + * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH * + * OF THESE OBJECTS SHOULD BE USED. * + * * + **************************************************** + + user + + The maximum total length of a user name is 64 characters. + + domain + + The maximum total length of a domain name or number is 64 + characters. + + path + + The maximum total length of a reverse-path or + forward-path is 256 characters (including the punctuation + and element separators). + + command line + + The maximum total length of a command line including the + command word and the is 512 characters. + + reply line + + The maximum total length of a reply line including the + reply code and the is 512 characters. + + + + + +[Page 42] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + text line + + The maximum total length of a text line including the + is 1000 characters (but not counting the leading + dot duplicated for transparency). + + recipients buffer + + The maximum total number of recipients that must be + buffered is 100 recipients. + + + **************************************************** + * * + * TO THE MAXIMUM EXTENT POSSIBLE, IMPLEMENTATION * + * TECHNIQUES WHICH IMPOSE NO LIMITS ON THE LENGTH * + * OF THESE OBJECTS SHOULD BE USED. * + * * + **************************************************** + + Errors due to exceeding these limits may be reported by using + the reply codes, for example: + + 500 Line too long. + + 501 Path too long + + 552 Too many recipients. + + 552 Too much mail data. + + + + + + + + + + + + + + + + + + + +Postel [Page 43] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + +APPENDIX A + + TCP Transport service + + The Transmission Control Protocol [3] is used in the ARPA + Internet, and in any network following the US DoD standards for + internetwork protocols. + + Connection Establishment + + The SMTP transmission channel is a TCP connection established + between the sender process port U and the receiver process port + L. This single full duplex connection is used as the + transmission channel. This protocol is assigned the service + port 25 (31 octal), that is L=25. + + Data Transfer + + The TCP connection supports the transmission of 8-bit bytes. + The SMTP data is 7-bit ASCII characters. Each character is + transmitted as an 8-bit byte with the high-order bit cleared to + zero. + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 44] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + +APPENDIX B + + NCP Transport service + + The ARPANET Host-to-Host Protocol [4] (implemented by the Network + Control Program) may be used in the ARPANET. + + Connection Establishment + + The SMTP transmission channel is established via NCP between + the sender process socket U and receiver process socket L. The + Initial Connection Protocol [5] is followed resulting in a pair + of simplex connections. This pair of connections is used as + the transmission channel. This protocol is assigned the + contact socket 25 (31 octal), that is L=25. + + Data Transfer + + The NCP data connections are established in 8-bit byte mode. + The SMTP data is 7-bit ASCII characters. Each character is + transmitted as an 8-bit byte with the high-order bit cleared to + zero. + + + + + + + + + + + + + + + + + + + + + + + + + + + +Postel [Page 45] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + +APPENDIX C + + NITS + + The Network Independent Transport Service [6] may be used. + + Connection Establishment + + The SMTP transmission channel is established via NITS between + the sender process and receiver process. The sender process + executes the CONNECT primitive, and the waiting receiver + process executes the ACCEPT primitive. + + Data Transfer + + The NITS connection supports the transmission of 8-bit bytes. + The SMTP data is 7-bit ASCII characters. Each character is + transmitted as an 8-bit byte with the high-order bit cleared to + zero. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 46] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + +APPENDIX D + + X.25 Transport service + + It may be possible to use the X.25 service [7] as provided by the + Public Data Networks directly, however, it is suggested that a + reliable end-to-end protocol such as TCP be used on top of X.25 + connections. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Postel [Page 47] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + +APPENDIX E + + Theory of Reply Codes + + The three digits of the reply each have a special significance. + The first digit denotes whether the response is good, bad or + incomplete. An unsophisticated sender-SMTP will be able to + determine its next action (proceed as planned, redo, retrench, + etc.) by simply examining this first digit. A sender-SMTP that + wants to know approximately what kind of error occurred (e.g., + mail system error, command syntax error) may examine the second + digit, reserving the third digit for the finest gradation of + information. + + There are five values for the first digit of the reply code: + + 1yz Positive Preliminary reply + + The command has been accepted, but the requested action + is being held in abeyance, pending confirmation of the + information in this reply. The sender-SMTP should send + another command specifying whether to continue or abort + the action. + + [Note: SMTP does not have any commands that allow this + type of reply, and so does not have the continue or + abort commands.] + + 2yz Positive Completion reply + + The requested action has been successfully completed. A + new request may be initiated. + + 3yz Positive Intermediate reply + + The command has been accepted, but the requested action + is being held in abeyance, pending receipt of further + information. The sender-SMTP should send another command + specifying this information. This reply is used in + command sequence groups. + + 4yz Transient Negative Completion reply + + The command was not accepted and the requested action did + not occur. However, the error condition is temporary and + the action may be requested again. The sender should + + + +[Page 48] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + return to the beginning of the command sequence (if any). + It is difficult to assign a meaning to "transient" when + two different sites (receiver- and sender- SMTPs) must + agree on the interpretation. Each reply in this category + might have a different time value, but the sender-SMTP is + encouraged to try again. A rule of thumb to determine if + a reply fits into the 4yz or the 5yz category (see below) + is that replies are 4yz if they can be repeated without + any change in command form or in properties of the sender + or receiver. (E.g., the command is repeated identically + and the receiver does not put up a new implementation.) + + 5yz Permanent Negative Completion reply + + The command was not accepted and the requested action did + not occur. The sender-SMTP is discouraged from repeating + the exact request (in the same sequence). Even some + "permanent" error conditions can be corrected, so the + human user may want to direct the sender-SMTP to + reinitiate the command sequence by direct action at some + point in the future (e.g., after the spelling has been + changed, or the user has altered the account status). + + The second digit encodes responses in specific categories: + + x0z Syntax -- These replies refer to syntax errors, + syntactically correct commands that don't fit any + functional category, and unimplemented or superfluous + commands. + + x1z Information -- These are replies to requests for + information, such as status or help. + + x2z Connections -- These are replies referring to the + transmission channel. + + x3z Unspecified as yet. + + x4z Unspecified as yet. + + x5z Mail system -- These replies indicate the status of + the receiver mail system vis-a-vis the requested + transfer or other mail system action. + + The third digit gives a finer gradation of meaning in each + category specified by the second digit. The list of replies + + + +Postel [Page 49] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + illustrates this. Each reply text is recommended rather than + mandatory, and may even change according to the command with + which it is associated. On the other hand, the reply codes + must strictly follow the specifications in this section. + Receiver implementations should not invent new codes for + slightly different situations from the ones described here, but + rather adapt codes already defined. + + For example, a command such as NOOP whose successful execution + does not offer the sender-SMTP any new information will return + a 250 reply. The response is 502 when the command requests an + unimplemented non-site-specific action. A refinement of that + is the 504 reply for a command that is implemented, but that + requests an unimplemented parameter. + + The reply text may be longer than a single line; in these cases + the complete text must be marked so the sender-SMTP knows when it + can stop reading the reply. This requires a special format to + indicate a multiple line reply. + + The format for multiline replies requires that every line, + except the last, begin with the reply code, followed + immediately by a hyphen, "-" (also known as minus), followed by + text. The last line will begin with the reply code, followed + immediately by , optionally some text, and . + + For example: + 123-First line + 123-Second line + 123-234 text beginning with numbers + 123 The last line + + In many cases the sender-SMTP then simply needs to search for + the reply code followed by at the beginning of a line, and + ignore all preceding lines. In a few cases, there is important + data for the sender in the reply "text". The sender will know + these cases from the current context. + + + + + + + + + + + + +[Page 50] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + +APPENDIX F + + Scenarios + + This section presents complete scenarios of several types of SMTP + sessions. + + A Typical SMTP Transaction Scenario + + This SMTP example shows mail sent by Smith at host USC-ISIF, to + Jones, Green, and Brown at host BBN-UNIX. Here we assume that + host USC-ISIF contacts host BBN-UNIX directly. The mail is + accepted for Jones and Brown. Green does not have a mailbox at + host BBN-UNIX. + + ------------------------------------------------------------- + + R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready + S: HELO USC-ISIF.ARPA + R: 250 BBN-UNIX.ARPA + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: 250 OK + + S: RCPT TO: + R: 550 No such user here + + S: RCPT TO: + R: 250 OK + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: QUIT + R: 221 BBN-UNIX.ARPA Service closing transmission channel + + Scenario 1 + + ------------------------------------------------------------- + + + +Postel [Page 51] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + Aborted SMTP Transaction Scenario + + ------------------------------------------------------------- + + R: 220 MIT-Multics.ARPA Simple Mail Transfer Service Ready + S: HELO ISI-VAXA.ARPA + R: 250 MIT-Multics.ARPA + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: 250 OK + + S: RCPT TO: + R: 550 No such user here + + S: RSET + R: 250 OK + + S: QUIT + R: 221 MIT-Multics.ARPA Service closing transmission channel + + Scenario 2 + + ------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + + +[Page 52] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + Relayed Mail Scenario + + ------------------------------------------------------------- + + Step 1 -- Source Host to Relay Host + + R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready + S: HELO MIT-AI.ARPA + R: 250 USC-ISIE.ARPA + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO:<@USC-ISIE.ARPA:Jones@BBN-VAX.ARPA> + R: 250 OK + + S: DATA + R: 354 Start mail input; end with . + S: Date: 2 Nov 81 22:33:44 + S: From: John Q. Public + S: Subject: The Next Meeting of the Board + S: To: Jones@BBN-Vax.ARPA + S: + S: Bill: + S: The next meeting of the board of directors will be + S: on Tuesday. + S: John. + S: . + R: 250 OK + + S: QUIT + R: 221 USC-ISIE.ARPA Service closing transmission channel + + + + + + + + + + + + + + + + + +Postel [Page 53] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + Step 2 -- Relay Host to Destination Host + + R: 220 BBN-VAX.ARPA Simple Mail Transfer Service Ready + S: HELO USC-ISIE.ARPA + R: 250 BBN-VAX.ARPA + + S: MAIL FROM:<@USC-ISIE.ARPA:JQP@MIT-AI.ARPA> + R: 250 OK + + S: RCPT TO: + R: 250 OK + + S: DATA + R: 354 Start mail input; end with . + S: Received: from MIT-AI.ARPA by USC-ISIE.ARPA ; + 2 Nov 81 22:40:10 UT + S: Date: 2 Nov 81 22:33:44 + S: From: John Q. Public + S: Subject: The Next Meeting of the Board + S: To: Jones@BBN-Vax.ARPA + S: + S: Bill: + S: The next meeting of the board of directors will be + S: on Tuesday. + S: John. + S: . + R: 250 OK + + S: QUIT + R: 221 USC-ISIE.ARPA Service closing transmission channel + + Scenario 3 + + ------------------------------------------------------------- + + + + + + + + + + + + + + + +[Page 54] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + Verifying and Sending Scenario + + ------------------------------------------------------------- + + R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready + S: HELO MIT-MC.ARPA + R: 250 SU-SCORE.ARPA + + S: VRFY Crispin + R: 250 Mark Crispin + + S: SEND FROM: + R: 250 OK + + S: RCPT TO: + R: 250 OK + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: QUIT + R: 221 SU-SCORE.ARPA Service closing transmission channel + + Scenario 4 + + ------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + +Postel [Page 55] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + Sending and Mailing Scenarios + + First the user's name is verified, then an attempt is made to + send to the user's terminal. When that fails, the messages is + mailed to the user's mailbox. + + ------------------------------------------------------------- + + R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready + S: HELO MIT-MC.ARPA + R: 250 SU-SCORE.ARPA + + S: VRFY Crispin + R: 250 Mark Crispin + + S: SEND FROM: + R: 250 OK + + S: RCPT TO: + R: 450 User not active now + + S: RSET + R: 250 OK + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: 250 OK + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: QUIT + R: 221 SU-SCORE.ARPA Service closing transmission channel + + Scenario 5 + + ------------------------------------------------------------- + + + + + + +[Page 56] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + Doing the preceding scenario more efficiently. + + ------------------------------------------------------------- + + R: 220 SU-SCORE.ARPA Simple Mail Transfer Service Ready + S: HELO MIT-MC.ARPA + R: 250 SU-SCORE.ARPA + + S: VRFY Crispin + R: 250 Mark Crispin + + S: SOML FROM: + R: 250 OK + + S: RCPT TO: + R: 250 User not active now, so will do mail. + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: QUIT + R: 221 SU-SCORE.ARPA Service closing transmission channel + + Scenario 6 + + ------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + +Postel [Page 57] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + Mailing List Scenario + + First each of two mailing lists are expanded in separate sessions + with different hosts. Then the message is sent to everyone that + appeared on either list (but no duplicates) via a relay host. + + ------------------------------------------------------------- + + Step 1 -- Expanding the First List + + R: 220 MIT-AI.ARPA Simple Mail Transfer Service Ready + S: HELO SU-SCORE.ARPA + R: 250 MIT-AI.ARPA + + S: EXPN Example-People + R: 250- + R: 250-Fred Fonebone + R: 250-Xenon Y. Zither + R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> + R: 250- + R: 250 + + S: QUIT + R: 221 MIT-AI.ARPA Service closing transmission channel + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 58] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + Step 2 -- Expanding the Second List + + R: 220 MIT-MC.ARPA Simple Mail Transfer Service Ready + S: HELO SU-SCORE.ARPA + R: 250 MIT-MC.ARPA + + S: EXPN Interested-Parties + R: 250-Al Calico + R: 250- + R: 250-Quincy Smith <@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> + R: 250- + R: 250 + + S: QUIT + R: 221 MIT-MC.ARPA Service closing transmission channel + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Postel [Page 59] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + Step 3 -- Mailing to All via a Relay Host + + R: 220 USC-ISIE.ARPA Simple Mail Transfer Service Ready + S: HELO SU-SCORE.ARPA + R: 250 USC-ISIE.ARPA + + S: MAIL FROM: + R: 250 OK + S: RCPT TO:<@USC-ISIE.ARPA:ABC@MIT-MC.ARPA> + R: 250 OK + S: RCPT TO:<@USC-ISIE.ARPA:Fonebone@USC-ISIQA.ARPA> + R: 250 OK + S: RCPT TO:<@USC-ISIE.ARPA:XYZ@MIT-AI.ARPA> + R: 250 OK + S: RCPT + TO:<@USC-ISIE.ARPA,@USC-ISIF.ARPA:Q-Smith@ISI-VAXA.ARPA> + R: 250 OK + S: RCPT TO:<@USC-ISIE.ARPA:joe@FOO-UNIX.ARPA> + R: 250 OK + S: RCPT TO:<@USC-ISIE.ARPA:xyz@BAR-UNIX.ARPA> + R: 250 OK + S: RCPT TO:<@USC-ISIE.ARPA:fred@BBN-UNIX.ARPA> + R: 250 OK + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: QUIT + R: 221 USC-ISIE.ARPA Service closing transmission channel + + Scenario 7 + + ------------------------------------------------------------- + + + + + + + + + + + + +[Page 60] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + Forwarding Scenarios + + ------------------------------------------------------------- + + R: 220 USC-ISIF.ARPA Simple Mail Transfer Service Ready + S: HELO LBL-UNIX.ARPA + R: 250 USC-ISIF.ARPA + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: 251 User not local; will forward to + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: QUIT + R: 221 USC-ISIF.ARPA Service closing transmission channel + + Scenario 8 + + ------------------------------------------------------------- + + + + + + + + + + + + + + + + + + + + + + +Postel [Page 61] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + ------------------------------------------------------------- + + Step 1 -- Trying the Mailbox at the First Host + + R: 220 USC-ISIF.ARPA Simple Mail Transfer Service Ready + S: HELO LBL-UNIX.ARPA + R: 250 USC-ISIF.ARPA + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: 251 User not local; will forward to + + S: RSET + R: 250 OK + + S: QUIT + R: 221 USC-ISIF.ARPA Service closing transmission channel + + Step 2 -- Delivering the Mail at the Second Host + + R: 220 USC-ISI.ARPA Simple Mail Transfer Service Ready + S: HELO LBL-UNIX.ARPA + R: 250 USC-ISI.ARPA + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: OK + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: QUIT + R: 221 USC-ISI.ARPA Service closing transmission channel + + Scenario 9 + + ------------------------------------------------------------- + + + + +[Page 62] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + Too Many Recipients Scenario + + ------------------------------------------------------------- + + R: 220 BERKELEY.ARPA Simple Mail Transfer Service Ready + S: HELO USC-ISIF.ARPA + R: 250 BERKELEY.ARPA + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: 250 OK + + S: RCPT TO: + R: 552 Recipient storage full, try again in another transaction + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: MAIL FROM: + R: 250 OK + + S: RCPT TO: + R: 250 OK + + S: DATA + R: 354 Start mail input; end with . + S: Blah blah blah... + S: ...etc. etc. etc. + S: . + R: 250 OK + + S: QUIT + R: 221 BERKELEY.ARPA Service closing transmission channel + + Scenario 10 + + ------------------------------------------------------------- + + Note that a real implementation must handle many recipients as + specified in Section 4.5.3. + + + +Postel [Page 63] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + +GLOSSARY + + ASCII + + American Standard Code for Information Interchange [1]. + + command + + A request for a mail service action sent by the sender-SMTP to the + receiver-SMTP. + + domain + + The hierarchially structured global character string address of a + host computer in the mail system. + + end of mail data indication + + A special sequence of characters that indicates the end of the + mail data. In particular, the five characters carriage return, + line feed, period, carriage return, line feed, in that order. + + host + + A computer in the internetwork environment on which mailboxes or + SMTP processes reside. + + line + + A a sequence of ASCII characters ending with a . + + mail data + + A sequence of ASCII characters of arbitrary length, which conforms + to the standard set in the Standard for the Format of ARPA + Internet Text Messages (RFC 822 [2]). + + mailbox + + A character string (address) which identifies a user to whom mail + is to be sent. Mailbox normally consists of the host and user + specifications. The standard mailbox naming convention is defined + to be "user@domain". Additionally, the "container" in which mail + is stored. + + + + + +[Page 64] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + + receiver-SMTP process + + A process which transfers mail in cooperation with a sender-SMTP + process. It waits for a connection to be established via the + transport service. It receives SMTP commands from the + sender-SMTP, sends replies, and performs the specified operations. + + reply + + A reply is an acknowledgment (positive or negative) sent from + receiver to sender via the transmission channel in response to a + command. The general form of a reply is a completion code + (including error codes) followed by a text string. The codes are + for use by programs and the text is usually intended for human + users. + + sender-SMTP process + + A process which transfers mail in cooperation with a receiver-SMTP + process. A local language may be used in the user interface + command/reply dialogue. The sender-SMTP initiates the transport + service connection. It initiates SMTP commands, receives replies, + and governs the transfer of mail. + + session + + The set of exchanges that occur while the transmission channel is + open. + + transaction + + The set of exchanges required for one message to be transmitted + for one or more recipients. + + transmission channel + + A full-duplex communication path between a sender-SMTP and a + receiver-SMTP for the exchange of commands, replies, and mail + text. + + transport service + + Any reliable stream-oriented data communication services. For + example, NCP, TCP, NITS. + + + + + +Postel [Page 65] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + user + + A human being (or a process on behalf of a human being) wishing to + obtain mail transfer service. In addition, a recipient of + computer mail. + + word + + A sequence of printing characters. + + + + The characters carriage return and line feed (in that order). + + + + The space character. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 66] Postel + + + +RFC 821 August 1982 + Simple Mail Transfer Protocol + + + +REFERENCES + + [1] ASCII + + ASCII, "USA Code for Information Interchange", United States of + America Standards Institute, X3.4, 1968. Also in: Feinler, E. + and J. Postel, eds., "ARPANET Protocol Handbook", NIC 7104, for + the Defense Communications Agency by SRI International, Menlo + Park, California, Revised January 1978. + + [2] RFC 822 + + Crocker, D., "Standard for the Format of ARPA Internet Text + Messages," RFC 822, Department of Electrical Engineering, + University of Delaware, August 1982. + + [3] TCP + + Postel, J., ed., "Transmission Control Protocol - DARPA Internet + Program Protocol Specification", RFC 793, USC/Information Sciences + Institute, NTIS AD Number A111091, September 1981. Also in: + Feinler, E. and J. Postel, eds., "Internet Protocol Transition + Workbook", SRI International, Menlo Park, California, March 1982. + + [4] NCP + + McKenzie,A., "Host/Host Protocol for the ARPA Network", NIC 8246, + January 1972. Also in: Feinler, E. and J. Postel, eds., "ARPANET + Protocol Handbook", NIC 7104, for the Defense Communications + Agency by SRI International, Menlo Park, California, Revised + January 1978. + + [5] Initial Connection Protocol + + Postel, J., "Official Initial Connection Protocol", NIC 7101, + 11 June 1971. Also in: Feinler, E. and J. Postel, eds., "ARPANET + Protocol Handbook", NIC 7104, for the Defense Communications + Agency by SRI International, Menlo Park, California, Revised + January 1978. + + [6] NITS + + PSS/SG3, "A Network Independent Transport Service", Study Group 3, + The Post Office PSS Users Group, February 1980. Available from + the DCPU, National Physical Laboratory, Teddington, UK. + + + + +Postel [Page 67] + + + +August 1982 RFC 821 +Simple Mail Transfer Protocol + + + + [7] X.25 + + CCITT, "Recommendation X.25 - Interface Between Data Terminal + Equipment (DTE) and Data Circuit-terminating Equipment (DCE) for + Terminals Operating in the Packet Mode on Public Data Networks," + CCITT Orange Book, Vol. VIII.2, International Telephone and + Telegraph Consultative Committee, Geneva, 1976. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +[Page 68] Postel + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc0822.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc0822.txt new file mode 100644 index 0000000..35b09a3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc0822.txt @@ -0,0 +1,2901 @@ + + + + + + + RFC # 822 + + Obsoletes: RFC #733 (NIC #41952) + + + + + + + + + + + + + STANDARD FOR THE FORMAT OF + + ARPA INTERNET TEXT MESSAGES + + + + + + + August 13, 1982 + + + + + + + Revised by + + David H. Crocker + + + Dept. of Electrical Engineering + University of Delaware, Newark, DE 19711 + Network: DCrocker @ UDel-Relay + + + + + + + + + + + + + + + + Standard for ARPA Internet Text Messages + + + TABLE OF CONTENTS + + + PREFACE .................................................... ii + + 1. INTRODUCTION ........................................... 1 + + 1.1. Scope ............................................ 1 + 1.2. Communication Framework .......................... 2 + + 2. NOTATIONAL CONVENTIONS ................................. 3 + + 3. LEXICAL ANALYSIS OF MESSAGES ........................... 5 + + 3.1. General Description .............................. 5 + 3.2. Header Field Definitions ......................... 9 + 3.3. Lexical Tokens ................................... 10 + 3.4. Clarifications ................................... 11 + + 4. MESSAGE SPECIFICATION .................................. 17 + + 4.1. Syntax ........................................... 17 + 4.2. Forwarding ....................................... 19 + 4.3. Trace Fields ..................................... 20 + 4.4. Originator Fields ................................ 21 + 4.5. Receiver Fields .................................. 23 + 4.6. Reference Fields ................................. 23 + 4.7. Other Fields ..................................... 24 + + 5. DATE AND TIME SPECIFICATION ............................ 26 + + 5.1. Syntax ........................................... 26 + 5.2. Semantics ........................................ 26 + + 6. ADDRESS SPECIFICATION .................................. 27 + + 6.1. Syntax ........................................... 27 + 6.2. Semantics ........................................ 27 + 6.3. Reserved Address ................................. 33 + + 7. BIBLIOGRAPHY ........................................... 34 + + + APPENDIX + + A. EXAMPLES ............................................... 36 + B. SIMPLE FIELD PARSING ................................... 40 + C. DIFFERENCES FROM RFC #733 .............................. 41 + D. ALPHABETICAL LISTING OF SYNTAX RULES ................... 44 + + + August 13, 1982 - i - RFC #822 + + + + + Standard for ARPA Internet Text Messages + + + PREFACE + + + By 1977, the Arpanet employed several informal standards for + the text messages (mail) sent among its host computers. It was + felt necessary to codify these practices and provide for those + features that seemed imminent. The result of that effort was + Request for Comments (RFC) #733, "Standard for the Format of ARPA + Network Text Message", by Crocker, Vittal, Pogran, and Henderson. + The specification attempted to avoid major changes in existing + software, while permitting several new features. + + This document revises the specifications in RFC #733, in + order to serve the needs of the larger and more complex ARPA + Internet. Some of RFC #733's features failed to gain adequate + acceptance. In order to simplify the standard and the software + that follows it, these features have been removed. A different + addressing scheme is used, to handle the case of inter-network + mail; and the concept of re-transmission has been introduced. + + This specification is intended for use in the ARPA Internet. + However, an attempt has been made to free it of any dependence on + that environment, so that it can be applied to other network text + message systems. + + The specification of RFC #733 took place over the course of + one year, using the ARPANET mail environment, itself, to provide + an on-going forum for discussing the capabilities to be included. + More than twenty individuals, from across the country, partici- + pated in the original discussion. The development of this + revised specification has, similarly, utilized network mail-based + group discussion. Both specification efforts greatly benefited + from the comments and ideas of the participants. + + The syntax of the standard, in RFC #733, was originally + specified in the Backus-Naur Form (BNF) meta-language. Ken L. + Harrenstien, of SRI International, was responsible for re-coding + the BNF into an augmented BNF that makes the representation + smaller and easier to understand. + + + + + + + + + + + + + August 13, 1982 - ii - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 1. INTRODUCTION + + 1.1. SCOPE + + This standard specifies a syntax for text messages that are + sent among computer users, within the framework of "electronic + mail". The standard supersedes the one specified in ARPANET + Request for Comments #733, "Standard for the Format of ARPA Net- + work Text Messages". + + In this context, messages are viewed as having an envelope + and contents. The envelope contains whatever information is + needed to accomplish transmission and delivery. The contents + compose the object to be delivered to the recipient. This stan- + dard applies only to the format and some of the semantics of mes- + sage contents. It contains no specification of the information + in the envelope. + + However, some message systems may use information from the + contents to create the envelope. It is intended that this stan- + dard facilitate the acquisition of such information by programs. + + Some message systems may store messages in formats that + differ from the one specified in this standard. This specifica- + tion is intended strictly as a definition of what message content + format is to be passed BETWEEN hosts. + + Note: This standard is NOT intended to dictate the internal for- + mats used by sites, the specific message system features + that they are expected to support, or any of the charac- + teristics of user interface programs that create or read + messages. + + A distinction should be made between what the specification + REQUIRES and what it ALLOWS. Messages can be made complex and + rich with formally-structured components of information or can be + kept small and simple, with a minimum of such information. Also, + the standard simplifies the interpretation of differing visual + formats in messages; only the visual aspect of a message is + affected and not the interpretation of information within it. + Implementors may choose to retain such visual distinctions. + + The formal definition is divided into four levels. The bot- + tom level describes the meta-notation used in this document. The + second level describes basic lexical analyzers that feed tokens + to higher-level parsers. Next is an overall specification for + messages; it permits distinguishing individual fields. Finally, + there is definition of the contents of several structured fields. + + + + August 13, 1982 - 1 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 1.2. COMMUNICATION FRAMEWORK + + Messages consist of lines of text. No special provisions + are made for encoding drawings, facsimile, speech, or structured + text. No significant consideration has been given to questions + of data compression or to transmission and storage efficiency, + and the standard tends to be free with the number of bits con- + sumed. For example, field names are specified as free text, + rather than special terse codes. + + A general "memo" framework is used. That is, a message con- + sists of some information in a rigid format, followed by the main + part of the message, with a format that is not specified in this + document. The syntax of several fields of the rigidly-formated + ("headers") section is defined in this specification; some of + these fields must be included in all messages. + + The syntax that distinguishes between header fields is + specified separately from the internal syntax for particular + fields. This separation is intended to allow simple parsers to + operate on the general structure of messages, without concern for + the detailed structure of individual header fields. Appendix B + is provided to facilitate construction of these parsers. + + In addition to the fields specified in this document, it is + expected that other fields will gain common use. As necessary, + the specifications for these "extension-fields" will be published + through the same mechanism used to publish this document. Users + may also wish to extend the set of fields that they use + privately. Such "user-defined fields" are permitted. + + The framework severely constrains document tone and appear- + ance and is primarily useful for most intra-organization communi- + cations and well-structured inter-organization communication. + It also can be used for some types of inter-process communica- + tion, such as simple file transfer and remote job entry. A more + robust framework might allow for multi-font, multi-color, multi- + dimension encoding of information. A less robust one, as is + present in most single-machine message systems, would more + severely constrain the ability to add fields and the decision to + include specific fields. In contrast with paper-based communica- + tion, it is interesting to note that the RECEIVER of a message + can exercise an extraordinary amount of control over the + message's appearance. The amount of actual control available to + message receivers is contingent upon the capabilities of their + individual message systems. + + + + + + August 13, 1982 - 2 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 2. NOTATIONAL CONVENTIONS + + This specification uses an augmented Backus-Naur Form (BNF) + notation. The differences from standard BNF involve naming rules + and indicating repetition and "local" alternatives. + + 2.1. RULE NAMING + + Angle brackets ("<", ">") are not used, in general. The + name of a rule is simply the name itself, rather than "". + Quotation-marks enclose literal text (which may be upper and/or + lower case). Certain basic rules are in uppercase, such as + SPACE, TAB, CRLF, DIGIT, ALPHA, etc. Angle brackets are used in + rule definitions, and in the rest of this document, whenever + their presence will facilitate discerning the use of rule names. + + 2.2. RULE1 / RULE2: ALTERNATIVES + + Elements separated by slash ("/") are alternatives. There- + fore "foo / bar" will accept foo or bar. + + 2.3. (RULE1 RULE2): LOCAL ALTERNATIVES + + Elements enclosed in parentheses are treated as a single + element. Thus, "(elem (foo / bar) elem)" allows the token + sequences "elem foo elem" and "elem bar elem". + + 2.4. *RULE: REPETITION + + The character "*" preceding an element indicates repetition. + The full form is: + + *element + + indicating at least and at most occurrences of element. + Default values are 0 and infinity so that "*(element)" allows any + number, including zero; "1*element" requires at least one; and + "1*2element" allows one or two. + + 2.5. [RULE]: OPTIONAL + + Square brackets enclose optional elements; "[foo bar]" is + equivalent to "*1(foo bar)". + + 2.6. NRULE: SPECIFIC REPETITION + + "(element)" is equivalent to "*(element)"; that is, + exactly occurrences of (element). Thus 2DIGIT is a 2-digit + number, and 3ALPHA is a string of three alphabetic characters. + + + August 13, 1982 - 3 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 2.7. #RULE: LISTS + + A construct "#" is defined, similar to "*", as follows: + + #element + + indicating at least and at most elements, each separated + by one or more commas (","). This makes the usual form of lists + very easy; a rule such as '(element *("," element))' can be shown + as "1#element". Wherever this construct is used, null elements + are allowed, but do not contribute to the count of elements + present. That is, "(element),,(element)" is permitted, but + counts as only two elements. Therefore, where at least one ele- + ment is required, at least one non-null element must be present. + Default values are 0 and infinity so that "#(element)" allows any + number, including zero; "1#element" requires at least one; and + "1#2element" allows one or two. + + 2.8. ; COMMENTS + + A semi-colon, set off some distance to the right of rule + text, starts a comment that continues to the end of line. This + is a simple way of including useful notes in parallel with the + specifications. + + + + + + + + + + + + + + + + + + + + + + + + + + + + August 13, 1982 - 4 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 3. LEXICAL ANALYSIS OF MESSAGES + + 3.1. GENERAL DESCRIPTION + + A message consists of header fields and, optionally, a body. + The body is simply a sequence of lines containing ASCII charac- + ters. It is separated from the headers by a null line (i.e., a + line with nothing preceding the CRLF). + + 3.1.1. LONG HEADER FIELDS + + Each header field can be viewed as a single, logical line of + ASCII characters, comprising a field-name and a field-body. + For convenience, the field-body portion of this conceptual + entity can be split into a multiple-line representation; this + is called "folding". The general rule is that wherever there + may be linear-white-space (NOT simply LWSP-chars), a CRLF + immediately followed by AT LEAST one LWSP-char may instead be + inserted. Thus, the single line + + To: "Joe & J. Harvey" , JJV @ BBN + + can be represented as: + + To: "Joe & J. Harvey" , + JJV@BBN + + and + + To: "Joe & J. Harvey" + , JJV + @BBN + + and + + To: "Joe & + J. Harvey" , JJV @ BBN + + The process of moving from this folded multiple-line + representation of a header field to its single line represen- + tation is called "unfolding". Unfolding is accomplished by + regarding CRLF immediately followed by a LWSP-char as + equivalent to the LWSP-char. + + Note: While the standard permits folding wherever linear- + white-space is permitted, it is recommended that struc- + tured fields, such as those containing addresses, limit + folding to higher-level syntactic breaks. For address + fields, it is recommended that such folding occur + + + August 13, 1982 - 5 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + between addresses, after the separating comma. + + 3.1.2. STRUCTURE OF HEADER FIELDS + + Once a field has been unfolded, it may be viewed as being com- + posed of a field-name followed by a colon (":"), followed by a + field-body, and terminated by a carriage-return/line-feed. + The field-name must be composed of printable ASCII characters + (i.e., characters that have values between 33. and 126., + decimal, except colon). The field-body may be composed of any + ASCII characters, except CR or LF. (While CR and/or LF may be + present in the actual text, they are removed by the action of + unfolding the field.) + + Certain field-bodies of headers may be interpreted according + to an internal syntax that some systems may wish to parse. + These fields are called "structured fields". Examples + include fields containing dates and addresses. Other fields, + such as "Subject" and "Comments", are regarded simply as + strings of text. + + Note: Any field which has a field-body that is defined as + other than simply is to be treated as a struc- + tured field. + + Field-names, unstructured field bodies and structured + field bodies each are scanned by their own, independent + "lexical" analyzers. + + 3.1.3. UNSTRUCTURED FIELD BODIES + + For some fields, such as "Subject" and "Comments", no struc- + turing is assumed, and they are treated simply as s, as + in the message body. Rules of folding apply to these fields, + so that such field bodies which occupy several lines must + therefore have the second and successive lines indented by at + least one LWSP-char. + + 3.1.4. STRUCTURED FIELD BODIES + + To aid in the creation and reading of structured fields, the + free insertion of linear-white-space (which permits folding + by inclusion of CRLFs) is allowed between lexical tokens. + Rather than obscuring the syntax specifications for these + structured fields with explicit syntax for this linear-white- + space, the existence of another "lexical" analyzer is assumed. + This analyzer does not apply for unstructured field bodies + that are simply strings of text, as described above. The + analyzer provides an interpretation of the unfolded text + + + August 13, 1982 - 6 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + composing the body of the field as a sequence of lexical sym- + bols. + + These symbols are: + + - individual special characters + - quoted-strings + - domain-literals + - comments + - atoms + + The first four of these symbols are self-delimiting. Atoms + are not; they are delimited by the self-delimiting symbols and + by linear-white-space. For the purposes of regenerating + sequences of atoms and quoted-strings, exactly one SPACE is + assumed to exist, and should be used, between them. (Also, in + the "Clarifications" section on "White Space", below, note the + rules about treatment of multiple contiguous LWSP-chars.) + + So, for example, the folded body of an address field + + ":sysmail"@ Some-Group. Some-Org, + Muhammed.(I am the greatest) Ali @(the)Vegas.WBA + + + + + + + + + + + + + + + + + + + + + + + + + + + + + August 13, 1982 - 7 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + is analyzed into the following lexical symbols and types: + + :sysmail quoted string + @ special + Some-Group atom + . special + Some-Org atom + , special + Muhammed atom + . special + (I am the greatest) comment + Ali atom + @ atom + (the) comment + Vegas atom + . special + WBA atom + + The canonical representations for the data in these addresses + are the following strings: + + ":sysmail"@Some-Group.Some-Org + + and + + Muhammed.Ali@Vegas.WBA + + Note: For purposes of display, and when passing such struc- + tured information to other systems, such as mail proto- + col services, there must be NO linear-white-space + between s that are separated by period (".") or + at-sign ("@") and exactly one SPACE between all other + s. Also, headers should be in a folded form. + + + + + + + + + + + + + + + + + + + August 13, 1982 - 8 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 3.2. HEADER FIELD DEFINITIONS + + These rules show a field meta-syntax, without regard for the + particular type or internal syntax. Their purpose is to permit + detection of fields; also, they present to higher-level parsers + an image of each field as fitting on one line. + + field = field-name ":" [ field-body ] CRLF + + field-name = 1* + + field-body = field-body-contents + [CRLF LWSP-char field-body] + + field-body-contents = + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + August 13, 1982 - 9 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 3.3. LEXICAL TOKENS + + The following rules are used to define an underlying lexical + analyzer, which feeds tokens to higher level parsers. See the + ANSI references, in the Bibliography. + + ; ( Octal, Decimal.) + CHAR = ; ( 0-177, 0.-127.) + ALPHA = + ; (101-132, 65.- 90.) + ; (141-172, 97.-122.) + DIGIT = ; ( 60- 71, 48.- 57.) + CTL = ; ( 177, 127.) + CR = ; ( 15, 13.) + LF = ; ( 12, 10.) + SPACE = ; ( 40, 32.) + HTAB = ; ( 11, 9.) + <"> = ; ( 42, 34.) + CRLF = CR LF + + LWSP-char = SPACE / HTAB ; semantics = SPACE + + linear-white-space = 1*([CRLF] LWSP-char) ; semantics = SPACE + ; CRLF => folding + + specials = "(" / ")" / "<" / ">" / "@" ; Must be in quoted- + / "," / ";" / ":" / "\" / <"> ; string, to use + / "." / "[" / "]" ; within a word. + + delimiters = specials / linear-white-space / comment + + text = atoms, specials, + CR & bare LF, but NOT ; comments and + including CRLF> ; quoted-strings are + ; NOT recognized. + + atom = 1* + + quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or + ; quoted chars. + + qtext = , ; => may be folded + "\" & CR, and including + linear-white-space> + + domain-literal = "[" *(dtext / quoted-pair) "]" + + + + + August 13, 1982 - 10 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + dtext = may be folded + "]", "\" & CR, & including + linear-white-space> + + comment = "(" *(ctext / quoted-pair / comment) ")" + + ctext = may be folded + ")", "\" & CR, & including + linear-white-space> + + quoted-pair = "\" CHAR ; may quote any char + + phrase = 1*word ; Sequence of words + + word = atom / quoted-string + + + 3.4. CLARIFICATIONS + + 3.4.1. QUOTING + + Some characters are reserved for special interpretation, such + as delimiting lexical tokens. To permit use of these charac- + ters as uninterpreted data, a quoting mechanism is provided. + To quote a character, precede it with a backslash ("\"). + + This mechanism is not fully general. Characters may be quoted + only within a subset of the lexical constructs. In particu- + lar, quoting is limited to use within: + + - quoted-string + - domain-literal + - comment + + Within these constructs, quoting is REQUIRED for CR and "\" + and for the character(s) that delimit the token (e.g., "(" and + ")" for a comment). However, quoting is PERMITTED for any + character. + + Note: In particular, quoting is NOT permitted within atoms. + For example when the local-part of an addr-spec must + contain a special character, a quoted string must be + used. Therefore, a specification such as: + + Full\ Name@Domain + + is not legal and must be specified as: + + "Full Name"@Domain + + + August 13, 1982 - 11 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 3.4.2. WHITE SPACE + + Note: In structured field bodies, multiple linear space ASCII + characters (namely HTABs and SPACEs) are treated as + single spaces and may freely surround any symbol. In + all header fields, the only place in which at least one + LWSP-char is REQUIRED is at the beginning of continua- + tion lines in a folded field. + + When passing text to processes that do not interpret text + according to this standard (e.g., mail protocol servers), then + NO linear-white-space characters should occur between a period + (".") or at-sign ("@") and a . Exactly ONE SPACE should + be used in place of arbitrary linear-white-space and comment + sequences. + + Note: Within systems conforming to this standard, wherever a + member of the list of delimiters is allowed, LWSP-chars + may also occur before and/or after it. + + Writers of mail-sending (i.e., header-generating) programs + should realize that there is no network-wide definition of the + effect of ASCII HT (horizontal-tab) characters on the appear- + ance of text at another network host; therefore, the use of + tabs in message headers, though permitted, is discouraged. + + 3.4.3. COMMENTS + + A comment is a set of ASCII characters, which is enclosed in + matching parentheses and which is not within a quoted-string + The comment construct permits message originators to add text + which will be useful for human readers, but which will be + ignored by the formal semantics. Comments should be retained + while the message is subject to interpretation according to + this standard. However, comments must NOT be included in + other cases, such as during protocol exchanges with mail + servers. + + Comments nest, so that if an unquoted left parenthesis occurs + in a comment string, there must also be a matching right + parenthesis. When a comment acts as the delimiter between a + sequence of two lexical symbols, such as two atoms, it is lex- + ically equivalent with a single SPACE, for the purposes of + regenerating the sequence, such as when passing the sequence + onto a mail protocol server. Comments are detected as such + only within field-bodies of structured fields. + + If a comment is to be "folded" onto multiple lines, then the + syntax for folding must be adhered to. (See the "Lexical + + + August 13, 1982 - 12 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + Analysis of Messages" section on "Folding Long Header Fields" + above, and the section on "Case Independence" below.) Note + that the official semantics therefore do not "see" any + unquoted CRLFs that are in comments, although particular pars- + ing programs may wish to note their presence. For these pro- + grams, it would be reasonable to interpret a "CRLF LWSP-char" + as being a CRLF that is part of the comment; i.e., the CRLF is + kept and the LWSP-char is discarded. Quoted CRLFs (i.e., a + backslash followed by a CR followed by a LF) still must be + followed by at least one LWSP-char. + + 3.4.4. DELIMITING AND QUOTING CHARACTERS + + The quote character (backslash) and characters that delimit + syntactic units are not, generally, to be taken as data that + are part of the delimited or quoted unit(s). In particular, + the quotation-marks that define a quoted-string, the + parentheses that define a comment and the backslash that + quotes a following character are NOT part of the quoted- + string, comment or quoted character. A quotation-mark that is + to be part of a quoted-string, a parenthesis that is to be + part of a comment and a backslash that is to be part of either + must each be preceded by the quote-character backslash ("\"). + Note that the syntax allows any character to be quoted within + a quoted-string or comment; however only certain characters + MUST be quoted to be included as data. These characters are + the ones that are not part of the alternate text group (i.e., + ctext or qtext). + + The one exception to this rule is that a single SPACE is + assumed to exist between contiguous words in a phrase, and + this interpretation is independent of the actual number of + LWSP-chars that the creator places between the words. To + include more than one SPACE, the creator must make the LWSP- + chars be part of a quoted-string. + + Quotation marks that delimit a quoted string and backslashes + that quote the following character should NOT accompany the + quoted-string when the string is passed to processes that do + not interpret data according to this specification (e.g., mail + protocol servers). + + 3.4.5. QUOTED-STRINGS + + Where permitted (i.e., in words in structured fields) quoted- + strings are treated as a single symbol. That is, a quoted- + string is equivalent to an atom, syntactically. If a quoted- + string is to be "folded" onto multiple lines, then the syntax + for folding must be adhered to. (See the "Lexical Analysis of + + + August 13, 1982 - 13 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + Messages" section on "Folding Long Header Fields" above, and + the section on "Case Independence" below.) Therefore, the + official semantics do not "see" any bare CRLFs that are in + quoted-strings; however particular parsing programs may wish + to note their presence. For such programs, it would be rea- + sonable to interpret a "CRLF LWSP-char" as being a CRLF which + is part of the quoted-string; i.e., the CRLF is kept and the + LWSP-char is discarded. Quoted CRLFs (i.e., a backslash fol- + lowed by a CR followed by a LF) are also subject to rules of + folding, but the presence of the quoting character (backslash) + explicitly indicates that the CRLF is data to the quoted + string. Stripping off the first following LWSP-char is also + appropriate when parsing quoted CRLFs. + + 3.4.6. BRACKETING CHARACTERS + + There is one type of bracket which must occur in matched pairs + and may have pairs nested within each other: + + o Parentheses ("(" and ")") are used to indicate com- + ments. + + There are three types of brackets which must occur in matched + pairs, and which may NOT be nested: + + o Colon/semi-colon (":" and ";") are used in address + specifications to indicate that the included list of + addresses are to be treated as a group. + + o Angle brackets ("<" and ">") are generally used to + indicate the presence of a one machine-usable refer- + ence (e.g., delimiting mailboxes), possibly including + source-routing to the machine. + + o Square brackets ("[" and "]") are used to indicate the + presence of a domain-literal, which the appropriate + name-domain is to use directly, bypassing normal + name-resolution mechanisms. + + 3.4.7. CASE INDEPENDENCE + + Except as noted, alphabetic strings may be represented in any + combination of upper and lower case. The only syntactic units + + + + + + + + + August 13, 1982 - 14 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + which requires preservation of case information are: + + - text + - qtext + - dtext + - ctext + - quoted-pair + - local-part, except "Postmaster" + + When matching any other syntactic unit, case is to be ignored. + For example, the field-names "From", "FROM", "from", and even + "FroM" are semantically equal and should all be treated ident- + ically. + + When generating these units, any mix of upper and lower case + alphabetic characters may be used. The case shown in this + specification is suggested for message-creating processes. + + Note: The reserved local-part address unit, "Postmaster", is + an exception. When the value "Postmaster" is being + interpreted, it must be accepted in any mixture of + case, including "POSTMASTER", and "postmaster". + + 3.4.8. FOLDING LONG HEADER FIELDS + + Each header field may be represented on exactly one line con- + sisting of the name of the field and its body, and terminated + by a CRLF; this is what the parser sees. For readability, the + field-body portion of long header fields may be "folded" onto + multiple lines of the actual field. "Long" is commonly inter- + preted to mean greater than 65 or 72 characters. The former + length serves as a limit, when the message is to be viewed on + most simple terminals which use simple display software; how- + ever, the limit is not imposed by this standard. + + Note: Some display software often can selectively fold lines, + to suit the display terminal. In such cases, sender- + provided folding can interfere with the display + software. + + 3.4.9. BACKSPACE CHARACTERS + + ASCII BS characters (Backspace, decimal 8) may be included in + texts and quoted-strings to effect overstriking. However, any + use of backspaces which effects an overstrike to the left of + the beginning of the text or quoted-string is prohibited. + + + + + + August 13, 1982 - 15 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 3.4.10. NETWORK-SPECIFIC TRANSFORMATIONS + + During transmission through heterogeneous networks, it may be + necessary to force data to conform to a network's local con- + ventions. For example, it may be required that a CR be fol- + lowed either by LF, making a CRLF, or by , if the CR is + to stand alone). Such transformations are reversed, when the + message exits that network. + + When crossing network boundaries, the message should be + treated as passing through two modules. It will enter the + first module containing whatever network-specific transforma- + tions that were necessary to permit migration through the + "current" network. It then passes through the modules: + + o Transformation Reversal + + The "current" network's idiosyncracies are removed and + the message is returned to the canonical form speci- + fied in this standard. + + o Transformation + + The "next" network's local idiosyncracies are imposed + on the message. + + ------------------ + From ==> | Remove Net-A | + Net-A | idiosyncracies | + ------------------ + || + \/ + Conformance + with standard + || + \/ + ------------------ + | Impose Net-B | ==> To + | idiosyncracies | Net-B + ------------------ + + + + + + + + + + + + August 13, 1982 - 16 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 4. MESSAGE SPECIFICATION + + 4.1. SYNTAX + + Note: Due to an artifact of the notational conventions, the syn- + tax indicates that, when present, some fields, must be in + a particular order. Header fields are NOT required to + occur in any particular order, except that the message + body must occur AFTER the headers. It is recommended + that, if present, headers be sent in the order "Return- + Path", "Received", "Date", "From", "Subject", "Sender", + "To", "cc", etc. + + This specification permits multiple occurrences of most + fields. Except as noted, their interpretation is not + specified here, and their use is discouraged. + + The following syntax for the bodies of various fields should + be thought of as describing each field body as a single long + string (or line). The "Lexical Analysis of Message" section on + "Long Header Fields", above, indicates how such long strings can + be represented on more than one line in the actual transmitted + message. + + message = fields *( CRLF *text ) ; Everything after + ; first null line + ; is message body + + fields = dates ; Creation time, + source ; author id & one + 1*destination ; address required + *optional-field ; others optional + + source = [ trace ] ; net traversals + originator ; original mail + [ resent ] ; forwarded + + trace = return ; path to sender + 1*received ; receipt tags + + return = "Return-path" ":" route-addr ; return address + + received = "Received" ":" ; one per relay + ["from" domain] ; sending host + ["by" domain] ; receiving host + ["via" atom] ; physical path + *("with" atom) ; link/mail protocol + ["id" msg-id] ; receiver msg id + ["for" addr-spec] ; initial form + + + August 13, 1982 - 17 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + ";" date-time ; time received + + originator = authentic ; authenticated addr + [ "Reply-To" ":" 1#address] ) + + authentic = "From" ":" mailbox ; Single author + / ( "Sender" ":" mailbox ; Actual submittor + "From" ":" 1#mailbox) ; Multiple authors + ; or not sender + + resent = resent-authentic + [ "Resent-Reply-To" ":" 1#address] ) + + resent-authentic = + = "Resent-From" ":" mailbox + / ( "Resent-Sender" ":" mailbox + "Resent-From" ":" 1#mailbox ) + + dates = orig-date ; Original + [ resent-date ] ; Forwarded + + orig-date = "Date" ":" date-time + + resent-date = "Resent-Date" ":" date-time + + destination = "To" ":" 1#address ; Primary + / "Resent-To" ":" 1#address + / "cc" ":" 1#address ; Secondary + / "Resent-cc" ":" 1#address + / "bcc" ":" #address ; Blind carbon + / "Resent-bcc" ":" #address + + optional-field = + / "Message-ID" ":" msg-id + / "Resent-Message-ID" ":" msg-id + / "In-Reply-To" ":" *(phrase / msg-id) + / "References" ":" *(phrase / msg-id) + / "Keywords" ":" #phrase + / "Subject" ":" *text + / "Comments" ":" *text + / "Encrypted" ":" 1#2word + / extension-field ; To be defined + / user-defined-field ; May be pre-empted + + msg-id = "<" addr-spec ">" ; Unique message id + + + + + + + August 13, 1982 - 18 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + extension-field = + + + user-defined-field = + + + 4.2. FORWARDING + + Some systems permit mail recipients to forward a message, + retaining the original headers, by adding some new fields. This + standard supports such a service, through the "Resent-" prefix to + field names. + + Whenever the string "Resent-" begins a field name, the field + has the same semantics as a field whose name does not have the + prefix. However, the message is assumed to have been forwarded + by an original recipient who attached the "Resent-" field. This + new field is treated as being more recent than the equivalent, + original field. For example, the "Resent-From", indicates the + person that forwarded the message, whereas the "From" field indi- + cates the original author. + + Use of such precedence information depends upon partici- + pants' communication needs. For example, this standard does not + dictate when a "Resent-From:" address should receive replies, in + lieu of sending them to the "From:" address. + + Note: In general, the "Resent-" fields should be treated as con- + taining a set of information that is independent of the + set of original fields. Information for one set should + not automatically be taken from the other. The interpre- + tation of multiple "Resent-" fields, of the same type, is + undefined. + + In the remainder of this specification, occurrence of legal + "Resent-" fields are treated identically with the occurrence of + + + + + + + + + August 13, 1982 - 19 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + fields whose names do not contain this prefix. + + 4.3. TRACE FIELDS + + Trace information is used to provide an audit trail of mes- + sage handling. In addition, it indicates a route back to the + sender of the message. + + The list of known "via" and "with" values are registered + with the Network Information Center, SRI International, Menlo + Park, California. + + 4.3.1. RETURN-PATH + + This field is added by the final transport system that + delivers the message to its recipient. The field is intended + to contain definitive information about the address and route + back to the message's originator. + + Note: The "Reply-To" field is added by the originator and + serves to direct replies, whereas the "Return-Path" + field is used to identify a path back to the origina- + tor. + + While the syntax indicates that a route specification is + optional, every attempt should be made to provide that infor- + mation in this field. + + 4.3.2. RECEIVED + + A copy of this field is added by each transport service that + relays the message. The information in the field can be quite + useful for tracing transport problems. + + The names of the sending and receiving hosts and time-of- + receipt may be specified. The "via" parameter may be used, to + indicate what physical mechanism the message was sent over, + such as Arpanet or Phonenet, and the "with" parameter may be + used to indicate the mail-, or connection-, level protocol + that was used, such as the SMTP mail protocol, or X.25 tran- + sport protocol. + + Note: Several "with" parameters may be included, to fully + specify the set of protocols that were used. + + Some transport services queue mail; the internal message iden- + tifier that is assigned to the message may be noted, using the + "id" parameter. When the sending host uses a destination + address specification that the receiving host reinterprets, by + + + August 13, 1982 - 20 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + expansion or transformation, the receiving host may wish to + record the original specification, using the "for" parameter. + For example, when a copy of mail is sent to the member of a + distribution list, this parameter may be used to record the + original address that was used to specify the list. + + 4.4. ORIGINATOR FIELDS + + The standard allows only a subset of the combinations possi- + ble with the From, Sender, Reply-To, Resent-From, Resent-Sender, + and Resent-Reply-To fields. The limitation is intentional. + + 4.4.1. FROM / RESENT-FROM + + This field contains the identity of the person(s) who wished + this message to be sent. The message-creation process should + default this field to be a single, authenticated machine + address, indicating the AGENT (person, system or process) + entering the message. If this is not done, the "Sender" field + MUST be present. If the "From" field IS defaulted this way, + the "Sender" field is optional and is redundant with the + "From" field. In all cases, addresses in the "From" field + must be machine-usable (addr-specs) and may not contain named + lists (groups). + + 4.4.2. SENDER / RESENT-SENDER + + This field contains the authenticated identity of the AGENT + (person, system or process) that sends the message. It is + intended for use when the sender is not the author of the mes- + sage, or to indicate who among a group of authors actually + sent the message. If the contents of the "Sender" field would + be completely redundant with the "From" field, then the + "Sender" field need not be present and its use is discouraged + (though still legal). In particular, the "Sender" field MUST + be present if it is NOT the same as the "From" Field. + + The Sender mailbox specification includes a word sequence + which must correspond to a specific agent (i.e., a human user + or a computer program) rather than a standard address. This + indicates the expectation that the field will identify the + single AGENT (person, system, or process) responsible for + sending the mail and not simply include the name of a mailbox + from which the mail was sent. For example in the case of a + shared login name, the name, by itself, would not be adequate. + The local-part address unit, which refers to this agent, is + expected to be a computer system term, and not (for example) a + generalized person reference which can be used outside the + network text message context. + + + August 13, 1982 - 21 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + Since the critical function served by the "Sender" field is + identification of the agent responsible for sending mail and + since computer programs cannot be held accountable for their + behavior, it is strongly recommended that when a computer pro- + gram generates a message, the HUMAN who is responsible for + that program be referenced as part of the "Sender" field mail- + box specification. + + 4.4.3. REPLY-TO / RESENT-REPLY-TO + + This field provides a general mechanism for indicating any + mailbox(es) to which responses are to be sent. Three typical + uses for this feature can be distinguished. In the first + case, the author(s) may not have regular machine-based mail- + boxes and therefore wish(es) to indicate an alternate machine + address. In the second case, an author may wish additional + persons to be made aware of, or responsible for, replies. A + somewhat different use may be of some help to "text message + teleconferencing" groups equipped with automatic distribution + services: include the address of that service in the "Reply- + To" field of all messages submitted to the teleconference; + then participants can "reply" to conference submissions to + guarantee the correct distribution of any submission of their + own. + + Note: The "Return-Path" field is added by the mail transport + service, at the time of final deliver. It is intended + to identify a path back to the orginator of the mes- + sage. The "Reply-To" field is added by the message + originator and is intended to direct replies. + + 4.4.4. AUTOMATIC USE OF FROM / SENDER / REPLY-TO + + For systems which automatically generate address lists for + replies to messages, the following recommendations are made: + + o The "Sender" field mailbox should be sent notices of + any problems in transport or delivery of the original + messages. If there is no "Sender" field, then the + "From" field mailbox should be used. + + o The "Sender" field mailbox should NEVER be used + automatically, in a recipient's reply message. + + o If the "Reply-To" field exists, then the reply should + go to the addresses indicated in that field and not to + the address(es) indicated in the "From" field. + + + + + August 13, 1982 - 22 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + o If there is a "From" field, but no "Reply-To" field, + the reply should be sent to the address(es) indicated + in the "From" field. + + Sometimes, a recipient may actually wish to communicate with + the person that initiated the message transfer. In such + cases, it is reasonable to use the "Sender" address. + + This recommendation is intended only for automated use of + originator-fields and is not intended to suggest that replies + may not also be sent to other recipients of messages. It is + up to the respective mail-handling programs to decide what + additional facilities will be provided. + + Examples are provided in Appendix A. + + 4.5. RECEIVER FIELDS + + 4.5.1. TO / RESENT-TO + + This field contains the identity of the primary recipients of + the message. + + 4.5.2. CC / RESENT-CC + + This field contains the identity of the secondary (informa- + tional) recipients of the message. + + 4.5.3. BCC / RESENT-BCC + + This field contains the identity of additional recipients of + the message. The contents of this field are not included in + copies of the message sent to the primary and secondary reci- + pients. Some systems may choose to include the text of the + "Bcc" field only in the author(s)'s copy, while others may + also include it in the text sent to all those indicated in the + "Bcc" list. + + 4.6. REFERENCE FIELDS + + 4.6.1. MESSAGE-ID / RESENT-MESSAGE-ID + + This field contains a unique identifier (the local-part + address unit) which refers to THIS version of THIS message. + The uniqueness of the message identifier is guaranteed by the + host which generates it. This identifier is intended to be + machine readable and not necessarily meaningful to humans. A + message identifier pertains to exactly one instantiation of a + particular message; subsequent revisions to the message should + + + August 13, 1982 - 23 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + each receive new message identifiers. + + 4.6.2. IN-REPLY-TO + + The contents of this field identify previous correspon- + dence which this message answers. Note that if message iden- + tifiers are used in this field, they must use the msg-id + specification format. + + 4.6.3. REFERENCES + + The contents of this field identify other correspondence + which this message references. Note that if message identif- + iers are used, they must use the msg-id specification format. + + 4.6.4. KEYWORDS + + This field contains keywords or phrases, separated by + commas. + + 4.7. OTHER FIELDS + + 4.7.1. SUBJECT + + This is intended to provide a summary, or indicate the + nature, of the message. + + 4.7.2. COMMENTS + + Permits adding text comments onto the message without + disturbing the contents of the message's body. + + 4.7.3. ENCRYPTED + + Sometimes, data encryption is used to increase the + privacy of message contents. If the body of a message has + been encrypted, to keep its contents private, the "Encrypted" + field can be used to note the fact and to indicate the nature + of the encryption. The first parameter indicates the + software used to encrypt the body, and the second, optional + is intended to aid the recipient in selecting the + proper decryption key. This code word may be viewed as an + index to a table of keys held by the recipient. + + Note: Unfortunately, headers must contain envelope, as well + as contents, information. Consequently, it is neces- + sary that they remain unencrypted, so that mail tran- + sport services may access them. Since names, + addresses, and "Subject" field contents may contain + + + August 13, 1982 - 24 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + sensitive information, this requirement limits total + message privacy. + + Names of encryption software are registered with the Net- + work Information Center, SRI International, Menlo Park, Cali- + fornia. + + 4.7.4. EXTENSION-FIELD + + A limited number of common fields have been defined in + this document. As network mail requirements dictate, addi- + tional fields may be standardized. To provide user-defined + fields with a measure of safety, in name selection, such + extension-fields will never have names that begin with the + string "X-". + + Names of Extension-fields are registered with the Network + Information Center, SRI International, Menlo Park, California. + + 4.7.5. USER-DEFINED-FIELD + + Individual users of network mail are free to define and + use additional header fields. Such fields must have names + which are not already used in the current specification or in + any definitions of extension-fields, and the overall syntax of + these user-defined-fields must conform to this specification's + rules for delimiting and folding fields. Due to the + extension-field publishing process, the name of a user- + defined-field may be pre-empted + + Note: The prefatory string "X-" will never be used in the + names of Extension-fields. This provides user-defined + fields with a protected set of names. + + + + + + + + + + + + + + + + + + + August 13, 1982 - 25 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 5. DATE AND TIME SPECIFICATION + + 5.1. SYNTAX + + date-time = [ day "," ] date time ; dd mm yy + ; hh:mm:ss zzz + + day = "Mon" / "Tue" / "Wed" / "Thu" + / "Fri" / "Sat" / "Sun" + + date = 1*2DIGIT month 2DIGIT ; day month year + ; e.g. 20 Jun 82 + + month = "Jan" / "Feb" / "Mar" / "Apr" + / "May" / "Jun" / "Jul" / "Aug" + / "Sep" / "Oct" / "Nov" / "Dec" + + time = hour zone ; ANSI and Military + + hour = 2DIGIT ":" 2DIGIT [":" 2DIGIT] + ; 00:00:00 - 23:59:59 + + zone = "UT" / "GMT" ; Universal Time + ; North American : UT + / "EST" / "EDT" ; Eastern: - 5/ - 4 + / "CST" / "CDT" ; Central: - 6/ - 5 + / "MST" / "MDT" ; Mountain: - 7/ - 6 + / "PST" / "PDT" ; Pacific: - 8/ - 7 + / 1ALPHA ; Military: Z = UT; + ; A:-1; (J not used) + ; M:-12; N:+1; Y:+12 + / ( ("+" / "-") 4DIGIT ) ; Local differential + ; hours+min. (HHMM) + + 5.2. SEMANTICS + + If included, day-of-week must be the day implied by the date + specification. + + Time zone may be indicated in several ways. "UT" is Univer- + sal Time (formerly called "Greenwich Mean Time"); "GMT" is per- + mitted as a reference to Universal Time. The military standard + uses a single character for each zone. "Z" is Universal Time. + "A" indicates one hour earlier, and "M" indicates 12 hours ear- + lier; "N" is one hour later, and "Y" is 12 hours later. The + letter "J" is not used. The other remaining two forms are taken + from ANSI standard X3.51-1975. One allows explicit indication of + the amount of offset from UT; the other uses common 3-character + strings for indicating time zones in North America. + + + August 13, 1982 - 26 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 6. ADDRESS SPECIFICATION + + 6.1. SYNTAX + + address = mailbox ; one addressee + / group ; named list + + group = phrase ":" [#mailbox] ";" + + mailbox = addr-spec ; simple address + / phrase route-addr ; name & addr-spec + + route-addr = "<" [route] addr-spec ">" + + route = 1#("@" domain) ":" ; path-relative + + addr-spec = local-part "@" domain ; global address + + local-part = word *("." word) ; uninterpreted + ; case-preserved + + domain = sub-domain *("." sub-domain) + + sub-domain = domain-ref / domain-literal + + domain-ref = atom ; symbolic reference + + 6.2. SEMANTICS + + A mailbox receives mail. It is a conceptual entity which + does not necessarily pertain to file storage. For example, some + sites may choose to print mail on their line printer and deliver + the output to the addressee's desk. + + A mailbox specification comprises a person, system or pro- + cess name reference, a domain-dependent string, and a name-domain + reference. The name reference is optional and is usually used to + indicate the human name of a recipient. The name-domain refer- + ence specifies a sequence of sub-domains. The domain-dependent + string is uninterpreted, except by the final sub-domain; the rest + of the mail service merely transmits it as a literal string. + + 6.2.1. DOMAINS + + A name-domain is a set of registered (mail) names. A name- + domain specification resolves to a subordinate name-domain + specification or to a terminal domain-dependent string. + Hence, domain specification is extensible, permitting any + number of registration levels. + + + August 13, 1982 - 27 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + Name-domains model a global, logical, hierarchical addressing + scheme. The model is logical, in that an address specifica- + tion is related to name registration and is not necessarily + tied to transmission path. The model's hierarchy is a + directed graph, called an in-tree, such that there is a single + path from the root of the tree to any node in the hierarchy. + If more than one path actually exists, they are considered to + be different addresses. + + The root node is common to all addresses; consequently, it is + not referenced. Its children constitute "top-level" name- + domains. Usually, a service has access to its own full domain + specification and to the names of all top-level name-domains. + + The "top" of the domain addressing hierarchy -- a child of the + root -- is indicated by the right-most field, in a domain + specification. Its child is specified to the left, its child + to the left, and so on. + + Some groups provide formal registration services; these con- + stitute name-domains that are independent logically of + specific machines. In addition, networks and machines impli- + citly compose name-domains, since their membership usually is + registered in name tables. + + In the case of formal registration, an organization implements + a (distributed) data base which provides an address-to-route + mapping service for addresses of the form: + + person@registry.organization + + Note that "organization" is a logical entity, separate from + any particular communication network. + + A mechanism for accessing "organization" is universally avail- + able. That mechanism, in turn, seeks an instantiation of the + registry; its location is not indicated in the address specif- + ication. It is assumed that the system which operates under + the name "organization" knows how to find a subordinate regis- + try. The registry will then use the "person" string to deter- + mine where to send the mail specification. + + The latter, network-oriented case permits simple, direct, + attachment-related address specification, such as: + + user@host.network + + Once the network is accessed, it is expected that a message + will go directly to the host and that the host will resolve + + + August 13, 1982 - 28 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + the user name, placing the message in the user's mailbox. + + 6.2.2. ABBREVIATED DOMAIN SPECIFICATION + + Since any number of levels is possible within the domain + hierarchy, specification of a fully qualified address can + become inconvenient. This standard permits abbreviated domain + specification, in a special case: + + For the address of the sender, call the left-most + sub-domain Level N. In a header address, if all of + the sub-domains above (i.e., to the right of) Level N + are the same as those of the sender, then they do not + have to appear in the specification. Otherwise, the + address must be fully qualified. + + This feature is subject to approval by local sub- + domains. Individual sub-domains may require their + member systems, which originate mail, to provide full + domain specification only. When permitted, abbrevia- + tions may be present only while the message stays + within the sub-domain of the sender. + + Use of this mechanism requires the sender's sub-domain + to reserve the names of all top-level domains, so that + full specifications can be distinguished from abbrevi- + ated specifications. + + For example, if a sender's address is: + + sender@registry-A.registry-1.organization-X + + and one recipient's address is: + + recipient@registry-B.registry-1.organization-X + + and another's is: + + recipient@registry-C.registry-2.organization-X + + then ".registry-1.organization-X" need not be specified in the + the message, but "registry-C.registry-2" DOES have to be + specified. That is, the first two addresses may be abbrevi- + ated, but the third address must be fully specified. + + When a message crosses a domain boundary, all addresses must + be specified in the full format, ending with the top-level + name-domain in the right-most field. It is the responsibility + of mail forwarding services to ensure that addresses conform + + + August 13, 1982 - 29 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + with this requirement. In the case of abbreviated addresses, + the relaying service must make the necessary expansions. It + should be noted that it often is difficult for such a service + to locate all occurrences of address abbreviations. For exam- + ple, it will not be possible to find such abbreviations within + the body of the message. The "Return-Path" field can aid + recipients in recovering from these errors. + + Note: When passing any portion of an addr-spec onto a process + which does not interpret data according to this stan- + dard (e.g., mail protocol servers). There must be NO + LWSP-chars preceding or following the at-sign or any + delimiting period ("."), such as shown in the above + examples, and only ONE SPACE between contiguous + s. + + 6.2.3. DOMAIN TERMS + + A domain-ref must be THE official name of a registry, network, + or host. It is a symbolic reference, within a name sub- + domain. At times, it is necessary to bypass standard mechan- + isms for resolving such references, using more primitive + information, such as a network host address rather than its + associated host name. + + To permit such references, this standard provides the domain- + literal construct. Its contents must conform with the needs + of the sub-domain in which it is interpreted. + + Domain-literals which refer to domains within the ARPA Inter- + net specify 32-bit Internet addresses, in four 8-bit fields + noted in decimal, as described in Request for Comments #820, + "Assigned Numbers." For example: + + [10.0.3.19] + + Note: THE USE OF DOMAIN-LITERALS IS STRONGLY DISCOURAGED. It + is permitted only as a means of bypassing temporary + system limitations, such as name tables which are not + complete. + + The names of "top-level" domains, and the names of domains + under in the ARPA Internet, are registered with the Network + Information Center, SRI International, Menlo Park, California. + + 6.2.4. DOMAIN-DEPENDENT LOCAL STRING + + The local-part of an addr-spec in a mailbox specification + (i.e., the host's name for the mailbox) is understood to be + + + August 13, 1982 - 30 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + whatever the receiving mail protocol server allows. For exam- + ple, some systems do not understand mailbox references of the + form "P. D. Q. Bach", but others do. + + This specification treats periods (".") as lexical separators. + Hence, their presence in local-parts which are not quoted- + strings, is detected. However, such occurrences carry NO + semantics. That is, if a local-part has periods within it, an + address parser will divide the local-part into several tokens, + but the sequence of tokens will be treated as one uninter- + preted unit. The sequence will be re-assembled, when the + address is passed outside of the system such as to a mail pro- + tocol service. + + For example, the address: + + First.Last@Registry.Org + + is legal and does not require the local-part to be surrounded + with quotation-marks. (However, "First Last" DOES require + quoting.) The local-part of the address, when passed outside + of the mail system, within the Registry.Org domain, is + "First.Last", again without quotation marks. + + 6.2.5. BALANCING LOCAL-PART AND DOMAIN + + In some cases, the boundary between local-part and domain can + be flexible. The local-part may be a simple string, which is + used for the final determination of the recipient's mailbox. + All other levels of reference are, therefore, part of the + domain. + + For some systems, in the case of abbreviated reference to the + local and subordinate sub-domains, it may be possible to + specify only one reference within the domain part and place + the other, subordinate name-domain references within the + local-part. This would appear as: + + mailbox.sub1.sub2@this-domain + + Such a specification would be acceptable to address parsers + which conform to RFC #733, but do not support this newer + Internet standard. While contrary to the intent of this stan- + dard, the form is legal. + + Also, some sub-domains have a specification syntax which does + not conform to this standard. For example: + + sub-net.mailbox@sub-domain.domain + + + August 13, 1982 - 31 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + uses a different parsing sequence for local-part than for + domain. + + Note: As a rule, the domain specification should contain + fields which are encoded according to the syntax of + this standard and which contain generally-standardized + information. The local-part specification should con- + tain only that portion of the address which deviates + from the form or intention of the domain field. + + 6.2.6. MULTIPLE MAILBOXES + + An individual may have several mailboxes and wish to receive + mail at whatever mailbox is convenient for the sender to + access. This standard does not provide a means of specifying + "any member of" a list of mailboxes. + + A set of individuals may wish to receive mail as a single unit + (i.e., a distribution list). The construct permits + specification of such a list. Recipient mailboxes are speci- + fied within the bracketed part (":" - ";"). A copy of the + transmitted message is to be sent to each mailbox listed. + This standard does not permit recursive specification of + groups within groups. + + While a list must be named, it is not required that the con- + tents of the list be included. In this case, the
+ serves only as an indication of group distribution and would + appear in the form: + + name:; + + Some mail services may provide a group-list distribution + facility, accepting a single mailbox reference, expanding it + to the full distribution list, and relaying the mail to the + list's members. This standard provides no additional syntax + for indicating such a service. Using the address + alternative, while listing one mailbox in it, can mean either + that the mailbox reference will be expanded to a list or that + there is a group with one member. + + 6.2.7. EXPLICIT PATH SPECIFICATION + + At times, a message originator may wish to indicate the + transmission path that a message should follow. This is + called source routing. The normal addressing scheme, used in + an addr-spec, is carefully separated from such information; + the portion of a route-addr is provided for such occa- + sions. It specifies the sequence of hosts and/or transmission + + + August 13, 1982 - 32 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + services that are to be traversed. Both domain-refs and + domain-literals may be used. + + Note: The use of source routing is discouraged. Unless the + sender has special need of path restriction, the choice + of transmission route should be left to the mail tran- + sport service. + + 6.3. RESERVED ADDRESS + + It often is necessary to send mail to a site, without know- + ing any of its valid addresses. For example, there may be mail + system dysfunctions, or a user may wish to find out a person's + correct address, at that site. + + This standard specifies a single, reserved mailbox address + (local-part) which is to be valid at each site. Mail sent to + that address is to be routed to a person responsible for the + site's mail system or to a person with responsibility for general + site operation. The name of the reserved local-part address is: + + Postmaster + + so that "Postmaster@domain" is required to be valid. + + Note: This reserved local-part must be matched without sensi- + tivity to alphabetic case, so that "POSTMASTER", "postmas- + ter", and even "poStmASteR" is to be accepted. + + + + + + + + + + + + + + + + + + + + + + + + August 13, 1982 - 33 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + 7. BIBLIOGRAPHY + + + ANSI. "USA Standard Code for Information Interchange," X3.4. + American National Standards Institute: New York (1968). Also + in: Feinler, E. and J. Postel, eds., "ARPANET Protocol Hand- + book", NIC 7104. + + ANSI. "Representations of Universal Time, Local Time Differen- + tials, and United States Time Zone References for Information + Interchange," X3.51-1975. American National Standards Insti- + tute: New York (1975). + + Bemer, R.W., "Time and the Computer." In: Interface Age (Feb. + 1979). + + Bennett, C.J. "JNT Mail Protocol". Joint Network Team, Ruther- + ford and Appleton Laboratory: Didcot, England. + + Bhushan, A.K., Pogran, K.T., Tomlinson, R.S., and White, J.E. + "Standardizing Network Mail Headers," ARPANET Request for + Comments No. 561, Network Information Center No. 18516; SRI + International: Menlo Park (September 1973). + + Birrell, A.D., Levin, R., Needham, R.M., and Schroeder, M.D. + "Grapevine: An Exercise in Distributed Computing," Communica- + tions of the ACM 25, 4 (April 1982), 260-274. + + Crocker, D.H., Vittal, J.J., Pogran, K.T., Henderson, D.A. + "Standard for the Format of ARPA Network Text Message," + ARPANET Request for Comments No. 733, Network Information + Center No. 41952. SRI International: Menlo Park (November + 1977). + + Feinler, E.J. and Postel, J.B. ARPANET Protocol Handbook, Net- + work Information Center No. 7104 (NTIS AD A003890). SRI + International: Menlo Park (April 1976). + + Harary, F. "Graph Theory". Addison-Wesley: Reading, Mass. + (1969). + + Levin, R. and Schroeder, M. "Transport of Electronic Messages + through a Network," TeleInformatics 79, pp. 29-33. North + Holland (1979). Also as Xerox Palo Alto Research Center + Technical Report CSL-79-4. + + Myer, T.H. and Henderson, D.A. "Message Transmission Protocol," + ARPANET Request for Comments, No. 680, Network Information + Center No. 32116. SRI International: Menlo Park (1975). + + + August 13, 1982 - 34 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + NBS. "Specification of Message Format for Computer Based Message + Systems, Recommended Federal Information Processing Standard." + National Bureau of Standards: Gaithersburg, Maryland + (October 1981). + + NIC. Internet Protocol Transition Workbook. Network Information + Center, SRI-International, Menlo Park, California (March + 1982). + + Oppen, D.C. and Dalal, Y.K. "The Clearinghouse: A Decentralized + Agent for Locating Named Objects in a Distributed Environ- + ment," OPD-T8103. Xerox Office Products Division: Palo Alto, + CA. (October 1981). + + Postel, J.B. "Assigned Numbers," ARPANET Request for Comments, + No. 820. SRI International: Menlo Park (August 1982). + + Postel, J.B. "Simple Mail Transfer Protocol," ARPANET Request + for Comments, No. 821. SRI International: Menlo Park (August + 1982). + + Shoch, J.F. "Internetwork naming, addressing and routing," in + Proc. 17th IEEE Computer Society International Conference, pp. + 72-79, Sept. 1978, IEEE Cat. No. 78 CH 1388-8C. + + Su, Z. and Postel, J. "The Domain Naming Convention for Internet + User Applications," ARPANET Request for Comments, No. 819. + SRI International: Menlo Park (August 1982). + + + + + + + + + + + + + + + + + + + + + + + + August 13, 1982 - 35 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + APPENDIX + + + A. EXAMPLES + + A.1. ADDRESSES + + A.1.1. Alfred Neuman + + A.1.2. Neuman@BBN-TENEXA + + These two "Alfred Neuman" examples have identical seman- + tics, as far as the operation of the local host's mail sending + (distribution) program (also sometimes called its "mailer") + and the remote host's mail protocol server are concerned. In + the first example, the "Alfred Neuman" is ignored by the + mailer, as "Neuman@BBN-TENEXA" completely specifies the reci- + pient. The second example contains no superfluous informa- + tion, and, again, "Neuman@BBN-TENEXA" is the intended reci- + pient. + + Note: When the message crosses name-domain boundaries, then + these specifications must be changed, so as to indicate + the remainder of the hierarchy, starting with the top + level. + + A.1.3. "George, Ted" + + This form might be used to indicate that a single mailbox + is shared by several users. The quoted string is ignored by + the originating host's mailer, because "Shared@Group.Arpanet" + completely specifies the destination mailbox. + + A.1.4. Wilt . (the Stilt) Chamberlain@NBA.US + + The "(the Stilt)" is a comment, which is NOT included in + the destination mailbox address handed to the originating + system's mailer. The local-part of the address is the string + "Wilt.Chamberlain", with NO space between the first and second + words. + + A.1.5. Address Lists + + Gourmets: Pompous Person , + Childs@WGBH.Boston, Galloping Gourmet@ + ANT.Down-Under (Australian National Television), + Cheapie@Discount-Liquors;, + Cruisers: Port@Portugal, Jones@SEA;, + Another@Somewhere.SomeOrg + + + August 13, 1982 - 36 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + This group list example points out the use of comments and the + mixing of addresses and groups. + + A.2. ORIGINATOR ITEMS + + A.2.1. Author-sent + + George Jones logs into his host as "Jones". He sends + mail himself. + + From: Jones@Group.Org + + or + + From: George Jones + + A.2.2. Secretary-sent + + George Jones logs in as Jones on his host. His secre- + tary, who logs in as Secy sends mail for him. Replies to the + mail should go to George. + + From: George Jones + Sender: Secy@Other-Group + + A.2.3. Secretary-sent, for user of shared directory + + George Jones' secretary sends mail for George. Replies + should go to George. + + From: George Jones + Sender: Secy@Other-Group + + Note that there need not be a space between "Jones" and the + "<", but adding a space enhances readability (as is the case + in other examples. + + A.2.4. Committee activity, with one author + + George is a member of a committee. He wishes to have any + replies to his message go to all committee members. + + From: George Jones + Sender: Jones@Host + Reply-To: The Committee: Jones@Host.Net, + Smith@Other.Org, + Doe@Somewhere-Else; + + Note that if George had not included himself in the + + + August 13, 1982 - 37 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + enumeration of The Committee, he would not have gotten an + implicit reply; the presence of the "Reply-to" field SUPER- + SEDES the sending of a reply to the person named in the "From" + field. + + A.2.5. Secretary acting as full agent of author + + George Jones asks his secretary (Secy@Host) to send a + message for him in his capacity as Group. He wants his secre- + tary to handle all replies. + + From: George Jones + Sender: Secy@Host + Reply-To: Secy@Host + + A.2.6. Agent for user without online mailbox + + A friend of George's, Sarah, is visiting. George's + secretary sends some mail to a friend of Sarah in computer- + land. Replies should go to George, whose mailbox is Jones at + Registry. + + From: Sarah Friendly + Sender: Secy-Name + Reply-To: Jones@Registry. + + A.2.7. Agent for member of a committee + + George's secretary sends out a message which was authored + jointly by all the members of a committee. Note that the name + of the committee cannot be specified, since names are + not permitted in the From field. + + From: Jones@Host, + Smith@Other-Host, + Doe@Somewhere-Else + Sender: Secy@SHost + + + + + + + + + + + + + + + August 13, 1982 - 38 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + A.3. COMPLETE HEADERS + + A.3.1. Minimum required + + Date: 26 Aug 76 1429 EDT Date: 26 Aug 76 1429 EDT + From: Jones@Registry.Org or From: Jones@Registry.Org + Bcc: To: Smith@Registry.Org + + Note that the "Bcc" field may be empty, while the "To" field + is required to have at least one address. + + A.3.2. Using some of the additional fields + + Date: 26 Aug 76 1430 EDT + From: George Jones + Sender: Secy@SHOST + To: "Al Neuman"@Mad-Host, + Sam.Irving@Other-Host + Message-ID: + + A.3.3. About as complex as you're going to get + + Date : 27 Aug 76 0932 PDT + From : Ken Davis + Subject : Re: The Syntax in the RFC + Sender : KSecy@Other-Host + Reply-To : Sam.Irving@Reg.Organization + To : George Jones , + Al.Neuman@MAD.Publisher + cc : Important folk: + Tom Softwood , + "Sam Irving"@Other-Host;, + Standard Distribution: + /main/davis/people/standard@Other-Host, + "standard.dist.3"@Tops-20-Host>; + Comment : Sam is away on business. He asked me to handle + his mail for him. He'll be able to provide a + more accurate explanation when he returns + next week. + In-Reply-To: , George's message + X-Special-action: This is a sample of user-defined field- + names. There could also be a field-name + "Special-action", but its name might later be + preempted + Message-ID: <4231.629.XYzi-What@Other-Host> + + + + + + + August 13, 1982 - 39 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + B. SIMPLE FIELD PARSING + + Some mail-reading software systems may wish to perform only + minimal processing, ignoring the internal syntax of structured + field-bodies and treating them the same as unstructured-field- + bodies. Such software will need only to distinguish: + + o Header fields from the message body, + + o Beginnings of fields from lines which continue fields, + + o Field-names from field-contents. + + The abbreviated set of syntactic rules which follows will + suffice for this purpose. It describes a limited view of mes- + sages and is a subset of the syntactic rules provided in the main + part of this specification. One small exception is that the con- + tents of field-bodies consist only of text: + + B.1. SYNTAX + + + message = *field *(CRLF *text) + + field = field-name ":" [field-body] CRLF + + field-name = 1* + + field-body = *text [CRLF LWSP-char field-body] + + + B.2. SEMANTICS + + Headers occur before the message body and are terminated by + a null line (i.e., two contiguous CRLFs). + + A line which continues a header field begins with a SPACE or + HTAB character, while a line beginning a field starts with a + printable character which is not a colon. + + A field-name consists of one or more printable characters + (excluding colon, space, and control-characters). A field-name + MUST be contained on one line. Upper and lower case are not dis- + tinguished when comparing field-names. + + + + + + + + August 13, 1982 - 40 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + C. DIFFERENCES FROM RFC #733 + + The following summarizes the differences between this stan- + dard and the one specified in Arpanet Request for Comments #733, + "Standard for the Format of ARPA Network Text Messages". The + differences are listed in the order of their occurrence in the + current specification. + + C.1. FIELD DEFINITIONS + + C.1.1. FIELD NAMES + + These now must be a sequence of printable characters. They + may not contain any LWSP-chars. + + C.2. LEXICAL TOKENS + + C.2.1. SPECIALS + + The characters period ("."), left-square bracket ("["), and + right-square bracket ("]") have been added. For presentation + purposes, and when passing a specification to a system that + does not conform to this standard, periods are to be contigu- + ous with their surrounding lexical tokens. No linear-white- + space is permitted between them. The presence of one LWSP- + char between other tokens is still directed. + + C.2.2. ATOM + + Atoms may not contain SPACE. + + C.2.3. SPECIAL TEXT + + ctext and qtext have had backslash ("\") added to the list of + prohibited characters. + + C.2.4. DOMAINS + + The lexical tokens and have been + added. + + C.3. MESSAGE SPECIFICATION + + C.3.1. TRACE + + The "Return-path:" and "Received:" fields have been specified. + + + + + + August 13, 1982 - 41 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + C.3.2. FROM + + The "From" field must contain machine-usable addresses (addr- + spec). Multiple addresses may be specified, but named-lists + (groups) may not. + + C.3.3. RESENT + + The meta-construct of prefacing field names with the string + "Resent-" has been added, to indicate that a message has been + forwarded by an intermediate recipient. + + C.3.4. DESTINATION + + A message must contain at least one destination address field. + "To" and "CC" are required to contain at least one address. + + C.3.5. IN-REPLY-TO + + The field-body is no longer a comma-separated list, although a + sequence is still permitted. + + C.3.6. REFERENCE + + The field-body is no longer a comma-separated list, although a + sequence is still permitted. + + C.3.7. ENCRYPTED + + A field has been specified that permits senders to indicate + that the body of a message has been encrypted. + + C.3.8. EXTENSION-FIELD + + Extension fields are prohibited from beginning with the char- + acters "X-". + + C.4. DATE AND TIME SPECIFICATION + + C.4.1. SIMPLIFICATION + + Fewer optional forms are permitted and the list of three- + letter time zones has been shortened. + + C.5. ADDRESS SPECIFICATION + + + + + + + August 13, 1982 - 42 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + C.5.1. ADDRESS + + The use of quoted-string, and the ":"-atom-":" construct, have + been removed. An address now is either a single mailbox + reference or is a named list of addresses. The latter indi- + cates a group distribution. + + C.5.2. GROUPS + + Group lists are now required to to have a name. Group lists + may not be nested. + + C.5.3. MAILBOX + + A mailbox specification may indicate a person's name, as + before. Such a named list no longer may specify multiple + mailboxes and may not be nested. + + C.5.4. ROUTE ADDRESSING + + Addresses now are taken to be absolute, global specifications, + independent of transmission paths. The construct has + been provided, to permit explicit specification of transmis- + sion path. RFC #733's use of multiple at-signs ("@") was + intended as a general syntax for indicating routing and/or + hierarchical addressing. The current standard separates these + specifications and only one at-sign is permitted. + + C.5.5. AT-SIGN + + The string " at " no longer is used as an address delimiter. + Only at-sign ("@") serves the function. + + C.5.6. DOMAINS + + Hierarchical, logical name-domains have been added. + + C.6. RESERVED ADDRESS + + The local-part "Postmaster" has been reserved, so that users can + be guaranteed at least one valid address at a site. + + + + + + + + + + + August 13, 1982 - 43 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + D. ALPHABETICAL LISTING OF SYNTAX RULES + + address = mailbox ; one addressee + / group ; named list + addr-spec = local-part "@" domain ; global address + ALPHA = + ; (101-132, 65.- 90.) + ; (141-172, 97.-122.) + atom = 1* + authentic = "From" ":" mailbox ; Single author + / ( "Sender" ":" mailbox ; Actual submittor + "From" ":" 1#mailbox) ; Multiple authors + ; or not sender + CHAR = ; ( 0-177, 0.-127.) + comment = "(" *(ctext / quoted-pair / comment) ")" + CR = ; ( 15, 13.) + CRLF = CR LF + ctext = may be folded + ")", "\" & CR, & including + linear-white-space> + CTL = ; ( 177, 127.) + date = 1*2DIGIT month 2DIGIT ; day month year + ; e.g. 20 Jun 82 + dates = orig-date ; Original + [ resent-date ] ; Forwarded + date-time = [ day "," ] date time ; dd mm yy + ; hh:mm:ss zzz + day = "Mon" / "Tue" / "Wed" / "Thu" + / "Fri" / "Sat" / "Sun" + delimiters = specials / linear-white-space / comment + destination = "To" ":" 1#address ; Primary + / "Resent-To" ":" 1#address + / "cc" ":" 1#address ; Secondary + / "Resent-cc" ":" 1#address + / "bcc" ":" #address ; Blind carbon + / "Resent-bcc" ":" #address + DIGIT = ; ( 60- 71, 48.- 57.) + domain = sub-domain *("." sub-domain) + domain-literal = "[" *(dtext / quoted-pair) "]" + domain-ref = atom ; symbolic reference + dtext = may be folded + "]", "\" & CR, & including + linear-white-space> + extension-field = + + + + August 13, 1982 - 44 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + field = field-name ":" [ field-body ] CRLF + fields = dates ; Creation time, + source ; author id & one + 1*destination ; address required + *optional-field ; others optional + field-body = field-body-contents + [CRLF LWSP-char field-body] + field-body-contents = + + field-name = 1* + group = phrase ":" [#mailbox] ";" + hour = 2DIGIT ":" 2DIGIT [":" 2DIGIT] + ; 00:00:00 - 23:59:59 + HTAB = ; ( 11, 9.) + LF = ; ( 12, 10.) + linear-white-space = 1*([CRLF] LWSP-char) ; semantics = SPACE + ; CRLF => folding + local-part = word *("." word) ; uninterpreted + ; case-preserved + LWSP-char = SPACE / HTAB ; semantics = SPACE + mailbox = addr-spec ; simple address + / phrase route-addr ; name & addr-spec + message = fields *( CRLF *text ) ; Everything after + ; first null line + ; is message body + month = "Jan" / "Feb" / "Mar" / "Apr" + / "May" / "Jun" / "Jul" / "Aug" + / "Sep" / "Oct" / "Nov" / "Dec" + msg-id = "<" addr-spec ">" ; Unique message id + optional-field = + / "Message-ID" ":" msg-id + / "Resent-Message-ID" ":" msg-id + / "In-Reply-To" ":" *(phrase / msg-id) + / "References" ":" *(phrase / msg-id) + / "Keywords" ":" #phrase + / "Subject" ":" *text + / "Comments" ":" *text + / "Encrypted" ":" 1#2word + / extension-field ; To be defined + / user-defined-field ; May be pre-empted + orig-date = "Date" ":" date-time + originator = authentic ; authenticated addr + [ "Reply-To" ":" 1#address] ) + phrase = 1*word ; Sequence of words + + + + + August 13, 1982 - 45 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + qtext = , ; => may be folded + "\" & CR, and including + linear-white-space> + quoted-pair = "\" CHAR ; may quote any char + quoted-string = <"> *(qtext/quoted-pair) <">; Regular qtext or + ; quoted chars. + received = "Received" ":" ; one per relay + ["from" domain] ; sending host + ["by" domain] ; receiving host + ["via" atom] ; physical path + *("with" atom) ; link/mail protocol + ["id" msg-id] ; receiver msg id + ["for" addr-spec] ; initial form + ";" date-time ; time received + + resent = resent-authentic + [ "Resent-Reply-To" ":" 1#address] ) + resent-authentic = + = "Resent-From" ":" mailbox + / ( "Resent-Sender" ":" mailbox + "Resent-From" ":" 1#mailbox ) + resent-date = "Resent-Date" ":" date-time + return = "Return-path" ":" route-addr ; return address + route = 1#("@" domain) ":" ; path-relative + route-addr = "<" [route] addr-spec ">" + source = [ trace ] ; net traversals + originator ; original mail + [ resent ] ; forwarded + SPACE = ; ( 40, 32.) + specials = "(" / ")" / "<" / ">" / "@" ; Must be in quoted- + / "," / ";" / ":" / "\" / <"> ; string, to use + / "." / "[" / "]" ; within a word. + sub-domain = domain-ref / domain-literal + text = atoms, specials, + CR & bare LF, but NOT ; comments and + including CRLF> ; quoted-strings are + ; NOT recognized. + time = hour zone ; ANSI and Military + trace = return ; path to sender + 1*received ; receipt tags + user-defined-field = + + word = atom / quoted-string + + + + + August 13, 1982 - 46 - RFC #822 + + + + Standard for ARPA Internet Text Messages + + + zone = "UT" / "GMT" ; Universal Time + ; North American : UT + / "EST" / "EDT" ; Eastern: - 5/ - 4 + / "CST" / "CDT" ; Central: - 6/ - 5 + / "MST" / "MDT" ; Mountain: - 7/ - 6 + / "PST" / "PDT" ; Pacific: - 8/ - 7 + / 1ALPHA ; Military: Z = UT; + <"> = ; ( 42, 34.) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + August 13, 1982 - 47 - RFC #822 + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1341.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1341.txt new file mode 100644 index 0000000..1be6f7d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1341.txt @@ -0,0 +1,5265 @@ + + + + + + + Network Working Group N. Borenstein, Bellcore + Request for Comments: 1341 N. Freed, Innosoft + June 1992 + + + + MIME (Multipurpose Internet Mail Extensions): + + + Mechanisms for Specifying and Describing + the Format of Internet Message Bodies + + + Status of this Memo + + This RFC specifies an IAB standards track protocol for the + Internet community, and requests discussion and suggestions + for improvements. Please refer to the current edition of + the "IAB Official Protocol Standards" for the + standardization state and status of this protocol. + Distribution of this memo is unlimited. + + Abstract + + RFC 822 defines a message representation protocol which + specifies considerable detail about message headers, but + which leaves the message content, or message body, as flat + ASCII text. This document redefines the format of message + bodies to allow multi-part textual and non-textual message + bodies to be represented and exchanged without loss of + information. This is based on earlier work documented in + RFC 934 and RFC 1049, but extends and revises that work. + Because RFC 822 said so little about message bodies, this + document is largely orthogonal to (rather than a revision + of) RFC 822. + + In particular, this document is designed to provide + facilities to include multiple objects in a single message, + to represent body text in character sets other than US- + ASCII, to represent formatted multi-font text messages, to + represent non-textual material such as images and audio + fragments, and generally to facilitate later extensions + defining new types of Internet mail for use by cooperating + mail agents. + + This document does NOT extend Internet mail header fields to + permit anything other than US-ASCII text data. It is + recognized that such extensions are necessary, and they are + the subject of a companion document [RFC -1342]. + + A table of contents appears at the end of this document. + + + + + + + Borenstein & Freed [Page i] + + + + + + + + 1 Introduction + + Since its publication in 1982, RFC 822 [RFC-822] has defined + the standard format of textual mail messages on the + Internet. Its success has been such that the RFC 822 format + has been adopted, wholly or partially, well beyond the + confines of the Internet and the Internet SMTP transport + defined by RFC 821 [RFC-821]. As the format has seen wider + use, a number of limitations have proven increasingly + restrictive for the user community. + + RFC 822 was intended to specify a format for text messages. + As such, non-text messages, such as multimedia messages that + might include audio or images, are simply not mentioned. + Even in the case of text, however, RFC 822 is inadequate for + the needs of mail users whose languages require the use of + character sets richer than US ASCII [US-ASCII]. Since RFC + 822 does not specify mechanisms for mail containing audio, + video, Asian language text, or even text in most European + languages, additional specifications are needed + + One of the notable limitations of RFC 821/822 based mail + systems is the fact that they limit the contents of + electronic mail messages to relatively short lines of + seven-bit ASCII. This forces users to convert any non- + textual data that they may wish to send into seven-bit bytes + representable as printable ASCII characters before invoking + a local mail UA (User Agent, a program with which human + users send and receive mail). Examples of such encodings + currently used in the Internet include pure hexadecimal, + uuencode, the 3-in-4 base 64 scheme specified in RFC 1113, + the Andrew Toolkit Representation [ATK], and many others. + + The limitations of RFC 822 mail become even more apparent as + gateways are designed to allow for the exchange of mail + messages between RFC 822 hosts and X.400 hosts. X.400 [X400] + specifies mechanisms for the inclusion of non-textual body + parts within electronic mail messages. The current + standards for the mapping of X.400 messages to RFC 822 + messages specify that either X.400 non-textual body parts + should be converted to (not encoded in) an ASCII format, or + that they should be discarded, notifying the RFC 822 user + that discarding has occurred. This is clearly undesirable, + as information that a user may wish to receive is lost. + Even though a user's UA may not have the capability of + dealing with the non-textual body part, the user might have + some mechanism external to the UA that can extract useful + information from the body part. Moreover, it does not allow + for the fact that the message may eventually be gatewayed + back into an X.400 message handling system (i.e., the X.400 + message is "tunneled" through Internet mail), where the + non-textual information would definitely become useful + again. + + + + + Borenstein & Freed [Page 1] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + This document describes several mechanisms that combine to + solve most of these problems without introducing any serious + incompatibilities with the existing world of RFC 822 mail. + In particular, it describes: + + 1. A MIME-Version header field, which uses a version number + to declare a message to be conformant with this + specification and allows mail processing agents to + distinguish between such messages and those generated + by older or non-conformant software, which is presumed + to lack such a field. + + 2. A Content-Type header field, generalized from RFC 1049 + [RFC-1049], which can be used to specify the type and + subtype of data in the body of a message and to fully + specify the native representation (encoding) of such + data. + + 2.a. A "text" Content-Type value, which can be used to + represent textual information in a number of + character sets and formatted text description + languages in a standardized manner. + + 2.b. A "multipart" Content-Type value, which can be + used to combine several body parts, possibly of + differing types of data, into a single message. + + 2.c. An "application" Content-Type value, which can be + used to transmit application data or binary data, + and hence, among other uses, to implement an + electronic mail file transfer service. + + 2.d. A "message" Content-Type value, for encapsulating + a mail message. + + 2.e An "image" Content-Type value, for transmitting + still image (picture) data. + + 2.f. An "audio" Content-Type value, for transmitting + audio or voice data. + + 2.g. A "video" Content-Type value, for transmitting + video or moving image data, possibly with audio as + part of the composite video data format. + + 3. A Content-Transfer-Encoding header field, which can be + used to specify an auxiliary encoding that was applied + to the data in order to allow it to pass through mail + transport mechanisms which may have data or character + set limitations. + + 4. Two optional header fields that can be used to further + describe the data in a message body, the Content-ID and + Content-Description header fields. + + + + Borenstein & Freed [Page 2] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + MIME has been carefully designed as an extensible mechanism, + and it is expected that the set of content-type/subtype + pairs and their associated parameters will grow + significantly with time. Several other MIME fields, notably + including character set names, are likely to have new values + defined over time. In order to ensure that the set of such + values is developed in an orderly, well-specified, and + public manner, MIME defines a registration process which + uses the Internet Assigned Numbers Authority (IANA) as a + central registry for such values. Appendix F provides + details about how IANA registration is accomplished. + + Finally, to specify and promote interoperability, Appendix A + of this document provides a basic applicability statement + for a subset of the above mechanisms that defines a minimal + level of "conformance" with this document. + + HISTORICAL NOTE: Several of the mechanisms described in + this document may seem somewhat strange or even baroque at + first reading. It is important to note that compatibility + with existing standards AND robustness across existing + practice were two of the highest priorities of the working + group that developed this document. In particular, + compatibility was always favored over elegance. + + 2 Notations, Conventions, and Generic BNF Grammar + + This document is being published in two versions, one as + plain ASCII text and one as PostScript. The latter is + recommended, though the textual contents are identical. An + Andrew-format copy of this document is also available from + the first author (Borenstein). + + Although the mechanisms specified in this document are all + described in prose, most are also described formally in the + modified BNF notation of RFC 822. Implementors will need to + be familiar with this notation in order to understand this + specification, and are referred to RFC 822 for a complete + explanation of the modified BNF notation. + + Some of the modified BNF in this document makes reference to + syntactic entities that are defined in RFC 822 and not in + this document. A complete formal grammar, then, is obtained + by combining the collected grammar appendix of this document + with that of RFC 822. + + The term CRLF, in this document, refers to the sequence of + the two ASCII characters CR (13) and LF (10) which, taken + together, in this order, denote a line break in RFC 822 + mail. + + The term "character set", wherever it is used in this + document, refers to a coded character set, in the sense of + ISO character set standardization work, and must not be + + + + Borenstein & Freed [Page 3] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + misinterpreted as meaning "a set of characters." + + The term "message", when not further qualified, means either + the (complete or "top-level") message being transferred on a + network, or a message encapsulated in a body of type + "message". + + The term "body part", in this document, means one of the + parts of the body of a multipart entity. A body part has a + header and a body, so it makes sense to speak about the body + of a body part. + + The term "entity", in this document, means either a message + or a body part. All kinds of entities share the property + that they have a header and a body. + + The term "body", when not further qualified, means the body + of an entity, that is the body of either a message or of a + body part. + + Note : the previous four definitions are clearly circular. + This is unavoidable, since the overal structure of a MIME + message is indeed recursive. + + In this document, all numeric and octet values are given in + decimal notation. + + It must be noted that Content-Type values, subtypes, and + parameter names as defined in this document are case- + insensitive. However, parameter values are case-sensitive + unless otherwise specified for the specific parameter. + + FORMATTING NOTE: This document has been carefully formatted + for ease of reading. The PostScript version of this + document, in particular, places notes like this one, which + may be skipped by the reader, in a smaller, italicized, + font, and indents it as well. In the text version, only the + indentation is preserved, so if you are reading the text + version of this you might consider using the PostScript + version instead. However, all such notes will be indented + and preceded by "NOTE:" or some similar introduction, even + in the text version. + + The primary purpose of these non-essential notes is to + convey information about the rationale of this document, or + to place this document in the proper historical or + evolutionary context. Such information may be skipped by + those who are focused entirely on building a compliant + implementation, but may be of use to those who wish to + understand why this document is written as it is. + + For ease of recognition, all BNF definitions have been + placed in a fixed-width font in the PostScript version of + this document. + + + + Borenstein & Freed [Page 4] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 3 The MIME-Version Header Field + + Since RFC 822 was published in 1982, there has really been + only one format standard for Internet messages, and there + has been little perceived need to declare the format + standard in use. This document is an independent document + that complements RFC 822. Although the extensions in this + document have been defined in such a way as to be compatible + with RFC 822, there are still circumstances in which it + might be desirable for a mail-processing agent to know + whether a message was composed with the new standard in + mind. + + Therefore, this document defines a new header field, "MIME- + Version", which is to be used to declare the version of the + Internet message body format standard in use. + + Messages composed in accordance with this document MUST + include such a header field, with the following verbatim + text: + + MIME-Version: 1.0 + + The presence of this header field is an assertion that the + message has been composed in compliance with this document. + + Since it is possible that a future document might extend the + message format standard again, a formal BNF is given for the + content of the MIME-Version field: + + MIME-Version := text + + Thus, future format specifiers, which might replace or + extend "1.0", are (minimally) constrained by the definition + of "text", which appears in RFC 822. + + Note that the MIME-Version header field is required at the + top level of a message. It is not required for each body + part of a multipart entity. It is required for the embedded + headers of a body of type "message" if and only if the + embedded message is itself claimed to be MIME-compliant. + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 5] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 4 The Content-Type Header Field + + The purpose of the Content-Type field is to describe the + data contained in the body fully enough that the receiving + user agent can pick an appropriate agent or mechanism to + present the data to the user, or otherwise deal with the + data in an appropriate manner. + + HISTORICAL NOTE: The Content-Type header field was first + defined in RFC 1049. RFC 1049 Content-types used a simpler + and less powerful syntax, but one that is largely compatible + with the mechanism given here. + + The Content-Type header field is used to specify the nature + of the data in the body of an entity, by giving type and + subtype identifiers, and by providing auxiliary information + that may be required for certain types. After the type and + subtype names, the remainder of the header field is simply a + set of parameters, specified in an attribute/value notation. + The set of meaningful parameters differs for the different + types. The ordering of parameters is not significant. + Among the defined parameters is a "charset" parameter by + which the character set used in the body may be declared. + Comments are allowed in accordance with RFC 822 rules for + structured header fields. + + In general, the top-level Content-Type is used to declare + the general type of data, while the subtype specifies a + specific format for that type of data. Thus, a Content-Type + of "image/xyz" is enough to tell a user agent that the data + is an image, even if the user agent has no knowledge of the + specific image format "xyz". Such information can be used, + for example, to decide whether or not to show a user the raw + data from an unrecognized subtype -- such an action might be + reasonable for unrecognized subtypes of text, but not for + unrecognized subtypes of image or audio. For this reason, + registered subtypes of audio, image, text, and video, should + not contain embedded information that is really of a + different type. Such compound types should be represented + using the "multipart" or "application" types. + + Parameters are modifiers of the content-subtype, and do not + fundamentally affect the requirements of the host system. + Although most parameters make sense only with certain + content-types, others are "global" in the sense that they + might apply to any subtype. For example, the "boundary" + parameter makes sense only for the "multipart" content-type, + but the "charset" parameter might make sense with several + content-types. + + An initial set of seven Content-Types is defined by this + document. This set of top-level names is intended to be + substantially complete. It is expected that additions to + the larger set of supported types can generally be + + + + Borenstein & Freed [Page 6] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + accomplished by the creation of new subtypes of these + initial types. In the future, more top-level types may be + defined only by an extension to this standard. If another + primary type is to be used for any reason, it must be given + a name starting with "X-" to indicate its non-standard + status and to avoid a potential conflict with a future + official name. + + In the Extended BNF notation of RFC 822, a Content-Type + header field value is defined as follows: + + Content-Type := type "/" subtype *[";" parameter] + + type := "application" / "audio" + / "image" / "message" + / "multipart" / "text" + / "video" / x-token + + x-token := + + subtype := token + + parameter := attribute "=" value + + attribute := token + + value := token / quoted-string + + token := 1* + + tspecials := "(" / ")" / "<" / ">" / "@" ; Must be in + / "," / ";" / ":" / "\" / <"> ; quoted-string, + / "/" / "[" / "]" / "?" / "." ; to use within + / "=" ; parameter values + + Note that the definition of "tspecials" is the same as the + RFC 822 definition of "specials" with the addition of the + three characters "/", "?", and "=". + + Note also that a subtype specification is MANDATORY. There + are no default subtypes. + + The type, subtype, and parameter names are not case + sensitive. For example, TEXT, Text, and TeXt are all + equivalent. Parameter values are normally case sensitive, + but certain parameters are interpreted to be case- + insensitive, depending on the intended use. (For example, + multipart boundaries are case-sensitive, but the "access- + type" for message/External-body is not case-sensitive.) + + Beyond this syntax, the only constraint on the definition of + subtype names is the desire that their uses must not + conflict. That is, it would be undesirable to have two + + + + Borenstein & Freed [Page 7] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + different communities using "Content-Type: + application/foobar" to mean two different things. The + process of defining new content-subtypes, then, is not + intended to be a mechanism for imposing restrictions, but + simply a mechanism for publicizing the usages. There are, + therefore, two acceptable mechanisms for defining new + Content-Type subtypes: + + 1. Private values (starting with "X-") may be + defined bilaterally between two cooperating + agents without outside registration or + standardization. + + 2. New standard values must be documented, + registered with, and approved by IANA, as + described in Appendix F. Where intended for + public use, the formats they refer to must + also be defined by a published specification, + and possibly offered for standardization. + + The seven standard initial predefined Content-Types are + detailed in the bulk of this document. They are: + + text -- textual information. The primary subtype, + "plain", indicates plain (unformatted) text. No + special software is required to get the full + meaning of the text, aside from support for the + indicated character set. Subtypes are to be used + for enriched text in forms where application + software may enhance the appearance of the text, + but such software must not be required in order to + get the general idea of the content. Possible + subtypes thus include any readable word processor + format. A very simple and portable subtype, + richtext, is defined in this document. + multipart -- data consisting of multiple parts of + independent data types. Four initial subtypes + are defined, including the primary "mixed" + subtype, "alternative" for representing the same + data in multiple formats, "parallel" for parts + intended to be viewed simultaneously, and "digest" + for multipart entities in which each part is of + type "message". + message -- an encapsulated message. A body of + Content-Type "message" is itself a fully formatted + RFC 822 conformant message which may contain its + own different Content-Type header field. The + primary subtype is "rfc822". The "partial" + subtype is defined for partial messages, to permit + the fragmented transmission of bodies that are + thought to be too large to be passed through mail + transport facilities. Another subtype, + "External-body", is defined for specifying large + bodies by reference to an external data source. + + + + Borenstein & Freed [Page 8] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + image -- image data. Image requires a display device + (such as a graphical display, a printer, or a FAX + machine) to view the information. Initial + subtypes are defined for two widely-used image + formats, jpeg and gif. + audio -- audio data, with initial subtype "basic". + Audio requires an audio output device (such as a + speaker or a telephone) to "display" the contents. + video -- video data. Video requires the capability to + display moving images, typically including + specialized hardware and software. The initial + subtype is "mpeg". + application -- some other kind of data, typically + either uninterpreted binary data or information to + be processed by a mail-based application. The + primary subtype, "octet-stream", is to be used in + the case of uninterpreted binary data, in which + case the simplest recommended action is to offer + to write the information into a file for the user. + Two additional subtypes, "ODA" and "PostScript", + are defined for transporting ODA and PostScript + documents in bodies. Other expected uses for + "application" include spreadsheets, data for + mail-based scheduling systems, and languages for + "active" (computational) email. (Note that active + email entails several securityconsiderations, + which are discussed later in this memo, + particularly in the context of + application/PostScript.) + + Default RFC 822 messages are typed by this protocol as plain + text in the US-ASCII character set, which can be explicitly + specified as "Content-type: text/plain; charset=us-ascii". + If no Content-Type is specified, either by error or by an + older user agent, this default is assumed. In the presence + of a MIME-Version header field, a receiving User Agent can + also assume that plain US-ASCII text was the sender's + intent. In the absence of a MIME-Version specification, + plain US-ASCII text must still be assumed, but the sender's + intent might have been otherwise. + + RATIONALE: In the absence of any Content-Type header field + or MIME-Version header field, it is impossible to be certain + that a message is actually text in the US-ASCII character + set, since it might well be a message that, using the + conventions that predate this document, includes text in + another character set or non-textual data in a manner that + cannot be automatically recognized (e.g., a uuencoded + compressed UNIX tar file). Although there is no fully + acceptable alternative to treating such untyped messages as + "text/plain; charset=us-ascii", implementors should remain + aware that if a message lacks both the MIME-Version and the + Content-Type header fields, it may in practice contain + almost anything. + + + + Borenstein & Freed [Page 9] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + It should be noted that the list of Content-Type values + given here may be augmented in time, via the mechanisms + described above, and that the set of subtypes is expected to + grow substantially. + + When a mail reader encounters mail with an unknown Content- + type value, it should generally treat it as equivalent to + "application/octet-stream", as described later in this + document. + + 5 The Content-Transfer-Encoding Header Field + + Many Content-Types which could usefully be transported via + email are represented, in their "natural" format, as 8-bit + character or binary data. Such data cannot be transmitted + over some transport protocols. For example, RFC 821 + restricts mail messages to 7-bit US-ASCII data with 1000 + character lines. + + It is necessary, therefore, to define a standard mechanism + for re-encoding such data into a 7-bit short-line format. + This document specifies that such encodings will be + indicated by a new "Content-Transfer-Encoding" header field. + The Content-Transfer-Encoding field is used to indicate the + type of transformation that has been used in order to + represent the body in an acceptable manner for transport. + + Unlike Content-Types, a proliferation of Content-Transfer- + Encoding values is undesirable and unnecessary. However, + establishing only a single Content-Transfer-Encoding + mechanism does not seem possible. There is a tradeoff + between the desire for a compact and efficient encoding of + largely-binary data and the desire for a readable encoding + of data that is mostly, but not entirely, 7-bit data. For + this reason, at least two encoding mechanisms are necessary: + a "readable" encoding and a "dense" encoding. + + The Content-Transfer-Encoding field is designed to specify + an invertible mapping between the "native" representation of + a type of data and a representation that can be readily + exchanged using 7 bit mail transport protocols, such as + those defined by RFC 821 (SMTP). This field has not been + defined by any previous standard. The field's value is a + single token specifying the type of encoding, as enumerated + below. Formally: + + Content-Transfer-Encoding := "BASE64" / "QUOTED-PRINTABLE" / + "8BIT" / "7BIT" / + "BINARY" / x-token + + These values are not case sensitive. That is, Base64 and + BASE64 and bAsE64 are all equivalent. An encoding type of + 7BIT requires that the body is already in a seven-bit mail- + ready representation. This is the default value -- that is, + + + + Borenstein & Freed [Page 10] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + "Content-Transfer-Encoding: 7BIT" is assumed if the + Content-Transfer-Encoding header field is not present. + + The values "8bit", "7bit", and "binary" all imply that NO + encoding has been performed. However, they are potentially + useful as indications of the kind of data contained in the + object, and therefore of the kind of encoding that might + need to be performed for transmission in a given transport + system. "7bit" means that the data is all represented as + short lines of US-ASCII data. "8bit" means that the lines + are short, but there may be non-ASCII characters (octets + with the high-order bit set). "Binary" means that not only + may non-ASCII characters be present, but also that the lines + are not necessarily short enough for SMTP transport. + + The difference between "8bit" (or any other conceivable + bit-width token) and the "binary" token is that "binary" + does not require adherence to any limits on line length or + to the SMTP CRLF semantics, while the bit-width tokens do + require such adherence. If the body contains data in any + bit-width other than 7-bit, the appropriate bit-width + Content-Transfer-Encoding token must be used (e.g., "8bit" + for unencoded 8 bit wide data). If the body contains binary + data, the "binary" Content-Transfer-Encoding token must be + used. + + NOTE: The distinction between the Content-Transfer-Encoding + values of "binary," "8bit," etc. may seem unimportant, in + that all of them really mean "none" -- that is, there has + been no encoding of the data for transport. However, clear + labeling will be of enormous value to gateways between + future mail transport systems with differing capabilities in + transporting data that do not meet the restrictions of RFC + 821 transport. + + As of the publication of this document, there are no + standardized Internet transports for which it is legitimate + to include unencoded 8-bit or binary data in mail bodies. + Thus there are no circumstances in which the "8bit" or + "binary" Content-Transfer-Encoding is actually legal on the + Internet. However, in the event that 8-bit or binary mail + transport becomes a reality in Internet mail, or when this + document is used in conjunction with any other 8-bit or + binary-capable transport mechanism, 8-bit or binary bodies + should be labeled as such using this mechanism. + + NOTE: The five values defined for the Content-Transfer- + Encoding field imply nothing about the Content-Type other + than the algorithm by which it was encoded or the transport + system requirements if unencoded. + + Implementors may, if necessary, define new Content- + Transfer-Encoding values, but must use an x-token, which is + a name prefixed by "X-" to indicate its non-standard status, + + + + Borenstein & Freed [Page 11] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + e.g., "Content-Transfer-Encoding: x-my-new-encoding". + However, unlike Content-Types and subtypes, the creation of + new Content-Transfer-Encoding values is explicitly and + strongly discouraged, as it seems likely to hinder + interoperability with little potential benefit. Their use + is allowed only as the result of an agreement between + cooperating user agents. + + If a Content-Transfer-Encoding header field appears as part + of a message header, it applies to the entire body of that + message. If a Content-Transfer-Encoding header field + appears as part of a body part's headers, it applies only to + the body of that body part. If an entity is of type + "multipart" or "message", the Content-Transfer-Encoding is + not permitted to have any value other than a bit width + (e.g., "7bit", "8bit", etc.) or "binary". + + It should be noted that email is character-oriented, so that + the mechanisms described here are mechanisms for encoding + arbitrary byte streams, not bit streams. If a bit stream is + to be encoded via one of these mechanisms, it must first be + converted to an 8-bit byte stream using the network standard + bit order ("big-endian"), in which the earlier bits in a + stream become the higher-order bits in a byte. A bit stream + not ending at an 8-bit boundary must be padded with zeroes. + This document provides a mechanism for noting the addition + of such padding in the case of the application Content-Type, + which has a "padding" parameter. + + The encoding mechanisms defined here explicitly encode all + data in ASCII. Thus, for example, suppose an entity has + header fields such as: + + Content-Type: text/plain; charset=ISO-8859-1 + Content-transfer-encoding: base64 + + This should be interpreted to mean that the body is a base64 + ASCII encoding of data that was originally in ISO-8859-1, + and will be in that character set again after decoding. + + The following sections will define the two standard encoding + mechanisms. The definition of new content-transfer- + encodings is explicitly discouraged and should only occur + when absolutely necessary. All content-transfer-encoding + namespace except that beginning with "X-" is explicitly + reserved to the IANA for future use. Private agreements + about content-transfer-encodings are also explicitly + discouraged. + + Certain Content-Transfer-Encoding values may only be used on + certain Content-Types. In particular, it is expressly + forbidden to use any encodings other than "7bit", "8bit", or + "binary" with any Content-Type that recursively includes + other Content-Type fields, notably the "multipart" and + + + + Borenstein & Freed [Page 12] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + "message" Content-Types. All encodings that are desired for + bodies of type multipart or message must be done at the + innermost level, by encoding the actual body that needs to + be encoded. + + NOTE ON ENCODING RESTRICTIONS: Though the prohibition + against using content-transfer-encodings on data of type + multipart or message may seem overly restrictive, it is + necessary to prevent nested encodings, in which data are + passed through an encoding algorithm multiple times, and + must be decoded multiple times in order to be properly + viewed. Nested encodings add considerable complexity to + user agents: aside from the obvious efficiency problems + with such multiple encodings, they can obscure the basic + structure of a message. In particular, they can imply that + several decoding operations are necessary simply to find out + what types of objects a message contains. Banning nested + encodings may complicate the job of certain mail gateways, + but this seems less of a problem than the effect of nested + encodings on user agents. + + NOTE ON THE RELATIONSHIP BETWEEN CONTENT-TYPE AND CONTENT- + TRANSFER-ENCODING: It may seem that the Content-Transfer- + Encoding could be inferred from the characteristics of the + Content-Type that is to be encoded, or, at the very least, + that certain Content-Transfer-Encodings could be mandated + for use with specific Content-Types. There are several + reasons why this is not the case. First, given the varying + types of transports used for mail, some encodings may be + appropriate for some Content-Type/transport combinations and + not for others. (For example, in an 8-bit transport, no + encoding would be required for text in certain character + sets, while such encodings are clearly required for 7-bit + SMTP.) Second, certain Content-Types may require different + types of transfer encoding under different circumstances. + For example, many PostScript bodies might consist entirely + of short lines of 7-bit data and hence require little or no + encoding. Other PostScript bodies (especially those using + Level 2 PostScript's binary encoding mechanism) may only be + reasonably represented using a binary transport encoding. + Finally, since Content-Type is intended to be an open-ended + specification mechanism, strict specification of an + association between Content-Types and encodings effectively + couples the specification of an application protocol with a + specific lower-level transport. This is not desirable since + the developers of a Content-Type should not have to be aware + of all the transports in use and what their limitations are. + + NOTE ON TRANSLATING ENCODINGS: The quoted-printable and + base64 encodings are designed so that conversion between + them is possible. The only issue that arises in such a + conversion is the handling of line breaks. When converting + from quoted-printable to base64 a line break must be + converted into a CRLF sequence. Similarly, a CRLF sequence + + + + Borenstein & Freed [Page 13] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + in base64 data should be converted to a quoted-printable + line break, but ONLY when converting text data. + + NOTE ON CANONICAL ENCODING MODEL: There was some + confusion, in earlier drafts of this memo, regarding the + model for when email data was to be converted to canonical + form and encoded, and in particular how this process would + affect the treatment of CRLFs, given that the representation + of newlines varies greatly from system to system. For this + reason, a canonical model for encoding is presented as + Appendix H. + + 5.1 Quoted-Printable Content-Transfer-Encoding + + The Quoted-Printable encoding is intended to represent data + that largely consists of octets that correspond to printable + characters in the ASCII character set. It encodes the data + in such a way that the resulting octets are unlikely to be + modified by mail transport. If the data being encoded are + mostly ASCII text, the encoded form of the data remains + largely recognizable by humans. A body which is entirely + ASCII may also be encoded in Quoted-Printable to ensure the + integrity of the data should the message pass through a + character-translating, and/or line-wrapping gateway. + + In this encoding, octets are to be represented as determined + by the following rules: + + Rule #1: (General 8-bit representation) Any octet, + except those indicating a line break according to the + newline convention of the canonical form of the data + being encoded, may be represented by an "=" followed by + a two digit hexadecimal representation of the octet's + value. The digits of the hexadecimal alphabet, for this + purpose, are "0123456789ABCDEF". Uppercase letters must + be + used when sending hexadecimal data, though a robust + implementation may choose to recognize lowercase + letters on receipt. Thus, for example, the value 12 + (ASCII form feed) can be represented by "=0C", and the + value 61 (ASCII EQUAL SIGN) can be represented by + "=3D". Except when the following rules allow an + alternative encoding, this rule is mandatory. + + Rule #2: (Literal representation) Octets with decimal + values of 33 through 60 inclusive, and 62 through 126, + inclusive, MAY be represented as the ASCII characters + which correspond to those octets (EXCLAMATION POINT + through LESS THAN, and GREATER THAN through TILDE, + respectively). + + Rule #3: (White Space): Octets with values of 9 and 32 + MAY be represented as ASCII TAB (HT) and SPACE + characters, respectively, but MUST NOT be so + + + + Borenstein & Freed [Page 14] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + represented at the end of an encoded line. Any TAB (HT) + or SPACE characters on an encoded line MUST thus be + followed on that line by a printable character. In + particular, an "=" at the end of an encoded line, + indicating a soft line break (see rule #5) may follow + one or more TAB (HT) or SPACE characters. It follows + that an octet with value 9 or 32 appearing at the end + of an encoded line must be represented according to + Rule #1. This rule is necessary because some MTAs + (Message Transport Agents, programs which transport + messages from one user to another, or perform a part of + such transfers) are known to pad lines of text with + SPACEs, and others are known to remove "white space" + characters from the end of a line. Therefore, when + decoding a Quoted-Printable body, any trailing white + space on a line must be deleted, as it will necessarily + have been added by intermediate transport agents. + + Rule #4 (Line Breaks): A line break in a text body + part, independent of what its representation is + following the canonical representation of the data + being encoded, must be represented by a (RFC 822) line + break, which is a CRLF sequence, in the Quoted- + Printable encoding. If isolated CRs and LFs, or LF CR + and CR LF sequences are allowed to appear in binary + data according to the canonical form, they must be + represented using the "=0D", "=0A", "=0A=0D" and + "=0D=0A" notations respectively. + + Note that many implementation may elect to encode the + local representation of various content types directly. + In particular, this may apply to plain text material on + systems that use newline conventions other than CRLF + delimiters. Such an implementation is permissible, but + the generation of line breaks must be generalized to + account for the case where alternate representations of + newline sequences are used. + + Rule #5 (Soft Line Breaks): The Quoted-Printable + encoding REQUIRES that encoded lines be no more than 76 + characters long. If longer lines are to be encoded with + the Quoted-Printable encoding, 'soft' line breaks must + be used. An equal sign as the last character on a + encoded line indicates such a non-significant ('soft') + line break in the encoded text. Thus if the "raw" form + of the line is a single unencoded line that says: + + Now's the time for all folk to come to the aid of + their country. + + This can be represented, in the Quoted-Printable + encoding, as + + + + + + Borenstein & Freed [Page 15] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Now's the time = + for all folk to come= + to the aid of their country. + + This provides a mechanism with which long lines are + encoded in such a way as to be restored by the user + agent. The 76 character limit does not count the + trailing CRLF, but counts all other characters, + including any equal signs. + + Since the hyphen character ("-") is represented as itself in + the Quoted-Printable encoding, care must be taken, when + encapsulating a quoted-printable encoded body in a multipart + entity, to ensure that the encapsulation boundary does not + appear anywhere in the encoded body. (A good strategy is to + choose a boundary that includes a character sequence such as + "=_" which can never appear in a quoted-printable body. See + the definition of multipart messages later in this + document.) + + NOTE: The quoted-printable encoding represents something of + a compromise between readability and reliability in + transport. Bodies encoded with the quoted-printable + encoding will work reliably over most mail gateways, but may + not work perfectly over a few gateways, notably those + involving translation into EBCDIC. (In theory, an EBCDIC + gateway could decode a quoted-printable body and re-encode + it using base64, but such gateways do not yet exist.) A + higher level of confidence is offered by the base64 + Content-Transfer-Encoding. A way to get reasonably reliable + transport through EBCDIC gateways is to also quote the ASCII + characters + + !"#$@[\]^`{|}~ + + according to rule #1. See Appendix B for more information. + + Because quoted-printable data is generally assumed to be + line-oriented, it is to be expected that the breaks between + the lines of quoted printable data may be altered in + transport, in the same manner that plain text mail has + always been altered in Internet mail when passing between + systems with differing newline conventions. If such + alterations are likely to constitute a corruption of the + data, it is probably more sensible to use the base64 + encoding rather than the quoted-printable encoding. + + + + + + + + + + + + Borenstein & Freed [Page 16] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 5.2 Base64 Content-Transfer-Encoding + + The Base64 Content-Transfer-Encoding is designed to + represent arbitrary sequences of octets in a form that is + not humanly readable. The encoding and decoding algorithms + are simple, but the encoded data are consistently only about + 33 percent larger than the unencoded data. This encoding is + based on the one used in Privacy Enhanced Mail applications, + as defined in RFC 1113. The base64 encoding is adapted + from RFC 1113, with one change: base64 eliminates the "*" + mechanism for embedded clear text. + + A 65-character subset of US-ASCII is used, enabling 6 bits + to be represented per printable character. (The extra 65th + character, "=", is used to signify a special processing + function.) + + NOTE: This subset has the important property that it is + represented identically in all versions of ISO 646, + including US ASCII, and all characters in the subset are + also represented identically in all versions of EBCDIC. + Other popular encodings, such as the encoding used by the + UUENCODE utility and the base85 encoding specified as part + of Level 2 PostScript, do not share these properties, and + thus do not fulfill the portability requirements a binary + transport encoding for mail must meet. + + The encoding process represents 24-bit groups of input bits + as output strings of 4 encoded characters. Proceeding from + left to right, a 24-bit input group is formed by + concatenating 3 8-bit input groups. These 24 bits are then + treated as 4 concatenated 6-bit groups, each of which is + translated into a single digit in the base64 alphabet. When + encoding a bit stream via the base64 encoding, the bit + stream must be presumed to be ordered with the most- + significant-bit first. That is, the first bit in the stream + will be the high-order bit in the first byte, and the eighth + bit will be the low-order bit in the first byte, and so on. + + Each 6-bit group is used as an index into an array of 64 + printable characters. The character referenced by the index + is placed in the output string. These characters, identified + in Table 1, below, are selected so as to be universally + representable, and the set excludes characters with + particular significance to SMTP (e.g., ".", "CR", "LF") and + to the encapsulation boundaries defined in this document + (e.g., "-"). + + + + + + + + + + + Borenstein & Freed [Page 17] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value + Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y + + The output stream (encoded bytes) must be represented in + lines of no more than 76 characters each. All line breaks + or other characters not found in Table 1 must be ignored by + decoding software. In base64 data, characters other than + those in Table 1, line breaks, and other white space + probably indicate a transmission error, about which a + warning message or even a message rejection might be + appropriate under some circumstances. + + Special processing is performed if fewer than 24 bits are + available at the end of the data being encoded. A full + encoding quantum is always completed at the end of a body. + When fewer than 24 input bits are available in an input + group, zero bits are added (on the right) to form an + integral number of 6-bit groups. Output character positions + which are not required to represent actual input data are + set to the character "=". Since all base64 input is an + integral number of octets, only the following cases can + arise: (1) the final quantum of encoding input is an + integral multiple of 24 bits; here, the final unit of + encoded output will be an integral multiple of 4 characters + with no "=" padding, (2) the final quantum of encoding input + is exactly 8 bits; here, the final unit of encoded output + will be two characters followed by two "=" padding + characters, or (3) the final quantum of encoding input is + exactly 16 bits; here, the final unit of encoded output will + be three characters followed by one "=" padding character. + + Care must be taken to use the proper octets for line breaks + if base64 encoding is applied directly to text material that + has not been converted to canonical form. In particular, + text line breaks should be converted into CRLF sequences + + + + Borenstein & Freed [Page 18] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + prior to base64 encoding. The important thing to note is + that this may be done directly by the encoder rather than in + a prior canonicalization step in some implementations. + + NOTE: There is no need to worry about quoting apparent + encapsulation boundaries within base64-encoded parts of + multipart entities because no hyphen characters are used in + the base64 encoding. + + 6 Additional Optional Content- Header Fields + + 6.1 Optional Content-ID Header Field + + In constructing a high-level user agent, it may be desirable + to allow one body to make reference to another. + Accordingly, bodies may be labeled using the "Content-ID" + header field, which is syntactically identical to the + "Message-ID" header field: + + Content-ID := msg-id + + Like the Message-ID values, Content-ID values must be + generated to be as unique as possible. + + 6.2 Optional Content-Description Header Field + + The ability to associate some descriptive information with a + given body is often desirable. For example, it may be useful + to mark an "image" body as "a picture of the Space Shuttle + Endeavor." Such text may be placed in the Content- + Description header field. + + Content-Description := *text + + The description is presumed to be given in the US-ASCII + character set, although the mechanism specified in [RFC- + 1342] may be used for non-US-ASCII Content-Description + values. + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 19] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 7 The Predefined Content-Type Values + + This document defines seven initial Content-Type values and + an extension mechanism for private or experimental types. + Further standard types must be defined by new published + specifications. It is expected that most innovation in new + types of mail will take place as subtypes of the seven types + defined here. The most essential characteristics of the + seven content-types are summarized in Appendix G. + + 7.1 The Text Content-Type + + The text Content-Type is intended for sending material which + is principally textual in form. It is the default Content- + Type. A "charset" parameter may be used to indicate the + character set of the body text. The primary subtype of text + is "plain". This indicates plain (unformatted) text. The + default Content-Type for Internet mail is "text/plain; + charset=us-ascii". + + Beyond plain text, there are many formats for representing + what might be known as "extended text" -- text with embedded + formatting and presentation information. An interesting + characteristic of many such representations is that they are + to some extent readable even without the software that + interprets them. It is useful, then, to distinguish them, + at the highest level, from such unreadable data as images, + audio, or text represented in an unreadable form. In the + absence of appropriate interpretation software, it is + reasonable to show subtypes of text to the user, while it is + not reasonable to do so with most nontextual data. + + Such formatted textual data should be represented using + subtypes of text. Plausible subtypes of text are typically + given by the common name of the representation format, e.g., + "text/richtext". + + 7.1.1 The charset parameter + + A critical parameter that may be specified in the Content- + Type field for text data is the character set. This is + specified with a "charset" parameter, as in: + + Content-type: text/plain; charset=us-ascii + + Unlike some other parameter values, the values of the + charset parameter are NOT case sensitive. The default + character set, which must be assumed in the absence of a + charset parameter, is US-ASCII. + + An initial list of predefined character set names can be + found at the end of this section. Additional character sets + may be registered with IANA as described in Appendix F, + although the standardization of their use requires the usual + + + + Borenstein & Freed [Page 20] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + IAB review and approval. Note that if the specified + character set includes 8-bit data, a Content-Transfer- + Encoding header field and a corresponding encoding on the + data are required in order to transmit the body via some + mail transfer protocols, such as SMTP. + + The default character set, US-ASCII, has been the subject of + some confusion and ambiguity in the past. Not only were + there some ambiguities in the definition, there have been + wide variations in practice. In order to eliminate such + ambiguity and variations in the future, it is strongly + recommended that new user agents explicitly specify a + character set via the Content-Type header field. "US-ASCII" + does not indicate an arbitrary seven-bit character code, but + specifies that the body uses character coding that uses the + exact correspondence of codes to characters specified in + ASCII. National use variations of ISO 646 [ISO-646] are NOT + ASCII and their use in Internet mail is explicitly + discouraged. The omission of the ISO 646 character set is + deliberate in this regard. The character set name of "US- + ASCII" explicitly refers to ANSI X3.4-1986 [US-ASCII] only. + The character set name "ASCII" is reserved and must not be + used for any purpose. + + NOTE: RFC 821 explicitly specifies "ASCII", and references + an earlier version of the American Standard. Insofar as one + of the purposes of specifying a Content-Type and character + set is to permit the receiver to unambiguously determine how + the sender intended the coded message to be interpreted, + assuming anything other than "strict ASCII" as the default + would risk unintentional and incompatible changes to the + semantics of messages now being transmitted. This also + implies that messages containing characters coded according + to national variations on ISO 646, or using code-switching + procedures (e.g., those of ISO 2022), as well as 8-bit or + multiple octet character encodings MUST use an appropriate + character set specification to be consistent with this + specification. + + The complete US-ASCII character set is listed in [US-ASCII]. + Note that the control characters including DEL (0-31, 127) + have no defined meaning apart from the combination CRLF + (ASCII values 13 and 10) indicating a new line. Two of the + characters have de facto meanings in wide use: FF (12) often + means "start subsequent text on the beginning of a new + page"; and TAB or HT (9) often (though not always) means + "move the cursor to the next available column after the + current position where the column number is a multiple of 8 + (counting the first column as column 0)." Apart from this, + any use of the control characters or DEL in a body must be + part of a private agreement between the sender and + recipient. Such private agreements are discouraged and + should be replaced by the other capabilities of this + document. + + + + Borenstein & Freed [Page 21] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + NOTE: Beyond US-ASCII, an enormous proliferation of + character sets is possible. It is the opinion of the IETF + working group that a large number of character sets is NOT a + good thing. We would prefer to specify a single character + set that can be used universally for representing all of the + world's languages in electronic mail. Unfortunately, + existing practice in several communities seems to point to + the continued use of multiple character sets in the near + future. For this reason, we define names for a small number + of character sets for which a strong constituent base + exists. It is our hope that ISO 10646 or some other + effort will eventually define a single world character set + which can then be specified for use in Internet mail, but in + the advance of that definition we cannot specify the use of + ISO 10646, Unicode, or any other character set whose + definition is, as of this writing, incomplete. + + The defined charset values are: + + US-ASCII -- as defined in [US-ASCII]. + + ISO-8859-X -- where "X" is to be replaced, as + necessary, for the parts of ISO-8859 [ISO- + 8859]. Note that the ISO 646 character sets + have deliberately been omitted in favor of + their 8859 replacements, which are the + designated character sets for Internet mail. + As of the publication of this document, the + legitimate values for "X" are the digits 1 + through 9. + + Note that the character set used, if anything other than + US-ASCII, must always be explicitly specified in the + Content-Type field. + + No other character set name may be used in Internet mail + without the publication of a formal specification and its + registration with IANA as described in Appendix F, or by + private agreement, in which case the character set name must + begin with "X-". + + Implementors are discouraged from defining new character + sets for mail use unless absolutely necessary. + + The "charset" parameter has been defined primarily for the + purpose of textual data, and is described in this section + for that reason. However, it is conceivable that non- + textual data might also wish to specify a charset value for + some purpose, in which case the same syntax and values + should be used. + + In general, mail-sending software should always use the + "lowest common denominator" character set possible. For + example, if a body contains only US-ASCII characters, it + + + + Borenstein & Freed [Page 22] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + should be marked as being in the US-ASCII character set, not + ISO-8859-1, which, like all the ISO-8859 family of character + sets, is a superset of US-ASCII. More generally, if a + widely-used character set is a subset of another character + set, and a body contains only characters in the widely-used + subset, it should be labeled as being in that subset. This + will increase the chances that the recipient will be able to + view the mail correctly. + + 7.1.2 The Text/plain subtype + + The primary subtype of text is "plain". This indicates + plain (unformatted) text. The default Content-Type for + Internet mail, "text/plain; charset=us-ascii", describes + existing Internet practice, that is, it is the type of body + defined by RFC 822. + + 7.1.3 The Text/richtext subtype + + In order to promote the wider interoperability of simple + formatted text, this document defines an extremely simple + subtype of "text", the "richtext" subtype. This subtype was + designed to meet the following criteria: + + 1. The syntax must be extremely simple to parse, + so that even teletype-oriented mail systems can + easily strip away the formatting information and + leave only the readable text. + + 2. The syntax must be extensible to allow for new + formatting commands that are deemed essential. + + 3. The capabilities must be extremely limited, to + ensure that it can represent no more than is + likely to be representable by the user's primary + word processor. While this limits what can be + sent, it increases the likelihood that what is + sent can be properly displayed. + + 4. The syntax must be compatible with SGML, so + that, with an appropriate DTD (Document Type + Definition, the standard mechanism for defining a + document type using SGML), a general SGML parser + could be made to parse richtext. However, despite + this compatibility, the syntax should be far + simpler than full SGML, so that no SGML knowledge + is required in order to implement it. + + The syntax of "richtext" is very simple. It is assumed, at + the top-level, to be in the US-ASCII character set, unless + of course a different charset parameter was specified in the + Content-type field. All characters represent themselves, + with the exception of the "<" character (ASCII 60), which is + used to mark the beginning of a formatting command. + + + + Borenstein & Freed [Page 23] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Formatting instructions consist of formatting commands + surrounded by angle brackets ("<>", ASCII 60 and 62). Each + formatting command may be no more than 40 characters in + length, all in US-ASCII, restricted to the alphanumeric and + hyphen ("-") characters. Formatting commands may be preceded + by a forward slash or solidus ("/", ASCII 47), making them + negations, and such negations must always exist to balance + the initial opening commands, except as noted below. Thus, + if the formatting command "" appears at some point, + there must later be a "" to balance it. There are + only three exceptions to this "balancing" rule: First, the + command "" is used to represent a literal "<" character. + Second, the command "" is used to represent a required + line break. (Otherwise, CRLFs in the data are treated as + equivalent to a single SPACE character.) Finally, the + command "" is used to represent a page break. (NOTE: + The 40 character limit on formatting commands does not + include the "<", ">", or "/" characters that might be + attached to such commands.) + + Initially defined formatting commands, not all of which will + be implemented by all richtext implementations, include: + + Bold -- causes the subsequent text to be in a bold + font. + Italic -- causes the subsequent text to be in an italic + font. + Fixed -- causes the subsequent text to be in a fixed + width font. + Smaller -- causes the subsequent text to be in a + smaller font. + Bigger -- causes the subsequent text to be in a bigger + font. + Underline -- causes the subsequent text to be + underlined. + Center -- causes the subsequent text to be centered. + FlushLeft -- causes the subsequent text to be left + justified. + FlushRight -- causes the subsequent text to be right + justified. + Indent -- causes the subsequent text to be indented at + the left margin. + IndentRight -- causes the subsequent text to be + indented at the right margin. + Outdent -- causes the subsequent text to be outdented + at the left margin. + OutdentRight -- causes the subsequent text to be + outdented at the right margin. + SamePage -- causes the subsequent text to be grouped, + if possible, on one page. + Subscript -- causes the subsequent text to be + interpreted as a subscript. + + + + + + Borenstein & Freed [Page 24] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Superscript -- causes the subsequent text to be + interpreted as a superscript. + Heading -- causes the subsequent text to be interpreted + as a page heading. + Footing -- causes the subsequent text to be interpreted + as a page footing. + ISO-8859-X (for any value of X that is legal as a + "charset" parameter) -- causes the subsequent text + to be interpreted as text in the appropriate + character set. + US-ASCII -- causes the subsequent text to be + interpreted as text in the US-ASCII character set. + Excerpt -- causes the subsequent text to be interpreted + as a textual excerpt from another source. + Typically this will be displayed using indentation + and an alternate font, but such decisions are up + to the viewer. + Paragraph -- causes the subsequent text to be + interpreted as a single paragraph, with + appropriate paragraph breaks (typically blank + space) before and after. + Signature -- causes the subsequent text to be + interpreted as a "signature". Some systems may + wish to display signatures in a smaller font or + otherwise set them apart from the main text of the + message. + Comment -- causes the subsequent text to be interpreted + as a comment, and hence not shown to the reader. + No-op -- has no effect on the subsequent text. + lt -- is replaced by a literal "<" character. No + balancing is allowed. + nl -- causes a line break. No balancing is + allowed. + np -- causes a page break. No balancing is + allowed. + + Each positive formatting command affects all subsequent text + until the matching negative formatting command. Such pairs + of formatting commands must be properly balanced and nested. + Thus, a proper way to describe text in bold italics is: + + the-text + + or, alternately, + + the-text + + but, in particular, the following is illegal + richtext: + + the-text + + NOTE: The nesting requirement for formatting commands + imposes a slightly higher burden upon the composers of + + + + Borenstein & Freed [Page 25] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + richtext bodies, but potentially simplifies richtext + displayers by allowing them to be stack-based. The main + goal of richtext is to be simple enough to make multifont, + formatted email widely readable, so that those with the + capability of sending it will be able to do so with + confidence. Thus slightly increased complexity in the + composing software was deemed a reasonable tradeoff for + simplified reading software. Nonetheless, implementors of + richtext readers are encouraged to follow the general + Internet guidelines of being conservative in what you send + and liberal in what you accept. Those implementations that + can do so are encouraged to deal reasonably with improperly + nested richtext. + + Implementations must regard any unrecognized formatting + command as equivalent to "No-op", thus facilitating future + extensions to "richtext". Private extensions may be defined + using formatting commands that begin with "X-", by analogy + to Internet mail header field names. + + It is worth noting that no special behavior is required for + the TAB (HT) character. It is recommended, however, that, at + least when fixed-width fonts are in use, the common + semantics of the TAB (HT) character should be observed, + namely that it moves to the next column position that is a + multiple of 8. (In other words, if a TAB (HT) occurs in + column n, where the leftmost column is column 0, then that + TAB (HT) should be replaced by 8-(n mod 8) SPACE + characters.) + + Richtext also differentiates between "hard" and "soft" line + breaks. A line break (CRLF) in the richtext data stream is + interpreted as a "soft" line break, one that is included + only for purposes of mail transport, and is to be treated as + white space by richtext interpreters. To include a "hard" + line break (one that must be displayed as such), the "" + or " formatting constructs should be used. In + general, a soft line break should be treated as white space, + but when soft line breaks immediately follow a or a + tag they should be ignored rather than treated + as white space. + + Putting all this together, the following "text/richtext" + body fragment: + + Now is the time for + all good men + (and women>) to + come + + to the aid of their + + + + + + + Borenstein & Freed [Page 26] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + beloved country. Stupid + quote! -- the end + + represents the following formatted text (which will, no + doubt, look cryptic in the text-only version of this + document): + + Now is the time for all good men (and ) to + come to the aid of their + beloved + + country. -- the end + + Richtext conformance: A minimal richtext implementation is + one that simply converts "" to "<", converts CRLFs to + SPACE, converts to a newline according to local newline + convention, removes everything between a command + and the next balancing command, and removes all + other formatting commands (all text enclosed in angle + brackets). + + NOTE ON THE RELATIONSHIP OF RICHTEXT TO SGML: Richtext is + decidedly not SGML, and must not be used to transport + arbitrary SGML documents. Those who wish to use SGML + document types as a mail transport format must define a new + text or application subtype, e.g., "text/sgml-dtd-whatever" + or "application/sgml-dtd-whatever", depending on the + perceived readability of the DTD in use. Richtext is + designed to be compatible with SGML, and specifically so + that it will be possible to define a richtext DTD if one is + needed. However, this does not imply that arbitrary SGML + can be called richtext, nor that richtext implementors have + any need to understand SGML; the description in this + document is a complete definition of richtext, which is far + simpler than complete SGML. + + NOTE ON THE INTENDED USE OF RICHTEXT: It is recognized that + implementors of future mail systems will want rich text + functionality far beyond that currently defined for + richtext. The intent of richtext is to provide a common + format for expressing that functionality in a form in which + much of it, at least, will be understood by interoperating + software. Thus, in particular, software with a richer + notion of formatted text than richtext can still use + richtext as its basic representation, but can extend it with + new formatting commands and by hiding information specific + to that software system in richtext comments. As such + systems evolve, it is expected that the definition of + richtext will be further refined by future published + specifications, but richtext as defined here provides a + platform on which evolutionary refinements can be based. + + IMPLEMENTATION NOTE: In some environments, it might be + impossible to combine certain richtext formatting commands, + + + + Borenstein & Freed [Page 27] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + whereas in others they might be combined easily. For + example, the combination of and might + produce bold italics on systems that support such fonts, but + there exist systems that can make text bold or italicized, + but not both. In such cases, the most recently issued + recognized formatting command should be preferred. + + One of the major goals in the design of richtext was to make + it so simple that even text-only mailers will implement + richtext-to-plain-text translators, thus increasing the + likelihood that multifont text will become "safe" to use + very widely. To demonstrate this simplicity, an extremely + simple 35-line C program that converts richtext input into + plain text output is included in Appendix D. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 28] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 7.2 The Multipart Content-Type + + In the case of multiple part messages, in which one or more + different sets of data are combined in a single body, a + "multipart" Content-Type field must appear in the entity's + header. The body must then contain one or more "body parts," + each preceded by an encapsulation boundary, and the last one + followed by a closing boundary. Each part starts with an + encapsulation boundary, and then contains a body part + consisting of header area, a blank line, and a body area. + Thus a body part is similar to an RFC 822 message in syntax, + but different in meaning. + + A body part is NOT to be interpreted as actually being an + RFC 822 message. To begin with, NO header fields are + actually required in body parts. A body part that starts + with a blank line, therefore, is allowed and is a body part + for which all default values are to be assumed. In such a + case, the absence of a Content-Type header field implies + that the encapsulation is plain US-ASCII text. The only + header fields that have defined meaning for body parts are + those the names of which begin with "Content-". All other + header fields are generally to be ignored in body parts. + Although they should generally be retained in mail + processing, they may be discarded by gateways if necessary. + Such other fields are permitted to appear in body parts but + should not be depended on. "X-" fields may be created for + experimental or private purposes, with the recognition that + the information they contain may be lost at some gateways. + + The distinction between an RFC 822 message and a body part + is subtle, but important. A gateway between Internet and + X.400 mail, for example, must be able to tell the difference + between a body part that contains an image and a body part + that contains an encapsulated message, the body of which is + an image. In order to represent the latter, the body part + must have "Content-Type: message", and its body (after the + blank line) must be the encapsulated message, with its own + "Content-Type: image" header field. The use of similar + syntax facilitates the conversion of messages to body parts, + and vice versa, but the distinction between the two must be + understood by implementors. (For the special case in which + all parts actually are messages, a "digest" subtype is also + defined.) + + As stated previously, each body part is preceded by an + encapsulation boundary. The encapsulation boundary MUST NOT + appear inside any of the encapsulated parts. Thus, it is + crucial that the composing agent be able to choose and + specify the unique boundary that will separate the parts. + + All present and future subtypes of the "multipart" type must + use an identical syntax. Subtypes may differ in their + semantics, and may impose additional restrictions on syntax, + + + + Borenstein & Freed [Page 29] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + but must conform to the required syntax for the multipart + type. This requirement ensures that all conformant user + agents will at least be able to recognize and separate the + parts of any multipart entity, even of an unrecognized + subtype. + + As stated in the definition of the Content-Transfer-Encoding + field, no encoding other than "7bit", "8bit", or "binary" is + permitted for entities of type "multipart". The multipart + delimiters and header fields are always 7-bit ASCII in any + case, and data within the body parts can be encoded on a + part-by-part basis, with Content-Transfer-Encoding fields + for each appropriate body part. + + Mail gateways, relays, and other mail handling agents are + commonly known to alter the top-level header of an RFC 822 + message. In particular, they frequently add, remove, or + reorder header fields. Such alterations are explicitly + forbidden for the body part headers embedded in the bodies + of messages of type "multipart." + + 7.2.1 Multipart: The common syntax + + All subtypes of "multipart" share a common syntax, defined + in this section. A simple example of a multipart message + also appears in this section. An example of a more complex + multipart message is given in Appendix C. + + The Content-Type field for multipart entities requires one + parameter, "boundary", which is used to specify the + encapsulation boundary. The encapsulation boundary is + defined as a line consisting entirely of two hyphen + characters ("-", decimal code 45) followed by the boundary + parameter value from the Content-Type header field. + + NOTE: The hyphens are for rough compatibility with the + earlier RFC 934 method of message encapsulation, and for + ease of searching for the boundaries in some + implementations. However, it should be noted that multipart + messages are NOT completely compatible with RFC 934 + encapsulations; in particular, they do not obey RFC 934 + quoting conventions for embedded lines that begin with + hyphens. This mechanism was chosen over the RFC 934 + mechanism because the latter causes lines to grow with each + level of quoting. The combination of this growth with the + fact that SMTP implementations sometimes wrap long lines + made the RFC 934 mechanism unsuitable for use in the event + that deeply-nested multipart structuring is ever desired. + + Thus, a typical multipart Content-Type header field might + look like this: + + Content-Type: multipart/mixed; + + + + + Borenstein & Freed [Page 30] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + boundary=gc0p4Jq0M2Yt08jU534c0p + + This indicates that the entity consists of several parts, + each itself with a structure that is syntactically identical + to an RFC 822 message, except that the header area might be + completely empty, and that the parts are each preceded by + the line + + --gc0p4Jq0M2Yt08jU534c0p + + Note that the encapsulation boundary must occur at the + beginning of a line, i.e., following a CRLF, and that that + initial CRLF is considered to be part of the encapsulation + boundary rather than part of the preceding part. The + boundary must be followed immediately either by another CRLF + and the header fields for the next part, or by two CRLFs, in + which case there are no header fields for the next part (and + it is therefore assumed to be of Content-Type text/plain). + + NOTE: The CRLF preceding the encapsulation line is + considered part of the boundary so that it is possible to + have a part that does not end with a CRLF (line break). + Body parts that must be considered to end with line breaks, + therefore, should have two CRLFs preceding the encapsulation + line, the first of which is part of the preceding body part, + and the second of which is part of the encapsulation + boundary. + + The requirement that the encapsulation boundary begins with + a CRLF implies that the body of a multipart entity must + itself begin with a CRLF before the first encapsulation line + -- that is, if the "preamble" area is not used, the entity + headers must be followed by TWO CRLFs. This is indeed how + such entities should be composed. A tolerant mail reading + program, however, may interpret a body of type multipart + that begins with an encapsulation line NOT initiated by a + CRLF as also being an encapsulation boundary, but a + compliant mail sending program must not generate such + entities. + + Encapsulation boundaries must not appear within the + encapsulations, and must be no longer than 70 characters, + not counting the two leading hyphens. + + The encapsulation boundary following the last body part is a + distinguished delimiter that indicates that no further body + parts will follow. Such a delimiter is identical to the + previous delimiters, with the addition of two more hyphens + at the end of the line: + + --gc0p4Jq0M2Yt08jU534c0p-- + + There appears to be room for additional information prior to + the first encapsulation boundary and following the final + + + + Borenstein & Freed [Page 31] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + boundary. These areas should generally be left blank, and + implementations should ignore anything that appears before + the first boundary or after the last one. + + NOTE: These "preamble" and "epilogue" areas are not used + because of the lack of proper typing of these parts and the + lack of clear semantics for handling these areas at + gateways, particularly X.400 gateways. + + NOTE: Because encapsulation boundaries must not appear in + the body parts being encapsulated, a user agent must + exercise care to choose a unique boundary. The boundary in + the example above could have been the result of an algorithm + designed to produce boundaries with a very low probability + of already existing in the data to be encapsulated without + having to prescan the data. Alternate algorithms might + result in more 'readable' boundaries for a recipient with an + old user agent, but would require more attention to the + possibility that the boundary might appear in the + encapsulated part. The simplest boundary possible is + something like "---", with a closing boundary of "-----". + + As a very simple example, the following multipart message + has two parts, both of them plain text, one of them + explicitly typed and one of them implicitly typed: + + From: Nathaniel Borenstein + To: Ned Freed + Subject: Sample message + MIME-Version: 1.0 + Content-type: multipart/mixed; boundary="simple + boundary" + + This is the preamble. It is to be ignored, though it + is a handy place for mail composers to include an + explanatory note to non-MIME compliant readers. + --simple boundary + + This is implicitly typed plain ASCII text. + It does NOT end with a linebreak. + --simple boundary + Content-type: text/plain; charset=us-ascii + + This is explicitly typed plain ASCII text. + It DOES end with a linebreak. + + --simple boundary-- + This is the epilogue. It is also to be ignored. + + The use of a Content-Type of multipart in a body part within + another multipart entity is explicitly allowed. In such + cases, for obvious reasons, care must be taken to ensure + that each nested multipart entity must use a different + boundary delimiter. See Appendix C for an example of nested + + + + Borenstein & Freed [Page 32] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + multipart entities. + + The use of the multipart Content-Type with only a single + body part may be useful in certain contexts, and is + explicitly permitted. + + The only mandatory parameter for the multipart Content-Type + is the boundary parameter, which consists of 1 to 70 + characters from a set of characters known to be very robust + through email gateways, and NOT ending with white space. + (If a boundary appears to end with white space, the white + space must be presumed to have been added by a gateway, and + should be deleted.) It is formally specified by the + following BNF: + + boundary := 0*69 bcharsnospace + + bchars := bcharsnospace / " " + + bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / "+" / + "_" + / "," / "-" / "." / "/" / ":" / "=" / "?" + + Overall, the body of a multipart entity may be specified as + follows: + + multipart-body := preamble 1*encapsulation + close-delimiter epilogue + + encapsulation := delimiter CRLF body-part + + delimiter := CRLF "--" boundary ; taken from Content-Type + field. + ; when content-type is + multipart + ; There must be no space + ; between "--" and boundary. + + close-delimiter := delimiter "--" ; Again, no space before + "--" + + preamble := *text ; to be ignored upon + receipt. + + epilogue := *text ; to be ignored upon + receipt. + + body-part = <"message" as defined in RFC 822, + with all header fields optional, and with the + specified delimiter not occurring anywhere in + the message body, either on a line by itself + or as a substring anywhere. Note that the + + + + + + Borenstein & Freed [Page 33] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + semantics of a part differ from the semantics + of a message, as described in the text.> + + NOTE: Conspicuously missing from the multipart type is a + notion of structured, related body parts. In general, it + seems premature to try to standardize interpart structure + yet. It is recommended that those wishing to provide a more + structured or integrated multipart messaging facility should + define a subtype of multipart that is syntactically + identical, but that always expects the inclusion of a + distinguished part that can be used to specify the structure + and integration of the other parts, probably referring to + them by their Content-ID field. If this approach is used, + other implementations will not recognize the new subtype, + but will treat it as the primary subtype (multipart/mixed) + and will thus be able to show the user the parts that are + recognized. + + 7.2.2 The Multipart/mixed (primary) subtype + + The primary subtype for multipart, "mixed", is intended for + use when the body parts are independent and intended to be + displayed serially. Any multipart subtypes that an + implementation does not recognize should be treated as being + of subtype "mixed". + + 7.2.3 The Multipart/alternative subtype + + The multipart/alternative type is syntactically identical to + multipart/mixed, but the semantics are different. In + particular, each of the parts is an "alternative" version of + the same information. User agents should recognize that the + content of the various parts are interchangeable. The user + agent should either choose the "best" type based on the + user's environment and preferences, or offer the user the + available alternatives. In general, choosing the best type + means displaying only the LAST part that can be displayed. + This may be used, for example, to send mail in a fancy text + format in such a way that it can easily be displayed + anywhere: + + From: Nathaniel Borenstein + To: Ned Freed + Subject: Formatted text mail + MIME-Version: 1.0 + Content-Type: multipart/alternative; boundary=boundary42 + + + --boundary42 + Content-Type: text/plain; charset=us-ascii + + ...plain text version of message goes here.... + + + + + + Borenstein & Freed [Page 34] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + --boundary42 + Content-Type: text/richtext + + .... richtext version of same message goes here ... + --boundary42 + Content-Type: text/x-whatever + + .... fanciest formatted version of same message goes here + ... + --boundary42-- + + In this example, users whose mail system understood the + "text/x-whatever" format would see only the fancy version, + while other users would see only the richtext or plain text + version, depending on the capabilities of their system. + + In general, user agents that compose multipart/alternative + entities should place the body parts in increasing order of + preference, that is, with the preferred format last. For + fancy text, the sending user agent should put the plainest + format first and the richest format last. Receiving user + agents should pick and display the last format they are + capable of displaying. In the case where one of the + alternatives is itself of type "multipart" and contains + unrecognized sub-parts, the user agent may choose either to + show that alternative, an earlier alternative, or both. + + NOTE: From an implementor's perspective, it might seem more + sensible to reverse this ordering, and have the plainest + alternative last. However, placing the plainest alternative + first is the friendliest possible option when + mutlipart/alternative entities are viewed using a non-MIME- + compliant mail reader. While this approach does impose some + burden on compliant mail readers, interoperability with + older mail readers was deemed to be more important in this + case. + + It may be the case that some user agents, if they can + recognize more than one of the formats, will prefer to offer + the user the choice of which format to view. This makes + sense, for example, if mail includes both a nicely-formatted + image version and an easily-edited text version. What is + most critical, however, is that the user not automatically + be shown multiple versions of the same data. Either the + user should be shown the last recognized version or should + explicitly be given the choice. + + + + + + + + + + + + Borenstein & Freed [Page 35] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 7.2.4 The Multipart/digest subtype + + This document defines a "digest" subtype of the multipart + Content-Type. This type is syntactically identical to + multipart/mixed, but the semantics are different. In + particular, in a digest, the default Content-Type value for + a body part is changed from "text/plain" to + "message/rfc822". This is done to allow a more readable + digest format that is largely compatible (except for the + quoting convention) with RFC 934. + + A digest in this format might, then, look something like + this: + + From: Moderator-Address + MIME-Version: 1.0 + Subject: Internet Digest, volume 42 + Content-Type: multipart/digest; + boundary="---- next message ----" + + + ------ next message ---- + + From: someone-else + Subject: my opinion + + ...body goes here ... + + ------ next message ---- + + From: someone-else-again + Subject: my different opinion + + ... another body goes here... + + ------ next message ------ + + 7.2.5 The Multipart/parallel subtype + + This document defines a "parallel" subtype of the multipart + Content-Type. This type is syntactically identical to + multipart/mixed, but the semantics are different. In + particular, in a parallel entity, all of the parts are + intended to be presented in parallel, i.e., simultaneously, + on hardware and software that are capable of doing so. + Composing agents should be aware that many mail readers will + lack this capability and will show the parts serially in any + event. + + + + + + + + + + Borenstein & Freed [Page 36] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 7.3 The Message Content-Type + + It is frequently desirable, in sending mail, to encapsulate + another mail message. For this common operation, a special + Content-Type, "message", is defined. The primary subtype, + message/rfc822, has no required parameters in the Content- + Type field. Additional subtypes, "partial" and "External- + body", do have required parameters. These subtypes are + explained below. + + NOTE: It has been suggested that subtypes of message might + be defined for forwarded or rejected messages. However, + forwarded and rejected messages can be handled as multipart + messages in which the first part contains any control or + descriptive information, and a second part, of type + message/rfc822, is the forwarded or rejected message. + Composing rejection and forwarding messages in this manner + will preserve the type information on the original message + and allow it to be correctly presented to the recipient, and + hence is strongly encouraged. + + As stated in the definition of the Content-Transfer-Encoding + field, no encoding other than "7bit", "8bit", or "binary" is + permitted for messages or parts of type "message". The + message header fields are always US-ASCII in any case, and + data within the body can still be encoded, in which case the + Content-Transfer-Encoding header field in the encapsulated + message will reflect this. Non-ASCII text in the headers of + an encapsulated message can be specified using the + mechanisms described in [RFC-1342]. + + Mail gateways, relays, and other mail handling agents are + commonly known to alter the top-level header of an RFC 822 + message. In particular, they frequently add, remove, or + reorder header fields. Such alterations are explicitly + forbidden for the encapsulated headers embedded in the + bodies of messages of type "message." + + 7.3.1 The Message/rfc822 (primary) subtype + + A Content-Type of "message/rfc822" indicates that the body + contains an encapsulated message, with the syntax of an RFC + 822 message. + + 7.3.2 The Message/Partial subtype + + A subtype of message, "partial", is defined in order to + allow large objects to be delivered as several separate + pieces of mail and automatically reassembled by the + receiving user agent. (The concept is similar to IP + fragmentation/reassembly in the basic Internet Protocols.) + This mechanism can be used when intermediate transport + agents limit the size of individual messages that can be + sent. Content-Type "message/partial" thus indicates that + + + + Borenstein & Freed [Page 37] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + the body contains a fragment of a larger message. + + Three parameters must be specified in the Content-Type field + of type message/partial: The first, "id", is a unique + identifier, as close to a world-unique identifier as + possible, to be used to match the parts together. (In + general, the identifier is essentially a message-id; if + placed in double quotes, it can be any message-id, in + accordance with the BNF for "parameter" given earlier in + this specification.) The second, "number", an integer, is + the part number, which indicates where this part fits into + the sequence of fragments. The third, "total", another + integer, is the total number of parts. This third subfield + is required on the final part, and is optional on the + earlier parts. Note also that these parameters may be given + in any order. + + Thus, part 2 of a 3-part message may have either of the + following header fields: + + Content-Type: Message/Partial; + number=2; total=3; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com"; + + Content-Type: Message/Partial; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com"; + number=2 + + But part 3 MUST specify the total number of parts: + + Content-Type: Message/Partial; + number=3; total=3; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com"; + + Note that part numbering begins with 1, not 0. + + When the parts of a message broken up in this manner are put + together, the result is a complete RFC 822 format message, + which may have its own Content-Type header field, and thus + may contain any other data type. + + Message fragmentation and reassembly: The semantics of a + reassembled partial message must be those of the "inner" + message, rather than of a message containing the inner + message. This makes it possible, for example, to send a + large audio message as several partial messages, and still + have it appear to the recipient as a simple audio message + rather than as an encapsulated message containing an audio + message. That is, the encapsulation of the message is + considered to be "transparent". + + When generating and reassembling the parts of a + message/partial message, the headers of the encapsulated + message must be merged with the headers of the enclosing + + + + Borenstein & Freed [Page 38] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + entities. In this process the following rules must be + observed: + + (1) All of the headers from the initial enclosing + entity (part one), except those that start with + "Content-" and "Message-ID", must be copied, in + order, to the new message. + + (2) Only those headers in the enclosed message + which start with "Content-" and "Message-ID" must + be appended, in order, to the headers of the new + message. Any headers in the enclosed message + which do not start with "Content-" (except for + "Message-ID") will be ignored. + + (3) All of the headers from the second and any + subsequent messages will be ignored. + + For example, if an audio message is broken into two parts, + the first part might look something like this: + + X-Weird-Header-1: Foo + From: Bill@host.com + To: joe@otherhost.com + Subject: Audio mail + Message-ID: id1@host.com + MIME-Version: 1.0 + Content-type: message/partial; + id="ABC@host.com"; + number=1; total=2 + + X-Weird-Header-1: Bar + X-Weird-Header-2: Hello + Message-ID: anotherid@foo.com + Content-type: audio/basic + Content-transfer-encoding: base64 + + ... first half of encoded audio data goes here... + + and the second half might look something like this: + + From: Bill@host.com + To: joe@otherhost.com + Subject: Audio mail + MIME-Version: 1.0 + Message-ID: id2@host.com + Content-type: message/partial; + id="ABC@host.com"; number=2; total=2 + + ... second half of encoded audio data goes here... + + Then, when the fragmented message is reassembled, the + resulting message to be displayed to the user should look + something like this: + + + + Borenstein & Freed [Page 39] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + X-Weird-Header-1: Foo + From: Bill@host.com + To: joe@otherhost.com + Subject: Audio mail + Message-ID: anotherid@foo.com + MIME-Version: 1.0 + Content-type: audio/basic + Content-transfer-encoding: base64 + + ... first half of encoded audio data goes here... + ... second half of encoded audio data goes here... + + It should be noted that, because some message transfer + agents may choose to automatically fragment large messages, + and because such agents may use different fragmentation + thresholds, it is possible that the pieces of a partial + message, upon reassembly, may prove themselves to comprise a + partial message. This is explicitly permitted. + + It should also be noted that the inclusion of a "References" + field in the headers of the second and subsequent pieces of + a fragmented message that references the Message-Id on the + previous piece may be of benefit to mail readers that + understand and track references. However, the generation of + such "References" fields is entirely optional. + + 7.3.3 The Message/External-Body subtype + + The external-body subtype indicates that the actual body + data are not included, but merely referenced. In this case, + the parameters describe a mechanism for accessing the + external data. + + When a message body or body part is of type + "message/external-body", it consists of a header, two + consecutive CRLFs, and the message header for the + encapsulated message. If another pair of consecutive CRLFs + appears, this of course ends the message header for the + encapsulated message. However, since the encapsulated + message's body is itself external, it does NOT appear in the + area that follows. For example, consider the following + message: + + Content-type: message/external-body; access- + type=local-file; + name=/u/nsb/Me.gif + + Content-type: image/gif + + THIS IS NOT REALLY THE BODY! + + The area at the end, which might be called the "phantom + body", is ignored for most external-body messages. However, + it may be used to contain auxilliary information for some + + + + Borenstein & Freed [Page 40] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + such messages, as indeed it is when the access-type is + "mail-server". Of the access-types defined by this + document, the phantom body is used only when the access-type + is "mail-server". In all other cases, the phantom body is + ignored. + + The only always-mandatory parameter for message/external- + body is "access-type"; all of the other parameters may be + mandatory or optional depending on the value of access-type. + + ACCESS-TYPE -- One or more case-insensitive words, + comma-separated, indicating supported access + mechanisms by which the file or data may be + obtained. Values include, but are not limited to, + "FTP", "ANON-FTP", "TFTP", "AFS", "LOCAL-FILE", + and "MAIL-SERVER". Future values, except for + experimental values beginning with "X-", must be + registered with IANA, as described in Appendix F . + + In addition, the following two parameters are optional for + ALL access-types: + + EXPIRATION -- The date (in the RFC 822 "date-time" + syntax, as extended by RFC 1123 to permit 4 digits + in the date field) after which the existence of + the external data is not guaranteed. + + SIZE -- The size (in octets) of the data. The + intent of this parameter is to help the recipient + decide whether or not to expend the necessary + resources to retrieve the external data. + + PERMISSION -- A field that indicates whether or + not it is expected that clients might also attempt + to overwrite the data. By default, or if + permission is "read", the assumption is that they + are not, and that if the data is retrieved once, + it is never needed again. If PERMISSION is "read- + write", this assumption is invalid, and any local + copy must be considered no more than a cache. + "Read" and "Read-write" are the only defined + values of permission. + + The precise semantics of the access-types defined here are + described in the sections that follow. + + 7.3.3.1 The "ftp" and "tftp" access-types + + An access-type of FTP or TFTP indicates that the message + body is accessible as a file using the FTP [RFC-959] or TFTP + [RFC-783] protocols, respectively. For these access-types, + the following additional parameters are mandatory: + + + + + + Borenstein & Freed [Page 41] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + NAME -- The name of the file that contains the + actual body data. + + SITE -- A machine from which the file may be + obtained, using the given protocol + + Before the data is retrieved, using these protocols, the + user will generally need to be asked to provide a login id + and a password for the machine named by the site parameter. + + In addition, the following optional parameters may also + appear when the access-type is FTP or ANON-FTP: + + DIRECTORY -- A directory from which the data named + by NAME should be retrieved. + + MODE -- A transfer mode for retrieving the + information, e.g. "image". + + 7.3.3.2 The "anon-ftp" access-type + + The "anon-ftp" access-type is identical to the "ftp" access + type, except that the user need not be asked to provide a + name and password for the specified site. Instead, the ftp + protocol will be used with login "anonymous" and a password + that corresponds to the user's email address. + + 7.3.3.3 The "local-file" and "afs" access-types + + An access-type of "local-file" indicates that the actual + body is accessible as a file on the local machine. An + access-type of "afs" indicates that the file is accessible + via the global AFS file system. In both cases, only a + single parameter is required: + + NAME -- The name of the file that contains the + actual body data. + + The following optional parameter may be used to describe the + locality of reference for the data, that is, the site or + sites at which the file is expected to be visible: + + SITE -- A domain specifier for a machine or set of + machines that are known to have access to the data + file. Asterisks may be used for wildcard matching + to a part of a domain name, such as + "*.bellcore.com", to indicate a set of machines on + which the data should be directly visible, while a + single asterisk may be used to indicate a file + that is expected to be universally available, + e.g., via a global file system. + + 7.3.3.4 The "mail-server" access-type + + + + + Borenstein & Freed [Page 42] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + The "mail-server" access-type indicates that the actual body + is available from a mail server. The mandatory parameter + for this access-type is: + + SERVER -- The email address of the mail server + from which the actual body data can be obtained. + + Because mail servers accept a variety of syntax, some of + which is multiline, the full command to be sent to a mail + server is not included as a parameter on the content-type + line. Instead, it may be provided as the "phantom body" + when the content-type is message/external-body and the + access-type is mail-server. + + Note that MIME does not define a mail server syntax. + Rather, it allows the inclusion of arbitrary mail server + commands in the phantom body. Implementations should + include the phantom body in the body of the message it sends + to the mail server address to retrieve the relevant data. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 43] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 7.3.3.5 Examples and Further Explanations + + With the emerging possibility of very wide-area file + systems, it becomes very hard to know in advance the set of + machines where a file will and will not be accessible + directly from the file system. Therefore it may make sense + to provide both a file name, to be tried directly, and the + name of one or more sites from which the file is known to be + accessible. An implementation can try to retrieve remote + files using FTP or any other protocol, using anonymous file + retrieval or prompting the user for the necessary name and + password. If an external body is accessible via multiple + mechanisms, the sender may include multiple parts of type + message/external-body within an entity of type + multipart/alternative. + + However, the external-body mechanism is not intended to be + limited to file retrieval, as shown by the mail-server + access-type. Beyond this, one can imagine, for example, + using a video server for external references to video clips. + + If an entity is of type "message/external-body", then the + body of the entity will contain the header fields of the + encapsulated message. The body itself is to be found in the + external location. This means that if the body of the + "message/external-body" message contains two consecutive + CRLFs, everything after those pairs is NOT part of the + message itself. For most message/external-body messages, + this trailing area must simply be ignored. However, it is a + convenient place for additional data that cannot be included + in the content-type header field. In particular, if the + "access-type" value is "mail-server", then the trailing area + must contain commands to be sent to the mail server at the + address given by NAME@SITE, where NAME and SITE are the + values of the NAME and SITE parameters, respectively. + + The embedded message header fields which appear in the body + of the message/external-body data can be used to declare the + Content-type of the external body. Thus a complete + message/external-body message, referring to a document in + PostScript format, might look like this: + + From: Whomever + Subject: whatever + MIME-Version: 1.0 + Message-ID: id1@host.com + Content-Type: multipart/alternative; boundary=42 + + + --42 + Content-Type: message/external-body; + name="BodyFormats.ps"; + + + + + + Borenstein & Freed [Page 44] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + site="thumper.bellcore.com"; + access-type=ANON-FTP; + directory="pub"; + mode="image"; + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + + --42 + Content-Type: message/external-body; + name="/u/nsb/writing/rfcs/RFC-XXXX.ps"; + site="thumper.bellcore.com"; + access-type=AFS + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + + --42 + Content-Type: message/external-body; + access-type=mail-server + server="listserv@bogus.bitnet"; + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + + get rfc-xxxx doc + + --42-- + + Like the message/partial type, the message/external-body + type is intended to be transparent, that is, to convey the + data type in the external body rather than to convey a + message with a body of that type. Thus the headers on the + outer and inner parts must be merged using the same rules as + for message/partial. In particular, this means that the + Content-type header is overridden, but the From and Subject + headers are preserved. + + Note that since the external bodies are not transported as + mail, they need not conform to the 7-bit and line length + requirements, but might in fact be binary files. Thus a + Content-Transfer-Encoding is not generally necessary, though + it is permitted. + + Note that the body of a message of type "message/external- + body" is governed by the basic syntax for an RFC 822 + message. In particular, anything before the first + consecutive pair of CRLFs is header information, while + anything after it is body information, which is ignored for + most access-types. + + + + + + + + Borenstein & Freed [Page 45] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 7.4 The Application Content-Type + + The "application" Content-Type is to be used for data which + do not fit in any of the other categories, and particularly + for data to be processed by mail-based uses of application + programs. This is information which must be processed by an + application before it is viewable or usable to a user. + Expected uses for Content-Type application include mail- + based file transfer, spreadsheets, data for mail-based + scheduling systems, and languages for "active" + (computational) email. (The latter, in particular, can pose + security problems which should be understood by + implementors, and are considered in detail in the discussion + of the application/PostScript content-type.) + + For example, a meeting scheduler might define a standard + representation for information about proposed meeting dates. + An intelligent user agent would use this information to + conduct a dialog with the user, and might then send further + mail based on that dialog. More generally, there have been + several "active" messaging languages developed in which + programs in a suitably specialized language are sent through + the mail and automatically run in the recipient's + environment. + + Such applications may be defined as subtypes of the + "application" Content-Type. This document defines three + subtypes: octet-stream, ODA, and PostScript. + + In general, the subtype of application will often be the + name of the application for which the data are intended. + This does not mean, however, that any application program + name may be used freely as a subtype of application. Such + usages must be registered with IANA, as described in + Appendix F. + + 7.4.1 The Application/Octet-Stream (primary) subtype + + The primary subtype of application, "octet-stream", may be + used to indicate that a body contains binary data. The set + of possible parameters includes, but is not limited to: + + NAME -- a suggested name for the binary data if + stored as a file. + + TYPE -- the general type or category of binary + data. This is intended as information for the + human recipient rather than for any automatic + processing. + + CONVERSIONS -- the set of operations that have + been performed on the data before putting it in + the mail (and before any Content-Transfer-Encoding + that might have been applied). If multiple + + + + Borenstein & Freed [Page 46] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + conversions have occurred, they must be separated + by commas and specified in the order they were + applied -- that is, the leftmost conversion must + have occurred first, and conversions are undone + from right to left. Note that NO conversion + values are defined by this document. Any + conversion values that that do not begin with "X-" + must be preceded by a published specification and + by registration with IANA, as described in + Appendix F. + + PADDING -- the number of bits of padding that were + appended to the bitstream comprising the actual + contents to produce the enclosed byte-oriented + data. This is useful for enclosing a bitstream in + a body when the total number of bits is not a + multiple of the byte size. + + The values for these attributes are left undefined at + present, but may require specification in the future. An + example of a common (though UNIX-specific) usage might be: + + Content-Type: application/octet-stream; + name=foo.tar.Z; type=tar; + conversions="x-encrypt,x-compress" + + However, it should be noted that the use of such conversions + is explicitly discouraged due to a lack of portability and + standardization. The use of uuencode is particularly + discouraged, in favor of the Content-Transfer-Encoding + mechanism, which is both more standardized and more portable + across mail boundaries. + + The recommended action for an implementation that receives + application/octet-stream mail is to simply offer to put the + data in a file, with any Content-Transfer-Encoding undone, + or perhaps to use it as input to a user-specified process. + + To reduce the danger of transmitting rogue programs through + the mail, it is strongly recommended that implementations + NOT implement a path-search mechanism whereby an arbitrary + program named in the Content-Type parameter (e.g., an + "interpreter=" parameter) is found and executed using the + mail body as input. + + 7.4.2 The Application/PostScript subtype + + A Content-Type of "application/postscript" indicates a + PostScript program. The language is defined in + [POSTSCRIPT]. It is recommended that Postscript as sent + through email should use Postscript document structuring + conventions if at all possible, and correctly. + + + + + + Borenstein & Freed [Page 47] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + The execution of general-purpose PostScript interpreters + entails serious security risks, and implementors are + discouraged from simply sending PostScript email bodies to + "off-the-shelf" interpreters. While it is usually safe to + send PostScript to a printer, where the potential for harm + is greatly constrained, implementors should consider all of + the following before they add interactive display of + PostScript bodies to their mail readers. + + The remainder of this section outlines some, though probably + not all, of the possible problems with sending PostScript + through the mail. + + Dangerous operations in the PostScript language include, but + may not be limited to, the PostScript operators deletefile, + renamefile, filenameforall, and file. File is only + dangerous when applied to something other than standard + input or output. Implementations may also define additional + nonstandard file operators; these may also pose a threat to + security. Filenameforall, the wildcard file search + operator, may appear at first glance to be harmless. Note, + however, that this operator has the potential to reveal + information about what files the recipient has access to, + and this information may itself be sensitive. Message + senders should avoid the use of potentially dangerous file + operators, since these operators are quite likely to be + unavailable in secure PostScript implementations. Message- + receiving and -displaying software should either completely + disable all potentially dangerous file operators or take + special care not to delegate any special authority to their + operation. These operators should be viewed as being done by + an outside agency when interpreting PostScript documents. + Such disabling and/or checking should be done completely + outside of the reach of the PostScript language itself; care + should be taken to insure that no method exists for + reenabling full-function versions of these operators. + + The PostScript language provides facilities for exiting the + normal interpreter, or server, loop. Changes made in this + "outer" environment are customarily retained across + documents, and may in some cases be retained semipermanently + in nonvolatile memory. The operators associated with exiting + the interpreter loop have the potential to interfere with + subsequent document processing. As such, their unrestrained + use constitutes a threat of service denial. PostScript + operators that exit the interpreter loop include, but may + not be limited to, the exitserver and startjob operators. + Message-sending software should not generate PostScript that + depends on exiting the interpreter loop to operate. The + ability to exit will probably be unavailable in secure + PostScript implementations. Message-receiving and + -displaying software should, if possible, disable the + ability to make retained changes to the PostScript + environment. Eliminate the startjob and exitserver commands. + + + + Borenstein & Freed [Page 48] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + If these commands cannot be eliminated, at least set the + password associated with them to a hard-to-guess value. + + PostScript provides operators for setting system-wide and + device-specific parameters. These parameter settings may be + retained across jobs and may potentially pose a threat to + the correct operation of the interpreter. The PostScript + operators that set system and device parameters include, but + may not be limited to, the setsystemparams and setdevparams + operators. Message-sending software should not generate + PostScript that depends on the setting of system or device + parameters to operate correctly. The ability to set these + parameters will probably be unavailable in secure PostScript + implementations. Message-receiving and -displaying software + should, if possible, disable the ability to change system + and device parameters. If these operators cannot be + disabled, at least set the password associated with them to + a hard-to-guess value. + + Some PostScript implementations provide nonstandard + facilities for the direct loading and execution of machine + code. Such facilities are quite obviously open to + substantial abuse. Message-sending software should not + make use of such features. Besides being totally hardware- + specific, they are also likely to be unavailable in secure + implementations of PostScript. Message-receiving and + -displaying software should not allow such operators to be + used if they exist. + + PostScript is an extensible language, and many, if not most, + implementations of it provide a number of their own + extensions. This document does not deal with such extensions + explicitly since they constitute an unknown factor. + Message-sending software should not make use of nonstandard + extensions; they are likely to be missing from some + implementations. Message-receiving and -displaying software + should make sure that any nonstandard PostScript operators + are secure and don't present any kind of threat. + + It is possible to write PostScript that consumes huge + amounts of various system resources. It is also possible to + write PostScript programs that loop infinitely. Both types + of programs have the potential to cause damage if sent to + unsuspecting recipients. Message-sending software should + avoid the construction and dissemination of such programs, + which is antisocial. Message-receiving and -displaying + software should provide appropriate mechanisms to abort + processing of a document after a reasonable amount of time + has elapsed. In addition, PostScript interpreters should be + limited to the consumption of only a reasonable amount of + any given system resource. + + Finally, bugs may exist in some PostScript interpreters + which could possibly be exploited to gain unauthorized + + + + Borenstein & Freed [Page 49] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + access to a recipient's system. Apart from noting this + possibility, there is no specific action to take to prevent + this, apart from the timely correction of such bugs if any + are found. + + 7.4.3 The Application/ODA subtype + + The "ODA" subtype of application is used to indicate that a + body contains information encoded according to the Office + Document Architecture [ODA] standards, using the ODIF + representation format. For application/oda, the Content- + Type line should also specify an attribute/value pair that + indicates the document application profile (DAP), using the + key word "profile". Thus an appropriate header field might + look like this: + + Content-Type: application/oda; profile=Q112 + + Consult the ODA standard [ODA] for further information. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 50] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 7.5 The Image Content-Type + + A Content-Type of "image" indicates that the bodycontains an + image. The subtype names the specific image format. These + names are case insensitive. Two initial subtypes are "jpeg" + for the JPEG format, JFIF encoding, and "gif" for GIF format + [GIF]. + + The list of image subtypes given here is neither exclusive + nor exhaustive, and is expected to grow as more types are + registered with IANA, as described in Appendix F. + + 7.6 The Audio Content-Type + + A Content-Type of "audio" indicates that the body contains + audio data. Although there is not yet a consensus on an + "ideal" audio format for use with computers, there is a + pressing need for a format capable of providing + interoperable behavior. + + The initial subtype of "basic" is specified to meet this + requirement by providing an absolutely minimal lowest common + denominator audio format. It is expected that richer + formats for higher quality and/or lower bandwidth audio will + be defined by a later document. + + The content of the "audio/basic" subtype is audio encoded + using 8-bit ISDN u-law [PCM]. When this subtype is present, + a sample rate of 8000 Hz and a single channel is assumed. + + 7.7 The Video Content-Type + + A Content-Type of "video" indicates that the body contains a + time-varying-picture image, possibly with color and + coordinated sound. The term "video" is used extremely + generically, rather than with reference to any particular + technology or format, and is not meant to preclude subtypes + such as animated drawings encoded compactly. The subtype + "mpeg" refers to video coded according to the MPEG standard + [MPEG]. + + Note that although in general this document strongly + discourages the mixing of multiple media in a single body, + it is recognized that many so-called "video" formats include + a representation for synchronized audio, and this is + explicitly permitted for subtypes of "video". + + 7.8 Experimental Content-Type Values + + A Content-Type value beginning with the characters "X-" is a + private value, to be used by consenting mail systems by + mutual agreement. Any format without a rigorous and public + definition must be named with an "X-" prefix, and publicly + specified values shall never begin with "X-". (Older + + + + Borenstein & Freed [Page 51] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + versions of the widely-used Andrew system use the "X-BE2" + name, so new systems should probably choose a different + name.) + + In general, the use of "X-" top-level types is strongly + discouraged. Implementors should invent subtypes of the + existing types whenever possible. The invention of new + types is intended to be restricted primarily to the + development of new media types for email, such as digital + odors or holography, and not for new data formats in + general. In many cases, a subtype of application will be + more appropriate than a new top-level type. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 52] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Summary + + Using the MIME-Version, Content-Type, and Content-Transfer- + Encoding header fields, it is possible to include, in a + standardized way, arbitrary types of data objects with RFC + 822 conformant mail messages. No restrictions imposed by + either RFC 821 or RFC 822 are violated, and care has been + taken to avoid problems caused by additional restrictions + imposed by the characteristics of some Internet mail + transport mechanisms (see Appendix B). The "multipart" and + "message" Content-Types allow mixing and hierarchical + structuring of objects of different types in a single + message. Further Content-Types provide a standardized + mechanism for tagging messages or body parts as audio, + image, or several other kinds of data. A distinguished + parameter syntax allows further specification of data format + details, particularly the specification of alternate + character sets. Additional optional header fields provide + mechanisms for certain extensions deemed desirable by many + implementors. Finally, a number of useful Content-Types are + defined for general use by consenting user agents, notably + text/richtext, message/partial, and message/external-body. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 53] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Acknowledgements + + This document is the result of the collective effort of a + large number of people, at several IETF meetings, on the + IETF-SMTP and IETF-822 mailing lists, and elsewhere. + Although any enumeration seems doomed to suffer from + egregious omissions, the following are among the many + contributors to this effort: + + Harald Tveit Alvestrand Timo Lehtinen + Randall Atkinson John R. MacMillan + Philippe Brandon Rick McGowan + Kevin Carosso Leo Mclaughlin + Uhhyung Choi Goli Montaser-Kohsari + Cristian Constantinof Keith Moore + Mark Crispin Tom Moore + Dave Crocker Erik Naggum + Terry Crowley Mark Needleman + Walt Daniels John Noerenberg + Frank Dawson Mats Ohrman + Hitoshi Doi Julian Onions + Kevin Donnelly Michael Patton + Keith Edwards David J. Pepper + Chris Eich Blake C. Ramsdell + Johnny Eriksson Luc Rooijakkers + Craig Everhart Marshall T. Rose + Patrik Faeltstroem Jonathan Rosenberg + Erik E. Fair Jan Rynning + Roger Fajman Harri Salminen + Alain Fontaine Michael Sanderson + James M. Galvin Masahiro Sekiguchi + Philip Gladstone Mark Sherman + Thomas Gordon Keld Simonsen + Phill Gross Bob Smart + James Hamilton Peter Speck + Steve Hardcastle-Kille Henry Spencer + David Herron Einar Stefferud + Bruce Howard Michael Stein + Bill Janssen Klaus Steinberger + Olle Jaernefors Peter Svanberg + Risto Kankkunen James Thompson + Phil Karn Steve Uhler + Alan Katz Stuart Vance + Tim Kehres Erik van der Poel + Neil Katin Guido van Rossum + Kyuho Kim Peter Vanderbilt + Anders Klemets Greg Vaudreuil + John Klensin Ed Vielmetti + Valdis Kletniek Ryan Waldron + Jim Knowles Wally Wedel + Stev Knowles Sven-Ove Westberg + Bob Kummerfeld Brian Wideen + + + + + + Borenstein & Freed [Page 54] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Pekka Kytolaakso John Wobus + Stellan Lagerstr.m Glenn Wright + Vincent Lau Rayan Zachariassen + Donald Lindsay David Zimmerman + The authors apologize for any omissions from this list, + which are certainly unintentional. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 55] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Appendix A -- Minimal MIME-Conformance + + The mechanisms described in this document are open-ended. + It is definitely not expected that all implementations will + support all of the Content-Types described, nor that they + will all share the same extensions. In order to promote + interoperability, however, it is useful to define the + concept of "MIME-conformance" to define a certain level of + implementation that allows the useful interworking of + messages with content that differs from US ASCII text. In + this section, we specify the requirements for such + conformance. + + A mail user agent that is MIME-conformant MUST: + + 1. Always generate a "MIME-Version: 1.0" header + field. + + 2. Recognize the Content-Transfer-Encoding header + field, and decode all received data encoded with + either the quoted-printable or base64 + implementations. Encode any data sent that is + not in seven-bit mail-ready representation using + one of these transformations and include the + appropriate Content-Transfer-Encoding header + field, unless the underlying transport mechanism + supports non-seven-bit data, as SMTP does not. + + 3. Recognize and interpret the Content-Type + header field, and avoid showing users raw data + with a Content-Type field other than text. Be + able to send at least text/plain messages, with + the character set specified as a parameter if it + is not US-ASCII. + + 4. Explicitly handle the following Content-Type + values, to at least the following extents: + + Text: + -- Recognize and display "text" mail + with the character set "US-ASCII." + -- Recognize other character sets at + least to the extent of being able + to inform the user about what + character set the message uses. + -- Recognize the "ISO-8859-*" character + sets to the extent of being able to + display those characters that are + common to ISO-8859-* and US-ASCII, + namely all characters represented + by octet values 0-127. + -- For unrecognized subtypes, show or + offer to show the user the "raw" + version of the data. An ability at + + + + Borenstein & Freed [Page 56] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + least to convert "text/richtext" to + plain text, as shown in Appendix D, + is encouraged, but not required for + conformance. + Message: + --Recognize and display at least the + primary (822) encapsulation. + Multipart: + -- Recognize the primary (mixed) + subtype. Display all relevant + information on the message level + and the body part header level and + then display or offer to display + each of the body parts + individually. + -- Recognize the "alternative" subtype, + and avoid showing the user + redundant parts of + multipart/alternative mail. + -- Treat any unrecognized subtypes as if + they were "mixed". + Application: + -- Offer the ability to remove either of + the two types of Content-Transfer- + Encoding defined in this document + and put the resulting information + in a user file. + + 5. Upon encountering any unrecognized Content- + Type, an implementation must treat it as if it had + a Content-Type of "application/octet-stream" with + no parameter sub-arguments. How such data are + handled is up to an implementation, but likely + options for handling such unrecognized data + include offering the user to write it into a file + (decoded from its mail transport format) or + offering the user to name a program to which the + decoded data should be passed as input. + Unrecognized predefined types, which in a MIME- + conformant mailer might still include audio, + image, or video, should also be treated in this + way. + + A user agent that meets the above conditions is said to be + MIME-conformant. The meaning of this phrase is that it is + assumed to be "safe" to send virtually any kind of + properly-marked data to users of such mail systems, because + such systems will at least be able to treat the data as + undifferentiated binary, and will not simply splash it onto + the screen of unsuspecting users. There is another sense + in which it is always "safe" to send data in a format that + is MIME-conformant, which is that such data will not break + or be broken by any known systems that are conformant with + RFC 821 and RFC 822. User agents that are MIME-conformant + + + + Borenstein & Freed [Page 57] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + have the additional guarantee that the user will not be + shown data that were never intended to be viewed as text. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 58] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Appendix B -- General Guidelines For Sending Email Data + + Internet email is not a perfect, homogeneous system. Mail + may become corrupted at several stages in its travel to a + final destination. Specifically, email sent throughout the + Internet may travel across many networking technologies. + Many networking and mail technologies do not support the + full functionality possible in the SMTP transport + environment. Mail traversing these systems is likely to be + modified in such a way that it can be transported. + + There exist many widely-deployed non-conformant MTAs in the + Internet. These MTAs, speaking the SMTP protocol, alter + messages on the fly to take advantage of the internal data + structure of the hosts they are implemented on, or are just + plain broken. + + The following guidelines may be useful to anyone devising a + data format (Content-Type) that will survive the widest + range of networking technologies and known broken MTAs + unscathed. Note that anything encoded in the base64 + encoding will satisfy these rules, but that some well-known + mechanisms, notably the UNIX uuencode facility, will not. + Note also that anything encoded in the Quoted-Printable + encoding will survive most gateways intact, but possibly not + some gateways to systems that use the EBCDIC character set. + + (1) Under some circumstances the encoding used for + data may change as part of normal gateway or user + agent operation. In particular, conversion from + base64 to quoted-printable and vice versa may be + necessary. This may result in the confusion of + CRLF sequences with line breaks in text body + parts. As such, the persistence of CRLF as + something other than a line break should not be + relied on. + + (2) Many systems may elect to represent and store + text data using local newline conventions. Local + newline conventions may not match the RFC822 CRLF + convention -- systems are known that use plain CR, + plain LF, CRLF, or counted records. The result is + that isolated CR and LF characters are not well + tolerated in general; they may be lost or + converted to delimiters on some systems, and hence + should not be relied on. + + (3) TAB (HT) characters may be misinterpreted or + may be automatically converted to variable numbers + of spaces. This is unavoidable in some + environments, notably those not based on the ASCII + character set. Such conversion is STRONGLY + DISCOURAGED, but it may occur, and mail formats + should not rely on the persistence of TAB (HT) + + + + Borenstein & Freed [Page 59] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + characters. + + (4) Lines longer than 76 characters may be wrapped + or truncated in some environments. Line wrapping + and line truncation are STRONGLY DISCOURAGED, but + unavoidable in some cases. Applications which + require long lines should somehow differentiate + between soft and hard line breaks. (A simple way + to do this is to use the quoted-printable + encoding.) + + (5) Trailing "white space" characters (SPACE, TAB + (HT)) on a line may be discarded by some transport + agents, while other transport agents may pad lines + with these characters so that all lines in a mail + file are of equal length. The persistence of + trailing white space, therefore, should not be + relied on. + + (6) Many mail domains use variations on the ASCII + character set, or use character sets such as + EBCDIC which contain most but not all of the US- + ASCII characters. The correct translation of + characters not in the "invariant" set cannot be + depended on across character converting gateways. + For example, this situation is a problem when + sending uuencoded information across BITNET, an + EBCDIC system. Similar problems can occur without + crossing a gateway, since many Internet hosts use + character sets other than ASCII internally. The + definition of Printable Strings in X.400 adds + further restrictions in certain special cases. In + particular, the only characters that are known to + be consistent across all gateways are the 73 + characters that correspond to the upper and lower + case letters A-Z and a-z, the 10 digits 0-9, and + the following eleven special characters: + + "'" (ASCII code 39) + "(" (ASCII code 40) + ")" (ASCII code 41) + "+" (ASCII code 43) + "," (ASCII code 44) + "-" (ASCII code 45) + "." (ASCII code 46) + "/" (ASCII code 47) + ":" (ASCII code 58) + "=" (ASCII code 61) + "?" (ASCII code 63) + + A maximally portable mail representation, such as + the base64 encoding, will confine itself to + relatively short lines of text in which the only + meaningful characters are taken from this set of + + + + Borenstein & Freed [Page 60] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + 73 characters. + + Please note that the above list is NOT a list of recommended + practices for MTAs. RFC 821 MTAs are prohibited from + altering the character of white space or wrapping long + lines. These BAD and illegal practices are known to occur + on established networks, and implementions should be robust + in dealing with the bad effects they can cause. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 61] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Appendix C -- A Complex Multipart Example + + What follows is the outline of a complex multipart message. + This message has five parts to be displayed serially: two + introductory plain text parts, an embedded multipart + message, a richtext part, and a closing encapsulated text + message in a non-ASCII character set. The embedded + multipart message has two parts to be displayed in parallel, + a picture and an audio fragment. + + MIME-Version: 1.0 + From: Nathaniel Borenstein + Subject: A multipart example + Content-Type: multipart/mixed; + boundary=unique-boundary-1 + + This is the preamble area of a multipart message. + Mail readers that understand multipart format + should ignore this preamble. + If you are reading this text, you might want to + consider changing to a mail reader that understands + how to properly display multipart messages. + --unique-boundary-1 + + ...Some text appears here... + [Note that the preceding blank line means + no header fields were given and this is text, + with charset US ASCII. It could have been + done with explicit typing as in the next part.] + + --unique-boundary-1 + Content-type: text/plain; charset=US-ASCII + + This could have been part of the previous part, + but illustrates explicit versus implicit + typing of body parts. + + --unique-boundary-1 + Content-Type: multipart/parallel; + boundary=unique-boundary-2 + + + --unique-boundary-2 + Content-Type: audio/basic + Content-Transfer-Encoding: base64 + + ... base64-encoded 8000 Hz single-channel + u-law-format audio data goes here.... + + --unique-boundary-2 + Content-Type: image/gif + Content-Transfer-Encoding: Base64 + + + + + + Borenstein & Freed [Page 62] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + ... base64-encoded image data goes here.... + + --unique-boundary-2-- + + --unique-boundary-1 + Content-type: text/richtext + + This is richtext. + Isn't it + cool? + + --unique-boundary-1 + Content-Type: message/rfc822 + + From: (name in US-ASCII) + Subject: (subject in US-ASCII) + Content-Type: Text/plain; charset=ISO-8859-1 + Content-Transfer-Encoding: Quoted-printable + + ... Additional text in ISO-8859-1 goes here ... + + --unique-boundary-1-- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 63] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Appendix D -- A Simple Richtext-to-Text Translator in C + + One of the major goals in the design of the richtext subtype + of the text Content-Type is to make formatted text so simple + that even text-only mailers will implement richtext-to- + plain-text translators, thus increasing the likelihood that + multifont text will become "safe" to use very widely. To + demonstrate this simplicity, what follows is an extremely + simple 44-line C program that converts richtext input into + plain text output: + + #include + #include + main() { + int c, i; + char token[50]; + + while((c = getc(stdin)) != EOF) { + if (c == '<') { + for (i=0; (i<49 && (c = getc(stdin)) != '>' + && c != EOF); ++i) { + token[i] = isupper(c) ? tolower(c) : c; + } + if (c == EOF) break; + if (c != '>') while ((c = getc(stdin)) != + '>' + && c != EOF) {;} + if (c == EOF) break; + token[i] = '\0'; + if (!strcmp(token, "lt")) { + putc('<', stdout); + } else if (!strcmp(token, "nl")) { + putc('\n', stdout); + } else if (!strcmp(token, "/paragraph")) { + fputs("\n\n", stdout); + } else if (!strcmp(token, "comment")) { + int commct=1; + while (commct > 0) { + while ((c = getc(stdin)) != '<' + && c != EOF) ; + if (c == EOF) break; + for (i=0; (c = getc(stdin)) != '>' + && c != EOF; ++i) { + token[i] = isupper(c) ? + tolower(c) : c; + } + if (c== EOF) break; + token[i] = NULL; + if (!strcmp(token, "/comment")) -- + commct; + if (!strcmp(token, "comment")) + ++commct; + + + + + + Borenstein & Freed [Page 64] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + } + } /* Ignore all other tokens */ + } else if (c != '\n') putc(c, stdout); + } + putc('\n', stdout); /* for good measure */ + } + It should be noted that one can do considerably better than + this in displaying richtext data on a dumb terminal. In + particular, one can replace font information such as "bold" + with textual emphasis (like *this* or _T_H_I_S_). One can + also properly handle the richtext formatting commands + regarding indentation, justification, and others. However, + the above program is all that is necessary in order to + present richtext on a dumb terminal. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 65] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Appendix E -- Collected Grammar + + This appendix contains the complete BNF grammar for all the + syntax specified by this document. + + By itself, however, this grammar is incomplete. It refers + to several entities that are defined by RFC 822. Rather + than reproduce those definitions here, and risk + unintentional differences between the two, this document + simply refers the reader to RFC 822 for the remaining + definitions. Wherever a term is undefined, it refers to the + RFC 822 definition. + + attribute := token + + body-part = <"message" as defined in RFC 822, + with all header fields optional, and with the + specified delimiter not occurring anywhere in + the message body, either on a line by itself + or as a substring anywhere.> + + boundary := 0*69 bcharsnospace + + bchars := bcharsnospace / " " + + bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / "+" / + "_" + / "," / "-" / "." / "/" / ":" / "=" / "?" + + close-delimiter := delimiter "--" + + Content-Description := *text + + Content-ID := msg-id + + Content-Transfer-Encoding := "BASE64" / "QUOTED- + PRINTABLE" / + "8BIT" / "7BIT" / + "BINARY" / x-token + + Content-Type := type "/" subtype *[";" parameter] + + delimiter := CRLF "--" boundary ; taken from Content-Type + field. + ; when content-type is + multipart + ; There should be no space + ; between "--" and boundary. + + encapsulation := delimiter CRLF body-part + + epilogue := *text ; to be ignored upon + receipt. + + + + + Borenstein & Freed [Page 66] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + MIME-Version := 1*text + + multipart-body := preamble 1*encapsulation close-delimiter + epilogue + + parameter := attribute "=" value + + preamble := *text ; to be ignored upon + receipt. + + subtype := token + + token := 1* + + tspecials := "(" / ")" / "<" / ">" / "@" ; Must be in + / "," / ";" / ":" / "\" / <"> ; quoted-string, + / "/" / "[" / "]" / "?" / "." ; to use within + / "=" ; parameter values + + + type := "application" / "audio" ; case- + insensitive + / "image" / "message" + / "multipart" / "text" + / "video" / x-token + + value := token / quoted-string + + x-token := + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 67] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Appendix F -- IANA Registration Procedures + + MIME has been carefully designed to have extensible + mechanisms, and it is expected that the set of content- + type/subtype pairs and their associated parameters will grow + significantly with time. Several other MIME fields, notably + character set names, access-type parameters for the + message/external-body type, conversions parameters for the + application type, and possibly even Content-Transfer- + Encoding values, are likely to have new values defined over + time. In order to ensure that the set of such values is + developed in an orderly, well-specified, and public manner, + MIME defines a registration process which uses the Internet + Assigned Numbers Authority (IANA) as a central registry for + such values. + + In general, parameters in the content-type header field are + used to convey supplemental information for various content + types, and their use is defined when the content-type and + subtype are defined. New parameters should not be defined + as a way to introduce new functionality. + + In order to simplify and standardize the registration + process, this appendix gives templates for the registration + of new values with IANA. Each of these is given in the form + of an email message template, to be filled in by the + registering party. + + F.1 Registration of New Content-type/subtype Values + + Note that MIME is generally expected to be extended by + subtypes. If a new fundamental top-level type is needed, + its specification should be published as an RFC or + submitted in a form suitable to become an RFC, and be + subject to the Internet standards process. + + To: IANA@isi.edu + Subject: Registration of new MIME content-type/subtype + + MIME type name: + + (If the above is not an existing top-level MIME type, + please explain why an existing type cannot be used.) + + MIME subtype name: + + Required parameters: + + Optional parameters: + + Encoding considerations: + + Security considerations: + + + + + Borenstein & Freed [Page 68] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Published specification: + + (The published specification must be an Internet RFC or + RFC-to-be if a new top-level type is being defined, and + must be a publicly available specification in any + case.) + + Person & email address to contact for further + information: + F.2 Registration of New Character Set Values + + To: IANA@isi.edu + Subject: Registration of new MIME character set value + + MIME character set name: + + Published specification: + + (The published specification must be an Internet RFC or + RFC-to-be or an international standard.) + + Person & email address to contact for further + information: + + F.3 Registration of New Access-type Values for + Message/external-body + + To: IANA@isi.edu + Subject: Registration of new MIME Access-type for + Message/external-body content-type + + MIME access-type name: + + Required parameters: + + Optional parameters: + + Published specification: + + (The published specification must be an Internet RFC or + RFC-to-be.) + + Person & email address to contact for further + information: + + + F.4 Registration of New Conversions Values for Application + + To: IANA@isi.edu + Subject: Registration of new MIME Conversions value + for Application content-type + + MIME Conversions name: + + + + + Borenstein & Freed [Page 69] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Published specification: + + (The published specification must be an Internet RFC or + RFC-to-be.) + + Person & email address to contact for further + information: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 70] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Appendix G -- Summary of the Seven Content-types + + Content-type: text + + Subtypes defined by this document: plain, richtext + + Important Parameters: charset + + Encoding notes: quoted-printable generally preferred if an + encoding is needed and the character set is mostly an + ASCII superset. + + Security considerations: Rich text formats such as TeX and + Troff often contain mechanisms for executing arbitrary + commands or file system operations, and should not be + used automatically unless these security problems have + been addressed. Even plain text may contain control + characters that can be used to exploit the capabilities + of "intelligent" terminals and cause security + violations. User interfaces designed to run on such + terminals should be aware of and try to prevent such + problems. + ________________________________________________________________ + + Content-type: multipart + + Subtypes defined by this document: mixed, alternative, + digest, parallel. + + Important Parameters: boundary + + Encoding notes: No content-transfer-encoding is permitted. + + ________________________________________________________________ + + Content-type: message + + Subtypes defined by this document: rfc822, partial, + external-body + + Important Parameters: id, number, total + + Encoding notes: No content-transfer-encoding is permitted. + + ________________________________________________________________ + + Content-type: application + + Subtypes defined by this document: octet-stream, + postscript, oda + + Important Parameters: profile + + + + + + Borenstein & Freed [Page 71] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Encoding notes: base64 generally preferred for octet-stream + or other unreadable subtypes. + + Security considerations: This type is intended for the + transmission of data to be interpreted by locally-installed + programs. If used, for example, to transmit executable + binary programs or programs in general-purpose interpreted + languages, such as LISP programs or shell scripts, severe + security problems could result. In general, authors of + mail-reading agents are cautioned against giving their + systems the power to execute mail-based application data + without carefully considering the security implications. + While it is certainly possible to define safe application + formats and even safe interpreters for unsafe formats, each + interpreter should be evaluated separately for possible + security problems. + ________________________________________________________________ + + Content-type: image + + Subtypes defined by this document: jpeg, gif + + Important Parameters: none + + Encoding notes: base64 generally preferred + + ________________________________________________________________ + + Content-type: audio + + Subtypes defined by this document: basic + + Important Parameters: none + + Encoding notes: base64 generally preferred + + ________________________________________________________________ + + Content-type: video + + Subtypes defined by this document: mpeg + + Important Parameters: none + + Encoding notes: base64 generally preferred + + + + + + + + + + + + + Borenstein & Freed [Page 72] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Appendix H -- Canonical Encoding Model + + + + There was some confusion, in earlier drafts of this memo, + regarding the model for when email data was to be converted + to canonical form and encoded, and in particular how this + process would affect the treatment of CRLFs, given that the + representation of newlines varies greatly from system to + system. For this reason, a canonical model for encoding is + presented below. + + The process of composing a MIME message part can be modelled + as being done in a number of steps. Note that these steps + are roughly similar to those steps used in RFC1113: + + Step 1. Creation of local form. + + The body part to be transmitted is created in the system's + native format. The native character set is used, and where + appropriate local end of line conventions are used as well. + The may be a UNIX-style text file, or a Sun raster image, or + a VMS indexed file, or audio data in a system-dependent + format stored only in memory, or anything else that + corresponds to the local model for the representation of + some form of information. + + Step 2. Conversion to canonical form. + + The entire body part, including "out-of-band" information + such as record lengths and possibly file attribute + information, is converted to a universal canonical form. + The specific content type of the body part as well as its + associated attributes dictate the nature of the canonical + form that is used. Conversion to the proper canonical form + may involve character set conversion, transformation of + audio data, compression, or various other operations + specific to the various content types. + + For example, in the case of text/plain data, the text must + be converted to a supported character set and lines must be + delimited with CRLF delimiters in accordance with RFC822. + Note that the restriction on line lengths implied by RFC822 + is eliminated if the next step employs either quoted- + printable or base64 encoding. + + Step 3. Apply transfer encoding. + + A Content-Transfer-Encoding appropriate for this body part + is applied. Note that there is no fixed relationship + between the content type and the transfer encoding. In + particular, it may be appropriate to base the choice of + base64 or quoted-printable on character frequency counts + which are specific to a given instance of body part. + + + + Borenstein & Freed [Page 73] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Step 4. Insertion into message. + + The encoded object is inserted into a MIME message with + appropriate body part headers and boundary markers. + + It is vital to note that these steps are only a model; they + are specifically NOT a blueprint for how an actual system + would be built. In particular, the model fails to account + for two common designs: + + 1. In many cases the conversion to a canonical + form prior to encoding will be subsumed into the + encoder itself, which understands local formats + directly. For example, the local newline + convention for text bodyparts might be carried + through to the encoder itself along with knowledge + of what that format is. + + 2. The output of the encoders may have to pass + through one or more additional steps prior to + being transmitted as a message. As such, the + output of the encoder may not be compliant with + the formats specified by RFC822. In particular, + once again it may be appropriate for the + converter's output to be expressed using local + newline conventions rather than using the standard + RFC822 CRLF delimiters. + + Other implementation variations are conceivable as well. + The only important aspect of this discussion is that the + resulting messages are consistent with those produced by the + model described here. + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 74] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + References + + [US-ASCII] Coded Character Set--7-Bit American Standard Code + for Information Interchange, ANSI X3.4-1986. + + [ATK] Borenstein, Nathaniel S., Multimedia Applications + Development with the Andrew Toolkit, Prentice-Hall, 1990. + + [GIF] Graphics Interchange Format (Version 89a), Compuserve, + Inc., Columbus, Ohio, 1990. + + [ISO-2022] International Standard--Information Processing-- + ISO 7-bit and 8-bit coded character sets--Code extension + techniques, ISO 2022:1986. + + [ISO-8859] Information Processing -- 8-bit Single-Byte Coded + Graphic Character Sets -- Part 1: Latin Alphabet No. 1, ISO + 8859-1:1987. Part 2: Latin alphabet No. 2, ISO 8859-2, + 1987. Part 3: Latin alphabet No. 3, ISO 8859-3, 1988. Part + 4: Latin alphabet No. 4, ISO 8859-4, 1988. Part 5: + Latin/Cyrillic alphabet, ISO 8859-5, 1988. Part 6: + Latin/Arabic alphabet, ISO 8859-6, 1987. Part 7: + Latin/Greek alphabet, ISO 8859-7, 1987. Part 8: + Latin/Hebrew alphabet, ISO 8859-8, 1988. Part 9: Latin + alphabet No. 5, ISO 8859-9, 1990. + + [ISO-646] International Standard--Information Processing-- + ISO 7-bit coded character set for information interchange, + ISO 646:1983. + + [MPEG] Video Coding Draft Standard ISO 11172 CD, ISO + IEC/TJC1/SC2/WG11 (Motion Picture Experts Group), May, 1991. + + [ODA] ISO 8613; Information Processing: Text and Office + System; Office Document Architecture (ODA) and Interchange + Format (ODIF), Part 1-8, 1989. + + [PCM] CCITT, Fascicle III.4 - Recommendation G.711, Geneva, + 1972, "Pulse Code Modulation (PCM) of Voice Frequencies". + + [POSTSCRIPT] Adobe Systems, Inc., PostScript Language + Reference Manual, Addison-Wesley, 1985. + + [X400] Schicker, Pietro, "Message Handling Systems, X.400", + Message Handling Systems and Distributed Applications, E. + Stefferud, O-j. Jacobsen, and P. Schicker, eds., North- + Holland, 1989, pp. 3-41. + + [RFC-783] Sollins, K.R. TFTP Protocol (revision 2). June, + 1981, MIT, RFC-783. + + [RFC-821] Postel, J.B. Simple Mail Transfer Protocol. + August, 1982, USC/Information Sciences Institute, RFC-821. + + + + + Borenstein & Freed [Page 75] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + [RFC-822] Crocker, D. Standard for the format of ARPA + Internet text messages. August, 1982, UDEL, RFC-822. + + [RFC-934] Rose, M.T.; Stefferud, E.A. Proposed standard + for message encapsulation. January, 1985, Delaware + and NMA, RFC-934. + + [RFC-959] Postel, J.B.; Reynolds, J.K. File Transfer + Protocol. October, 1985, USC/Information Sciences + Institute, RFC-959. + + [RFC-1049] Sirbu, M.A. Content-Type header field for + Internet messages. March, 1988, CMU, RFC-1049. + + [RFC-1113] Linn, J. Privacy enhancement for Internet + electronic mail: Part I - message encipherment and + authentication procedures. August, 1989, IAB Privacy Task + Force, RFC-1113. + + [RFC-1154] Robinson, D.; Ullmann, R. Encoding header field + for Internet messages. April, 1990, Prime Computer, + Inc., RFC-1154. + + [RFC-1342] Moore, Keith, Representation of Non-Ascii Text in + Internet Message Headers. June, 1992, University of + Tennessee, RFC-1342. + + Security Considerations + + Security issues are discussed in Section 7.4.2 and in + Appendix G. Implementors should pay special attention to + the security implications of any mail content-types that can + cause the remote execution of any actions in the recipient's + environment. In such cases, the discussion of the + applicaton/postscript content-type in Section 7.4.2 may + serve as a model for considering other content-types with + remote execution capabilities. + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 76] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + Authors' Addresses + + For more information, the authors of this document may be + contacted via Internet mail: + + Nathaniel S. Borenstein + MRE 2D-296, Bellcore + 445 South St. + Morristown, NJ 07962-1910 + + Phone: +1 201 829 4270 + Fax: +1 201 829 7019 + Email: nsb@bellcore.com + + + Ned Freed + Innosoft International, Inc. + 250 West First Street + Suite 240 + Claremont, CA 91711 + + Phone: +1 714 624 7907 + Fax: +1 714 621 5319 + Email: ned@innosoft.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page 77] + + + + + RFC 1341MIME: Multipurpose Internet Mail ExtensionsJune 1992 + + + + + + THIS PAGE INTENTIONALLY LEFT BLANK. + + Please discard this page and place the following table of + contents after the title page. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page i] + + + + + + + + + Table of Contents + + + 1 Introduction....................................... 1 + 2 Notations, Conventions, and Generic BNF Grammar.... 3 + 3 The MIME-Version Header Field...................... 5 + 4 The Content-Type Header Field...................... 6 + 5 The Content-Transfer-Encoding Header Field......... 10 + 5.1 Quoted-Printable Content-Transfer-Encoding......... 14 + 5.2 Base64 Content-Transfer-Encoding................... 17 + 6 Additional Optional Content- Header Fields......... 19 + 6.1 Optional Content-ID Header Field................... 19 + 6.2 Optional Content-Description Header Field.......... 19 + 7 The Predefined Content-Type Values................. 20 + 7.1 The Text Content-Type.............................. 20 + 7.1.1 The charset parameter.............................. 20 + 7.1.2 The Text/plain subtype............................. 23 + 7.1.3 The Text/richtext subtype.......................... 23 + 7.2 The Multipart Content-Type......................... 29 + 7.2.1 Multipart: The common syntax...................... 30 + 7.2.2 The Multipart/mixed (primary) subtype.............. 34 + 7.2.3 The Multipart/alternative subtype.................. 34 + 7.2.4 The Multipart/digest subtype....................... 36 + 7.2.5 The Multipart/parallel subtype..................... 36 + 7.3 The Message Content-Type........................... 37 + 7.3.1 The Message/rfc822 (primary) subtype............... 37 + 7.3.2 The Message/Partial subtype........................ 37 + 7.3.3 The Message/External-Body subtype.................. 40 + 7.4 The Application Content-Type....................... 46 + 7.4.1 The Application/Octet-Stream (primary) subtype..... 46 + 7.4.2 The Application/PostScript subtype................. 47 + 7.4.3 The Application/ODA subtype........................ 50 + 7.5 The Image Content-Type............................. 51 + 7.6 The Audio Content-Type............................. 51 + 7.7 The Video Content-Type............................. 51 + 7.8 Experimental Content-Type Values................... 51 + Summary............................................ 53 + Acknowledgements................................... 54 + Appendix A -- Minimal MIME-Conformance............. 56 + Appendix B -- General Guidelines For Sending Email Data59 + Appendix C -- A Complex Multipart Example.......... 62 + Appendix D -- A Simple Richtext-to-Text Translator in C64 + Appendix E -- Collected Grammar.................... 66 + Appendix F -- IANA Registration Procedures......... 68 + F.1 Registration of New Content-type/subtype Values..68 + F.2 Registration of New Character Set Values...... 69 + F.3 Registration of New Access-type Values for Message/external-body69 + F.4 Registration of New Conversions Values for Application69 + Appendix G -- Summary of the Seven Content-types... 71 + Appendix H -- Canonical Encoding Model............. 73 + References......................................... 75 + Security Considerations............................ 76 + Authors' Addresses................................. 77 + + + + Borenstein & Freed [Page ii] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Borenstein & Freed [Page iii] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1521.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1521.txt new file mode 100644 index 0000000..074ba41 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1521.txt @@ -0,0 +1,4539 @@ + + + + + + +Network Working Group N. Borenstein +Request for Comments: 1521 Bellcore +Obsoletes: 1341 N. Freed +Category: Standards Track Innosoft + September 1993 + + + MIME (Multipurpose Internet Mail Extensions) Part One: + Mechanisms for Specifying and Describing + the Format of Internet Message Bodies + +Status of this Memo + + This RFC specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" for the standardization state and status + of this protocol. Distribution of this memo is unlimited. + +Abstract + + STD 11, RFC 822 defines a message representation protocol which + specifies considerable detail about message headers, but which leaves + the message content, or message body, as flat ASCII text. This + document redefines the format of message bodies to allow multi-part + textual and non-textual message bodies to be represented and + exchanged without loss of information. This is based on earlier work + documented in RFC 934 and STD 11, RFC 1049, but extends and revises + that work. Because RFC 822 said so little about message bodies, this + document is largely orthogonal to (rather than a revision of) RFC + 822. + + In particular, this document is designed to provide facilities to + include multiple objects in a single message, to represent body text + in character sets other than US-ASCII, to represent formatted multi- + font text messages, to represent non-textual material such as images + and audio fragments, and generally to facilitate later extensions + defining new types of Internet mail for use by cooperating mail + agents. + + This document does NOT extend Internet mail header fields to permit + anything other than US-ASCII text data. Such extensions are the + subject of a companion document [RFC-1522]. + + This document is a revision of RFC 1341. Significant differences + from RFC 1341 are summarized in Appendix H. + + + + + +Borenstein & Freed [Page 1] + +RFC 1521 MIME September 1993 + + +Table of Contents + + 1. Introduction....................................... 3 + 2. Notations, Conventions, and Generic BNF Grammar.... 6 + 3. The MIME-Version Header Field...................... 7 + 4. The Content-Type Header Field...................... 9 + 5. The Content-Transfer-Encoding Header Field......... 13 + 5.1. Quoted-Printable Content-Transfer-Encoding......... 18 + 5.2. Base64 Content-Transfer-Encoding................... 21 + 6. Additional Content-Header Fields................... 23 + 6.1. Optional Content-ID Header Field................... 23 + 6.2. Optional Content-Description Header Field.......... 24 + 7. The Predefined Content-Type Values................. 24 + 7.1. The Text Content-Type.............................. 24 + 7.1.1. The charset parameter.............................. 25 + 7.1.2. The Text/plain subtype............................. 28 + 7.2. The Multipart Content-Type......................... 28 + 7.2.1. Multipart: The common syntax...................... 29 + 7.2.2. The Multipart/mixed (primary) subtype.............. 34 + 7.2.3. The Multipart/alternative subtype.................. 34 + 7.2.4. The Multipart/digest subtype....................... 36 + 7.2.5. The Multipart/parallel subtype..................... 37 + 7.2.6. Other Multipart subtypes........................... 37 + 7.3. The Message Content-Type........................... 38 + 7.3.1. The Message/rfc822 (primary) subtype............... 38 + 7.3.2. The Message/Partial subtype........................ 39 + 7.3.3. The Message/External-Body subtype.................. 42 + 7.3.3.1. The "ftp" and "tftp" access-types............... 44 + 7.3.3.2. The "anon-ftp" access-type...................... 45 + 7.3.3.3. The "local-file" and "afs" access-types......... 45 + 7.3.3.4. The "mail-server" access-type................... 45 + 7.3.3.5. Examples and Further Explanations............... 46 + 7.4. The Application Content-Type....................... 49 + 7.4.1. The Application/Octet-Stream (primary) subtype..... 50 + 7.4.2. The Application/PostScript subtype................. 50 + 7.4.3. Other Application subtypes......................... 53 + 7.5. The Image Content-Type............................. 53 + 7.6. The Audio Content-Type............................. 54 + 7.7. The Video Content-Type............................. 54 + 7.8. Experimental Content-Type Values................... 54 + 8. Summary............................................ 56 + 9. Security Considerations............................ 56 + 10. Authors' Addresses................................. 57 + 11. Acknowledgements................................... 58 + Appendix A -- Minimal MIME-Conformance.................... 60 + Appendix B -- General Guidelines For Sending Email Data... 63 + Appendix C -- A Complex Multipart Example................. 66 + Appendix D -- Collected Grammar........................... 68 + + + +Borenstein & Freed [Page 2] + +RFC 1521 MIME September 1993 + + + Appendix E -- IANA Registration Procedures................ 72 + E.1 Registration of New Content-type/subtype Values...... 72 + E.2 Registration of New Access-type Values + for Message/external-body............................ 73 + Appendix F -- Summary of the Seven Content-types.......... 74 + Appendix G -- Canonical Encoding Model.................... 76 + Appendix H -- Changes from RFC 1341....................... 78 + References................................................ 80 + +1. Introduction + + Since its publication in 1982, STD 11, RFC 822 [RFC-822] has defined + the standard format of textual mail messages on the Internet. Its + success has been such that the RFC 822 format has been adopted, + wholly or partially, well beyond the confines of the Internet and the + Internet SMTP transport defined by STD 10, RFC 821 [RFC-821]. As the + format has seen wider use, a number of limitations have proven + increasingly restrictive for the user community. + + RFC 822 was intended to specify a format for text messages. As such, + non-text messages, such as multimedia messages that might include + audio or images, are simply not mentioned. Even in the case of text, + however, RFC 822 is inadequate for the needs of mail users whose + languages require the use of character sets richer than US ASCII + [US-ASCII]. Since RFC 822 does not specify mechanisms for mail + containing audio, video, Asian language text, or even text in most + European languages, additional specifications are needed. + + One of the notable limitations of RFC 821/822 based mail systems is + the fact that they limit the contents of electronic mail messages to + relatively short lines of seven-bit ASCII. This forces users to + convert any non-textual data that they may wish to send into seven- + bit bytes representable as printable ASCII characters before invoking + a local mail UA (User Agent, a program with which human users send + and receive mail). Examples of such encodings currently used in the + Internet include pure hexadecimal, uuencode, the 3-in-4 base 64 + scheme specified in RFC 1421, the Andrew Toolkit Representation + [ATK], and many others. + + The limitations of RFC 822 mail become even more apparent as gateways + are designed to allow for the exchange of mail messages between RFC + 822 hosts and X.400 hosts. X.400 [X400] specifies mechanisms for the + inclusion of non-textual body parts within electronic mail messages. + The current standards for the mapping of X.400 messages to RFC 822 + messages specify either that X.400 non-textual body parts must be + converted to (not encoded in) an ASCII format, or that they must be + discarded, notifying the RFC 822 user that discarding has occurred. + This is clearly undesirable, as information that a user may wish to + + + +Borenstein & Freed [Page 3] + +RFC 1521 MIME September 1993 + + + receive is lost. Even though a user's UA may not have the capability + of dealing with the non-textual body part, the user might have some + mechanism external to the UA that can extract useful information from + the body part. Moreover, it does not allow for the fact that the + message may eventually be gatewayed back into an X.400 message + handling system (i.e., the X.400 message is "tunneled" through + Internet mail), where the non-textual information would definitely + become useful again. + + This document describes several mechanisms that combine to solve most + of these problems without introducing any serious incompatibilities + with the existing world of RFC 822 mail. In particular, it + describes: + + 1. A MIME-Version header field, which uses a version number to + declare a message to be conformant with this specification and + allows mail processing agents to distinguish between such + messages and those generated by older or non-conformant software, + which is presumed to lack such a field. + + 2. A Content-Type header field, generalized from RFC 1049 [RFC-1049], + which can be used to specify the type and subtype of data in the + body of a message and to fully specify the native representation + (encoding) of such data. + + 2.a. A "text" Content-Type value, which can be used to represent + textual information in a number of character sets and + formatted text description languages in a standardized + manner. + + 2.b. A "multipart" Content-Type value, which can be used to + combine several body parts, possibly of differing types of + data, into a single message. + + 2.c. An "application" Content-Type value, which can be used to + transmit application data or binary data, and hence, among + other uses, to implement an electronic mail file transfer + service. + + 2.d. A "message" Content-Type value, for encapsulating another + mail message. + + 2.e An "image" Content-Type value, for transmitting still image + (picture) data. + + 2.f. An "audio" Content-Type value, for transmitting audio or + voice data. + + + + +Borenstein & Freed [Page 4] + +RFC 1521 MIME September 1993 + + + 2.g. A "video" Content-Type value, for transmitting video or + moving image data, possibly with audio as part of the + composite video data format. + + 3. A Content-Transfer-Encoding header field, which can be used to + specify an auxiliary encoding that was applied to the data in + order to allow it to pass through mail transport mechanisms which + may have data or character set limitations. + + 4. Two additional header fields that can be used to further describe + the data in a message body, the Content-ID and Content- + Description header fields. + + MIME has been carefully designed as an extensible mechanism, and it + is expected that the set of content-type/subtype pairs and their + associated parameters will grow significantly with time. Several + other MIME fields, notably including character set names, are likely + to have new values defined over time. In order to ensure that the + set of such values is developed in an orderly, well-specified, and + public manner, MIME defines a registration process which uses the + Internet Assigned Numbers Authority (IANA) as a central registry for + such values. Appendix E provides details about how IANA registration + is accomplished. + + Finally, to specify and promote interoperability, Appendix A of this + document provides a basic applicability statement for a subset of the + above mechanisms that defines a minimal level of "conformance" with + this document. + + HISTORICAL NOTE: Several of the mechanisms described in this + document may seem somewhat strange or even baroque at first + reading. It is important to note that compatibility with existing + standards AND robustness across existing practice were two of the + highest priorities of the working group that developed this + document. In particular, compatibility was always favored over + elegance. + + MIME was first defined and published as RFCs 1341 and 1342 [RFC-1341] + [RFC-1342]. This document is a relatively minor updating of RFC + 1341, and is intended to supersede it. The differences between this + document and RFC 1341 are summarized in Appendix H. Please refer to + the current edition of the "IAB Official Protocol Standards" for the + standardization state and status of this protocol. Several other RFC + documents will be of interest to the MIME implementor, in particular + [RFC 1343], [RFC-1344], and [RFC-1345]. + + + + + + +Borenstein & Freed [Page 5] + +RFC 1521 MIME September 1993 + + +2. Notations, Conventions, and Generic BNF Grammar + + This document is being published in two versions, one as plain ASCII + text and one as PostScript (PostScript is a trademark of Adobe + Systems Incorporated.). While the text version is the official + specification, some will find the PostScript version easier to read. + The textual contents are identical. An Andrew-format copy of this + document is also available from the first author (Borenstein). + + Although the mechanisms specified in this document are all described + in prose, most are also described formally in the modified BNF + notation of RFC 822. Implementors will need to be familiar with this + notation in order to understand this specification, and are referred + to RFC 822 for a complete explanation of the modified BNF notation. + + Some of the modified BNF in this document makes reference to + syntactic entities that are defined in RFC 822 and not in this + document. A complete formal grammar, then, is obtained by combining + the collected grammar appendix of this document with that of RFC 822 + plus the modifications to RFC 822 defined in RFC 1123, which + specifically changes the syntax for `return', `date' and `mailbox'. + + The term CRLF, in this document, refers to the sequence of the two + ASCII characters CR (13) and LF (10) which, taken together, in this + order, denote a line break in RFC 822 mail. + + The term "character set" is used in this document to refer to a + method used with one or more tables to convert encoded text to a + series of octets. This definition is intended to allow various kinds + of text encodings, from simple single-table mappings such as ASCII to + complex table switching methods such as those that use ISO 2022's + techniques. However, a MIME character set name must fully specify + the mapping to be performed. + + The term "message", when not further qualified, means either the + (complete or "top-level") message being transferred on a network, or + a message encapsulated in a body of type "message". + + The term "body part", in this document, means one of the parts of the + body of a multipart entity. A body part has a header and a body, so + it makes sense to speak about the body of a body part. + + The term "entity", in this document, means either a message or a body + part. All kinds of entities share the property that they have a + header and a body. + + The term "body", when not further qualified, means the body of an + entity, that is the body of either a message or of a body part. + + + +Borenstein & Freed [Page 6] + +RFC 1521 MIME September 1993 + + + NOTE: The previous four definitions are clearly circular. This is + unavoidable, since the overall structure of a MIME message is + indeed recursive. + + In this document, all numeric and octet values are given in decimal + notation. + + It must be noted that Content-Type values, subtypes, and parameter + names as defined in this document are case-insensitive. However, + parameter values are case-sensitive unless otherwise specified for + the specific parameter. + + FORMATTING NOTE: This document has been carefully formatted for + ease of reading. The PostScript version of this document, in + particular, places notes like this one, which may be skipped by + the reader, in a smaller, italicized, font, and indents it as + well. In the text version, only the indentation is preserved, so + if you are reading the text version of this you might consider + using the PostScript version instead. However, all such notes will + be indented and preceded by "NOTE:" or some similar introduction, + even in the text version. + + The primary purpose of these non-essential notes is to convey + information about the rationale of this document, or to place this + document in the proper historical or evolutionary context. Such + information may be skipped by those who are focused entirely on + building a conformant implementation, but may be of use to those + who wish to understand why this document is written as it is. + + For ease of recognition, all BNF definitions have been placed in a + fixed-width font in the PostScript version of this document. + +3. The MIME-Version Header Field + + Since RFC 822 was published in 1982, there has really been only one + format standard for Internet messages, and there has been little + perceived need to declare the format standard in use. This document + is an independent document that complements RFC 822. Although the + extensions in this document have been defined in such a way as to be + compatible with RFC 822, there are still circumstances in which it + might be desirable for a mail-processing agent to know whether a + message was composed with the new standard in mind. + + Therefore, this document defines a new header field, "MIME-Version", + which is to be used to declare the version of the Internet message + body format standard in use. + + Messages composed in accordance with this document MUST include such + + + +Borenstein & Freed [Page 7] + +RFC 1521 MIME September 1993 + + + a header field, with the following verbatim text: + + MIME-Version: 1.0 + + The presence of this header field is an assertion that the message + has been composed in compliance with this document. + + Since it is possible that a future document might extend the message + format standard again, a formal BNF is given for the content of the + MIME-Version field: + + version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT + + Thus, future format specifiers, which might replace or extend "1.0", + are constrained to be two integer fields, separated by a period. If + a message is received with a MIME-version value other than "1.0", it + cannot be assumed to conform with this specification. + + Note that the MIME-Version header field is required at the top level + of a message. It is not required for each body part of a multipart + entity. It is required for the embedded headers of a body of type + "message" if and only if the embedded message is itself claimed to be + MIME-conformant. + + It is not possible to fully specify how a mail reader that conforms + with MIME as defined in this document should treat a message that + might arrive in the future with some value of MIME-Version other than + "1.0". However, conformant software is encouraged to check the + version number and at least warn the user if an unrecognized MIME- + version is encountered. + + It is also worth noting that version control for specific content- + types is not accomplished using the MIME-Version mechanism. In + particular, some formats (such as application/postscript) have + version numbering conventions that are internal to the document + format. Where such conventions exist, MIME does nothing to supersede + them. Where no such conventions exist, a MIME type might use a + "version" parameter in the content-type field if necessary. + + NOTE TO IMPLEMENTORS: All header fields defined in this document, + including MIME-Version, Content-type, etc., are subject to the + general syntactic rules for header fields specified in RFC 822. In + particular, all can include comments, which means that the following + two MIME-Version fields are equivalent: + + MIME-Version: 1.0 + MIME-Version: 1.0 (Generated by GBD-killer 3.7) + + + + +Borenstein & Freed [Page 8] + +RFC 1521 MIME September 1993 + + +4. The Content-Type Header Field + + The purpose of the Content-Type field is to describe the data + contained in the body fully enough that the receiving user agent can + pick an appropriate agent or mechanism to present the data to the + user, or otherwise deal with the data in an appropriate manner. + + HISTORICAL NOTE: The Content-Type header field was first defined in + RFC 1049. RFC 1049 Content-types used a simpler and less powerful + syntax, but one that is largely compatible with the mechanism given + here. + + The Content-Type header field is used to specify the nature of the + data in the body of an entity, by giving type and subtype + identifiers, and by providing auxiliary information that may be + required for certain types. After the type and subtype names, the + remainder of the header field is simply a set of parameters, + specified in an attribute/value notation. The set of meaningful + parameters differs for the different types. In particular, there are + NO globally-meaningful parameters that apply to all content-types. + Global mechanisms are best addressed, in the MIME model, by the + definition of additional Content-* header fields. The ordering of + parameters is not significant. Among the defined parameters is a + "charset" parameter by which the character set used in the body may + be declared. Comments are allowed in accordance with RFC 822 rules + for structured header fields. + + In general, the top-level Content-Type is used to declare the general + type of data, while the subtype specifies a specific format for that + type of data. Thus, a Content-Type of "image/xyz" is enough to tell + a user agent that the data is an image, even if the user agent has no + knowledge of the specific image format "xyz". Such information can + be used, for example, to decide whether or not to show a user the raw + data from an unrecognized subtype -- such an action might be + reasonable for unrecognized subtypes of text, but not for + unrecognized subtypes of image or audio. For this reason, registered + subtypes of audio, image, text, and video, should not contain + embedded information that is really of a different type. Such + compound types should be represented using the "multipart" or + "application" types. + + Parameters are modifiers of the content-subtype, and do not + fundamentally affect the requirements of the host system. Although + most parameters make sense only with certain content-types, others + are "global" in the sense that they might apply to any subtype. For + example, the "boundary" parameter makes sense only for the + "multipart" content-type, but the "charset" parameter might make + sense with several content-types. + + + +Borenstein & Freed [Page 9] + +RFC 1521 MIME September 1993 + + + An initial set of seven Content-Types is defined by this document. + This set of top-level names is intended to be substantially complete. + It is expected that additions to the larger set of supported types + can generally be accomplished by the creation of new subtypes of + these initial types. In the future, more top-level types may be + defined only by an extension to this standard. If another primary + type is to be used for any reason, it must be given a name starting + with "X-" to indicate its non-standard status and to avoid a + potential conflict with a future official name. + + In the Augmented BNF notation of RFC 822, a Content-Type header field + value is defined as follows: + + content := "Content-Type" ":" type "/" subtype *(";" + parameter) + ; case-insensitive matching of type and subtype + + type := "application" / "audio" + / "image" / "message" + / "multipart" / "text" + / "video" / extension-token + ; All values case-insensitive + + extension-token := x-token / iana-token + + iana-token := + + x-token := + + subtype := token ; case-insensitive + + parameter := attribute "=" value + + attribute := token ; case-insensitive + + value := token / quoted-string + + token := 1* + + tspecials := "(" / ")" / "<" / ">" / "@" + / "," / ";" / ":" / "\" / <"> + / "/" / "[" / "]" / "?" / "=" + ; Must be in quoted-string, + ; to use within parameter values + + + +Borenstein & Freed [Page 10] + +RFC 1521 MIME September 1993 + + + Note that the definition of "tspecials" is the same as the RFC 822 + definition of "specials" with the addition of the three characters + "/", "?", and "=", and the removal of ".". + + Note also that a subtype specification is MANDATORY. There are no + default subtypes. + + The type, subtype, and parameter names are not case sensitive. For + example, TEXT, Text, and TeXt are all equivalent. Parameter values + are normally case sensitive, but certain parameters are interpreted + to be case-insensitive, depending on the intended use. (For example, + multipart boundaries are case-sensitive, but the "access-type" for + message/External-body is not case-sensitive.) + + Beyond this syntax, the only constraint on the definition of subtype + names is the desire that their uses must not conflict. That is, it + would be undesirable to have two different communities using + "Content-Type: application/foobar" to mean two different things. The + process of defining new content-subtypes, then, is not intended to be + a mechanism for imposing restrictions, but simply a mechanism for + publicizing the usages. There are, therefore, two acceptable + mechanisms for defining new Content-Type subtypes: + + 1. Private values (starting with "X-") may be + defined bilaterally between two cooperating + agents without outside registration or + standardization. + + 2. New standard values must be documented, + registered with, and approved by IANA, as + described in Appendix E. Where intended for + public use, the formats they refer to must + also be defined by a published specification, + and possibly offered for standardization. + + The seven standard initial predefined Content-Types are detailed in + the bulk of this document. They are: + + text -- textual information. The primary subtype, + "plain", indicates plain (unformatted) text. No + special software is required to get the full + meaning of the text, aside from support for the + indicated character set. Subtypes are to be used + for enriched text in forms where application + software may enhance the appearance of the text, + but such software must not be required in order to + get the general idea of the content. Possible + subtypes thus include any readable word processor + + + +Borenstein & Freed [Page 11] + +RFC 1521 MIME September 1993 + + + format. A very simple and portable subtype, + richtext, was defined in RFC 1341, with a future + revision expected. + + multipart -- data consisting of multiple parts of + independent data types. Four initial subtypes + are defined, including the primary "mixed" + subtype, "alternative" for representing the same + data in multiple formats, "parallel" for parts + intended to be viewed simultaneously, and "digest" + for multipart entities in which each part is of + type "message". + + message -- an encapsulated message. A body of + Content-Type "message" is itself all or part of a + fully formatted RFC 822 conformant message which + may contain its own different Content-Type header + field. The primary subtype is "rfc822". The + "partial" subtype is defined for partial messages, + to permit the fragmented transmission of bodies + that are thought to be too large to be passed + through mail transport facilities. Another + subtype, "External-body", is defined for + specifying large bodies by reference to an + external data source. + + image -- image data. Image requires a display device + (such as a graphical display, a printer, or a FAX + machine) to view the information. Initial + subtypes are defined for two widely-used image + formats, jpeg and gif. + + audio -- audio data, with initial subtype "basic". + Audio requires an audio output device (such as a + speaker or a telephone) to "display" the contents. + + video -- video data. Video requires the capability to + display moving images, typically including + specialized hardware and software. The initial + subtype is "mpeg". + + application -- some other kind of data, typically + either uninterpreted binary data or information to + be processed by a mail-based application. The + primary subtype, "octet-stream", is to be used in + the case of uninterpreted binary data, in which + case the simplest recommended action is to offer + to write the information into a file for the user. + + + +Borenstein & Freed [Page 12] + +RFC 1521 MIME September 1993 + + + An additional subtype, "PostScript", is defined + for transporting PostScript documents in bodies. + Other expected uses for "application" include + spreadsheets, data for mail-based scheduling + systems, and languages for "active" + (computational) email. (Note that active email + and other application data may entail several + security considerations, which are discussed later + in this memo, particularly in the context of + application/PostScript.) + + Default RFC 822 messages are typed by this protocol as plain text in + the US-ASCII character set, which can be explicitly specified as + "Content-type: text/plain; charset=us-ascii". If no Content-Type is + specified, this default is assumed. In the presence of a MIME- + Version header field, a receiving User Agent can also assume that + plain US-ASCII text was the sender's intent. In the absence of a + MIME-Version specification, plain US-ASCII text must still be + assumed, but the sender's intent might have been otherwise. + + RATIONALE: In the absence of any Content-Type header field or + MIME-Version header field, it is impossible to be certain that a + message is actually text in the US-ASCII character set, since it + might well be a message that, using the conventions that predate + this document, includes text in another character set or non- + textual data in a manner that cannot be automatically recognized + (e.g., a uuencoded compressed UNIX tar file). Although there is + no fully acceptable alternative to treating such untyped messages + as "text/plain; charset=us-ascii", implementors should remain + aware that if a message lacks both the MIME-Version and the + Content-Type header fields, it may in practice contain almost + anything. + + It should be noted that the list of Content-Type values given here + may be augmented in time, via the mechanisms described above, and + that the set of subtypes is expected to grow substantially. + + When a mail reader encounters mail with an unknown Content-type + value, it should generally treat it as equivalent to + "application/octet-stream", as described later in this document. + +5. The Content-Transfer-Encoding Header Field + + Many Content-Types which could usefully be transported via email are + represented, in their "natural" format, as 8-bit character or binary + data. Such data cannot be transmitted over some transport protocols. + For example, RFC 821 restricts mail messages to 7-bit US-ASCII data + with lines no longer than 1000 characters. + + + +Borenstein & Freed [Page 13] + +RFC 1521 MIME September 1993 + + + It is necessary, therefore, to define a standard mechanism for re- + encoding such data into a 7-bit short-line format. This document + specifies that such encodings will be indicated by a new "Content- + Transfer-Encoding" header field. The Content-Transfer-Encoding field + is used to indicate the type of transformation that has been used in + order to represent the body in an acceptable manner for transport. + + Unlike Content-Types, a proliferation of Content-Transfer-Encoding + values is undesirable and unnecessary. However, establishing only a + single Content-Transfer-Encoding mechanism does not seem possible. + There is a tradeoff between the desire for a compact and efficient + encoding of largely-binary data and the desire for a readable + encoding of data that is mostly, but not entirely, 7-bit data. For + this reason, at least two encoding mechanisms are necessary: a + "readable" encoding and a "dense" encoding. + + The Content-Transfer-Encoding field is designed to specify an + invertible mapping between the "native" representation of a type of + data and a representation that can be readily exchanged using 7 bit + mail transport protocols, such as those defined by RFC 821 (SMTP). + This field has not been defined by any previous standard. The field's + value is a single token specifying the type of encoding, as + enumerated below. Formally: + + encoding := "Content-Transfer-Encoding" ":" mechanism + + mechanism := "7bit" ; case-insensitive + / "quoted-printable" + / "base64" + / "8bit" + / "binary" + / x-token + + These values are not case sensitive. That is, Base64 and BASE64 and + bAsE64 are all equivalent. An encoding type of 7BIT requires that + the body is already in a seven-bit mail-ready representation. This + is the default value -- that is, "Content-Transfer-Encoding: 7BIT" is + assumed if the Content-Transfer-Encoding header field is not present. + + The values "8bit", "7bit", and "binary" all mean that NO encoding has + been performed. However, they are potentially useful as indications + of the kind of data contained in the object, and therefore of the + kind of encoding that might need to be performed for transmission in + a given transport system. In particular: + + "7bit" means that the data is all represented as short + lines of US-ASCII data. + + + + +Borenstein & Freed [Page 14] + +RFC 1521 MIME September 1993 + + + "8bit" means that the lines are short, but there may be + non-ASCII characters (octets with the high-order + bit set). + + "Binary" means that not only may non-ASCII characters + be present, but also that the lines are not + necessarily short enough for SMTP transport. + + The difference between "8bit" (or any other conceivable bit-width + token) and the "binary" token is that "binary" does not require + adherence to any limits on line length or to the SMTP CRLF semantics, + while the bit-width tokens do require such adherence. If the body + contains data in any bit-width other than 7-bit, the appropriate + bit-width Content-Transfer-Encoding token must be used (e.g., "8bit" + for unencoded 8 bit wide data). If the body contains binary data, + the "binary" Content-Transfer-Encoding token must be used. + + NOTE: The distinction between the Content-Transfer-Encoding values + of "binary", "8bit", etc. may seem unimportant, in that all of + them really mean "none" -- that is, there has been no encoding of + the data for transport. However, clear labeling will be of + enormous value to gateways between future mail transport systems + with differing capabilities in transporting data that do not meet + the restrictions of RFC 821 transport. + + Mail transport for unencoded 8-bit data is defined in RFC-1426 + [RFC-1426]. As of the publication of this document, there are no + standardized Internet mail transports for which it is legitimate + to include unencoded binary data in mail bodies. Thus there are + no circumstances in which the "binary" Content-Transfer-Encoding + is actually legal on the Internet. However, in the event that + binary mail transport becomes a reality in Internet mail, or when + this document is used in conjunction with any other binary-capable + transport mechanism, binary bodies should be labeled as such using + this mechanism. + + NOTE: The five values defined for the Content-Transfer-Encoding + field imply nothing about the Content-Type other than the + algorithm by which it was encoded or the transport system + requirements if unencoded. + + Implementors may, if necessary, define new Content-Transfer-Encoding + values, but must use an x-token, which is a name prefixed by "X-" to + indicate its non-standard status, e.g., "Content-Transfer-Encoding: + x-my-new-encoding". However, unlike Content-Types and subtypes, the + creation of new Content-Transfer-Encoding values is explicitly and + strongly discouraged, as it seems likely to hinder interoperability + with little potential benefit. Their use is allowed only as the + + + +Borenstein & Freed [Page 15] + +RFC 1521 MIME September 1993 + + + result of an agreement between cooperating user agents. + + If a Content-Transfer-Encoding header field appears as part of a + message header, it applies to the entire body of that message. If a + Content-Transfer-Encoding header field appears as part of a body + part's headers, it applies only to the body of that body part. If an + entity is of type "multipart" or "message", the Content-Transfer- + Encoding is not permitted to have any value other than a bit width + (e.g., "7bit", "8bit", etc.) or "binary". + + It should be noted that email is character-oriented, so that the + mechanisms described here are mechanisms for encoding arbitrary octet + streams, not bit streams. If a bit stream is to be encoded via one + of these mechanisms, it must first be converted to an 8-bit byte + stream using the network standard bit order ("big-endian"), in which + the earlier bits in a stream become the higher-order bits in a byte. + A bit stream not ending at an 8-bit boundary must be padded with + zeroes. This document provides a mechanism for noting the addition + of such padding in the case of the application Content-Type, which + has a "padding" parameter. + + The encoding mechanisms defined here explicitly encode all data in + ASCII. Thus, for example, suppose an entity has header fields such + as: + + Content-Type: text/plain; charset=ISO-8859-1 + Content-transfer-encoding: base64 + + This must be interpreted to mean that the body is a base64 ASCII + encoding of data that was originally in ISO-8859-1, and will be in + that character set again after decoding. + + The following sections will define the two standard encoding + mechanisms. The definition of new content-transfer-encodings is + explicitly discouraged and should only occur when absolutely + necessary. All content-transfer-encoding namespace except that + beginning with "X-" is explicitly reserved to the IANA for future + use. Private agreements about content-transfer-encodings are also + explicitly discouraged. + + Certain Content-Transfer-Encoding values may only be used on certain + Content-Types. In particular, it is expressly forbidden to use any + encodings other than "7bit", "8bit", or "binary" with any Content- + Type that recursively includes other Content-Type fields, notably the + "multipart" and "message" Content-Types. All encodings that are + desired for bodies of type multipart or message must be done at the + innermost level, by encoding the actual body that needs to be + encoded. + + + +Borenstein & Freed [Page 16] + +RFC 1521 MIME September 1993 + + + NOTE ON ENCODING RESTRICTIONS: Though the prohibition against + using content-transfer-encodings on data of type multipart or + message may seem overly restrictive, it is necessary to prevent + nested encodings, in which data are passed through an encoding + algorithm multiple times, and must be decoded multiple times in + order to be properly viewed. Nested encodings add considerable + complexity to user agents: aside from the obvious efficiency + problems with such multiple encodings, they can obscure the basic + structure of a message. In particular, they can imply that + several decoding operations are necessary simply to find out what + types of objects a message contains. Banning nested encodings may + complicate the job of certain mail gateways, but this seems less + of a problem than the effect of nested encodings on user agents. + + NOTE ON THE RELATIONSHIP BETWEEN CONTENT-TYPE AND CONTENT- + TRANSFER-ENCODING: It may seem that the Content-Transfer-Encoding + could be inferred from the characteristics of the Content-Type + that is to be encoded, or, at the very least, that certain + Content-Transfer-Encodings could be mandated for use with specific + Content-Types. There are several reasons why this is not the case. + First, given the varying types of transports used for mail, some + encodings may be appropriate for some Content-Type/transport + combinations and not for others. (For example, in an 8-bit + transport, no encoding would be required for text in certain + character sets, while such encodings are clearly required for 7- + bit SMTP.) Second, certain Content-Types may require different + types of transfer encoding under different circumstances. For + example, many PostScript bodies might consist entirely of short + lines of 7-bit data and hence require little or no encoding. + Other PostScript bodies (especially those using Level 2 + PostScript's binary encoding mechanism) may only be reasonably + represented using a binary transport encoding. Finally, since + Content-Type is intended to be an open-ended specification + mechanism, strict specification of an association between + Content-Types and encodings effectively couples the specification + of an application protocol with a specific lower-level transport. + This is not desirable since the developers of a Content-Type + should not have to be aware of all the transports in use and what + their limitations are. + + NOTE ON TRANSLATING ENCODINGS: The quoted-printable and base64 + encodings are designed so that conversion between them is + possible. The only issue that arises in such a conversion is the + handling of line breaks. When converting from quoted-printable to + base64 a line break must be converted into a CRLF sequence. + Similarly, a CRLF sequence in base64 data must be converted to a + quoted-printable line break, but ONLY when converting text data. + + + + +Borenstein & Freed [Page 17] + +RFC 1521 MIME September 1993 + + + NOTE ON CANONICAL ENCODING MODEL: There was some confusion, in + earlier drafts of this memo, regarding the model for when email + data was to be converted to canonical form and encoded, and in + particular how this process would affect the treatment of CRLFs, + given that the representation of newlines varies greatly from + system to system, and the relationship between content-transfer- + encodings and character sets. For this reason, a canonical model + for encoding is presented as Appendix G. + +5.1. Quoted-Printable Content-Transfer-Encoding + + The Quoted-Printable encoding is intended to represent data that + largely consists of octets that correspond to printable characters in + the ASCII character set. It encodes the data in such a way that the + resulting octets are unlikely to be modified by mail transport. If + the data being encoded are mostly ASCII text, the encoded form of the + data remains largely recognizable by humans. A body which is + entirely ASCII may also be encoded in Quoted-Printable to ensure the + integrity of the data should the message pass through a character- + translating, and/or line-wrapping gateway. + + In this encoding, octets are to be represented as determined by the + following rules: + + Rule #1: (General 8-bit representation) Any octet, except those + indicating a line break according to the newline convention of the + canonical (standard) form of the data being encoded, may be + represented by an "=" followed by a two digit hexadecimal + representation of the octet's value. The digits of the + hexadecimal alphabet, for this purpose, are "0123456789ABCDEF". + Uppercase letters must be used when sending hexadecimal data, + though a robust implementation may choose to recognize lowercase + letters on receipt. Thus, for example, the value 12 (ASCII form + feed) can be represented by "=0C", and the value 61 (ASCII EQUAL + SIGN) can be represented by "=3D". Except when the following + rules allow an alternative encoding, this rule is mandatory. + + Rule #2: (Literal representation) Octets with decimal values of 33 + through 60 inclusive, and 62 through 126, inclusive, MAY be + represented as the ASCII characters which correspond to those + octets (EXCLAMATION POINT through LESS THAN, and GREATER THAN + through TILDE, respectively). + + Rule #3: (White Space): Octets with values of 9 and 32 MAY be + represented as ASCII TAB (HT) and SPACE characters, respectively, + but MUST NOT be so represented at the end of an encoded line. Any + TAB (HT) or SPACE characters on an encoded line MUST thus be + followed on that line by a printable character. In particular, an + + + +Borenstein & Freed [Page 18] + +RFC 1521 MIME September 1993 + + + "=" at the end of an encoded line, indicating a soft line break + (see rule #5) may follow one or more TAB (HT) or SPACE characters. + It follows that an octet with value 9 or 32 appearing at the end + of an encoded line must be represented according to Rule #1. This + rule is necessary because some MTAs (Message Transport Agents, + programs which transport messages from one user to another, or + perform a part of such transfers) are known to pad lines of text + with SPACEs, and others are known to remove "white space" + characters from the end of a line. Therefore, when decoding a + Quoted-Printable body, any trailing white space on a line must be + deleted, as it will necessarily have been added by intermediate + transport agents. + + Rule #4 (Line Breaks): A line break in a text body, independent of + what its representation is following the canonical representation + of the data being encoded, must be represented by a (RFC 822) line + break, which is a CRLF sequence, in the Quoted-Printable encoding. + Since the canonical representation of types other than text do not + generally include the representation of line breaks, no hard line + breaks (i.e. line breaks that are intended to be meaningful and + to be displayed to the user) should occur in the quoted-printable + encoding of such types. Of course, occurrences of "=0D", "=0A", + "0A=0D" and "=0D=0A" will eventually be encountered. In general, + however, base64 is preferred over quoted-printable for binary + data. + + Note that many implementations may elect to encode the local + representation of various content types directly, as described in + Appendix G. In particular, this may apply to plain text material + on systems that use newline conventions other than CRLF + delimiters. Such an implementation is permissible, but the + generation of line breaks must be generalized to account for the + case where alternate representations of newline sequences are + used. + + Rule #5 (Soft Line Breaks): The Quoted-Printable encoding REQUIRES + that encoded lines be no more than 76 characters long. If longer + lines are to be encoded with the Quoted-Printable encoding, 'soft' + line breaks must be used. An equal sign as the last character on a + encoded line indicates such a non-significant ('soft') line break + in the encoded text. Thus if the "raw" form of the line is a + single unencoded line that says: + + Now's the time for all folk to come to the aid of + their country. + + This can be represented, in the Quoted-Printable encoding, as + + + + +Borenstein & Freed [Page 19] + +RFC 1521 MIME September 1993 + + + Now's the time = + for all folk to come= + to the aid of their country. + + This provides a mechanism with which long lines are encoded in + such a way as to be restored by the user agent. The 76 character + limit does not count the trailing CRLF, but counts all other + characters, including any equal signs. + + Since the hyphen character ("-") is represented as itself in the + Quoted-Printable encoding, care must be taken, when encapsulating a + quoted-printable encoded body in a multipart entity, to ensure that + the encapsulation boundary does not appear anywhere in the encoded + body. (A good strategy is to choose a boundary that includes a + character sequence such as "=_" which can never appear in a quoted- + printable body. See the definition of multipart messages later in + this document.) + + NOTE: The quoted-printable encoding represents something of a + compromise between readability and reliability in transport. + Bodies encoded with the quoted-printable encoding will work + reliably over most mail gateways, but may not work perfectly over + a few gateways, notably those involving translation into EBCDIC. + (In theory, an EBCDIC gateway could decode a quoted-printable body + and re-encode it using base64, but such gateways do not yet + exist.) A higher level of confidence is offered by the base64 + Content-Transfer-Encoding. A way to get reasonably reliable + transport through EBCDIC gateways is to also quote the ASCII + characters + + !"#$@[\]^`{|}~ + + according to rule #1. See Appendix B for more information. + + Because quoted-printable data is generally assumed to be line- + oriented, it is to be expected that the representation of the breaks + between the lines of quoted printable data may be altered in + transport, in the same manner that plain text mail has always been + altered in Internet mail when passing between systems with differing + newline conventions. If such alterations are likely to constitute a + corruption of the data, it is probably more sensible to use the + base64 encoding rather than the quoted-printable encoding. + + WARNING TO IMPLEMENTORS: If binary data are encoded in quoted- + printable, care must be taken to encode CR and LF characters as "=0D" + and "=0A", respectively. In particular, a CRLF sequence in binary + data should be encoded as "=0D=0A". Otherwise, if CRLF were + represented as a hard line break, it might be incorrectly decoded on + + + +Borenstein & Freed [Page 20] + +RFC 1521 MIME September 1993 + + + platforms with different line break conventions. + + For formalists, the syntax of quoted-printable data is described by + the following grammar: + + quoted-printable := ([*(ptext / SPACE / TAB) ptext] ["="] CRLF) + ; Maximum line length of 76 characters excluding CRLF + + ptext := octet / 127, =, SPACE, or TAB, + ; and is recommended for any characters not listed in + ; Appendix B as "mail-safe". + +5.2. Base64 Content-Transfer-Encoding + + The Base64 Content-Transfer-Encoding is designed to represent + arbitrary sequences of octets in a form that need not be humanly + readable. The encoding and decoding algorithms are simple, but the + encoded data are consistently only about 33 percent larger than the + unencoded data. This encoding is virtually identical to the one used + in Privacy Enhanced Mail (PEM) applications, as defined in RFC 1421. + The base64 encoding is adapted from RFC 1421, with one change: base64 + eliminates the "*" mechanism for embedded clear text. + + A 65-character subset of US-ASCII is used, enabling 6 bits to be + represented per printable character. (The extra 65th character, "=", + is used to signify a special processing function.) + + NOTE: This subset has the important property that it is + represented identically in all versions of ISO 646, including US + ASCII, and all characters in the subset are also represented + identically in all versions of EBCDIC. Other popular encodings, + such as the encoding used by the uuencode utility and the base85 + encoding specified as part of Level 2 PostScript, do not share + these properties, and thus do not fulfill the portability + requirements a binary transport encoding for mail must meet. + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8-bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + When encoding a bit stream via the base64 encoding, the bit stream + must be presumed to be ordered with the most-significant-bit first. + + + +Borenstein & Freed [Page 21] + +RFC 1521 MIME September 1993 + + + That is, the first bit in the stream will be the high-order bit in + the first byte, and the eighth bit will be the low-order bit in the + first byte, and so on. + + Each 6-bit group is used as an index into an array of 64 printable + characters. The character referenced by the index is placed in the + output string. These characters, identified in Table 1, below, are + selected so as to be universally representable, and the set excludes + characters with particular significance to SMTP (e.g., ".", CR, LF) + and to the encapsulation boundaries defined in this document (e.g., + "-"). + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y + + The output stream (encoded bytes) must be represented in lines of no + more than 76 characters each. All line breaks or other characters + not found in Table 1 must be ignored by decoding software. In base64 + data, characters other than those in Table 1, line breaks, and other + white space probably indicate a transmission error, about which a + warning message or even a message rejection might be appropriate + under some circumstances. + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a body. When fewer than 24 input bits + are available in an input group, zero bits are added (on the right) + to form an integral number of 6-bit groups. Padding at the end of + the data is performed using the '=' character. Since all base64 + input is an integral number of octets, only the following cases can + + + +Borenstein & Freed [Page 22] + +RFC 1521 MIME September 1993 + + + arise: (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded output will be + an integral multiple of 4 characters with no "=" padding, (2) the + final quantum of encoding input is exactly 8 bits; here, the final + unit of encoded output will be two characters followed by two "=" + padding characters, or (3) the final quantum of encoding input is + exactly 16 bits; here, the final unit of encoded output will be three + characters followed by one "=" padding character. + + Because it is used only for padding at the end of the data, the + occurrence of any '=' characters may be taken as evidence that the + end of the data has been reached (without truncation in transit). No + such assurance is possible, however, when the number of octets + transmitted was a multiple of three. + + Any characters outside of the base64 alphabet are to be ignored in + base64-encoded data. The same applies to any illegal sequence of + characters in the base64 encoding, such as "=====" + + Care must be taken to use the proper octets for line breaks if base64 + encoding is applied directly to text material that has not been + converted to canonical form. In particular, text line breaks must be + converted into CRLF sequences prior to base64 encoding. The important + thing to note is that this may be done directly by the encoder rather + than in a prior canonicalization step in some implementations. + + NOTE: There is no need to worry about quoting apparent + encapsulation boundaries within base64-encoded parts of multipart + entities because no hyphen characters are used in the base64 + encoding. + +6. Additional Content-Header Fields + +6.1. Optional Content-ID Header Field + + In constructing a high-level user agent, it may be desirable to allow + one body to make reference to another. Accordingly, bodies may be + labeled using the "Content-ID" header field, which is syntactically + identical to the "Message-ID" header field: + + id := "Content-ID" ":" msg-id + Like the Message-ID values, Content-ID values must be generated to be + world-unique. + + The Content-ID value may be used for uniquely identifying MIME + entities in several contexts, particularly for cacheing data + referenced by the message/external-body mechanism. Although the + Content-ID header is generally optional, its use is mandatory in + + + +Borenstein & Freed [Page 23] + +RFC 1521 MIME September 1993 + + + implementations which generate data of the optional MIME Content-type + "message/external-body". That is, each message/external-body entity + must have a Content-ID field to permit cacheing of such data. + + It is also worth noting that the Content-ID value has special + semantics in the case of the multipart/alternative content-type. + This is explained in the section of this document dealing with + multipart/alternative. + +6.2. Optional Content-Description Header Field + + The ability to associate some descriptive information with a given + body is often desirable. For example, it may be useful to mark an + "image" body as "a picture of the Space Shuttle Endeavor." Such text + may be placed in the Content-Description header field. + + description := "Content-Description" ":" *text + + The description is presumed to be given in the US-ASCII character + set, although the mechanism specified in [RFC-1522] may be used for + non-US-ASCII Content-Description values. + +7. The Predefined Content-Type Values + + This document defines seven initial Content-Type values and an + extension mechanism for private or experimental types. Further + standard types must be defined by new published specifications. It + is expected that most innovation in new types of mail will take place + as subtypes of the seven types defined here. The most essential + characteristics of the seven content-types are summarized in Appendix + F. + +7.1 The Text Content-Type + + The text Content-Type is intended for sending material which is + principally textual in form. It is the default Content-Type. A + "charset" parameter may be used to indicate the character set of the + body text for some text subtypes, notably including the primary + subtype, "text/plain", which indicates plain (unformatted) text. The + default Content-Type for Internet mail is "text/plain; charset=us- + ascii". + + Beyond plain text, there are many formats for representing what might + be known as "extended text" -- text with embedded formatting and + presentation information. An interesting characteristic of many such + representations is that they are to some extent readable even without + the software that interprets them. It is useful, then, to + distinguish them, at the highest level, from such unreadable data as + + + +Borenstein & Freed [Page 24] + +RFC 1521 MIME September 1993 + + + images, audio, or text represented in an unreadable form. In the + absence of appropriate interpretation software, it is reasonable to + show subtypes of text to the user, while it is not reasonable to do + so with most nontextual data. + + Such formatted textual data should be represented using subtypes of + text. Plausible subtypes of text are typically given by the common + name of the representation format, e.g., "text/richtext" [RFC-1341]. + +7.1.1. The charset parameter + + A critical parameter that may be specified in the Content-Type field + for text/plain data is the character set. This is specified with a + "charset" parameter, as in: + + Content-type: text/plain; charset=us-ascii + + Unlike some other parameter values, the values of the charset + parameter are NOT case sensitive. The default character set, which + must be assumed in the absence of a charset parameter, is US-ASCII. + + The specification for any future subtypes of "text" must specify + whether or not they will also utilize a "charset" parameter, and may + possibly restrict its values as well. When used with a particular + body, the semantics of the "charset" parameter should be identical to + those specified here for "text/plain", i.e., the body consists + entirely of characters in the given charset. In particular, definers + of future text subtypes should pay close attention the the + implications of multibyte character sets for their subtype + definitions. + + This RFC specifies the definition of the charset parameter for the + purposes of MIME to be a unique mapping of a byte stream to glyphs, a + mapping which does not require external profiling information. + + An initial list of predefined character set names can be found at the + end of this section. Additional character sets may be registered + with IANA, although the standardization of their use requires the + usual IESG [RFC-1340] review and approval. Note that if the + specified character set includes 8-bit data, a Content-Transfer- + Encoding header field and a corresponding encoding on the data are + required in order to transmit the body via some mail transfer + protocols, such as SMTP. + + The default character set, US-ASCII, has been the subject of some + confusion and ambiguity in the past. Not only were there some + ambiguities in the definition, there have been wide variations in + practice. In order to eliminate such ambiguity and variations in the + + + +Borenstein & Freed [Page 25] + +RFC 1521 MIME September 1993 + + + future, it is strongly recommended that new user agents explicitly + specify a character set via the Content-Type header field. "US- + ASCII" does not indicate an arbitrary seven-bit character code, but + specifies that the body uses character coding that uses the exact + correspondence of codes to characters specified in ASCII. National + use variations of ISO 646 [ISO-646] are NOT ASCII and their use in + Internet mail is explicitly discouraged. The omission of the ISO 646 + character set is deliberate in this regard. The character set name + of "US-ASCII" explicitly refers to ANSI X3.4-1986 [US-ASCII] only. + The character set name "ASCII" is reserved and must not be used for + any purpose. + + NOTE: RFC 821 explicitly specifies "ASCII", and references an + earlier version of the American Standard. Insofar as one of the + purposes of specifying a Content-Type and character set is to + permit the receiver to unambiguously determine how the sender + intended the coded message to be interpreted, assuming anything + other than "strict ASCII" as the default would risk unintentional + and incompatible changes to the semantics of messages now being + transmitted. This also implies that messages containing + characters coded according to national variations on ISO 646, or + using code-switching procedures (e.g., those of ISO 2022), as well + as 8-bit or multiple octet character encodings MUST use an + appropriate character set specification to be consistent with this + specification. + + The complete US-ASCII character set is listed in [US-ASCII]. Note + that the control characters including DEL (0-31, 127) have no defined + meaning apart from the combination CRLF (ASCII values 13 and 10) + indicating a new line. Two of the characters have de facto meanings + in wide use: FF (12) often means "start subsequent text on the + beginning of a new page"; and TAB or HT (9) often (though not always) + means "move the cursor to the next available column after the current + position where the column number is a multiple of 8 (counting the + first column as column 0)." Apart from this, any use of the control + characters or DEL in a body must be part of a private agreement + between the sender and recipient. Such private agreements are + discouraged and should be replaced by the other capabilities of this + document. + + NOTE: Beyond US-ASCII, an enormous proliferation of character sets + is possible. It is the opinion of the IETF working group that a + large number of character sets is NOT a good thing. We would + prefer to specify a single character set that can be used + universally for representing all of the world's languages in + electronic mail. Unfortunately, existing practice in several + communities seems to point to the continued use of multiple + character sets in the near future. For this reason, we define + + + +Borenstein & Freed [Page 26] + +RFC 1521 MIME September 1993 + + + names for a small number of character sets for which a strong + constituent base exists. + + The defined charset values are: + + US-ASCII -- as defined in [US-ASCII]. + + ISO-8859-X -- where "X" is to be replaced, as necessary, for the + parts of ISO-8859 [ISO-8859]. Note that the ISO 646 + character sets have deliberately been omitted in favor of + their 8859 replacements, which are the designated character + sets for Internet mail. As of the publication of this + document, the legitimate values for "X" are the digits 1 + through 9. + + The character sets specified above are the ones that were relatively + uncontroversial during the drafting of MIME. This document does not + endorse the use of any particular character set other than US-ASCII, + and recognizes that the future evolution of world character sets + remains unclear. It is expected that in the future, additional + character sets will be registered for use in MIME. + + Note that the character set used, if anything other than US-ASCII, + must always be explicitly specified in the Content-Type field. + + No other character set name may be used in Internet mail without the + publication of a formal specification and its registration with IANA, + or by private agreement, in which case the character set name must + begin with "X-". + + Implementors are discouraged from defining new character sets for + mail use unless absolutely necessary. + + The "charset" parameter has been defined primarily for the purpose of + textual data, and is described in this section for that reason. + However, it is conceivable that non-textual data might also wish to + specify a charset value for some purpose, in which case the same + syntax and values should be used. + + In general, mail-sending software must always use the "lowest common + denominator" character set possible. For example, if a body contains + only US-ASCII characters, it must be marked as being in the US-ASCII + character set, not ISO-8859-1, which, like all the ISO-8859 family of + character sets, is a superset of US-ASCII. More generally, if a + widely-used character set is a subset of another character set, and a + body contains only characters in the widely-used subset, it must be + labeled as being in that subset. This will increase the chances that + the recipient will be able to view the mail correctly. + + + +Borenstein & Freed [Page 27] + +RFC 1521 MIME September 1993 + + +7.1.2. The Text/plain subtype + + The primary subtype of text is "plain". This indicates plain + (unformatted) text. The default Content-Type for Internet mail, + "text/plain; charset=us-ascii", describes existing Internet practice. + That is, it is the type of body defined by RFC 822. + + No other text subtype is defined by this document. + + The formal grammar for the content-type header field for text is as + follows: + + text-type := "text" "/" text-subtype [";" "charset" "=" charset] + + text-subtype := "plain" / extension-token + + charset := "us-ascii"/ "iso-8859-1"/ "iso-8859-2"/ "iso-8859-3" + / "iso-8859-4"/ "iso-8859-5"/ "iso-8859-6"/ "iso-8859-7" + / "iso-8859-8" / "iso-8859-9" / extension-token + ; case insensitive + +7.2. The Multipart Content-Type + + In the case of multiple part entities, in which one or more different + sets of data are combined in a single body, a "multipart" Content- + Type field must appear in the entity's header. The body must then + contain one or more "body parts," each preceded by an encapsulation + boundary, and the last one followed by a closing boundary. Each part + starts with an encapsulation boundary, and then contains a body part + consisting of header area, a blank line, and a body area. Thus a + body part is similar to an RFC 822 message in syntax, but different + in meaning. + + A body part is NOT to be interpreted as actually being an RFC 822 + message. To begin with, NO header fields are actually required in + body parts. A body part that starts with a blank line, therefore, is + allowed and is a body part for which all default values are to be + assumed. In such a case, the absence of a Content-Type header field + implies that the corresponding body is plain US-ASCII text. The only + header fields that have defined meaning for body parts are those the + names of which begin with "Content-". All other header fields are + generally to be ignored in body parts. Although they should + generally be retained in mail processing, they may be discarded by + gateways if necessary. Such other fields are permitted to appear in + body parts but must not be depended on. "X-" fields may be created + for experimental or private purposes, with the recognition that the + information they contain may be lost at some gateways. + + + + +Borenstein & Freed [Page 28] + +RFC 1521 MIME September 1993 + + + NOTE: The distinction between an RFC 822 message and a body part + is subtle, but important. A gateway between Internet and X.400 + mail, for example, must be able to tell the difference between a + body part that contains an image and a body part that contains an + encapsulated message, the body of which is an image. In order to + represent the latter, the body part must have "Content-Type: + message", and its body (after the blank line) must be the + encapsulated message, with its own "Content-Type: image" header + field. The use of similar syntax facilitates the conversion of + messages to body parts, and vice versa, but the distinction + between the two must be understood by implementors. (For the + special case in which all parts actually are messages, a "digest" + subtype is also defined.) + + As stated previously, each body part is preceded by an encapsulation + boundary. The encapsulation boundary MUST NOT appear inside any of + the encapsulated parts. Thus, it is crucial that the composing agent + be able to choose and specify the unique boundary that will separate + the parts. + + All present and future subtypes of the "multipart" type must use an + identical syntax. Subtypes may differ in their semantics, and may + impose additional restrictions on syntax, but must conform to the + required syntax for the multipart type. This requirement ensures + that all conformant user agents will at least be able to recognize + and separate the parts of any multipart entity, even of an + unrecognized subtype. + + As stated in the definition of the Content-Transfer-Encoding field, + no encoding other than "7bit", "8bit", or "binary" is permitted for + entities of type "multipart". The multipart delimiters and header + fields are always represented as 7-bit ASCII in any case (though the + header fields may encode non-ASCII header text as per [RFC-1522]), + and data within the body parts can be encoded on a part-by-part + basis, with Content-Transfer-Encoding fields for each appropriate + body part. + + Mail gateways, relays, and other mail handling agents are commonly + known to alter the top-level header of an RFC 822 message. In + particular, they frequently add, remove, or reorder header fields. + Such alterations are explicitly forbidden for the body part headers + embedded in the bodies of messages of type "multipart." + +7.2.1. Multipart: The common syntax + + All subtypes of "multipart" share a common syntax, defined in this + section. A simple example of a multipart message also appears in + this section. An example of a more complex multipart message is + + + +Borenstein & Freed [Page 29] + +RFC 1521 MIME September 1993 + + + given in Appendix C. + + The Content-Type field for multipart entities requires one parameter, + "boundary", which is used to specify the encapsulation boundary. The + encapsulation boundary is defined as a line consisting entirely of + two hyphen characters ("-", decimal code 45) followed by the boundary + parameter value from the Content-Type header field. + + NOTE: The hyphens are for rough compatibility with the earlier RFC + 934 method of message encapsulation, and for ease of searching for + the boundaries in some implementations. However, it should be + noted that multipart messages are NOT completely compatible with + RFC 934 encapsulations; in particular, they do not obey RFC 934 + quoting conventions for embedded lines that begin with hyphens. + This mechanism was chosen over the RFC 934 mechanism because the + latter causes lines to grow with each level of quoting. The + combination of this growth with the fact that SMTP implementations + sometimes wrap long lines made the RFC 934 mechanism unsuitable + for use in the event that deeply-nested multipart structuring is + ever desired. + + WARNING TO IMPLEMENTORS: The grammar for parameters on the Content- + type field is such that it is often necessary to enclose the + boundaries in quotes on the Content-type line. This is not always + necessary, but never hurts. Implementors should be sure to study the + grammar carefully in order to avoid producing illegal Content-type + fields. Thus, a typical multipart Content-Type header field might + look like this: + + Content-Type: multipart/mixed; + boundary=gc0p4Jq0M2Yt08jU534c0p + + But the following is illegal: + + Content-Type: multipart/mixed; + boundary=gc0p4Jq0M:2Yt08jU534c0p + + (because of the colon) and must instead be represented as + + Content-Type: multipart/mixed; + boundary="gc0p4Jq0M:2Yt08jU534c0p" + + This indicates that the entity consists of several parts, each itself + with a structure that is syntactically identical to an RFC 822 + message, except that the header area might be completely empty, and + that the parts are each preceded by the line + + --gc0p4Jq0M:2Yt08jU534c0p + + + +Borenstein & Freed [Page 30] + +RFC 1521 MIME September 1993 + + + Note that the encapsulation boundary must occur at the beginning of a + line, i.e., following a CRLF, and that the initial CRLF is considered + to be attached to the encapsulation boundary rather than part of the + preceding part. The boundary must be followed immediately either by + another CRLF and the header fields for the next part, or by two + CRLFs, in which case there are no header fields for the next part + (and it is therefore assumed to be of Content-Type text/plain). + + NOTE: The CRLF preceding the encapsulation line is conceptually + attached to the boundary so that it is possible to have a part + that does not end with a CRLF (line break). Body parts that must + be considered to end with line breaks, therefore, must have two + CRLFs preceding the encapsulation line, the first of which is part + of the preceding body part, and the second of which is part of the + encapsulation boundary. + + Encapsulation boundaries must not appear within the encapsulations, + and must be no longer than 70 characters, not counting the two + leading hyphens. + + The encapsulation boundary following the last body part is a + distinguished delimiter that indicates that no further body parts + will follow. Such a delimiter is identical to the previous + delimiters, with the addition of two more hyphens at the end of the + line: + + --gc0p4Jq0M2Yt08jU534c0p-- + + There appears to be room for additional information prior to the + first encapsulation boundary and following the final boundary. These + areas should generally be left blank, and implementations must ignore + anything that appears before the first boundary or after the last + one. + + NOTE: These "preamble" and "epilogue" areas are generally not used + because of the lack of proper typing of these parts and the lack + of clear semantics for handling these areas at gateways, + particularly X.400 gateways. However, rather than leaving the + preamble area blank, many MIME implementations have found this to + be a convenient place to insert an explanatory note for recipients + who read the message with pre-MIME software, since such notes will + be ignored by MIME-compliant software. + + NOTE: Because encapsulation boundaries must not appear in the body + parts being encapsulated, a user agent must exercise care to + choose a unique boundary. The boundary in the example above could + have been the result of an algorithm designed to produce + boundaries with a very low probability of already existing in the + + + +Borenstein & Freed [Page 31] + +RFC 1521 MIME September 1993 + + + data to be encapsulated without having to prescan the data. + Alternate algorithms might result in more 'readable' boundaries + for a recipient with an old user agent, but would require more + attention to the possibility that the boundary might appear in the + encapsulated part. The simplest boundary possible is something + like "---", with a closing boundary of "-----". + + As a very simple example, the following multipart message has two + parts, both of them plain text, one of them explicitly typed and one + of them implicitly typed: + + From: Nathaniel Borenstein + To: Ned Freed + Subject: Sample message + MIME-Version: 1.0 + Content-type: multipart/mixed; boundary="simple + boundary" + + This is the preamble. It is to be ignored, though it + is a handy place for mail composers to include an + explanatory note to non-MIME conformant readers. + --simple boundary + + This is implicitly typed plain ASCII text. + It does NOT end with a linebreak. + --simple boundary + Content-type: text/plain; charset=us-ascii + + This is explicitly typed plain ASCII text. + It DOES end with a linebreak. + + --simple boundary-- + This is the epilogue. It is also to be ignored. + + The use of a Content-Type of multipart in a body part within another + multipart entity is explicitly allowed. In such cases, for obvious + reasons, care must be taken to ensure that each nested multipart + entity must use a different boundary delimiter. See Appendix C for an + example of nested multipart entities. + + The use of the multipart Content-Type with only a single body part + may be useful in certain contexts, and is explicitly permitted. + + The only mandatory parameter for the multipart Content-Type is the + boundary parameter, which consists of 1 to 70 characters from a set + of characters known to be very robust through email gateways, and NOT + ending with white space. (If a boundary appears to end with white + space, the white space must be presumed to have been added by a + + + +Borenstein & Freed [Page 32] + +RFC 1521 MIME September 1993 + + + gateway, and must be deleted.) It is formally specified by the + following BNF: + + boundary := 0*69 bcharsnospace + + bchars := bcharsnospace / " " + + bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / "+" /"_" + / "," / "-" / "." / "/" / ":" / "=" / "?" + + Overall, the body of a multipart entity may be specified as + follows: + + multipart-body := preamble 1*encapsulation + close-delimiter epilogue + + encapsulation := delimiter body-part CRLF + + delimiter := "--" boundary CRLF ; taken from Content-Type field. + ; There must be no space + ; between "--" and boundary. + + close-delimiter := "--" boundary "--" CRLF ; Again, no space + by "--", + + preamble := discard-text ; to be ignored upon receipt. + + epilogue := discard-text ; to be ignored upon receipt. + + discard-text := *(*text CRLF) + + body-part := <"message" as defined in RFC 822, + with all header fields optional, and with the + specified delimiter not occurring anywhere in + the message body, either on a line by itself + or as a substring anywhere. Note that the + semantics of a part differ from the semantics + of a message, as described in the text.> + + NOTE: In certain transport enclaves, RFC 822 restrictions such as + the one that limits bodies to printable ASCII characters may not + be in force. (That is, the transport domains may resemble + standard Internet mail transport as specified in RFC821 and + assumed by RFC822, but without certain restrictions.) The + relaxation of these restrictions should be construed as locally + extending the definition of bodies, for example to include octets + outside of the ASCII range, as long as these extensions are + supported by the transport and adequately documented in the + + + +Borenstein & Freed [Page 33] + +RFC 1521 MIME September 1993 + + + Content-Transfer-Encoding header field. However, in no event are + headers (either message headers or body-part headers) allowed to + contain anything other than ASCII characters. + + NOTE: Conspicuously missing from the multipart type is a notion of + structured, related body parts. In general, it seems premature to + try to standardize interpart structure yet. It is recommended + that those wishing to provide a more structured or integrated + multipart messaging facility should define a subtype of multipart + that is syntactically identical, but that always expects the + inclusion of a distinguished part that can be used to specify the + structure and integration of the other parts, probably referring + to them by their Content-ID field. If this approach is used, + other implementations will not recognize the new subtype, but will + treat it as the primary subtype (multipart/mixed) and will thus be + able to show the user the parts that are recognized. + +7.2.2. The Multipart/mixed (primary) subtype + + The primary subtype for multipart, "mixed", is intended for use when + the body parts are independent and need to be bundled in a particular + order. Any multipart subtypes that an implementation does not + recognize must be treated as being of subtype "mixed". + +7.2.3. The Multipart/alternative subtype + + The multipart/alternative type is syntactically identical to + multipart/mixed, but the semantics are different. In particular, + each of the parts is an "alternative" version of the same + information. + + Systems should recognize that the content of the various parts are + interchangeable. Systems should choose the "best" type based on the + local environment and preferences, in some cases even through user + interaction. As with multipart/mixed, the order of body parts is + significant. In this case, the alternatives appear in an order of + increasing faithfulness to the original content. In general, the best + choice is the LAST part of a type supported by the recipient system's + local environment. + + Multipart/alternative may be used, for example, to send mail in a + fancy text format in such a way that it can easily be displayed + anywhere: + + + + + + + + +Borenstein & Freed [Page 34] + +RFC 1521 MIME September 1993 + + + From: Nathaniel Borenstein + To: Ned Freed + Subject: Formatted text mail + MIME-Version: 1.0 + Content-Type: multipart/alternative; boundary=boundary42 + + --boundary42 + + Content-Type: text/plain; charset=us-ascii + + ...plain text version of message goes here.... + --boundary42 + Content-Type: text/richtext + + .... RFC 1341 richtext version of same message goes here ... + --boundary42 + Content-Type: text/x-whatever + + .... fanciest formatted version of same message goes here + ... + --boundary42-- + + In this example, users whose mail system understood the "text/x- + whatever" format would see only the fancy version, while other users + would see only the richtext or plain text version, depending on the + capabilities of their system. + + In general, user agents that compose multipart/alternative entities + must place the body parts in increasing order of preference, that is, + with the preferred format last. For fancy text, the sending user + agent should put the plainest format first and the richest format + last. Receiving user agents should pick and display the last format + they are capable of displaying. In the case where one of the + alternatives is itself of type "multipart" and contains unrecognized + sub-parts, the user agent may choose either to show that alternative, + an earlier alternative, or both. + + NOTE: From an implementor's perspective, it might seem more + sensible to reverse this ordering, and have the plainest + alternative last. However, placing the plainest alternative first + is the friendliest possible option when multipart/alternative + entities are viewed using a non-MIME-conformant mail reader. + While this approach does impose some burden on conformant mail + readers, interoperability with older mail readers was deemed to be + more important in this case. + + It may be the case that some user agents, if they can recognize more + than one of the formats, will prefer to offer the user the choice of + + + +Borenstein & Freed [Page 35] + +RFC 1521 MIME September 1993 + + + which format to view. This makes sense, for example, if mail + includes both a nicely-formatted image version and an easily-edited + text version. What is most critical, however, is that the user not + automatically be shown multiple versions of the same data. Either + the user should be shown the last recognized version or should be + given the choice. + + NOTE ON THE SEMANTICS OF CONTENT-ID IN MULTIPART/ALTERNATIVE: Each + part of a multipart/alternative entity represents the same data, but + the mappings between the two are not necessarily without information + loss. For example, information is lost when translating ODA to + PostScript or plain text. It is recommended that each part should + have a different Content-ID value in the case where the information + content of the two parts is not identical. However, where the + information content is identical -- for example, where several parts + of type "application/external- body" specify alternate ways to access + the identical data -- the same Content-ID field value should be used, + to optimize any cacheing mechanisms that might be present on the + recipient's end. However, it is recommended that the Content-ID + values used by the parts should not be the same Content-ID value that + describes the multipart/alternative as a whole, if there is any such + Content-ID field. That is, one Content-ID value will refer to the + multipart/alternative entity, while one or more other Content-ID + values will refer to the parts inside it. + +7.2.4. The Multipart/digest subtype + + This document defines a "digest" subtype of the multipart Content- + Type. This type is syntactically identical to multipart/mixed, but + the semantics are different. In particular, in a digest, the default + Content-Type value for a body part is changed from "text/plain" to + "message/rfc822". This is done to allow a more readable digest + format that is largely compatible (except for the quoting convention) + with RFC 934. + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 36] + +RFC 1521 MIME September 1993 + + + A digest in this format might, then, look something like this: + + From: Moderator-Address + To: Recipient-List + MIME-Version: 1.0 + Subject: Internet Digest, volume 42 + Content-Type: multipart/digest; + boundary="---- next message ----" + + ------ next message ---- + + From: someone-else + Subject: my opinion + + ...body goes here ... + + ------ next message ---- + + From: someone-else-again + Subject: my different opinion + + ... another body goes here... + + ------ next message ------ + +7.2.5. The Multipart/parallel subtype + + This document defines a "parallel" subtype of the multipart Content- + Type. This type is syntactically identical to multipart/mixed, but + the semantics are different. In particular, in a parallel entity, + the order of body parts is not significant. + + A common presentation of this type is to display all of the parts + simultaneously on hardware and software that are capable of doing so. + However, composing agents should be aware that many mail readers will + lack this capability and will show the parts serially in any event. + +7.2.6. Other Multipart subtypes + + Other multipart subtypes are expected in the future. MIME + implementations must in general treat unrecognized subtypes of + multipart as being equivalent to "multipart/mixed". + + The formal grammar for content-type header fields for multipart data + is given by: + + multipart-type := "multipart" "/" multipart-subtype + ";" "boundary" "=" boundary + + + +Borenstein & Freed [Page 37] + +RFC 1521 MIME September 1993 + + + multipart-subtype := "mixed" / "parallel" / "digest" + / "alternative" / extension-token + +7.3. The Message Content-Type + + It is frequently desirable, in sending mail, to encapsulate another + mail message. For this common operation, a special Content-Type, + "message", is defined. The primary subtype, message/rfc822, has no + required parameters in the Content-Type field. Additional subtypes, + "partial" and "External-body", do have required parameters. These + subtypes are explained below. + + NOTE: It has been suggested that subtypes of message might be + defined for forwarded or rejected messages. However, forwarded + and rejected messages can be handled as multipart messages in + which the first part contains any control or descriptive + information, and a second part, of type message/rfc822, is the + forwarded or rejected message. Composing rejection and forwarding + messages in this manner will preserve the type information on the + original message and allow it to be correctly presented to the + recipient, and hence is strongly encouraged. + + As stated in the definition of the Content-Transfer-Encoding field, + no encoding other than "7bit", "8bit", or "binary" is permitted for + messages or parts of type "message". Even stronger restrictions + apply to the subtypes "message/partial" and "message/external-body", + as specified below. The message header fields are always US-ASCII in + any case, and data within the body can still be encoded, in which + case the Content-Transfer-Encoding header field in the encapsulated + message will reflect this. Non-ASCII text in the headers of an + encapsulated message can be specified using the mechanisms described + in [RFC-1522]. + + Mail gateways, relays, and other mail handling agents are commonly + known to alter the top-level header of an RFC 822 message. In + particular, they frequently add, remove, or reorder header fields. + Such alterations are explicitly forbidden for the encapsulated + headers embedded in the bodies of messages of type "message." + +7.3.1. The Message/rfc822 (primary) subtype + + A Content-Type of "message/rfc822" indicates that the body contains + an encapsulated message, with the syntax of an RFC 822 message. + However, unlike top-level RFC 822 messages, it is not required that + each message/rfc822 body must include a "From", "Subject", and at + least one destination header. + + It should be noted that, despite the use of the numbers "822", a + + + +Borenstein & Freed [Page 38] + +RFC 1521 MIME September 1993 + + + message/rfc822 entity can include enhanced information as defined in + this document. In other words, a message/rfc822 message may be a + MIME message. + +7.3.2. The Message/Partial subtype + + A subtype of message, "partial", is defined in order to allow large + objects to be delivered as several separate pieces of mail and + automatically reassembled by the receiving user agent. (The concept + is similar to IP fragmentation/reassembly in the basic Internet + Protocols.) This mechanism can be used when intermediate transport + agents limit the size of individual messages that can be sent. + Content-Type "message/partial" thus indicates that the body contains + a fragment of a larger message. + + Three parameters must be specified in the Content-Type field of type + message/partial: The first, "id", is a unique identifier, as close to + a world-unique identifier as possible, to be used to match the parts + together. (In general, the identifier is essentially a message-id; + if placed in double quotes, it can be any message-id, in accordance + with the BNF for "parameter" given earlier in this specification.) + The second, "number", an integer, is the part number, which indicates + where this part fits into the sequence of fragments. The third, + "total", another integer, is the total number of parts. This third + subfield is required on the final part, and is optional (though + encouraged) on the earlier parts. Note also that these parameters + may be given in any order. + + Thus, part 2 of a 3-part message may have either of the following + header fields: + + Content-Type: Message/Partial; + number=2; total=3; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com" + + Content-Type: Message/Partial; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com"; + number=2 + + But part 3 MUST specify the total number of parts: + + Content-Type: Message/Partial; + number=3; total=3; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com" + + Note that part numbering begins with 1, not 0. + + When the parts of a message broken up in this manner are put + + + +Borenstein & Freed [Page 39] + +RFC 1521 MIME September 1993 + + + together, the result is a complete MIME entity, which may have its + own Content-Type header field, and thus may contain any other data + type. + + Message fragmentation and reassembly: The semantics of a reassembled + partial message must be those of the "inner" message, rather than of + a message containing the inner message. This makes it possible, for + example, to send a large audio message as several partial messages, + and still have it appear to the recipient as a simple audio message + rather than as an encapsulated message containing an audio message. + That is, the encapsulation of the message is considered to be + "transparent". + + When generating and reassembling the parts of a message/partial + message, the headers of the encapsulated message must be merged with + the headers of the enclosing entities. In this process the following + rules must be observed: + + (1) All of the header fields from the initial enclosing entity + (part one), except those that start with "Content-" and the + specific header fields "Message-ID", "Encrypted", and "MIME- + Version", must be copied, in order, to the new message. + + (2) Only those header fields in the enclosed message which start + with "Content-" and "Message-ID", "Encrypted", and "MIME-Version" + must be appended, in order, to the header fields of the new + message. Any header fields in the enclosed message which do not + start with "Content-" (except for "Message-ID", "Encrypted", and + "MIME-Version") will be ignored. + + (3) All of the header fields from the second and any subsequent + messages will be ignored. + + For example, if an audio message is broken into two parts, the first + part might look something like this: + + X-Weird-Header-1: Foo + From: Bill@host.com + To: joe@otherhost.com + Subject: Audio mail + Message-ID: + MIME-Version: 1.0 + Content-type: message/partial; + id="ABC@host.com"; + number=1; total=2 + + X-Weird-Header-1: Bar + X-Weird-Header-2: Hello + + + +Borenstein & Freed [Page 40] + +RFC 1521 MIME September 1993 + + + Message-ID: + MIME-Version: 1.0 + Content-type: audio/basic + Content-transfer-encoding: base64 + + ... first half of encoded audio data goes here... + + and the second half might look something like this: + + From: Bill@host.com + To: joe@otherhost.com + Subject: Audio mail + MIME-Version: 1.0 + Message-ID: + Content-type: message/partial; + id="ABC@host.com"; number=2; total=2 + + ... second half of encoded audio data goes here... + + Then, when the fragmented message is reassembled, the resulting + message to be displayed to the user should look something like this: + + X-Weird-Header-1: Foo + From: Bill@host.com + To: joe@otherhost.com + Subject: Audio mail + Message-ID: + MIME-Version: 1.0 + Content-type: audio/basic + Content-transfer-encoding: base64 + + ... first half of encoded audio data goes here... + ... second half of encoded audio data goes here... + + Note on encoding of MIME entities encapsulated inside message/partial + entities: Because data of type "message" may never be encoded in + base64 or quoted-printable, a problem might arise if message/partial + entities are constructed in an environment that supports binary or + 8-bit transport. The problem is that the binary data would be split + into multiple message/partial objects, each of them requiring binary + transport. If such objects were encountered at a gateway into a 7- + bit transport environment, there would be no way to properly encode + them for the 7-bit world, aside from waiting for all of the parts, + reassembling the message, and then encoding the reassembled data in + base64 or quoted-printable. Since it is possible that different + parts might go through different gateways, even this is not an + acceptable solution. For this reason, it is specified that MIME + entities of type message/partial must always have a content- + + + +Borenstein & Freed [Page 41] + +RFC 1521 MIME September 1993 + + + transfer-encoding of 7-bit (the default). In particular, even in + environments that support binary or 8-bit transport, the use of a + content-transfer-encoding of "8bit" or "binary" is explicitly + prohibited for entities of type message/partial. + + It should be noted that, because some message transfer agents may + choose to automatically fragment large messages, and because such + agents may use different fragmentation thresholds, it is possible + that the pieces of a partial message, upon reassembly, may prove + themselves to comprise a partial message. This is explicitly + permitted. + + It should also be noted that the inclusion of a "References" field in + the headers of the second and subsequent pieces of a fragmented + message that references the Message-Id on the previous piece may be + of benefit to mail readers that understand and track references. + However, the generation of such "References" fields is entirely + optional. + + Finally, it should be noted that the "Encrypted" header field has + been made obsolete by Privacy Enhanced Messaging (PEM), but the rules + above are believed to describe the correct way to treat it if it is + encountered in the context of conversion to and from message/partial + fragments. + +7.3.3. The Message/External-Body subtype + + The external-body subtype indicates that the actual body data are not + included, but merely referenced. In this case, the parameters + describe a mechanism for accessing the external data. + + When an entity is of type "message/external-body", it consists of a + header, two consecutive CRLFs, and the message header for the + encapsulated message. If another pair of consecutive CRLFs appears, + this of course ends the message header for the encapsulated message. + However, since the encapsulated message's body is itself external, it + does NOT appear in the area that follows. For example, consider the + following message: + + Content-type: message/external-body; access- + type=local-file; + + name="/u/nsb/Me.gif" + + Content-type: image/gif + Content-ID: + Content-Transfer-Encoding: binary + + + + +Borenstein & Freed [Page 42] + +RFC 1521 MIME September 1993 + + + THIS IS NOT REALLY THE BODY! + + The area at the end, which might be called the "phantom body", is + ignored for most external-body messages. However, it may be used to + contain auxiliary information for some such messages, as indeed it is + when the access-type is "mail-server". Of the access-types defined + by this document, the phantom body is used only when the access-type + is "mail-server". In all other cases, the phantom body is ignored. + + The only always-mandatory parameter for message/external-body is + "access-type"; all of the other parameters may be mandatory or + optional depending on the value of access-type. + + ACCESS-TYPE -- A case-insensitive word, indicating the supported + access mechanism by which the file or data may be obtained. + Values include, but are not limited to, "FTP", "ANON-FTP", "TFTP", + "AFS", "LOCAL-FILE", and "MAIL-SERVER". Future values, except for + experimental values beginning with "X-" must be registered with + IANA, as described in Appendix E . + + In addition, the following three parameters are optional for ALL + access-types: + + EXPIRATION -- The date (in the RFC 822 "date-time" syntax, as + extended by RFC 1123 to permit 4 digits in the year field) after + which the existence of the external data is not guaranteed. + + SIZE -- The size (in octets) of the data. The intent of this + parameter is to help the recipient decide whether or not to expend + the necessary resources to retrieve the external data. Note that + this describes the size of the data in its canonical form, that + is, before any Content- Transfer-Encoding has been applied or + after the data have been decoded. + + PERMISSION -- A case-insensitive field that indicates whether or + not it is expected that clients might also attempt to overwrite + the data. By default, or if permission is "read", the assumption + is that they are not, and that if the data is retrieved once, it + is never needed again. If PERMISSION is "read-write", this + assumption is invalid, and any local copy must be considered no + more than a cache. "Read" and "Read-write" are the only defined + values of permission. + + The precise semantics of the access-types defined here are described + in the sections that follow. + + The encapsulated headers in ALL message/external-body entities MUST + include a Content-ID header field to give a unique identifier by + + + +Borenstein & Freed [Page 43] + +RFC 1521 MIME September 1993 + + + which to reference the data. This identifier may be used for + cacheing mechanisms, and for recognizing the receipt of the data when + the access-type is "mail-server". + + Note that, as specified here, the tokens that describe external-body + data, such as file names and mail server commands, are required to be + in the US-ASCII character set. If this proves problematic in + practice, a new mechanism may be required as a future extension to + MIME, either as newly defined access-types for message/external-body + or by some other mechanism. + + As with message/partial, it is specified that MIME entities of type + message/external-body must always have a content-transfer-encoding of + 7-bit (the default). In particular, even in environments that + support binary or 8-bit transport, the use of a content-transfer- + encoding of "8bit" or "binary" is explicitly prohibited for entities + of type message/external-body. + +7.3.3.1. The "ftp" and "tftp" access-types + + An access-type of FTP or TFTP indicates that the message body is + accessible as a file using the FTP [RFC-959] or TFTP [RFC-783] + protocols, respectively. For these access-types, the following + additional parameters are mandatory: + + NAME -- The name of the file that contains the actual body data. + + SITE -- A machine from which the file may be obtained, using the + given protocol. This must be a fully qualified domain name, not a + nickname. + + Before any data are retrieved, using FTP, the user will generally + need to be asked to provide a login id and a password for the machine + named by the site parameter. For security reasons, such an id and + password are not specified as content-type parameters, but must be + obtained from the user. + + In addition, the following parameters are optional: + + DIRECTORY -- A directory from which the data named by NAME should + be retrieved. + + MODE -- A case-insensitive string indicating the mode to be used + when retrieving the information. The legal values for access-type + "TFTP" are "NETASCII", "OCTET", and "MAIL", as specified by the + TFTP protocol [RFC-783]. The legal values for access-type "FTP" + are "ASCII", "EBCDIC", "IMAGE", and "LOCALn" where "n" is a + decimal integer, typically 8. These correspond to the + + + +Borenstein & Freed [Page 44] + +RFC 1521 MIME September 1993 + + + representation types "A" "E" "I" and "L n" as specified by the FTP + protocol [RFC-959]. Note that "BINARY" and "TENEX" are not valid + values for MODE, but that "OCTET" or "IMAGE" or "LOCAL8" should be + used instead. IF MODE is not specified, the default value is + "NETASCII" for TFTP and "ASCII" otherwise. + +7.3.3.2. The "anon-ftp" access-type + + The "anon-ftp" access-type is identical to the "ftp" access type, + except that the user need not be asked to provide a name and password + for the specified site. Instead, the ftp protocol will be used with + login "anonymous" and a password that corresponds to the user's email + address. + +7.3.3.3. The "local-file" and "afs" access-types + + An access-type of "local-file" indicates that the actual body is + accessible as a file on the local machine. An access-type of "afs" + indicates that the file is accessible via the global AFS file system. + In both cases, only a single parameter is required: + + NAME -- The name of the file that contains the actual body data. + + The following optional parameter may be used to describe the locality + of reference for the data, that is, the site or sites at which the + file is expected to be visible: + + SITE -- A domain specifier for a machine or set of machines that + are known to have access to the data file. Asterisks may be used + for wildcard matching to a part of a domain name, such as + "*.bellcore.com", to indicate a set of machines on which the data + should be directly visible, while a single asterisk may be used to + indicate a file that is expected to be universally available, + e.g., via a global file system. + +7.3.3.4. The "mail-server" access-type + + The "mail-server" access-type indicates that the actual body is + available from a mail server. The mandatory parameter for this + access-type is: + + SERVER -- The email address of the mail server from which the + actual body data can be obtained. + + Because mail servers accept a variety of syntaxes, some of which is + multiline, the full command to be sent to a mail server is not + included as a parameter on the content-type line. Instead, it is + provided as the "phantom body" when the content-type is + + + +Borenstein & Freed [Page 45] + +RFC 1521 MIME September 1993 + + + message/external-body and the access- type is mail-server. + + An optional parameter for this access-type is: + + SUBJECT -- The subject that is to be used in the mail that is sent + to obtain the data. Note that keying mail servers on Subject lines + is NOT recommended, but such mail servers are known to exist. + + Note that MIME does not define a mail server syntax. Rather, it + allows the inclusion of arbitrary mail server commands in the phantom + body. Implementations must include the phantom body in the body of + the message it sends to the mail server address to retrieve the + relevant data. + + It is worth noting that, unlike other access-types, mail-server + access is asynchronous and will happen at an unpredictable time in + the future. For this reason, it is important that there be a + mechanism by which the returned data can be matched up with the + original message/external-body entity. MIME mailservers must use the + same Content-ID field on the returned message that was used in the + original message/external-body entity, to facilitate such matching. + +7.3.3.5. Examples and Further Explanations + + With the emerging possibility of very wide-area file systems, it + becomes very hard to know in advance the set of machines where a file + will and will not be accessible directly from the file system. + Therefore it may make sense to provide both a file name, to be tried + directly, and the name of one or more sites from which the file is + known to be accessible. An implementation can try to retrieve remote + files using FTP or any other protocol, using anonymous file retrieval + or prompting the user for the necessary name and password. If an + external body is accessible via multiple mechanisms, the sender may + include multiple parts of type message/external-body within an entity + of type multipart/alternative. + + However, the external-body mechanism is not intended to be limited to + file retrieval, as shown by the mail-server access-type. Beyond + this, one can imagine, for example, using a video server for external + references to video clips. + + If an entity is of type "message/external-body", then the body of the + entity will contain the header fields of the encapsulated message. + The body itself is to be found in the external location. This means + that if the body of the "message/external-body" message contains two + consecutive CRLFs, everything after those pairs is NOT part of the + message itself. For most message/external-body messages, this + trailing area must simply be ignored. However, it is a convenient + + + +Borenstein & Freed [Page 46] + +RFC 1521 MIME September 1993 + + + place for additional data that cannot be included in the content-type + header field. In particular, if the "access-type" value is "mail- + server", then the trailing area must contain commands to be sent to + the mail server at the address given by the value of the SERVER + parameter. + + The embedded message header fields which appear in the body of the + message/external-body data must be used to declare the Content-type + of the external body if it is anything other than plain ASCII text, + since the external body does not have a header section to declare its + type. Similarly, any Content-transfer-encoding other than "7bit" + must also be declared here. Thus a complete message/external-body + message, referring to a document in PostScript format, might look + like this: + + From: Whomever + To: Someone + Subject: whatever + MIME-Version: 1.0 + Message-ID: + Content-Type: multipart/alternative; boundary=42 + Content-ID: + + --42 + Content-Type: message/external-body; + name="BodyFormats.ps"; + site="thumper.bellcore.com"; + access-type=ANON-FTP; + directory="pub"; + mode="image"; + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + Content-ID: + + --42 + Content-Type: message/external-body; + name="/u/nsb/writing/rfcs/RFC-MIME.ps"; + site="thumper.bellcore.com"; + access-type=AFS + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + Content-ID: + + --42 + Content-Type: message/external-body; + access-type=mail-server + + + +Borenstein & Freed [Page 47] + +RFC 1521 MIME September 1993 + + + server="listserv@bogus.bitnet"; + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + Content-ID: + + get RFC-MIME.DOC + + --42-- + + Note that in the above examples, the default Content-transfer- + encoding of "7bit" is assumed for the external postscript data. + + Like the message/partial type, the message/external-body type is + intended to be transparent, that is, to convey the data type in the + external body rather than to convey a message with a body of that + type. Thus the headers on the outer and inner parts must be merged + using the same rules as for message/partial. In particular, this + means that the Content-type header is overridden, but the From and + Subject headers are preserved. + + Note that since the external bodies are not transported as mail, they + need not conform to the 7-bit and line length requirements, but might + in fact be binary files. Thus a Content-Transfer-Encoding is not + generally necessary, though it is permitted. + + Note that the body of a message of type "message/external-body" is + governed by the basic syntax for an RFC 822 message. In particular, + anything before the first consecutive pair of CRLFs is header + information, while anything after it is body information, which is + ignored for most access-types. + + The formal grammar for content-type header fields for data of type + message is given by: + + message-type := "message" "/" message-subtype + + message-subtype := "rfc822" + / "partial" 2#3partial-param + / "external-body" 1*external-param + / extension-token + + partial-param := (";" "id" "=" value) + / (";" "number" "=" 1*DIGIT) + / (";" "total" "=" 1*DIGIT) + ; id & number required; total required for last part + + external-param := (";" "access-type" "=" atype) + + + +Borenstein & Freed [Page 48] + +RFC 1521 MIME September 1993 + + + / (";" "expiration" "=" date-time) + ; Note that date-time is quoted + / (";" "size" "=" 1*DIGIT) + / (";" "permission" "=" ("read" / "read-write")) + ; Permission is case-insensitive + / (";" "name" "=" value) + / (";" "site" "=" value) + / (";" "dir" "=" value) + / (";" "mode" "=" value) + / (";" "server" "=" value) + / (";" "subject" "=" value) + ; access-type required;others required based on access-type + + atype := "ftp" / "anon-ftp" / "tftp" / "local-file" + / "afs" / "mail-server" / extension-token + ; Case-insensitive + +7.4. The Application Content-Type + + The "application" Content-Type is to be used for data which do not + fit in any of the other categories, and particularly for data to be + processed by mail-based uses of application programs. This is + information which must be processed by an application before it is + viewable or usable to a user. Expected uses for Content-Type + application include mail-based file transfer, spreadsheets, data for + mail-based scheduling systems, and languages for "active" + (computational) email. (The latter, in particular, can pose security + problems which must be understood by implementors, and are considered + in detail in the discussion of the application/PostScript content- + type.) + + For example, a meeting scheduler might define a standard + representation for information about proposed meeting dates. An + intelligent user agent would use this information to conduct a dialog + with the user, and might then send further mail based on that dialog. + More generally, there have been several "active" messaging languages + developed in which programs in a suitably specialized language are + sent through the mail and automatically run in the recipient's + environment. + + Such applications may be defined as subtypes of the "application" + Content-Type. This document defines two subtypes: octet-stream, and + PostScript. + + In general, the subtype of application will often be the name of the + application for which the data are intended. This does not mean, + however, that any application program name may be used freely as a + subtype of application. Such usages (other than subtypes beginning + + + +Borenstein & Freed [Page 49] + +RFC 1521 MIME September 1993 + + + with "x-") must be registered with IANA, as described in Appendix E. + +7.4.1. The Application/Octet-Stream (primary) subtype + + The primary subtype of application, "octet-stream", may be used to + indicate that a body contains binary data. The set of possible + parameters includes, but is not limited to: + + TYPE -- the general type or category of binary data. This is + intended as information for the human recipient rather than for + any automatic processing. + + PADDING -- the number of bits of padding that were appended to the + bit-stream comprising the actual contents to produce the enclosed + byte-oriented data. This is useful for enclosing a bit-stream in + a body when the total number of bits is not a multiple of the byte + size. + + An additional parameter, "conversions", was defined in [RFC-1341] but + has been removed. + + RFC 1341 also defined the use of a "NAME" parameter which gave a + suggested file name to be used if the data were to be written to a + file. This has been deprecated in anticipation of a separate + Content-Disposition header field, to be defined in a subsequent RFC. + + The recommended action for an implementation that receives + application/octet-stream mail is to simply offer to put the data in a + file, with any Content-Transfer-Encoding undone, or perhaps to use it + as input to a user-specified process. + + To reduce the danger of transmitting rogue programs through the mail, + it is strongly recommended that implementations NOT implement a + path-search mechanism whereby an arbitrary program named in the + Content-Type parameter (e.g., an "interpreter=" parameter) is found + and executed using the mail body as input. + +7.4.2. The Application/PostScript subtype + + A Content-Type of "application/postscript" indicates a PostScript + program. Currently two variants of the PostScript language are + allowed; the original level 1 variant is described in [POSTSCRIPT] + and the more recent level 2 variant is described in [POSTSCRIPT2]. + + PostScript is a registered trademark of Adobe Systems, Inc. Use of + the MIME content-type "application/postscript" implies recognition of + that trademark and all the rights it entails. + + + + +Borenstein & Freed [Page 50] + +RFC 1521 MIME September 1993 + + + The PostScript language definition provides facilities for internal + labeling of the specific language features a given program uses. This + labeling, called the PostScript document structuring conventions, is + very general and provides substantially more information than just + the language level. + + The use of document structuring conventions, while not required, is + strongly recommended as an aid to interoperability. Documents which + lack proper structuring conventions cannot be tested to see whether + or not they will work in a given environment. As such, some systems + may assume the worst and refuse to process unstructured documents. + + The execution of general-purpose PostScript interpreters entails + serious security risks, and implementors are discouraged from simply + sending PostScript email bodies to "off-the-shelf" interpreters. + While it is usually safe to send PostScript to a printer, where the + potential for harm is greatly constrained, implementors should + consider all of the following before they add interactive display of + PostScript bodies to their mail readers. + + The remainder of this section outlines some, though probably not all, + of the possible problems with sending PostScript through the mail. + + Dangerous operations in the PostScript language include, but may not + be limited to, the PostScript operators deletefile, renamefile, + filenameforall, and file. File is only dangerous when applied to + something other than standard input or output. Implementations may + also define additional nonstandard file operators; these may also + pose a threat to security. Filenameforall, the wildcard file search + operator, may appear at first glance to be harmless. Note, however, + that this operator has the potential to reveal information about what + files the recipient has access to, and this information may itself be + sensitive. Message senders should avoid the use of potentially + dangerous file operators, since these operators are quite likely to + be unavailable in secure PostScript implementations. Message- + receiving and -displaying software should either completely disable + all potentially dangerous file operators or take special care not to + delegate any special authority to their operation. These operators + should be viewed as being done by an outside agency when interpreting + PostScript documents. Such disabling and/or checking should be done + completely outside of the reach of the PostScript language itself; + care should be taken to insure that no method exists for re-enabling + full-function versions of these operators. + + The PostScript language provides facilities for exiting the normal + interpreter, or server, loop. Changes made in this "outer" + environment are customarily retained across documents, and may in + some cases be retained semipermanently in nonvolatile memory. The + + + +Borenstein & Freed [Page 51] + +RFC 1521 MIME September 1993 + + + operators associated with exiting the interpreter loop have the + potential to interfere with subsequent document processing. As such, + their unrestrained use constitutes a threat of service denial. + PostScript operators that exit the interpreter loop include, but may + not be limited to, the exitserver and startjob operators. Message- + sending software should not generate PostScript that depends on + exiting the interpreter loop to operate. The ability to exit will + probably be unavailable in secure PostScript implementations. + Message-receiving and -displaying software should, if possible, + disable the ability to make retained changes to the PostScript + environment, and eliminate the startjob and exitserver commands. If + these commands cannot be eliminated, the password associated with + them should at least be set to a hard-to-guess value. + + PostScript provides operators for setting system-wide and device- + specific parameters. These parameter settings may be retained across + jobs and may potentially pose a threat to the correct operation of + the interpreter. The PostScript operators that set system and device + parameters include, but may not be limited to, the setsystemparams + and setdevparams operators. Message-sending software should not + generate PostScript that depends on the setting of system or device + parameters to operate correctly. The ability to set these parameters + will probably be unavailable in secure PostScript implementations. + Message-receiving and -displaying software should, if possible, + disable the ability to change system and device parameters. If these + operators cannot be disabled, the password associated with them + should at least be set to a hard-to-guess value. + + Some PostScript implementations provide nonstandard facilities for + the direct loading and execution of machine code. Such facilities + are quite obviously open to substantial abuse. Message-sending + software should not make use of such features. Besides being totally + hardware- specific, they are also likely to be unavailable in secure + implementations of PostScript. Message-receiving and -displaying + software should not allow such operators to be used if they exist. + + PostScript is an extensible language, and many, if not most, + implementations of it provide a number of their own extensions. This + document does not deal with such extensions explicitly since they + constitute an unknown factor. Message-sending software should not + make use of nonstandard extensions; they are likely to be missing + from some implementations. Message-receiving and -displaying software + should make sure that any nonstandard PostScript operators are secure + and don't present any kind of threat. + + It is possible to write PostScript that consumes huge amounts of + various system resources. It is also possible to write PostScript + programs that loop infinitely. Both types of programs have the + + + +Borenstein & Freed [Page 52] + +RFC 1521 MIME September 1993 + + + potential to cause damage if sent to unsuspecting recipients. + Message-sending software should avoid the construction and + dissemination of such programs, which is antisocial. Message- + receiving and -displaying software should provide appropriate + mechanisms to abort processing of a document after a reasonable + amount of time has elapsed. In addition, PostScript interpreters + should be limited to the consumption of only a reasonable amount of + any given system resource. + + Finally, bugs may exist in some PostScript interpreters which could + possibly be exploited to gain unauthorized access to a recipient's + system. Apart from noting this possibility, there is no specific + action to take to prevent this, apart from the timely correction of + such bugs if any are found. + +7.4.3. Other Application subtypes + + It is expected that many other subtypes of application will be + defined in the future. MIME implementations must generally treat any + unrecognized subtypes as being equivalent to application/octet- + stream. + + The formal grammar for content-type header fields for application + data is given by: + + application-type := "application" "/" application-subtype + + application-subtype := ("octet-stream" *stream-param) + / "postscript" / extension-token + + stream-param := (";" "type" "=" value) + / (";" "padding" "=" padding) + + padding := "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" + +7.5. The Image Content-Type + + A Content-Type of "image" indicates that the body contains an image. + The subtype names the specific image format. These names are case + insensitive. Two initial subtypes are "jpeg" for the JPEG format, + JFIF encoding, and "gif" for GIF format [GIF]. + + The list of image subtypes given here is neither exclusive nor + exhaustive, and is expected to grow as more types are registered with + IANA, as described in Appendix E. + + The formal grammar for the content-type header field for data of type + image is given by: + + + +Borenstein & Freed [Page 53] + +RFC 1521 MIME September 1993 + + + image-type := "image" "/" ("gif" / "jpeg" / extension-token) + +7.6. The Audio Content-Type + + A Content-Type of "audio" indicates that the body contains audio + data. Although there is not yet a consensus on an "ideal" audio + format for use with computers, there is a pressing need for a format + capable of providing interoperable behavior. + + The initial subtype of "basic" is specified to meet this requirement + by providing an absolutely minimal lowest common denominator audio + format. It is expected that richer formats for higher quality and/or + lower bandwidth audio will be defined by a later document. + + The content of the "audio/basic" subtype is audio encoded using 8-bit + ISDN mu-law [PCM]. When this subtype is present, a sample rate of + 8000 Hz and a single channel is assumed. + + The formal grammar for the content-type header field for data of type + audio is given by: + + audio-type := "audio" "/" ("basic" / extension-token) + +7.7. The Video Content-Type + + A Content-Type of "video" indicates that the body contains a time- + varying-picture image, possibly with color and coordinated sound. + The term "video" is used extremely generically, rather than with + reference to any particular technology or format, and is not meant to + preclude subtypes such as animated drawings encoded compactly. The + subtype "mpeg" refers to video coded according to the MPEG standard + [MPEG]. + + Note that although in general this document strongly discourages the + mixing of multiple media in a single body, it is recognized that many + so-called "video" formats include a representation for synchronized + audio, and this is explicitly permitted for subtypes of "video". + + The formal grammar for the content-type header field for data of type + video is given by: + + video-type := "video" "/" ("mpeg" / extension-token) + +7.8. Experimental Content-Type Values + + A Content-Type value beginning with the characters "X-" is a private + value, to be used by consenting mail systems by mutual agreement. + Any format without a rigorous and public definition must be named + + + +Borenstein & Freed [Page 54] + +RFC 1521 MIME September 1993 + + + with an "X-" prefix, and publicly specified values shall never begin + with "X-". (Older versions of the widely-used Andrew system use the + "X-BE2" name, so new systems should probably choose a different + name.) + + In general, the use of "X-" top-level types is strongly discouraged. + Implementors should invent subtypes of the existing types whenever + possible. The invention of new types is intended to be restricted + primarily to the development of new media types for email, such as + digital odors or holography, and not for new data formats in general. + In many cases, a subtype of application will be more appropriate than + a new top-level type. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 55] + +RFC 1521 MIME September 1993 + + +8. Summary + + Using the MIME-Version, Content-Type, and Content-Transfer-Encoding + header fields, it is possible to include, in a standardized way, + arbitrary types of data objects with RFC 822 conformant mail + messages. No restrictions imposed by either RFC 821 or RFC 822 are + violated, and care has been taken to avoid problems caused by + additional restrictions imposed by the characteristics of some + Internet mail transport mechanisms (see Appendix B). The "multipart" + and "message" Content-Types allow mixing and hierarchical structuring + of objects of different types in a single message. Further Content- + Types provide a standardized mechanism for tagging messages or body + parts as audio, image, or several other kinds of data. A + distinguished parameter syntax allows further specification of data + format details, particularly the specification of alternate character + sets. Additional optional header fields provide mechanisms for + certain extensions deemed desirable by many implementors. Finally, a + number of useful Content-Types are defined for general use by + consenting user agents, notably message/partial, and + message/external-body. + +9. Security Considerations + + Security issues are discussed in Section 7.4.2 and in Appendix F. + Implementors should pay special attention to the security + implications of any mail content-types that can cause the remote + execution of any actions in the recipient's environment. In such + cases, the discussion of the application/postscript content-type in + Section 7.4.2 may serve as a model for considering other content- + types with remote execution capabilities. + + + + + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 56] + +RFC 1521 MIME September 1993 + + +10. Authors' Addresses + + For more information, the authors of this document may be contacted + via Internet mail: + + Nathaniel S. Borenstein + MRE 2D-296, Bellcore + 445 South St. + Morristown, NJ 07962-1910 + + Phone: +1 201 829 4270 + Fax: +1 201 829 7019 + Email: nsb@bellcore.com + + + Ned Freed + Innosoft International, Inc. + 250 West First Street + Suite 240 + Claremont, CA 91711 + + Phone: +1 909 624 7907 + Fax: +1 909 621 5319 + Email: ned@innosoft.com + + MIME is a result of the work of the Internet Engineering Task Force + Working Group on Email Extensions. The chairman of that group, Greg + Vaudreuil, may be reached at: + + Gregory M. Vaudreuil + Tigon Corporation + 17060 Dallas Parkway + Dallas Texas, 75248 + + Phone: +1 214-733-2722 + EMail: gvaudre@cnri.reston.va.us + + + + + + + + + + + + + + + +Borenstein & Freed [Page 57] + +RFC 1521 MIME September 1993 + + +11. Acknowledgements + + This document is the result of the collective effort of a large + number of people, at several IETF meetings, on the IETF-SMTP and + IETF-822 mailing lists, and elsewhere. Although any enumeration + seems doomed to suffer from egregious omissions, the following are + among the many contributors to this effort: + + Harald Tveit Alvestrand Timo Lehtinen + Randall Atkinson John R. MacMillan + Philippe Brandon Rick McGowan + Kevin Carosso Leo Mclaughlin + Uhhyung Choi Goli Montaser-Kohsari + Cristian Constantinof Keith Moore + Mark Crispin Tom Moore + Dave Crocker Erik Naggum + Terry Crowley Mark Needleman + Walt Daniels John Noerenberg + Frank Dawson Mats Ohrman + Hitoshi Doi Julian Onions + Kevin Donnelly Michael Patton + Keith Edwards David J. Pepper + Chris Eich Blake C. Ramsdell + Johnny Eriksson Luc Rooijakkers + Craig Everhart Marshall T. Rose + Patrik Faeltstroem Jonathan Rosenberg + Erik E. Fair Jan Rynning + Roger Fajman Harri Salminen + Alain Fontaine Michael Sanderson + James M. Galvin Masahiro Sekiguchi + Philip Gladstone Mark Sherman + Thomas Gordon Keld Simonsen + Phill Gross Bob Smart + James Hamilton Peter Speck + Steve Hardcastle-Kille Henry Spencer + David Herron Einar Stefferud + Bruce Howard Michael Stein + Bill Janssen Klaus Steinberger + Olle Jaernefors Peter Svanberg + Risto Kankkunen James Thompson + Phil Karn Steve Uhler + Alan Katz Stuart Vance + Tim Kehres Erik van der Poel + Neil Katin Guido van Rossum + Kyuho Kim Peter Vanderbilt + Anders Klemets Greg Vaudreuil + John Klensin Ed Vielmetti + Valdis Kletniek Ryan Waldron + + + +Borenstein & Freed [Page 58] + +RFC 1521 MIME September 1993 + + + Jim Knowles Wally Wedel + Stev Knowles Sven-Ove Westberg + Bob Kummerfeld Brian Wideen + Pekka Kytolaakso John Wobus + Stellan Lagerstrom Glenn Wright + Vincent Lau Rayan Zachariassen + Donald Lindsay David Zimmerman + Marc Andreessen Bob Braden + Brian Capouch Peter Clitherow + Dave Collier-Brown John Coonrod + Stephen Crocker Jim Davis + Axel Deininger Dana S Emery + Martin Forssen Stephen Gildea + Terry Gray Mark Horton + Warner Losh Carlyn Lowery + Laurence Lundblade Charles Lynn + Larry Masinter Michael J. McInerny + Jon Postel Christer Romson + Yutaka Sato Markku Savela + Richard Alan Schafer Larry W. Virden + Rhys Weatherly Jay Weber + Dave Wecker + +The authors apologize for any omissions from this list, which are +certainly unintentional. + + + + + + + + + + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 59] + +RFC 1521 MIME September 1993 + + +Appendix A -- Minimal MIME-Conformance + + The mechanisms described in this document are open-ended. It is + definitely not expected that all implementations will support all of + the Content-Types described, nor that they will all share the same + extensions. In order to promote interoperability, however, it is + useful to define the concept of "MIME-conformance" to define a + certain level of implementation that allows the useful interworking + of messages with content that differs from US ASCII text. In this + section, we specify the requirements for such conformance. + + A mail user agent that is MIME-conformant MUST: + + 1. Always generate a "MIME-Version: 1.0" header field. + + 2. Recognize the Content-Transfer-Encoding header field, and + decode all received data encoded with either the quoted-printable + or base64 implementations. Encode any data sent that is not in + seven-bit mail-ready representation using one of these + transformations and include the appropriate Content-Transfer- + Encoding header field, unless the underlying transport mechanism + supports non-seven-bit data, as SMTP does not. + + 3. Recognize and interpret the Content-Type header field, and + avoid showing users raw data with a Content-Type field other than + text. Be able to send at least text/plain messages, with the + character set specified as a parameter if it is not US-ASCII. + + 4. Explicitly handle the following Content-Type values, to at + least the following extents: + + Text: + + -- Recognize and display "text" mail + with the character set "US-ASCII." + + -- Recognize other character sets at + least to the extent of being able + to inform the user about what + character set the message uses. + + -- Recognize the "ISO-8859-*" character + sets to the extent of being able to + display those characters that are + common to ISO-8859-* and US-ASCII, + namely all characters represented + by octet values 0-127. + + + + +Borenstein & Freed [Page 60] + +RFC 1521 MIME September 1993 + + + -- For unrecognized subtypes, show or + offer to show the user the "raw" + version of the data after + conversion of the content from + canonical form to local form. + + Message: + + -- Recognize and display at least the + primary (822) encapsulation. + + Multipart: + + -- Recognize the primary (mixed) + subtype. Display all relevant + information on the message level + and the body part header level and + then display or offer to display + each of the body parts individually. + + -- Recognize the "alternative" subtype, + and avoid showing the user + redundant parts of + multipart/alternative mail. + + -- Treat any unrecognized subtypes as if + they were "mixed". + + Application: + + -- Offer the ability to remove either of + the two types of Content-Transfer- + Encoding defined in this document + and put the resulting information + in a user file. + + 5. Upon encountering any unrecognized Content- Type, an + implementation must treat it as if it had a Content-Type of + "application/octet-stream" with no parameter sub-arguments. How + such data are handled is up to an implementation, but likely + options for handling such unrecognized data include offering the + user to write it into a file (decoded from its mail transport + format) or offering the user to name a program to which the + decoded data should be passed as input. Unrecognized predefined + types, which in a MIME-conformant mailer might still include + audio, image, or video, should also be treated in this way. + + A user agent that meets the above conditions is said to be MIME- + + + +Borenstein & Freed [Page 61] + +RFC 1521 MIME September 1993 + + + conformant. The meaning of this phrase is that it is assumed to be + "safe" to send virtually any kind of properly-marked data to users of + such mail systems, because such systems will at least be able to + treat the data as undifferentiated binary, and will not simply splash + it onto the screen of unsuspecting users. There is another sense in + which it is always "safe" to send data in a format that is MIME- + conformant, which is that such data will not break or be broken by + any known systems that are conformant with RFC 821 and RFC 822. User + agents that are MIME-conformant have the additional guarantee that + the user will not be shown data that were never intended to be viewed + as text. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 62] + +RFC 1521 MIME September 1993 + + +Appendix B -- General Guidelines For Sending Email Data + + Internet email is not a perfect, homogeneous system. Mail may become + corrupted at several stages in its travel to a final destination. + Specifically, email sent throughout the Internet may travel across + many networking technologies. Many networking and mail technologies + do not support the full functionality possible in the SMTP transport + environment. Mail traversing these systems is likely to be modified + in such a way that it can be transported. + + There exist many widely-deployed non-conformant MTAs in the Internet. + These MTAs, speaking the SMTP protocol, alter messages on the fly to + take advantage of the internal data structure of the hosts they are + implemented on, or are just plain broken. + + The following guidelines may be useful to anyone devising a data + format (Content-Type) that will survive the widest range of + networking technologies and known broken MTAs unscathed. Note that + anything encoded in the base64 encoding will satisfy these rules, but + that some well-known mechanisms, notably the UNIX uuencode facility, + will not. Note also that anything encoded in the Quoted-Printable + encoding will survive most gateways intact, but possibly not some + gateways to systems that use the EBCDIC character set. + + (1) Under some circumstances the encoding used for data may change + as part of normal gateway or user agent operation. In particular, + conversion from base64 to quoted-printable and vice versa may be + necessary. This may result in the confusion of CRLF sequences with + line breaks in text bodies. As such, the persistence of CRLF as + something other than a line break must not be relied on. + + (2) Many systems may elect to represent and store text data using + local newline conventions. Local newline conventions may not match + the RFC822 CRLF convention -- systems are known that use plain CR, + plain LF, CRLF, or counted records. The result is that isolated + CR and LF characters are not well tolerated in general; they may + be lost or converted to delimiters on some systems, and hence must + not be relied on. + + (3) TAB (HT) characters may be misinterpreted or may be + automatically converted to variable numbers of spaces. This is + unavoidable in some environments, notably those not based on the + ASCII character set. Such conversion is STRONGLY DISCOURAGED, but + it may occur, and mail formats must not rely on the persistence of + TAB (HT) characters. + + (4) Lines longer than 76 characters may be wrapped or truncated in + some environments. Line wrapping and line truncation are STRONGLY + + + +Borenstein & Freed [Page 63] + +RFC 1521 MIME September 1993 + + + DISCOURAGED, but unavoidable in some cases. Applications which + require long lines must somehow differentiate between soft and + hard line breaks. (A simple way to do this is to use the quoted- + printable encoding.) + + (5) Trailing "white space" characters (SPACE, TAB (HT)) on a line + may be discarded by some transport agents, while other transport + agents may pad lines with these characters so that all lines in a + mail file are of equal length. The persistence of trailing white + space, therefore, must not be relied on. + + (6) Many mail domains use variations on the ASCII character set, + or use character sets such as EBCDIC which contain most but not + all of the US-ASCII characters. The correct translation of + characters not in the "invariant" set cannot be depended on across + character converting gateways. For example, this situation is a + problem when sending uuencoded information across BITNET, an + EBCDIC system. Similar problems can occur without crossing a + gateway, since many Internet hosts use character sets other than + ASCII internally. The definition of Printable Strings in X.400 + adds further restrictions in certain special cases. In + particular, the only characters that are known to be consistent + across all gateways are the 73 characters that correspond to the + upper and lower case letters A-Z and a-z, the 10 digits 0-9, and + the following eleven special characters: + + "'" (ASCII code 39) + "(" (ASCII code 40) + ")" (ASCII code 41) + "+" (ASCII code 43) + "," (ASCII code 44) + "-" (ASCII code 45) + "." (ASCII code 46) + "/" (ASCII code 47) + ":" (ASCII code 58) + "=" (ASCII code 61) + "?" (ASCII code 63) + + A maximally portable mail representation, such as the base64 + encoding, will confine itself to relatively short lines of text in + which the only meaningful characters are taken from this set of 73 + characters. + + (7) Some mail transport agents will corrupt data that includes + certain literal strings. In particular, a period (".") alone on a + line is known to be corrupted by some (incorrect) SMTP + implementations, and a line that starts with the five characters + "From " (the fifth character is a SPACE) are commonly corrupted as + + + +Borenstein & Freed [Page 64] + +RFC 1521 MIME September 1993 + + + well. A careful composition agent can prevent these corruptions + by encoding the data (e.g., in the quoted-printable encoding, + "=46rom " in place of "From " at the start of a line, and "=2E" in + place of "." alone on a line. + + Please note that the above list is NOT a list of recommended + practices for MTAs. RFC 821 MTAs are prohibited from altering the + character of white space or wrapping long lines. These BAD and + illegal practices are known to occur on established networks, and + implementations should be robust in dealing with the bad effects they + can cause. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 65] + +RFC 1521 MIME September 1993 + + +Appendix C -- A Complex Multipart Example + + What follows is the outline of a complex multipart message. This + message has five parts to be displayed serially: two introductory + plain text parts, an embedded multipart message, a richtext part, and + a closing encapsulated text message in a non-ASCII character set. + The embedded multipart message has two parts to be displayed in + parallel, a picture and an audio fragment. + + MIME-Version: 1.0 + From: Nathaniel Borenstein + To: Ned Freed + Subject: A multipart example + Content-Type: multipart/mixed; + boundary=unique-boundary-1 + + This is the preamble area of a multipart message. + Mail readers that understand multipart format + should ignore this preamble. + If you are reading this text, you might want to + consider changing to a mail reader that understands + how to properly display multipart messages. + --unique-boundary-1 + + ...Some text appears here... + [Note that the preceding blank line means + no header fields were given and this is text, + with charset US ASCII. It could have been + done with explicit typing as in the next part.] + + --unique-boundary-1 + Content-type: text/plain; charset=US-ASCII + + This could have been part of the previous part, + but illustrates explicit versus implicit + typing of body parts. + + --unique-boundary-1 + Content-Type: multipart/parallel; + boundary=unique-boundary-2 + + + --unique-boundary-2 + Content-Type: audio/basic + Content-Transfer-Encoding: base64 + + ... base64-encoded 8000 Hz single-channel + mu-law-format audio data goes here.... + + + +Borenstein & Freed [Page 66] + +RFC 1521 MIME September 1993 + + + --unique-boundary-2 + Content-Type: image/gif + Content-Transfer-Encoding: base64 + + ... base64-encoded image data goes here.... + + --unique-boundary-2-- + + --unique-boundary-1 + Content-type: text/richtext + + This is richtext. + as defined in RFC 1341 + Isn't it + cool? + + --unique-boundary-1 + Content-Type: message/rfc822 + + From: (mailbox in US-ASCII) + To: (address in US-ASCII) + Subject: (subject in US-ASCII) + Content-Type: Text/plain; charset=ISO-8859-1 + Content-Transfer-Encoding: Quoted-printable + + ... Additional text in ISO-8859-1 goes here ... + + --unique-boundary-1-- + + + + + + + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 67] + +RFC 1521 MIME September 1993 + + +Appendix D -- Collected Grammar + + This appendix contains the complete BNF grammar for all the syntax + specified by this document. + + By itself, however, this grammar is incomplete. It refers to several + entities that are defined by RFC 822. Rather than reproduce those + definitions here, and risk unintentional differences between the two, + this document simply refers the reader to RFC 822 for the remaining + definitions. Wherever a term is undefined, it refers to the RFC 822 + definition. + + application-subtype := ("octet-stream" *stream-param) + / "postscript" / extension-token + + application-type := "application" "/" application-subtype + + attribute := token ; case-insensitive + + atype := "ftp" / "anon-ftp" / "tftp" / "local-file" + / "afs" / "mail-server" / extension-token + ; Case-insensitive + + audio-type := "audio" "/" ("basic" / extension-token) + + body-part := <"message" as defined in RFC 822, + with all header fields optional, and with the + specified delimiter not occurring anywhere in + the message body, either on a line by itself + or as a substring anywhere.> + + NOTE: In certain transport enclaves, RFC 822 restrictions such as + the one that limits bodies to printable ASCII characters may not + be in force. (That is, the transport domains may resemble + standard Internet mail transport as specified in RFC821 and + assumed by RFC822, but without certain restrictions.) The + relaxation of these restrictions should be construed as locally + extending the definition of bodies, for example to include octets + outside of the ASCII range, as long as these extensions are + supported by the transport and adequately documented in the + Content-Transfer-Encoding header field. However, in no event are + headers (either message headers or body-part headers) allowed to + contain anything other than ASCII characters. + + + + + + + + +Borenstein & Freed [Page 68] + +RFC 1521 MIME September 1993 + + + boundary := 0*69 bcharsnospace + + bchars := bcharsnospace / " " + + bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / "+" / "_" + / "," / "-" / "." / "/" / ":" / "=" / "?" + + charset := "us-ascii" / "iso-8859-1" / "iso-8859-2"/ "iso-8859-3" + / "iso-8859-4" / "iso-8859-5" / "iso-8859-6" / "iso-8859-7" + / "iso-8859-8" / "iso-8859-9" / extension-token + ; case insensitive + + close-delimiter := "--" boundary "--" CRLF;Again,no space by "--", + + content := "Content-Type" ":" type "/" subtype *(";" parameter) + ; case-insensitive matching of type and subtype + + delimiter := "--" boundary CRLF ;taken from Content-Type field. + ; There must be no space + ; between "--" and boundary. + + description := "Content-Description" ":" *text + + discard-text := *(*text CRLF) + + encapsulation := delimiter body-part CRLF + + encoding := "Content-Transfer-Encoding" ":" mechanism + + epilogue := discard-text ; to be ignored upon receipt. + + extension-token := x-token / iana-token + + external-param := (";" "access-type" "=" atype) + / (";" "expiration" "=" date-time) + + ; Note that date-time is quoted + / (";" "size" "=" 1*DIGIT) + / (";" "permission" "=" ("read" / "read-write")) + ; Permission is case-insensitive + / (";" "name" "=" value) + / (";" "site" "=" value) + / (";" "dir" "=" value) + / (";" "mode" "=" value) + / (";" "server" "=" value) + / (";" "subject" "=" value) + ;access-type required; others required based on access-type + + + + +Borenstein & Freed [Page 69] + +RFC 1521 MIME September 1993 + + + iana-token := + + id := "Content-ID" ":" msg-id + + image-type := "image" "/" ("gif" / "jpeg" / extension-token) + + mechanism := "7bit" ; case-insensitive + / "quoted-printable" + / "base64" + / "8bit" + / "binary" + / x-token + + message-subtype := "rfc822" + / "partial" 2#3partial-param + / "external-body" 1*external-param + / extension-token + + message-type := "message" "/" message-subtype + + multipart-body :=preamble 1*encapsulation close-delimiter epilogue + + multipart-subtype := "mixed" / "parallel" / "digest" + / "alternative" / extension-token + + multipart-type := "multipart" "/" multipart-subtype + ";" "boundary" "=" boundary + + octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F") + ; octet must be used for characters > 127, =, SPACE, or + TAB, + ; and is recommended for any characters not listed in + ; Appendix B as "mail-safe". + + padding := "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" + + parameter := attribute "=" value + + partial-param := (";" "id" "=" value) + / (";" "number" "=" 1*DIGIT) + / (";" "total" "=" 1*DIGIT) + ; id & number required;total required for last part + + preamble := discard-text ; to be ignored upon receipt. + + ptext := octet / " / "@" + / "," / ";" / ":" / "\" / <"> + / "/" / "[" / "]" / "?" / "=" + ; Must be in quoted-string, + ; to use within parameter values + + + type := "application" / "audio" ; case-insensitive + / "image" / "message" + / "multipart" / "text" + / "video" / extension-token + ; All values case-insensitive + + value := token / quoted-string + + version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT + + video-type := "video" "/" ("mpeg" / extension-token) + + x-token := + + + + + + + + + + + + + +Borenstein & Freed [Page 71] + +RFC 1521 MIME September 1993 + + +Appendix E -- IANA Registration Procedures + + MIME has been carefully designed to have extensible mechanisms, and + it is expected that the set of content-type/subtype pairs and their + associated parameters will grow significantly with time. Several + other MIME fields, notably character set names, access-type + parameters for the message/external-body type, and possibly even + Content-Transfer-Encoding values, are likely to have new values + defined over time. In order to ensure that the set of such values is + developed in an orderly, well-specified, and public manner, MIME + defines a registration process which uses the Internet Assigned + Numbers Authority (IANA) as a central registry for such values. + + In general, parameters in the content-type header field are used to + convey supplemental information for various content types, and their + use is defined when the content-type and subtype are defined. New + parameters should not be defined as a way to introduce new + functionality. + + In order to simplify and standardize the registration process, this + appendix gives templates for the registration of new values with + IANA. Each of these is given in the form of an email message + template, to be filled in by the registering party. + + E.1 Registration of New Content-type/subtype Values + + Note that MIME is generally expected to be extended by subtypes. If + a new fundamental top-level type is needed, its specification must be + published as an RFC or submitted in a form suitable to become an RFC, + and be subject to the Internet standards process. + + To: IANA@isi.edu + Subject: Registration of new MIME + content-type/subtype + + MIME type name: + + (If the above is not an existing top-level MIME type, + please explain why an existing type cannot be used.) + + MIME subtype name: + + Required parameters: + + Optional parameters: + + Encoding considerations: + + + + +Borenstein & Freed [Page 72] + +RFC 1521 MIME September 1993 + + + Security considerations: + + Published specification: + + (The published specification must be an Internet RFC or + RFC-to-be if a new top-level type is being defined, and + must be a publicly available specification in any + case.) + + Person & email address to contact for further information: + + E.2 Registration of New Access-type Values + for Message/external-body + + To: IANA@isi.edu + Subject: Registration of new MIME Access-type for + Message/external-body content-type + + MIME access-type name: + + Required parameters: + + Optional parameters: + + Published specification: + + (The published specification must be an Internet RFC or + RFC-to-be.) + + Person & email address to contact for further information: + + + + + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 73] + +RFC 1521 MIME September 1993 + + +Appendix F -- Summary of the Seven Content-types + + Content-type: text + + Subtypes defined by this document: plain + + Important Parameters: charset + + Encoding notes: quoted-printable generally preferred if an encoding + is needed and the character set is mostly an ASCII superset. + + Security considerations: Rich text formats such as TeX and Troff + often contain mechanisms for executing arbitrary commands or file + system operations, and should not be used automatically unless + these security problems have been addressed. Even plain text may + contain control characters that can be used to exploit the + capabilities of "intelligent" terminals and cause security + violations. User interfaces designed to run on such terminals + should be aware of and try to prevent such problems. + + ________________________________________________________ + Content-type: multipart + + Subtypes defined by this document: mixed, alternative, + digest, parallel. + + Important Parameters: boundary + + Encoding notes: No content-transfer-encoding is permitted. + + ________________________________________________________ + Content-type: message + + Subtypes defined by this document: rfc822, partial, external-body + + Important Parameters: id, number, total, access-type, expiration, + size, permission, name, site, directory, mode, server, subject + + Encoding notes: No content-transfer-encoding is permitted. + Specifically, only "7bit" is permitted for "message/partial" or + "message/external-body", and only "7bit", "8bit", or "binary" are + permitted for other subtypes of "message". + ______________________________________________________________ + Content-type: application + + Subtypes defined by this document: octet-stream, postscript + + Important Parameters: type, padding + + + +Borenstein & Freed [Page 74] + +RFC 1521 MIME September 1993 + + + Deprecated Parameters: name and conversions were + defined in RFC 1341. + + Encoding notes: base64 preferred for unreadable subtypes. + + Security considerations: This type is intended for the + transmission of data to be interpreted by locally-installed + programs. If used, for example, to transmit executable + binary programs or programs in general-purpose interpreted + languages, such as LISP programs or shell scripts, severe + security problems could result. Authors of mail-reading + agents are cautioned against giving their systems the power + to execute mail-based application data without carefully + considering the security implications. While it is + certainly possible to define safe application formats and + even safe interpreters for unsafe formats, each interpreter + should be evaluated separately for possible security + problems. + ________________________________________________________________ + Content-type: image + + Subtypes defined by this document: jpeg, gif + + Important Parameters: none + + Encoding notes: base64 generally preferred + ________________________________________________________________ + Content-type: audio + + Subtypes defined by this document: basic + + Important Parameters: none + + Encoding notes: base64 generally preferred + ________________________________________________________________ + Content-type: video + + Subtypes defined by this document: mpeg + + Important Parameters: none + + Encoding notes: base64 generally preferred + + + + + + + + + +Borenstein & Freed [Page 75] + +RFC 1521 MIME September 1993 + + +Appendix G -- Canonical Encoding Model + + There was some confusion, in earlier drafts of this memo, regarding + the model for when email data was to be converted to canonical form + and encoded, and in particular how this process would affect the + treatment of CRLFs, given that the representation of newlines varies + greatly from system to system. For this reason, a canonical model + for encoding is presented below. + + The process of composing a MIME entity can be modeled as being done + in a number of steps. Note that these steps are roughly similar to + those steps used in RFC 1421 and are performed for each 'innermost + level' body: + + Step 1. Creation of local form. + + The body to be transmitted is created in the system's native format. + The native character set is used, and where appropriate local end of + line conventions are used as well. The body may be a UNIX-style text + file, or a Sun raster image, or a VMS indexed file, or audio data in + a system-dependent format stored only in memory, or anything else + that corresponds to the local model for the representation of some + form of information. Fundamentally, the data is created in the + "native" form specified by the type/subtype information. + + Step 2. Conversion to canonical form. + + The entire body, including "out-of-band" information such as record + lengths and possibly file attribute information, is converted to a + universal canonical form. The specific content type of the body as + well as its associated attributes dictate the nature of the canonical + form that is used. Conversion to the proper canonical form may + involve character set conversion, transformation of audio data, + compression, or various other operations specific to the various + content types. If character set conversion is involved, however, + care must be taken to understand the semantics of the content-type, + which may have strong implications for any character set conversion, + e.g. with regard to syntactically meaningful characters in a text + subtype other than "plain". + + For example, in the case of text/plain data, the text must be + converted to a supported character set and lines must be delimited + with CRLF delimiters in accordance with RFC822. Note that the + restriction on line lengths implied by RFC822 is eliminated if the + next step employs either quoted-printable or base64 encoding. + + + + + + +Borenstein & Freed [Page 76] + +RFC 1521 MIME September 1993 + + + Step 3. Apply transfer encoding. + + A Content-Transfer-Encoding appropriate for this body is applied. + Note that there is no fixed relationship between the content type and + the transfer encoding. In particular, it may be appropriate to base + the choice of base64 or quoted-printable on character frequency + counts which are specific to a given instance of a body. + + Step 4. Insertion into entity. + + The encoded object is inserted into a MIME entity with appropriate + headers. The entity is then inserted into the body of a higher-level + entity (message or multipart) if needed. + + It is vital to note that these steps are only a model; they are + specifically NOT a blueprint for how an actual system would be built. + In particular, the model fails to account for two common designs: + + 1. In many cases the conversion to a canonical form prior to + encoding will be subsumed into the encoder itself, which + understands local formats directly. For example, the local + newline convention for text bodies might be carried through to the + encoder itself along with knowledge of what that format is. + + 2. The output of the encoders may have to pass through one or + more additional steps prior to being transmitted as a message. As + such, the output of the encoder may not be conformant with the + formats specified by RFC822. In particular, once again it may be + appropriate for the converter's output to be expressed using local + newline conventions rather than using the standard RFC822 CRLF + delimiters. + + Other implementation variations are conceivable as well. The vital + aspect of this discussion is that, in spite of any optimizations, + collapsings of required steps, or insertion of additional processing, + the resulting messages must be consistent with those produced by the + model described here. For example, a message with the following + header fields: + + Content-type: text/foo; charset=bar + Content-Transfer-Encoding: base64 + + must be first represented in the text/foo form, then (if necessary) + represented in the "bar" character set, and finally transformed via + the base64 algorithm into a mail-safe form. + + + + + + +Borenstein & Freed [Page 77] + +RFC 1521 MIME September 1993 + + +Appendix H -- Changes from RFC 1341 + + This document is a relatively minor revision of RFC 1341. For + the convenience of those familiar with RFC 1341, the technical + changes from that document are summarized in this appendix. + + 1. The definition of "tspecials" has been changed to no longer + include ".". + + 2. The Content-ID field is now mandatory for message/external-body + parts. + + 3. The text/richtext type (including the old Section 7.1.3 and + Appendix D) has been moved to a separate document. + + 4. The rules on header merging for message/partial data have been + changed to treat the Encrypted and MIME-Version headers as special + cases. + + 5. The definition of the external-body access-type parameter has + been changed so that it can only indicate a single access method + (which was all that made sense). + + 6. There is a new "Subject" parameter for message/external-body, + access-type mail-server, to permit MIME-based use of mail servers + that rely on Subject field information. + + 7. The "conversions" parameter for application/octet-stream has been + removed. + + 8. Section 7.4.1 now deprecates the use of the "name" parameter for + application/octet-stream, as this will be superseded in the future by + a Content-Disposition header. + + 9. The formal grammar for multipart bodies has been changed so that + a CRLF is no longer required before the first boundary line. + + 10. MIME entities of type "message/partial" and "message/external- + body" are now required to use only the "7bit" transfer-encoding. + (Specifically, "binary" and "8bit" are not permitted.) + + 11. The "application/oda" content-type has been removed. + + 12. A note has been added to the end of section 7.2.3, explaining + the semantics of Content-ID in a multipart/alternative MIME entity. + + 13. The formal syntax for the "MIME-Version" field has been + tightened, but in a way that is completely compatible with the only + + + +Borenstein & Freed [Page 78] + +RFC 1521 MIME September 1993 + + + version number defined in RFC 1341. + + 14. In Section 7.3.1, the definition of message/rfc822 has been + relaxed regarding mandatory fields. + + All other changes from RFC 1341 were editorial changes and do not + affect the technical content of MIME. Considerable formal grammar + has been added, but this reflects the prose specification that was + already in place. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Borenstein & Freed [Page 79] + +RFC 1521 MIME September 1993 + + +References + + [US-ASCII] Coded Character Set--7-Bit American Standard Code for + Information Interchange, ANSI X3.4-1986. + + [ATK] Borenstein, Nathaniel S., Multimedia Applications Development + with the Andrew Toolkit, Prentice-Hall, 1990. + + [GIF] Graphics Interchange Format (Version 89a), Compuserve, Inc., + Columbus, Ohio, 1990. + + [ISO-2022] International Standard--Information Processing--ISO 7-bit + and 8-bit coded character sets--Code extension techniques, ISO + 2022:1986. + + [ISO-8859] Information Processing -- 8-bit Single-Byte Coded Graphic + Character Sets -- Part 1: Latin Alphabet No. 1, ISO 8859-1:1987. Part + 2: Latin alphabet No. 2, ISO 8859-2, 1987. Part 3: Latin alphabet + No. 3, ISO 8859-3, 1988. Part 4: Latin alphabet No. 4, ISO 8859-4, + 1988. Part 5: Latin/Cyrillic alphabet, ISO 8859-5, 1988. Part 6: + Latin/Arabic alphabet, ISO 8859-6, 1987. Part 7: Latin/Greek + alphabet, ISO 8859-7, 1987. Part 8: Latin/Hebrew alphabet, ISO + 8859-8, 1988. Part 9: Latin alphabet No. 5, ISO 8859-9, 1990. + + [ISO-646] International Standard--Information Processing--ISO 7-bit + coded character set for information interchange, ISO 646:1983. + + [MPEG] Video Coding Draft Standard ISO 11172 CD, ISO IEC/TJC1/SC2/WG11 + (Motion Picture Experts Group), May, 1991. + + [PCM] CCITT, Fascicle III.4 - Recommendation G.711, Geneva, 1972, + "Pulse Code Modulation (PCM) of Voice Frequencies". + + [POSTSCRIPT] Adobe Systems, Inc., PostScript Language Reference + Manual, Addison-Wesley, 1985. + + [POSTSCRIPT2] Adobe Systems, Inc., PostScript Language Reference + Manual, Addison-Wesley, Second Edition, 1990. + + [X400] Schicker, Pietro, "Message Handling Systems, X.400", Message + Handling Systems and Distributed Applications, E. Stefferud, O-j. + Jacobsen, and P. Schicker, eds., North-Holland, 1989, pp. 3-41. + + [RFC-783] Sollins, K., "TFTP Protocol (revision 2)", RFC 783, MIT, + June 1981. + + [RFC-821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC + 821, USC/Information Sciences Institute, August 1982. + + + +Borenstein & Freed [Page 80] + +RFC 1521 MIME September 1993 + + + [RFC-822] Crocker, D., "Standard for the Format of ARPA Internet Text + Messages", STD 11, RFC 822, UDEL, August 1982. + + [RFC-934] Rose, M., and E. Stefferud, "Proposed Standard for Message + Encapsulation", RFC 934, Delaware and NMA, January 1985. + + [RFC-959] Postel, J. and J. Reynolds, "File Transfer Protocol", + STD 9, RFC 959, USC/Information Sciences Institute, October 1985. + + [RFC-1049] Sirbu, M., "Content-Type Header Field for Internet + Messages", STD 11, RFC 1049, CMU, March 1988. + + [RFC-1421] Linn, J., "Privacy Enhancement for Internet Electronic Mail: + Part I - Message Encryption and Authentication Procedures", RFC + 1421, IAB IRTF PSRG, IETF PEM WG, February 1993. + + [RFC-1154] Robinson, D. and R. Ullmann, "Encoding Header Field for + Internet Messages", RFC 1154, Prime Computer, Inc., April 1990. + + [RFC-1341] Borenstein, N., and N. Freed, "MIME (Multipurpose Internet + Mail Extensions): Mechanisms for Specifying and Describing the Format + of Internet Message Bodies", RFC 1341, Bellcore, Innosoft, June 1992. + + [RFC-1342] Moore, K., "Representation of Non-Ascii Text in Internet + Message Headers", RFC 1342, University of Tennessee, June 1992. + + [RFC-1343] Borenstein, N., "A User Agent Configuration Mechanism + for Multimedia Mail Format Information", RFC 1343, Bellcore, June + 1992. + + [RFC-1344] Borenstein, N., "Implications of MIME for Internet + Mail Gateways", RFC 1344, Bellcore, June 1992. + + [RFC-1345] Simonsen, K., "Character Mnemonics & Character Sets", + RFC 1345, Rationel Almen Planlaegning, June 1992. + + [RFC-1426] Klensin, J., (WG Chair), Freed, N., (Editor), Rose, M., + Stefferud, E., and D. Crocker, "SMTP Service Extension for 8bit-MIME + transport", RFC 1426, United Nations Universit, Innosoft, Dover Beach + Consulting, Inc., Network Management Associates, Inc., The Branch + Office, February 1993. + + [RFC-1522] Moore, K., "Representation of Non-Ascii Text in Internet + Message Headers" RFC 1522, University of Tennessee, September 1993. + + [RFC-1340] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, RFC + 1340, USC/Information Sciences Institute, July 1992. + + + + +Borenstein & Freed [Page 81] + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1854.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1854.txt new file mode 100644 index 0000000..7b1a975 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc1854.txt @@ -0,0 +1,395 @@ + + + + + + +Network Working Group N. Freed +Request For Comments: 1854 Innosoft International, Inc. +Category: Standards Track A. Cargille, WG Chair + October 1995 + + + SMTP Service Extension + for Command Pipelining + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Abstract + + This memo defines an extension to the SMTP service whereby a server + can indicate the extent of its ability to accept multiple commands in + a single TCP send operation. Using a single TCP send operation for + multiple commands can improve SMTP performance significantly. + +Introduction + + Although SMTP is widely and robustly deployed, certain extensions may + nevertheless prove useful. In particular, many parts of the Internet + make use of high latency network links. + + SMTP's intrinsic one command-one response structure is significantly + penalized by high latency links, often to the point where the factors + contributing to overall connection time are dominated by the time + spent waiting for responses to individual commands (turnaround time). + + In the best of all worlds it would be possible to simply deploy SMTP + client software that makes use of command pipelining: batching up + multiple commands into single TCP send operations. Unfortunately, the + original SMTP specification [1] did not explicitly state that SMTP + servers must support this. As a result a non-trivial number of + Internet SMTP servers cannot adequately handle command pipelining. + Flaws known to exist in deployed servers include: + + (1) Connection handoff and buffer flushes in the middle of + the SMTP dialogue. Creation of server processes for + incoming SMTP connections is a useful, obvious, and + harmless implementation technique. However, some SMTP + servers defer process forking and connection handoff + + + +Freed & Cargille Standards Track [Page 1] + +RFC 1854 SMTP Pipelining October 1995 + + + until some intermediate point in the SMTP dialogue. + When this is done material read from the TCP connection + and kept in process buffers can be lost. + + (2) Flushing the TCP input buffer when an SMTP command + fails. SMTP commands often fail but there is no reason + to flush the TCP input buffer when this happens. + Nevertheless, some SMTP servers do this. + + (3) Improper processing and promulgation of SMTP command + failures. For example, some SMTP servers will refuse to + accept a DATA command if the last RCPT TO command + fails, paying no attention to the success or failure of + prior RCPT TO command results. Other servers will + accept a DATA command even when all previous RCPT TO + commands have failed. Although it is possible to + accommodate this sort of behavior in a client that + employs command pipelining, it does complicate the + construction of the client unnecessarily. + + This memo uses the mechanism described in [2] to define an extension + to the SMTP service whereby an SMTP server can declare that it is + capable of handling pipelined commands. The SMTP client can then + check for this declaration and use pipelining only when the server + declares itself capable of handling it. + +1. Framework for the Command Pipelining Extension + + The Command Pipelining extension is defined as follows: + + (1) the name of the SMTP service extension is Pipelining; + + (2) the EHLO keyword value associated with the extension is + PIPELINING; + + (3) no parameter is used with the PIPELINING EHLO keyword; + + (4) no additional parameters are added to either the MAIL + FROM or RCPT TO commands. + + (5) no additional SMTP verbs are defined by this extension; + and, + + (6) the next section specifies how support for the + extension affects the behavior of a server and client + SMTP. + + + + + +Freed & Cargille Standards Track [Page 2] + +RFC 1854 SMTP Pipelining October 1995 + + +2. The Pipelining Service Extension + + When a client SMTP wishes to employ command pipelining, it first + issues the EHLO command to the server SMTP. If the server SMTP + responds with code 250 to the EHLO command, and the response includes + the EHLO keyword value PIPELINING, then the server SMTP has indicated + that it can accommodate SMTP command pipelining. + +2.1. Client use of pipelining + + Once the client SMTP has confirmed that support exists for the + pipelining extension, the client SMTP may then elect to transmit + groups of SMTP commands in batches without waiting for a response to + each individual command. In particular, the commands RSET, MAIL FROM, + SEND FROM, SOML FROM, SAML FROM, and RCPT TO can all appear anywhere + in a pipelined command group. The EHLO, DATA, VRFY, EXPN, TURN, + QUIT, and NOOP commands can only appear as the last command in a + group since their success or failure produces a change of state which + the client SMTP must accommodate. (NOOP is included in this group so + it can be used as a synchronization point.) + + Additional commands added by other SMTP extensions may only appear as + the last command in a group unless otherwise specified by the + extensions that define the commands. + + The actual transfer of message content is explicitly allowed to be + the first "command" in a group. That is, the RSET/MAIL FROM sequence + necessary to initiate a new message transaction can be placed in the + same group as the final transfer of the headers and body of the + previous message. + + Client SMTP implementations that employ pipelining MUST check ALL + statuses associated with each command in a group. For example, if + none of the RCPT TO recipient addresses were accepted the client must + then check the response to the DATA command -- the client cannot + assume that the DATA command will be rejected just because none of + the RCPT TO commands worked. If the DATA command was properly + rejected the client SMTP can just issue RSET, but if the DATA command + was accepted the client SMTP should send a single dot. + + Command statuses MUST be coordinated with responses by counting each + separate response and correlating that count with the number of + commands known to have been issued. Multiline responses MUST be + supported. Matching on the basis of either the error code value or + associated text is expressly forbidden. + + Client SMTP implementations MAY elect to operate in a nonblocking + fashion, processing server responses immediately upon receipt, even + + + +Freed & Cargille Standards Track [Page 3] + +RFC 1854 SMTP Pipelining October 1995 + + + if there is still data pending transmission from the client's + previous TCP send operation. If nonblocking operation is not + supported, however, client SMTP implementations MUST also check the + TCP window size and make sure that each group of commands fits + entirely within the window. The window size is usually, but not + always, 4K octets. Failure to perform this check can lead to + deadlock conditions. + + Clients MUST NOT confuse responses to multiple commands with + multiline responses. Each command requires one or more lines of + response, the last line not containing a dash between the response + code and the response string. + +2.2. Server support of pipelining + + A server SMTP implementation that offers the pipelining extension: + + (1) MUST NOT flush or otherwise lose the contents of the + TCP input buffer under any circumstances whatsoever. + + (2) SHOULD issue a positive response to the DATA command if + and only if one or more valid RCPT TO addresses have + been previously received. + + (3) MUST NOT, after issuing a positive response to a DATA + command with no valid recipients and subsequently + receiving an empty message, send any message whatsoever + to anybody. + + (4) SHOULD elect to store responses to grouped RSET, MAIL + FROM, SEND FROM, SOML FROM, SAML FROM, and RCPT TO + commands in an internal buffer so they can sent as a + unit. + + (5) MUST NOT buffer responses to EHLO, DATA, VRFY, EXPN, + TURN, QUIT, and NOOP. + + (6) MUST NOT buffer responses to unrecognized commands. + + (7) MUST send all pending responses immediately whenever + the local TCP input buffer is emptied. + + (8) MUST NOT make assumptions about commands that are yet + to be received. + + (9) SHOULD issue response text that indicates, either + implicitly or explicitly, what command the response + matches. + + + +Freed & Cargille Standards Track [Page 4] + +RFC 1854 SMTP Pipelining October 1995 + + + The overriding intent of these server requirements is to make it as + easy as possible for servers to conform to these pipelining + extensions. + +3. Examples + + Consider the following SMTP dialogue that does not use pipelining: + + S: + C: + S: 220 innosoft.com SMTP service ready + C: HELO dbc.mtview.ca.us + S: 250 innosoft.com + C: MAIL FROM: + S: 250 sender OK + C: RCPT TO: + S: 250 recipient OK + C: RCPT TO: + S: 250 recipient OK + C: RCPT TO: + S: 250 recipient OK + C: DATA + S: 354 enter mail, end with line containing only "." + ... + C: . + S: 250 message sent + C: QUIT + S: 221 goodbye + + The client waits for a server response a total of 9 times in this + simple example. But if pipelining is employed the following dialogue + is possible: + + S: + C: + S: 220 innosoft.com SMTP service ready + C: EHLO dbc.mtview.ca.us + S: 250-innosoft.com + S: 250 PIPELINING + C: MAIL FROM: + C: RCPT TO: + C: RCPT TO: + C: RCPT TO: + C: DATA + S: 250 sender OK + S: 250 recipient OK + S: 250 recipient OK + S: 250 recipient OK + + + +Freed & Cargille Standards Track [Page 5] + +RFC 1854 SMTP Pipelining October 1995 + + + S: 354 enter mail, end with line containing only "." + ... + C: . + C: QUIT + S: 250 message sent + S: 221 goodbye + + The total number of turnarounds has been reduced from 9 to 4. + + The next example illustrates one possible form of behavior when + pipelining is used and all recipients are rejected: + + S: + C: + S: 220 innosoft.com SMTP service ready + C: EHLO dbc.mtview.ca.us + S: 250-innosoft.com + S: 250 PIPELINING + C: MAIL FROM: + C: RCPT TO: + C: RCPT TO: + C: DATA + S: 250 sender OK + S: 550 remote mail to not allowed + S: 550 remote mail to not allowed + S: 554 no valid recipients given + C: QUIT + S: 221 goodbye + + The client SMTP waits for the server 4 times here as well. If the + server SMTP does not check for at least one valid recipient prior to + accepting the DATA command, the following dialogue would result: + + S: + C: + S: 220 innosoft.com SMTP service ready + C: EHLO dbc.mtview.ca.us + S: 250-innosoft.com + S: 250 PIPELINING + C: MAIL FROM: + C: RCPT TO: + C: RCPT TO: + C: DATA + S: 250 sender OK + S: 550 remote mail to not allowed + S: 550 remote mail to not allowed + S: 354 enter mail, end with line containing only "." + C: . + + + +Freed & Cargille Standards Track [Page 6] + +RFC 1854 SMTP Pipelining October 1995 + + + C: QUIT + S: 554 no valid recipients + S: 221 goodbye + +4. Security Considerations + + This RFC does not discuss security issues and is not believed to + raise any security issues not endemic in electronic mail and present + in fully conforming implementations of [1]. + +5. Acknowledgements + + This document is based on the SMTP service extension model presented + in RFC 1425. Marshall Rose's description of SMTP command pipelining + in his book "The Internet Message" also served as a source of + inspiration for this extension. + +6. References + + [1] Postel, J., "Simple Mail Transfer Protocol", STD 10 + RFC 821, USC/Information Sciences Institute, August + 1982. + + [2] Klensin, J., Freed, N., Rose, M., Stefferud, E., + and D. Crocker, "SMTP Service Extensions", RFC 1651, + MCI, Innosoft, Dover Beach Consulting, Inc., + Network Management Associates, Inc., Silicon Graphics, + Inc., July 1994. + +7. Author's Address + + Ned Freed + Innosoft International, Inc. + 1050 East Garvey Avenue South + West Covina, CA 91790 + USA + + Phone: +1 818 919 3600 + Fax: +1 818 919 3614 + EMail: ned@innosoft.com + + + + + + + + + + + +Freed & Cargille Standards Track [Page 7] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2045.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2045.txt new file mode 100644 index 0000000..9f286b1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2045.txt @@ -0,0 +1,1739 @@ + + + + + + +Network Working Group N. Freed +Request for Comments: 2045 Innosoft +Obsoletes: 1521, 1522, 1590 N. Borenstein +Category: Standards Track First Virtual + November 1996 + + + Multipurpose Internet Mail Extensions + (MIME) Part One: + Format of Internet Message Bodies + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Abstract + + STD 11, RFC 822, defines a message representation protocol specifying + considerable detail about US-ASCII message headers, and leaves the + message content, or message body, as flat US-ASCII text. This set of + documents, collectively called the Multipurpose Internet Mail + Extensions, or MIME, redefines the format of messages to allow for + + (1) textual message bodies in character sets other than + US-ASCII, + + (2) an extensible set of different formats for non-textual + message bodies, + + (3) multi-part message bodies, and + + (4) textual header information in character sets other than + US-ASCII. + + These documents are based on earlier work documented in RFC 934, STD + 11, and RFC 1049, but extends and revises them. Because RFC 822 said + so little about message bodies, these documents are largely + orthogonal to (rather than a revision of) RFC 822. + + This initial document specifies the various headers used to describe + the structure of MIME messages. The second document, RFC 2046, + defines the general structure of the MIME media typing system and + defines an initial set of media types. The third document, RFC 2047, + describes extensions to RFC 822 to allow non-US-ASCII text data in + + + +Freed & Borenstein Standards Track [Page 1] + +RFC 2045 Internet Message Bodies November 1996 + + + Internet mail header fields. The fourth document, RFC 2048, specifies + various IANA registration procedures for MIME-related facilities. The + fifth and final document, RFC 2049, describes MIME conformance + criteria as well as providing some illustrative examples of MIME + message formats, acknowledgements, and the bibliography. + + These documents are revisions of RFCs 1521, 1522, and 1590, which + themselves were revisions of RFCs 1341 and 1342. An appendix in RFC + 2049 describes differences and changes from previous versions. + +Table of Contents + + 1. Introduction ......................................... 3 + 2. Definitions, Conventions, and Generic BNF Grammar .... 5 + 2.1 CRLF ................................................ 5 + 2.2 Character Set ....................................... 6 + 2.3 Message ............................................. 6 + 2.4 Entity .............................................. 6 + 2.5 Body Part ........................................... 7 + 2.6 Body ................................................ 7 + 2.7 7bit Data ........................................... 7 + 2.8 8bit Data ........................................... 7 + 2.9 Binary Data ......................................... 7 + 2.10 Lines .............................................. 7 + 3. MIME Header Fields ................................... 8 + 4. MIME-Version Header Field ............................ 8 + 5. Content-Type Header Field ............................ 10 + 5.1 Syntax of the Content-Type Header Field ............. 12 + 5.2 Content-Type Defaults ............................... 14 + 6. Content-Transfer-Encoding Header Field ............... 14 + 6.1 Content-Transfer-Encoding Syntax .................... 14 + 6.2 Content-Transfer-Encodings Semantics ................ 15 + 6.3 New Content-Transfer-Encodings ...................... 16 + 6.4 Interpretation and Use .............................. 16 + 6.5 Translating Encodings ............................... 18 + 6.6 Canonical Encoding Model ............................ 19 + 6.7 Quoted-Printable Content-Transfer-Encoding .......... 19 + 6.8 Base64 Content-Transfer-Encoding .................... 24 + 7. Content-ID Header Field .............................. 26 + 8. Content-Description Header Field ..................... 27 + 9. Additional MIME Header Fields ........................ 27 + 10. Summary ............................................. 27 + 11. Security Considerations ............................. 27 + 12. Authors' Addresses .................................. 28 + A. Collected Grammar .................................... 29 + + + + + + +Freed & Borenstein Standards Track [Page 2] + +RFC 2045 Internet Message Bodies November 1996 + + +1. Introduction + + Since its publication in 1982, RFC 822 has defined the standard + format of textual mail messages on the Internet. Its success has + been such that the RFC 822 format has been adopted, wholly or + partially, well beyond the confines of the Internet and the Internet + SMTP transport defined by RFC 821. As the format has seen wider use, + a number of limitations have proven increasingly restrictive for the + user community. + + RFC 822 was intended to specify a format for text messages. As such, + non-text messages, such as multimedia messages that might include + audio or images, are simply not mentioned. Even in the case of text, + however, RFC 822 is inadequate for the needs of mail users whose + languages require the use of character sets richer than US-ASCII. + Since RFC 822 does not specify mechanisms for mail containing audio, + video, Asian language text, or even text in most European languages, + additional specifications are needed. + + One of the notable limitations of RFC 821/822 based mail systems is + the fact that they limit the contents of electronic mail messages to + relatively short lines (e.g. 1000 characters or less [RFC-821]) of + 7bit US-ASCII. This forces users to convert any non-textual data + that they may wish to send into seven-bit bytes representable as + printable US-ASCII characters before invoking a local mail UA (User + Agent, a program with which human users send and receive mail). + Examples of such encodings currently used in the Internet include + pure hexadecimal, uuencode, the 3-in-4 base 64 scheme specified in + RFC 1421, the Andrew Toolkit Representation [ATK], and many others. + + The limitations of RFC 822 mail become even more apparent as gateways + are designed to allow for the exchange of mail messages between RFC + 822 hosts and X.400 hosts. X.400 [X400] specifies mechanisms for the + inclusion of non-textual material within electronic mail messages. + The current standards for the mapping of X.400 messages to RFC 822 + messages specify either that X.400 non-textual material must be + converted to (not encoded in) IA5Text format, or that they must be + discarded, notifying the RFC 822 user that discarding has occurred. + This is clearly undesirable, as information that a user may wish to + receive is lost. Even though a user agent may not have the + capability of dealing with the non-textual material, the user might + have some mechanism external to the UA that can extract useful + information from the material. Moreover, it does not allow for the + fact that the message may eventually be gatewayed back into an X.400 + message handling system (i.e., the X.400 message is "tunneled" + through Internet mail), where the non-textual information would + definitely become useful again. + + + + +Freed & Borenstein Standards Track [Page 3] + +RFC 2045 Internet Message Bodies November 1996 + + + This document describes several mechanisms that combine to solve most + of these problems without introducing any serious incompatibilities + with the existing world of RFC 822 mail. In particular, it + describes: + + (1) A MIME-Version header field, which uses a version + number to declare a message to be conformant with MIME + and allows mail processing agents to distinguish + between such messages and those generated by older or + non-conformant software, which are presumed to lack + such a field. + + (2) A Content-Type header field, generalized from RFC 1049, + which can be used to specify the media type and subtype + of data in the body of a message and to fully specify + the native representation (canonical form) of such + data. + + (3) A Content-Transfer-Encoding header field, which can be + used to specify both the encoding transformation that + was applied to the body and the domain of the result. + Encoding transformations other than the identity + transformation are usually applied to data in order to + allow it to pass through mail transport mechanisms + which may have data or character set limitations. + + (4) Two additional header fields that can be used to + further describe the data in a body, the Content-ID and + Content-Description header fields. + + All of the header fields defined in this document are subject to the + general syntactic rules for header fields specified in RFC 822. In + particular, all of these header fields except for Content-Disposition + can include RFC 822 comments, which have no semantic content and + should be ignored during MIME processing. + + Finally, to specify and promote interoperability, RFC 2049 provides a + basic applicability statement for a subset of the above mechanisms + that defines a minimal level of "conformance" with this document. + + HISTORICAL NOTE: Several of the mechanisms described in this set of + documents may seem somewhat strange or even baroque at first reading. + It is important to note that compatibility with existing standards + AND robustness across existing practice were two of the highest + priorities of the working group that developed this set of documents. + In particular, compatibility was always favored over elegance. + + + + + +Freed & Borenstein Standards Track [Page 4] + +RFC 2045 Internet Message Bodies November 1996 + + + Please refer to the current edition of the "Internet Official + Protocol Standards" for the standardization state and status of this + protocol. RFC 822 and STD 3, RFC 1123 also provide essential + background for MIME since no conforming implementation of MIME can + violate them. In addition, several other informational RFC documents + will be of interest to the MIME implementor, in particular RFC 1344, + RFC 1345, and RFC 1524. + +2. Definitions, Conventions, and Generic BNF Grammar + + Although the mechanisms specified in this set of documents are all + described in prose, most are also described formally in the augmented + BNF notation of RFC 822. Implementors will need to be familiar with + this notation in order to understand this set of documents, and are + referred to RFC 822 for a complete explanation of the augmented BNF + notation. + + Some of the augmented BNF in this set of documents makes named + references to syntax rules defined in RFC 822. A complete formal + grammar, then, is obtained by combining the collected grammar + appendices in each document in this set with the BNF of RFC 822 plus + the modifications to RFC 822 defined in RFC 1123 (which specifically + changes the syntax for `return', `date' and `mailbox'). + + All numeric and octet values are given in decimal notation in this + set of documents. All media type values, subtype values, and + parameter names as defined are case-insensitive. However, parameter + values are case-sensitive unless otherwise specified for the specific + parameter. + + FORMATTING NOTE: Notes, such at this one, provide additional + nonessential information which may be skipped by the reader without + missing anything essential. The primary purpose of these non- + essential notes is to convey information about the rationale of this + set of documents, or to place these documents in the proper + historical or evolutionary context. Such information may in + particular be skipped by those who are focused entirely on building a + conformant implementation, but may be of use to those who wish to + understand why certain design choices were made. + +2.1. CRLF + + The term CRLF, in this set of documents, refers to the sequence of + octets corresponding to the two US-ASCII characters CR (decimal value + 13) and LF (decimal value 10) which, taken together, in this order, + denote a line break in RFC 822 mail. + + + + + +Freed & Borenstein Standards Track [Page 5] + +RFC 2045 Internet Message Bodies November 1996 + + +2.2. Character Set + + The term "character set" is used in MIME to refer to a method of + converting a sequence of octets into a sequence of characters. Note + that unconditional and unambiguous conversion in the other direction + is not required, in that not all characters may be representable by a + given character set and a character set may provide more than one + sequence of octets to represent a particular sequence of characters. + + This definition is intended to allow various kinds of character + encodings, from simple single-table mappings such as US-ASCII to + complex table switching methods such as those that use ISO 2022's + techniques, to be used as character sets. However, the definition + associated with a MIME character set name must fully specify the + mapping to be performed. In particular, use of external profiling + information to determine the exact mapping is not permitted. + + NOTE: The term "character set" was originally to describe such + straightforward schemes as US-ASCII and ISO-8859-1 which have a + simple one-to-one mapping from single octets to single characters. + Multi-octet coded character sets and switching techniques make the + situation more complex. For example, some communities use the term + "character encoding" for what MIME calls a "character set", while + using the phrase "coded character set" to denote an abstract mapping + from integers (not octets) to characters. + +2.3. Message + + The term "message", when not further qualified, means either a + (complete or "top-level") RFC 822 message being transferred on a + network, or a message encapsulated in a body of type "message/rfc822" + or "message/partial". + +2.4. Entity + + The term "entity", refers specifically to the MIME-defined header + fields and contents of either a message or one of the parts in the + body of a multipart entity. The specification of such entities is + the essence of MIME. Since the contents of an entity are often + called the "body", it makes sense to speak about the body of an + entity. Any sort of field may be present in the header of an entity, + but only those fields whose names begin with "content-" actually have + any MIME-related meaning. Note that this does NOT imply thay they + have no meaning at all -- an entity that is also a message has non- + MIME header fields whose meanings are defined by RFC 822. + + + + + + +Freed & Borenstein Standards Track [Page 6] + +RFC 2045 Internet Message Bodies November 1996 + + +2.5. Body Part + + The term "body part" refers to an entity inside of a multipart + entity. + +2.6. Body + + The term "body", when not further qualified, means the body of an + entity, that is, the body of either a message or of a body part. + + NOTE: The previous four definitions are clearly circular. This is + unavoidable, since the overall structure of a MIME message is indeed + recursive. + +2.7. 7bit Data + + "7bit data" refers to data that is all represented as relatively + short lines with 998 octets or less between CRLF line separation + sequences [RFC-821]. No octets with decimal values greater than 127 + are allowed and neither are NULs (octets with decimal value 0). CR + (decimal value 13) and LF (decimal value 10) octets only occur as + part of CRLF line separation sequences. + +2.8. 8bit Data + + "8bit data" refers to data that is all represented as relatively + short lines with 998 octets or less between CRLF line separation + sequences [RFC-821]), but octets with decimal values greater than 127 + may be used. As with "7bit data" CR and LF octets only occur as part + of CRLF line separation sequences and no NULs are allowed. + +2.9. Binary Data + + "Binary data" refers to data where any sequence of octets whatsoever + is allowed. + +2.10. Lines + + "Lines" are defined as sequences of octets separated by a CRLF + sequences. This is consistent with both RFC 821 and RFC 822. + "Lines" only refers to a unit of data in a message, which may or may + not correspond to something that is actually displayed by a user + agent. + + + + + + + + +Freed & Borenstein Standards Track [Page 7] + +RFC 2045 Internet Message Bodies November 1996 + + +3. MIME Header Fields + + MIME defines a number of new RFC 822 header fields that are used to + describe the content of a MIME entity. These header fields occur in + at least two contexts: + + (1) As part of a regular RFC 822 message header. + + (2) In a MIME body part header within a multipart + construct. + + The formal definition of these header fields is as follows: + + entity-headers := [ content CRLF ] + [ encoding CRLF ] + [ id CRLF ] + [ description CRLF ] + *( MIME-extension-field CRLF ) + + MIME-message-headers := entity-headers + fields + version CRLF + ; The ordering of the header + ; fields implied by this BNF + ; definition should be ignored. + + MIME-part-headers := entity-headers + [ fields ] + ; Any field not beginning with + ; "content-" can have no defined + ; meaning and may be ignored. + ; The ordering of the header + ; fields implied by this BNF + ; definition should be ignored. + + The syntax of the various specific MIME header fields will be + described in the following sections. + +4. MIME-Version Header Field + + Since RFC 822 was published in 1982, there has really been only one + format standard for Internet messages, and there has been little + perceived need to declare the format standard in use. This document + is an independent specification that complements RFC 822. Although + the extensions in this document have been defined in such a way as to + be compatible with RFC 822, there are still circumstances in which it + might be desirable for a mail-processing agent to know whether a + message was composed with the new standard in mind. + + + +Freed & Borenstein Standards Track [Page 8] + +RFC 2045 Internet Message Bodies November 1996 + + + Therefore, this document defines a new header field, "MIME-Version", + which is to be used to declare the version of the Internet message + body format standard in use. + + Messages composed in accordance with this document MUST include such + a header field, with the following verbatim text: + + MIME-Version: 1.0 + + The presence of this header field is an assertion that the message + has been composed in compliance with this document. + + Since it is possible that a future document might extend the message + format standard again, a formal BNF is given for the content of the + MIME-Version field: + + version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT + + Thus, future format specifiers, which might replace or extend "1.0", + are constrained to be two integer fields, separated by a period. If + a message is received with a MIME-version value other than "1.0", it + cannot be assumed to conform with this document. + + Note that the MIME-Version header field is required at the top level + of a message. It is not required for each body part of a multipart + entity. It is required for the embedded headers of a body of type + "message/rfc822" or "message/partial" if and only if the embedded + message is itself claimed to be MIME-conformant. + + It is not possible to fully specify how a mail reader that conforms + with MIME as defined in this document should treat a message that + might arrive in the future with some value of MIME-Version other than + "1.0". + + It is also worth noting that version control for specific media types + is not accomplished using the MIME-Version mechanism. In particular, + some formats (such as application/postscript) have version numbering + conventions that are internal to the media format. Where such + conventions exist, MIME does nothing to supersede them. Where no + such conventions exist, a MIME media type might use a "version" + parameter in the content-type field if necessary. + + + + + + + + + + +Freed & Borenstein Standards Track [Page 9] + +RFC 2045 Internet Message Bodies November 1996 + + + NOTE TO IMPLEMENTORS: When checking MIME-Version values any RFC 822 + comment strings that are present must be ignored. In particular, the + following four MIME-Version fields are equivalent: + + MIME-Version: 1.0 + + MIME-Version: 1.0 (produced by MetaSend Vx.x) + + MIME-Version: (produced by MetaSend Vx.x) 1.0 + + MIME-Version: 1.(produced by MetaSend Vx.x)0 + + In the absence of a MIME-Version field, a receiving mail user agent + (whether conforming to MIME requirements or not) may optionally + choose to interpret the body of the message according to local + conventions. Many such conventions are currently in use and it + should be noted that in practice non-MIME messages can contain just + about anything. + + It is impossible to be certain that a non-MIME mail message is + actually plain text in the US-ASCII character set since it might well + be a message that, using some set of nonstandard local conventions + that predate MIME, includes text in another character set or non- + textual data presented in a manner that cannot be automatically + recognized (e.g., a uuencoded compressed UNIX tar file). + +5. Content-Type Header Field + + The purpose of the Content-Type field is to describe the data + contained in the body fully enough that the receiving user agent can + pick an appropriate agent or mechanism to present the data to the + user, or otherwise deal with the data in an appropriate manner. The + value in this field is called a media type. + + HISTORICAL NOTE: The Content-Type header field was first defined in + RFC 1049. RFC 1049 used a simpler and less powerful syntax, but one + that is largely compatible with the mechanism given here. + + The Content-Type header field specifies the nature of the data in the + body of an entity by giving media type and subtype identifiers, and + by providing auxiliary information that may be required for certain + media types. After the media type and subtype names, the remainder + of the header field is simply a set of parameters, specified in an + attribute=value notation. The ordering of parameters is not + significant. + + + + + + +Freed & Borenstein Standards Track [Page 10] + +RFC 2045 Internet Message Bodies November 1996 + + + In general, the top-level media type is used to declare the general + type of data, while the subtype specifies a specific format for that + type of data. Thus, a media type of "image/xyz" is enough to tell a + user agent that the data is an image, even if the user agent has no + knowledge of the specific image format "xyz". Such information can + be used, for example, to decide whether or not to show a user the raw + data from an unrecognized subtype -- such an action might be + reasonable for unrecognized subtypes of text, but not for + unrecognized subtypes of image or audio. For this reason, registered + subtypes of text, image, audio, and video should not contain embedded + information that is really of a different type. Such compound + formats should be represented using the "multipart" or "application" + types. + + Parameters are modifiers of the media subtype, and as such do not + fundamentally affect the nature of the content. The set of + meaningful parameters depends on the media type and subtype. Most + parameters are associated with a single specific subtype. However, a + given top-level media type may define parameters which are applicable + to any subtype of that type. Parameters may be required by their + defining content type or subtype or they may be optional. MIME + implementations must ignore any parameters whose names they do not + recognize. + + For example, the "charset" parameter is applicable to any subtype of + "text", while the "boundary" parameter is required for any subtype of + the "multipart" media type. + + There are NO globally-meaningful parameters that apply to all media + types. Truly global mechanisms are best addressed, in the MIME + model, by the definition of additional Content-* header fields. + + An initial set of seven top-level media types is defined in RFC 2046. + Five of these are discrete types whose content is essentially opaque + as far as MIME processing is concerned. The remaining two are + composite types whose contents require additional handling by MIME + processors. + + This set of top-level media types is intended to be substantially + complete. It is expected that additions to the larger set of + supported types can generally be accomplished by the creation of new + subtypes of these initial types. In the future, more top-level types + may be defined only by a standards-track extension to this standard. + If another top-level type is to be used for any reason, it must be + given a name starting with "X-" to indicate its non-standard status + and to avoid a potential conflict with a future official name. + + + + + +Freed & Borenstein Standards Track [Page 11] + +RFC 2045 Internet Message Bodies November 1996 + + +5.1. Syntax of the Content-Type Header Field + + In the Augmented BNF notation of RFC 822, a Content-Type header field + value is defined as follows: + + content := "Content-Type" ":" type "/" subtype + *(";" parameter) + ; Matching of media type and subtype + ; is ALWAYS case-insensitive. + + type := discrete-type / composite-type + + discrete-type := "text" / "image" / "audio" / "video" / + "application" / extension-token + + composite-type := "message" / "multipart" / extension-token + + extension-token := ietf-token / x-token + + ietf-token := + + x-token := + + subtype := extension-token / iana-token + + iana-token := + + parameter := attribute "=" value + + attribute := token + ; Matching of attributes + ; is ALWAYS case-insensitive. + + value := token / quoted-string + + token := 1* + + tspecials := "(" / ")" / "<" / ">" / "@" / + "," / ";" / ":" / "\" / <"> + "/" / "[" / "]" / "?" / "=" + ; Must be in quoted-string, + ; to use within parameter values + + + +Freed & Borenstein Standards Track [Page 12] + +RFC 2045 Internet Message Bodies November 1996 + + + Note that the definition of "tspecials" is the same as the RFC 822 + definition of "specials" with the addition of the three characters + "/", "?", and "=", and the removal of ".". + + Note also that a subtype specification is MANDATORY -- it may not be + omitted from a Content-Type header field. As such, there are no + default subtypes. + + The type, subtype, and parameter names are not case sensitive. For + example, TEXT, Text, and TeXt are all equivalent top-level media + types. Parameter values are normally case sensitive, but sometimes + are interpreted in a case-insensitive fashion, depending on the + intended use. (For example, multipart boundaries are case-sensitive, + but the "access-type" parameter for message/External-body is not + case-sensitive.) + + Note that the value of a quoted string parameter does not include the + quotes. That is, the quotation marks in a quoted-string are not a + part of the value of the parameter, but are merely used to delimit + that parameter value. In addition, comments are allowed in + accordance with RFC 822 rules for structured header fields. Thus the + following two forms + + Content-type: text/plain; charset=us-ascii (Plain text) + + Content-type: text/plain; charset="us-ascii" + + are completely equivalent. + + Beyond this syntax, the only syntactic constraint on the definition + of subtype names is the desire that their uses must not conflict. + That is, it would be undesirable to have two different communities + using "Content-Type: application/foobar" to mean two different + things. The process of defining new media subtypes, then, is not + intended to be a mechanism for imposing restrictions, but simply a + mechanism for publicizing their definition and usage. There are, + therefore, two acceptable mechanisms for defining new media subtypes: + + (1) Private values (starting with "X-") may be defined + bilaterally between two cooperating agents without + outside registration or standardization. Such values + cannot be registered or standardized. + + (2) New standard values should be registered with IANA as + described in RFC 2048. + + The second document in this set, RFC 2046, defines the initial set of + media types for MIME. + + + +Freed & Borenstein Standards Track [Page 13] + +RFC 2045 Internet Message Bodies November 1996 + + +5.2. Content-Type Defaults + + Default RFC 822 messages without a MIME Content-Type header are taken + by this protocol to be plain text in the US-ASCII character set, + which can be explicitly specified as: + + Content-type: text/plain; charset=us-ascii + + This default is assumed if no Content-Type header field is specified. + It is also recommend that this default be assumed when a + syntactically invalid Content-Type header field is encountered. In + the presence of a MIME-Version header field and the absence of any + Content-Type header field, a receiving User Agent can also assume + that plain US-ASCII text was the sender's intent. Plain US-ASCII + text may still be assumed in the absence of a MIME-Version or the + presence of an syntactically invalid Content-Type header field, but + the sender's intent might have been otherwise. + +6. Content-Transfer-Encoding Header Field + + Many media types which could be usefully transported via email are + represented, in their "natural" format, as 8bit character or binary + data. Such data cannot be transmitted over some transfer protocols. + For example, RFC 821 (SMTP) restricts mail messages to 7bit US-ASCII + data with lines no longer than 1000 characters including any trailing + CRLF line separator. + + It is necessary, therefore, to define a standard mechanism for + encoding such data into a 7bit short line format. Proper labelling + of unencoded material in less restrictive formats for direct use over + less restrictive transports is also desireable. This document + specifies that such encodings will be indicated by a new "Content- + Transfer-Encoding" header field. This field has not been defined by + any previous standard. + +6.1. Content-Transfer-Encoding Syntax + + The Content-Transfer-Encoding field's value is a single token + specifying the type of encoding, as enumerated below. Formally: + + encoding := "Content-Transfer-Encoding" ":" mechanism + + mechanism := "7bit" / "8bit" / "binary" / + "quoted-printable" / "base64" / + ietf-token / x-token + + These values are not case sensitive -- Base64 and BASE64 and bAsE64 + are all equivalent. An encoding type of 7BIT requires that the body + + + +Freed & Borenstein Standards Track [Page 14] + +RFC 2045 Internet Message Bodies November 1996 + + + is already in a 7bit mail-ready representation. This is the default + value -- that is, "Content-Transfer-Encoding: 7BIT" is assumed if the + Content-Transfer-Encoding header field is not present. + +6.2. Content-Transfer-Encodings Semantics + + This single Content-Transfer-Encoding token actually provides two + pieces of information. It specifies what sort of encoding + transformation the body was subjected to and hence what decoding + operation must be used to restore it to its original form, and it + specifies what the domain of the result is. + + The transformation part of any Content-Transfer-Encodings specifies, + either explicitly or implicitly, a single, well-defined decoding + algorithm, which for any sequence of encoded octets either transforms + it to the original sequence of octets which was encoded, or shows + that it is illegal as an encoded sequence. Content-Transfer- + Encodings transformations never depend on any additional external + profile information for proper operation. Note that while decoders + must produce a single, well-defined output for a valid encoding no + such restrictions exist for encoders: Encoding a given sequence of + octets to different, equivalent encoded sequences is perfectly legal. + + Three transformations are currently defined: identity, the "quoted- + printable" encoding, and the "base64" encoding. The domains are + "binary", "8bit" and "7bit". + + The Content-Transfer-Encoding values "7bit", "8bit", and "binary" all + mean that the identity (i.e. NO) encoding transformation has been + performed. As such, they serve simply as indicators of the domain of + the body data, and provide useful information about the sort of + encoding that might be needed for transmission in a given transport + system. The terms "7bit data", "8bit data", and "binary data" are + all defined in Section 2. + + The quoted-printable and base64 encodings transform their input from + an arbitrary domain into material in the "7bit" range, thus making it + safe to carry over restricted transports. The specific definition of + the transformations are given below. + + The proper Content-Transfer-Encoding label must always be used. + Labelling unencoded data containing 8bit characters as "7bit" is not + allowed, nor is labelling unencoded non-line-oriented data as + anything other than "binary" allowed. + + Unlike media subtypes, a proliferation of Content-Transfer-Encoding + values is both undesirable and unnecessary. However, establishing + only a single transformation into the "7bit" domain does not seem + + + +Freed & Borenstein Standards Track [Page 15] + +RFC 2045 Internet Message Bodies November 1996 + + + possible. There is a tradeoff between the desire for a compact and + efficient encoding of largely- binary data and the desire for a + somewhat readable encoding of data that is mostly, but not entirely, + 7bit. For this reason, at least two encoding mechanisms are + necessary: a more or less readable encoding (quoted-printable) and a + "dense" or "uniform" encoding (base64). + + Mail transport for unencoded 8bit data is defined in RFC 1652. As of + the initial publication of this document, there are no standardized + Internet mail transports for which it is legitimate to include + unencoded binary data in mail bodies. Thus there are no + circumstances in which the "binary" Content-Transfer-Encoding is + actually valid in Internet mail. However, in the event that binary + mail transport becomes a reality in Internet mail, or when MIME is + used in conjunction with any other binary-capable mail transport + mechanism, binary bodies must be labelled as such using this + mechanism. + + NOTE: The five values defined for the Content-Transfer-Encoding field + imply nothing about the media type other than the algorithm by which + it was encoded or the transport system requirements if unencoded. + +6.3. New Content-Transfer-Encodings + + Implementors may, if necessary, define private Content-Transfer- + Encoding values, but must use an x-token, which is a name prefixed by + "X-", to indicate its non-standard status, e.g., "Content-Transfer- + Encoding: x-my-new-encoding". Additional standardized Content- + Transfer-Encoding values must be specified by a standards-track RFC. + The requirements such specifications must meet are given in RFC 2048. + As such, all content-transfer-encoding namespace except that + beginning with "X-" is explicitly reserved to the IETF for future + use. + + Unlike media types and subtypes, the creation of new Content- + Transfer-Encoding values is STRONGLY discouraged, as it seems likely + to hinder interoperability with little potential benefit + +6.4. Interpretation and Use + + If a Content-Transfer-Encoding header field appears as part of a + message header, it applies to the entire body of that message. If a + Content-Transfer-Encoding header field appears as part of an entity's + headers, it applies only to the body of that entity. If an entity is + of type "multipart" the Content-Transfer-Encoding is not permitted to + have any value other than "7bit", "8bit" or "binary". Even more + severe restrictions apply to some subtypes of the "message" type. + + + + +Freed & Borenstein Standards Track [Page 16] + +RFC 2045 Internet Message Bodies November 1996 + + + It should be noted that most media types are defined in terms of + octets rather than bits, so that the mechanisms described here are + mechanisms for encoding arbitrary octet streams, not bit streams. If + a bit stream is to be encoded via one of these mechanisms, it must + first be converted to an 8bit byte stream using the network standard + bit order ("big-endian"), in which the earlier bits in a stream + become the higher-order bits in a 8bit byte. A bit stream not ending + at an 8bit boundary must be padded with zeroes. RFC 2046 provides a + mechanism for noting the addition of such padding in the case of the + application/octet-stream media type, which has a "padding" parameter. + + The encoding mechanisms defined here explicitly encode all data in + US-ASCII. Thus, for example, suppose an entity has header fields + such as: + + Content-Type: text/plain; charset=ISO-8859-1 + Content-transfer-encoding: base64 + + This must be interpreted to mean that the body is a base64 US-ASCII + encoding of data that was originally in ISO-8859-1, and will be in + that character set again after decoding. + + Certain Content-Transfer-Encoding values may only be used on certain + media types. In particular, it is EXPRESSLY FORBIDDEN to use any + encodings other than "7bit", "8bit", or "binary" with any composite + media type, i.e. one that recursively includes other Content-Type + fields. Currently the only composite media types are "multipart" and + "message". All encodings that are desired for bodies of type + multipart or message must be done at the innermost level, by encoding + the actual body that needs to be encoded. + + It should also be noted that, by definition, if a composite entity + has a transfer-encoding value such as "7bit", but one of the enclosed + entities has a less restrictive value such as "8bit", then either the + outer "7bit" labelling is in error, because 8bit data are included, + or the inner "8bit" labelling placed an unnecessarily high demand on + the transport system because the actual included data were actually + 7bit-safe. + + NOTE ON ENCODING RESTRICTIONS: Though the prohibition against using + content-transfer-encodings on composite body data may seem overly + restrictive, it is necessary to prevent nested encodings, in which + data are passed through an encoding algorithm multiple times, and + must be decoded multiple times in order to be properly viewed. + Nested encodings add considerable complexity to user agents: Aside + from the obvious efficiency problems with such multiple encodings, + they can obscure the basic structure of a message. In particular, + they can imply that several decoding operations are necessary simply + + + +Freed & Borenstein Standards Track [Page 17] + +RFC 2045 Internet Message Bodies November 1996 + + + to find out what types of bodies a message contains. Banning nested + encodings may complicate the job of certain mail gateways, but this + seems less of a problem than the effect of nested encodings on user + agents. + + Any entity with an unrecognized Content-Transfer-Encoding must be + treated as if it has a Content-Type of "application/octet-stream", + regardless of what the Content-Type header field actually says. + + NOTE ON THE RELATIONSHIP BETWEEN CONTENT-TYPE AND CONTENT-TRANSFER- + ENCODING: It may seem that the Content-Transfer-Encoding could be + inferred from the characteristics of the media that is to be encoded, + or, at the very least, that certain Content-Transfer-Encodings could + be mandated for use with specific media types. There are several + reasons why this is not the case. First, given the varying types of + transports used for mail, some encodings may be appropriate for some + combinations of media types and transports but not for others. (For + example, in an 8bit transport, no encoding would be required for text + in certain character sets, while such encodings are clearly required + for 7bit SMTP.) + + Second, certain media types may require different types of transfer + encoding under different circumstances. For example, many PostScript + bodies might consist entirely of short lines of 7bit data and hence + require no encoding at all. Other PostScript bodies (especially + those using Level 2 PostScript's binary encoding mechanism) may only + be reasonably represented using a binary transport encoding. + Finally, since the Content-Type field is intended to be an open-ended + specification mechanism, strict specification of an association + between media types and encodings effectively couples the + specification of an application protocol with a specific lower-level + transport. This is not desirable since the developers of a media + type should not have to be aware of all the transports in use and + what their limitations are. + +6.5. Translating Encodings + + The quoted-printable and base64 encodings are designed so that + conversion between them is possible. The only issue that arises in + such a conversion is the handling of hard line breaks in quoted- + printable encoding output. When converting from quoted-printable to + base64 a hard line break in the quoted-printable form represents a + CRLF sequence in the canonical form of the data. It must therefore be + converted to a corresponding encoded CRLF in the base64 form of the + data. Similarly, a CRLF sequence in the canonical form of the data + obtained after base64 decoding must be converted to a quoted- + printable hard line break, but ONLY when converting text data. + + + + +Freed & Borenstein Standards Track [Page 18] + +RFC 2045 Internet Message Bodies November 1996 + + +6.6. Canonical Encoding Model + + There was some confusion, in the previous versions of this RFC, + regarding the model for when email data was to be converted to + canonical form and encoded, and in particular how this process would + affect the treatment of CRLFs, given that the representation of + newlines varies greatly from system to system, and the relationship + between content-transfer-encodings and character sets. A canonical + model for encoding is presented in RFC 2049 for this reason. + +6.7. Quoted-Printable Content-Transfer-Encoding + + The Quoted-Printable encoding is intended to represent data that + largely consists of octets that correspond to printable characters in + the US-ASCII character set. It encodes the data in such a way that + the resulting octets are unlikely to be modified by mail transport. + If the data being encoded are mostly US-ASCII text, the encoded form + of the data remains largely recognizable by humans. A body which is + entirely US-ASCII may also be encoded in Quoted-Printable to ensure + the integrity of the data should the message pass through a + character-translating, and/or line-wrapping gateway. + + In this encoding, octets are to be represented as determined by the + following rules: + + (1) (General 8bit representation) Any octet, except a CR or + LF that is part of a CRLF line break of the canonical + (standard) form of the data being encoded, may be + represented by an "=" followed by a two digit + hexadecimal representation of the octet's value. The + digits of the hexadecimal alphabet, for this purpose, + are "0123456789ABCDEF". Uppercase letters must be + used; lowercase letters are not allowed. Thus, for + example, the decimal value 12 (US-ASCII form feed) can + be represented by "=0C", and the decimal value 61 (US- + ASCII EQUAL SIGN) can be represented by "=3D". This + rule must be followed except when the following rules + allow an alternative encoding. + + (2) (Literal representation) Octets with decimal values of + 33 through 60 inclusive, and 62 through 126, inclusive, + MAY be represented as the US-ASCII characters which + correspond to those octets (EXCLAMATION POINT through + LESS THAN, and GREATER THAN through TILDE, + respectively). + + (3) (White Space) Octets with values of 9 and 32 MAY be + represented as US-ASCII TAB (HT) and SPACE characters, + + + +Freed & Borenstein Standards Track [Page 19] + +RFC 2045 Internet Message Bodies November 1996 + + + respectively, but MUST NOT be so represented at the end + of an encoded line. Any TAB (HT) or SPACE characters + on an encoded line MUST thus be followed on that line + by a printable character. In particular, an "=" at the + end of an encoded line, indicating a soft line break + (see rule #5) may follow one or more TAB (HT) or SPACE + characters. It follows that an octet with decimal + value 9 or 32 appearing at the end of an encoded line + must be represented according to Rule #1. This rule is + necessary because some MTAs (Message Transport Agents, + programs which transport messages from one user to + another, or perform a portion of such transfers) are + known to pad lines of text with SPACEs, and others are + known to remove "white space" characters from the end + of a line. Therefore, when decoding a Quoted-Printable + body, any trailing white space on a line must be + deleted, as it will necessarily have been added by + intermediate transport agents. + + (4) (Line Breaks) A line break in a text body, represented + as a CRLF sequence in the text canonical form, must be + represented by a (RFC 822) line break, which is also a + CRLF sequence, in the Quoted-Printable encoding. Since + the canonical representation of media types other than + text do not generally include the representation of + line breaks as CRLF sequences, no hard line breaks + (i.e. line breaks that are intended to be meaningful + and to be displayed to the user) can occur in the + quoted-printable encoding of such types. Sequences + like "=0D", "=0A", "=0A=0D" and "=0D=0A" will routinely + appear in non-text data represented in quoted- + printable, of course. + + Note that many implementations may elect to encode the + local representation of various content types directly + rather than converting to canonical form first, + encoding, and then converting back to local + representation. In particular, this may apply to plain + text material on systems that use newline conventions + other than a CRLF terminator sequence. Such an + implementation optimization is permissible, but only + when the combined canonicalization-encoding step is + equivalent to performing the three steps separately. + + (5) (Soft Line Breaks) The Quoted-Printable encoding + REQUIRES that encoded lines be no more than 76 + characters long. If longer lines are to be encoded + with the Quoted-Printable encoding, "soft" line breaks + + + +Freed & Borenstein Standards Track [Page 20] + +RFC 2045 Internet Message Bodies November 1996 + + + must be used. An equal sign as the last character on a + encoded line indicates such a non-significant ("soft") + line break in the encoded text. + + Thus if the "raw" form of the line is a single unencoded line that + says: + + Now's the time for all folk to come to the aid of their country. + + This can be represented, in the Quoted-Printable encoding, as: + + Now's the time = + for all folk to come= + to the aid of their country. + + This provides a mechanism with which long lines are encoded in such a + way as to be restored by the user agent. The 76 character limit does + not count the trailing CRLF, but counts all other characters, + including any equal signs. + + Since the hyphen character ("-") may be represented as itself in the + Quoted-Printable encoding, care must be taken, when encapsulating a + quoted-printable encoded body inside one or more multipart entities, + to ensure that the boundary delimiter does not appear anywhere in the + encoded body. (A good strategy is to choose a boundary that includes + a character sequence such as "=_" which can never appear in a + quoted-printable body. See the definition of multipart messages in + RFC 2046.) + + NOTE: The quoted-printable encoding represents something of a + compromise between readability and reliability in transport. Bodies + encoded with the quoted-printable encoding will work reliably over + most mail gateways, but may not work perfectly over a few gateways, + notably those involving translation into EBCDIC. A higher level of + confidence is offered by the base64 Content-Transfer-Encoding. A way + to get reasonably reliable transport through EBCDIC gateways is to + also quote the US-ASCII characters + + !"#$@[\]^`{|}~ + + according to rule #1. + + Because quoted-printable data is generally assumed to be line- + oriented, it is to be expected that the representation of the breaks + between the lines of quoted-printable data may be altered in + transport, in the same manner that plain text mail has always been + altered in Internet mail when passing between systems with differing + newline conventions. If such alterations are likely to constitute a + + + +Freed & Borenstein Standards Track [Page 21] + +RFC 2045 Internet Message Bodies November 1996 + + + corruption of the data, it is probably more sensible to use the + base64 encoding rather than the quoted-printable encoding. + + NOTE: Several kinds of substrings cannot be generated according to + the encoding rules for the quoted-printable content-transfer- + encoding, and hence are formally illegal if they appear in the output + of a quoted-printable encoder. This note enumerates these cases and + suggests ways to handle such illegal substrings if any are + encountered in quoted-printable data that is to be decoded. + + (1) An "=" followed by two hexadecimal digits, one or both + of which are lowercase letters in "abcdef", is formally + illegal. A robust implementation might choose to + recognize them as the corresponding uppercase letters. + + (2) An "=" followed by a character that is neither a + hexadecimal digit (including "abcdef") nor the CR + character of a CRLF pair is illegal. This case can be + the result of US-ASCII text having been included in a + quoted-printable part of a message without itself + having been subjected to quoted-printable encoding. A + reasonable approach by a robust implementation might be + to include the "=" character and the following + character in the decoded data without any + transformation and, if possible, indicate to the user + that proper decoding was not possible at this point in + the data. + + (3) An "=" cannot be the ultimate or penultimate character + in an encoded object. This could be handled as in case + (2) above. + + (4) Control characters other than TAB, or CR and LF as + parts of CRLF pairs, must not appear. The same is true + for octets with decimal values greater than 126. If + found in incoming quoted-printable data by a decoder, a + robust implementation might exclude them from the + decoded data and warn the user that illegal characters + were discovered. + + (5) Encoded lines must not be longer than 76 characters, + not counting the trailing CRLF. If longer lines are + found in incoming, encoded data, a robust + implementation might nevertheless decode the lines, and + might report the erroneous encoding to the user. + + + + + + +Freed & Borenstein Standards Track [Page 22] + +RFC 2045 Internet Message Bodies November 1996 + + + WARNING TO IMPLEMENTORS: If binary data is encoded in quoted- + printable, care must be taken to encode CR and LF characters as "=0D" + and "=0A", respectively. In particular, a CRLF sequence in binary + data should be encoded as "=0D=0A". Otherwise, if CRLF were + represented as a hard line break, it might be incorrectly decoded on + platforms with different line break conventions. + + For formalists, the syntax of quoted-printable data is described by + the following grammar: + + quoted-printable := qp-line *(CRLF qp-line) + + qp-line := *(qp-segment transport-padding CRLF) + qp-part transport-padding + + qp-part := qp-section + ; Maximum length of 76 characters + + qp-segment := qp-section *(SPACE / TAB) "=" + ; Maximum length of 76 characters + + qp-section := [*(ptext / SPACE / TAB) ptext] + + ptext := hex-octet / safe-char + + safe-char := + ; Characters not listed as "mail-safe" in + ; RFC 2049 are also not recommended. + + hex-octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F") + ; Octet must be used for characters > 127, =, + ; SPACEs or TABs at the ends of lines, and is + ; recommended for any character not listed in + ; RFC 2049 as "mail-safe". + + transport-padding := *LWSP-char + ; Composers MUST NOT generate + ; non-zero length transport + ; padding, but receivers MUST + ; be able to handle padding + ; added by message transports. + + IMPORTANT: The addition of LWSP between the elements shown in this + BNF is NOT allowed since this BNF does not specify a structured + header field. + + + + + +Freed & Borenstein Standards Track [Page 23] + +RFC 2045 Internet Message Bodies November 1996 + + +6.8. Base64 Content-Transfer-Encoding + + The Base64 Content-Transfer-Encoding is designed to represent + arbitrary sequences of octets in a form that need not be humanly + readable. The encoding and decoding algorithms are simple, but the + encoded data are consistently only about 33 percent larger than the + unencoded data. This encoding is virtually identical to the one used + in Privacy Enhanced Mail (PEM) applications, as defined in RFC 1421. + + A 65-character subset of US-ASCII is used, enabling 6 bits to be + represented per printable character. (The extra 65th character, "=", + is used to signify a special processing function.) + + NOTE: This subset has the important property that it is represented + identically in all versions of ISO 646, including US-ASCII, and all + characters in the subset are also represented identically in all + versions of EBCDIC. Other popular encodings, such as the encoding + used by the uuencode utility, Macintosh binhex 4.0 [RFC-1741], and + the base85 encoding specified as part of Level 2 PostScript, do not + share these properties, and thus do not fulfill the portability + requirements a binary transport encoding for mail must meet. + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + When encoding a bit stream via the base64 encoding, the bit stream + must be presumed to be ordered with the most-significant-bit first. + That is, the first bit in the stream will be the high-order bit in + the first 8bit byte, and the eighth bit will be the low-order bit in + the first 8bit byte, and so on. + + Each 6-bit group is used as an index into an array of 64 printable + characters. The character referenced by the index is placed in the + output string. These characters, identified in Table 1, below, are + selected so as to be universally representable, and the set excludes + characters with particular significance to SMTP (e.g., ".", CR, LF) + and to the multipart boundary delimiters defined in RFC 2046 (e.g., + "-"). + + + + + + + + + + + +Freed & Borenstein Standards Track [Page 24] + +RFC 2045 Internet Message Bodies November 1996 + + + Table 1: The Base64 Alphabet + + Value Encoding Value Encoding Value Encoding Value Encoding + 0 A 17 R 34 i 51 z + 1 B 18 S 35 j 52 0 + 2 C 19 T 36 k 53 1 + 3 D 20 U 37 l 54 2 + 4 E 21 V 38 m 55 3 + 5 F 22 W 39 n 56 4 + 6 G 23 X 40 o 57 5 + 7 H 24 Y 41 p 58 6 + 8 I 25 Z 42 q 59 7 + 9 J 26 a 43 r 60 8 + 10 K 27 b 44 s 61 9 + 11 L 28 c 45 t 62 + + 12 M 29 d 46 u 63 / + 13 N 30 e 47 v + 14 O 31 f 48 w (pad) = + 15 P 32 g 49 x + 16 Q 33 h 50 y + + The encoded output stream must be represented in lines of no more + than 76 characters each. All line breaks or other characters not + found in Table 1 must be ignored by decoding software. In base64 + data, characters other than those in Table 1, line breaks, and other + white space probably indicate a transmission error, about which a + warning message or even a message rejection might be appropriate + under some circumstances. + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a body. When fewer than 24 input bits + are available in an input group, zero bits are added (on the right) + to form an integral number of 6-bit groups. Padding at the end of + the data is performed using the "=" character. Since all base64 + input is an integral number of octets, only the following cases can + arise: (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded output will be + an integral multiple of 4 characters with no "=" padding, (2) the + final quantum of encoding input is exactly 8 bits; here, the final + unit of encoded output will be two characters followed by two "=" + padding characters, or (3) the final quantum of encoding input is + exactly 16 bits; here, the final unit of encoded output will be three + characters followed by one "=" padding character. + + Because it is used only for padding at the end of the data, the + occurrence of any "=" characters may be taken as evidence that the + end of the data has been reached (without truncation in transit). No + + + +Freed & Borenstein Standards Track [Page 25] + +RFC 2045 Internet Message Bodies November 1996 + + + such assurance is possible, however, when the number of octets + transmitted was a multiple of three and no "=" characters are + present. + + Any characters outside of the base64 alphabet are to be ignored in + base64-encoded data. + + Care must be taken to use the proper octets for line breaks if base64 + encoding is applied directly to text material that has not been + converted to canonical form. In particular, text line breaks must be + converted into CRLF sequences prior to base64 encoding. The + important thing to note is that this may be done directly by the + encoder rather than in a prior canonicalization step in some + implementations. + + NOTE: There is no need to worry about quoting potential boundary + delimiters within base64-encoded bodies within multipart entities + because no hyphen characters are used in the base64 encoding. + +7. Content-ID Header Field + + In constructing a high-level user agent, it may be desirable to allow + one body to make reference to another. Accordingly, bodies may be + labelled using the "Content-ID" header field, which is syntactically + identical to the "Message-ID" header field: + + id := "Content-ID" ":" msg-id + + Like the Message-ID values, Content-ID values must be generated to be + world-unique. + + The Content-ID value may be used for uniquely identifying MIME + entities in several contexts, particularly for caching data + referenced by the message/external-body mechanism. Although the + Content-ID header is generally optional, its use is MANDATORY in + implementations which generate data of the optional MIME media type + "message/external-body". That is, each message/external-body entity + must have a Content-ID field to permit caching of such data. + + It is also worth noting that the Content-ID value has special + semantics in the case of the multipart/alternative media type. This + is explained in the section of RFC 2046 dealing with + multipart/alternative. + + + + + + + + +Freed & Borenstein Standards Track [Page 26] + +RFC 2045 Internet Message Bodies November 1996 + + +8. Content-Description Header Field + + The ability to associate some descriptive information with a given + body is often desirable. For example, it may be useful to mark an + "image" body as "a picture of the Space Shuttle Endeavor." Such text + may be placed in the Content-Description header field. This header + field is always optional. + + description := "Content-Description" ":" *text + + The description is presumed to be given in the US-ASCII character + set, although the mechanism specified in RFC 2047 may be used for + non-US-ASCII Content-Description values. + +9. Additional MIME Header Fields + + Future documents may elect to define additional MIME header fields + for various purposes. Any new header field that further describes + the content of a message should begin with the string "Content-" to + allow such fields which appear in a message header to be + distinguished from ordinary RFC 822 message header fields. + + MIME-extension-field := + +10. Summary + + Using the MIME-Version, Content-Type, and Content-Transfer-Encoding + header fields, it is possible to include, in a standardized way, + arbitrary types of data with RFC 822 conformant mail messages. No + restrictions imposed by either RFC 821 or RFC 822 are violated, and + care has been taken to avoid problems caused by additional + restrictions imposed by the characteristics of some Internet mail + transport mechanisms (see RFC 2049). + + The next document in this set, RFC 2046, specifies the initial set of + media types that can be labelled and transported using these headers. + +11. Security Considerations + + Security issues are discussed in the second document in this set, RFC + 2046. + + + + + + + + +Freed & Borenstein Standards Track [Page 27] + +RFC 2045 Internet Message Bodies November 1996 + + +12. Authors' Addresses + + For more information, the authors of this document are best contacted + via Internet mail: + + Ned Freed + Innosoft International, Inc. + 1050 East Garvey Avenue South + West Covina, CA 91790 + USA + + Phone: +1 818 919 3600 + Fax: +1 818 919 3614 + EMail: ned@innosoft.com + + + Nathaniel S. Borenstein + First Virtual Holdings + 25 Washington Avenue + Morristown, NJ 07960 + USA + + Phone: +1 201 540 8967 + Fax: +1 201 993 3032 + EMail: nsb@nsb.fv.com + + + MIME is a result of the work of the Internet Engineering Task Force + Working Group on RFC 822 Extensions. The chairman of that group, + Greg Vaudreuil, may be reached at: + + Gregory M. Vaudreuil + Octel Network Services + 17080 Dallas Parkway + Dallas, TX 75248-1905 + USA + + EMail: Greg.Vaudreuil@Octel.Com + + + + + + + + + + + + + +Freed & Borenstein Standards Track [Page 28] + +RFC 2045 Internet Message Bodies November 1996 + + +Appendix A -- Collected Grammar + + This appendix contains the complete BNF grammar for all the syntax + specified by this document. + + By itself, however, this grammar is incomplete. It refers by name to + several syntax rules that are defined by RFC 822. Rather than + reproduce those definitions here, and risk unintentional differences + between the two, this document simply refers the reader to RFC 822 + for the remaining definitions. Wherever a term is undefined, it + refers to the RFC 822 definition. + + attribute := token + ; Matching of attributes + ; is ALWAYS case-insensitive. + + composite-type := "message" / "multipart" / extension-token + + content := "Content-Type" ":" type "/" subtype + *(";" parameter) + ; Matching of media type and subtype + ; is ALWAYS case-insensitive. + + description := "Content-Description" ":" *text + + discrete-type := "text" / "image" / "audio" / "video" / + "application" / extension-token + + encoding := "Content-Transfer-Encoding" ":" mechanism + + entity-headers := [ content CRLF ] + [ encoding CRLF ] + [ id CRLF ] + [ description CRLF ] + *( MIME-extension-field CRLF ) + + extension-token := ietf-token / x-token + + hex-octet := "=" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F") + ; Octet must be used for characters > 127, =, + ; SPACEs or TABs at the ends of lines, and is + ; recommended for any character not listed in + ; RFC 2049 as "mail-safe". + + iana-token := + + + + +Freed & Borenstein Standards Track [Page 29] + +RFC 2045 Internet Message Bodies November 1996 + + + ietf-token := + + id := "Content-ID" ":" msg-id + + mechanism := "7bit" / "8bit" / "binary" / + "quoted-printable" / "base64" / + ietf-token / x-token + + MIME-extension-field := + + MIME-message-headers := entity-headers + fields + version CRLF + ; The ordering of the header + ; fields implied by this BNF + ; definition should be ignored. + + MIME-part-headers := entity-headers + [fields] + ; Any field not beginning with + ; "content-" can have no defined + ; meaning and may be ignored. + ; The ordering of the header + ; fields implied by this BNF + ; definition should be ignored. + + parameter := attribute "=" value + + ptext := hex-octet / safe-char + + qp-line := *(qp-segment transport-padding CRLF) + qp-part transport-padding + + qp-part := qp-section + ; Maximum length of 76 characters + + qp-section := [*(ptext / SPACE / TAB) ptext] + + qp-segment := qp-section *(SPACE / TAB) "=" + ; Maximum length of 76 characters + + quoted-printable := qp-line *(CRLF qp-line) + + + + + +Freed & Borenstein Standards Track [Page 30] + +RFC 2045 Internet Message Bodies November 1996 + + + safe-char := + ; Characters not listed as "mail-safe" in + ; RFC 2049 are also not recommended. + + subtype := extension-token / iana-token + + token := 1* + + transport-padding := *LWSP-char + ; Composers MUST NOT generate + ; non-zero length transport + ; padding, but receivers MUST + ; be able to handle padding + ; added by message transports. + + tspecials := "(" / ")" / "<" / ">" / "@" / + "," / ";" / ":" / "\" / <"> + "/" / "[" / "]" / "?" / "=" + ; Must be in quoted-string, + ; to use within parameter values + + type := discrete-type / composite-type + + value := token / quoted-string + + version := "MIME-Version" ":" 1*DIGIT "." 1*DIGIT + + x-token := + + + + + + + + + + + + + + + + + + + + +Freed & Borenstein Standards Track [Page 31] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2046.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2046.txt new file mode 100644 index 0000000..84d90c1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2046.txt @@ -0,0 +1,2467 @@ + + + + + + +Network Working Group N. Freed +Request for Comments: 2046 Innosoft +Obsoletes: 1521, 1522, 1590 N. Borenstein +Category: Standards Track First Virtual + November 1996 + + + Multipurpose Internet Mail Extensions + (MIME) Part Two: + Media Types + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Abstract + + STD 11, RFC 822 defines a message representation protocol specifying + considerable detail about US-ASCII message headers, but which leaves + the message content, or message body, as flat US-ASCII text. This + set of documents, collectively called the Multipurpose Internet Mail + Extensions, or MIME, redefines the format of messages to allow for + + (1) textual message bodies in character sets other than + US-ASCII, + + (2) an extensible set of different formats for non-textual + message bodies, + + (3) multi-part message bodies, and + + (4) textual header information in character sets other than + US-ASCII. + + These documents are based on earlier work documented in RFC 934, STD + 11, and RFC 1049, but extends and revises them. Because RFC 822 said + so little about message bodies, these documents are largely + orthogonal to (rather than a revision of) RFC 822. + + The initial document in this set, RFC 2045, specifies the various + headers used to describe the structure of MIME messages. This second + document defines the general structure of the MIME media typing + system and defines an initial set of media types. The third document, + RFC 2047, describes extensions to RFC 822 to allow non-US-ASCII text + + + +Freed & Borenstein Standards Track [Page 1] + +RFC 2046 Media Types November 1996 + + + data in Internet mail header fields. The fourth document, RFC 2048, + specifies various IANA registration procedures for MIME-related + facilities. The fifth and final document, RFC 2049, describes MIME + conformance criteria as well as providing some illustrative examples + of MIME message formats, acknowledgements, and the bibliography. + + These documents are revisions of RFCs 1521 and 1522, which themselves + were revisions of RFCs 1341 and 1342. An appendix in RFC 2049 + describes differences and changes from previous versions. + +Table of Contents + + 1. Introduction ......................................... 3 + 2. Definition of a Top-Level Media Type ................. 4 + 3. Overview Of The Initial Top-Level Media Types ........ 4 + 4. Discrete Media Type Values ........................... 6 + 4.1 Text Media Type ..................................... 6 + 4.1.1 Representation of Line Breaks ..................... 7 + 4.1.2 Charset Parameter ................................. 7 + 4.1.3 Plain Subtype ..................................... 11 + 4.1.4 Unrecognized Subtypes ............................. 11 + 4.2 Image Media Type .................................... 11 + 4.3 Audio Media Type .................................... 11 + 4.4 Video Media Type .................................... 12 + 4.5 Application Media Type .............................. 12 + 4.5.1 Octet-Stream Subtype .............................. 13 + 4.5.2 PostScript Subtype ................................ 14 + 4.5.3 Other Application Subtypes ........................ 17 + 5. Composite Media Type Values .......................... 17 + 5.1 Multipart Media Type ................................ 17 + 5.1.1 Common Syntax ..................................... 19 + 5.1.2 Handling Nested Messages and Multiparts ........... 24 + 5.1.3 Mixed Subtype ..................................... 24 + 5.1.4 Alternative Subtype ............................... 24 + 5.1.5 Digest Subtype .................................... 26 + 5.1.6 Parallel Subtype .................................. 27 + 5.1.7 Other Multipart Subtypes .......................... 28 + 5.2 Message Media Type .................................. 28 + 5.2.1 RFC822 Subtype .................................... 28 + 5.2.2 Partial Subtype ................................... 29 + 5.2.2.1 Message Fragmentation and Reassembly ............ 30 + 5.2.2.2 Fragmentation and Reassembly Example ............ 31 + 5.2.3 External-Body Subtype ............................. 33 + 5.2.4 Other Message Subtypes ............................ 40 + 6. Experimental Media Type Values ....................... 40 + 7. Summary .............................................. 41 + 8. Security Considerations .............................. 41 + 9. Authors' Addresses ................................... 42 + + + +Freed & Borenstein Standards Track [Page 2] + +RFC 2046 Media Types November 1996 + + + A. Collected Grammar .................................... 43 + +1. Introduction + + The first document in this set, RFC 2045, defines a number of header + fields, including Content-Type. The Content-Type field is used to + specify the nature of the data in the body of a MIME entity, by + giving media type and subtype identifiers, and by providing auxiliary + information that may be required for certain media types. After the + type and subtype names, the remainder of the header field is simply a + set of parameters, specified in an attribute/value notation. The + ordering of parameters is not significant. + + In general, the top-level media type is used to declare the general + type of data, while the subtype specifies a specific format for that + type of data. Thus, a media type of "image/xyz" is enough to tell a + user agent that the data is an image, even if the user agent has no + knowledge of the specific image format "xyz". Such information can + be used, for example, to decide whether or not to show a user the raw + data from an unrecognized subtype -- such an action might be + reasonable for unrecognized subtypes of "text", but not for + unrecognized subtypes of "image" or "audio". For this reason, + registered subtypes of "text", "image", "audio", and "video" should + not contain embedded information that is really of a different type. + Such compound formats should be represented using the "multipart" or + "application" types. + + Parameters are modifiers of the media subtype, and as such do not + fundamentally affect the nature of the content. The set of + meaningful parameters depends on the media type and subtype. Most + parameters are associated with a single specific subtype. However, a + given top-level media type may define parameters which are applicable + to any subtype of that type. Parameters may be required by their + defining media type or subtype or they may be optional. MIME + implementations must also ignore any parameters whose names they do + not recognize. + + MIME's Content-Type header field and media type mechanism has been + carefully designed to be extensible, and it is expected that the set + of media type/subtype pairs and their associated parameters will grow + significantly over time. Several other MIME facilities, such as + transfer encodings and "message/external-body" access types, are + likely to have new values defined over time. In order to ensure that + the set of such values is developed in an orderly, well-specified, + and public manner, MIME sets up a registration process which uses the + Internet Assigned Numbers Authority (IANA) as a central registry for + MIME's various areas of extensibility. The registration process for + these areas is described in a companion document, RFC 2048. + + + +Freed & Borenstein Standards Track [Page 3] + +RFC 2046 Media Types November 1996 + + + The initial seven standard top-level media type are defined and + described in the remainder of this document. + +2. Definition of a Top-Level Media Type + + The definition of a top-level media type consists of: + + (1) a name and a description of the type, including + criteria for whether a particular type would qualify + under that type, + + (2) the names and definitions of parameters, if any, which + are defined for all subtypes of that type (including + whether such parameters are required or optional), + + (3) how a user agent and/or gateway should handle unknown + subtypes of this type, + + (4) general considerations on gatewaying entities of this + top-level type, if any, and + + (5) any restrictions on content-transfer-encodings for + entities of this top-level type. + +3. Overview Of The Initial Top-Level Media Types + + The five discrete top-level media types are: + + (1) text -- textual information. The subtype "plain" in + particular indicates plain text containing no + formatting commands or directives of any sort. Plain + text is intended to be displayed "as-is". No special + software is required to get the full meaning of the + text, aside from support for the indicated character + set. Other subtypes are to be used for enriched text in + forms where application software may enhance the + appearance of the text, but such software must not be + required in order to get the general idea of the + content. Possible subtypes of "text" thus include any + word processor format that can be read without + resorting to software that understands the format. In + particular, formats that employ embeddded binary + formatting information are not considered directly + readable. A very simple and portable subtype, + "richtext", was defined in RFC 1341, with a further + revision in RFC 1896 under the name "enriched". + + + + + +Freed & Borenstein Standards Track [Page 4] + +RFC 2046 Media Types November 1996 + + + (2) image -- image data. "Image" requires a display device + (such as a graphical display, a graphics printer, or a + FAX machine) to view the information. An initial + subtype is defined for the widely-used image format + JPEG. . subtypes are defined for two widely-used image + formats, jpeg and gif. + + (3) audio -- audio data. "Audio" requires an audio output + device (such as a speaker or a telephone) to "display" + the contents. An initial subtype "basic" is defined in + this document. + + (4) video -- video data. "Video" requires the capability + to display moving images, typically including + specialized hardware and software. An initial subtype + "mpeg" is defined in this document. + + (5) application -- some other kind of data, typically + either uninterpreted binary data or information to be + processed by an application. The subtype "octet- + stream" is to be used in the case of uninterpreted + binary data, in which case the simplest recommended + action is to offer to write the information into a file + for the user. The "PostScript" subtype is also defined + for the transport of PostScript material. Other + expected uses for "application" include spreadsheets, + data for mail-based scheduling systems, and languages + for "active" (computational) messaging, and word + processing formats that are not directly readable. + Note that security considerations may exist for some + types of application data, most notably + "application/PostScript" and any form of active + messaging. These issues are discussed later in this + document. + + The two composite top-level media types are: + + (1) multipart -- data consisting of multiple entities of + independent data types. Four subtypes are initially + defined, including the basic "mixed" subtype specifying + a generic mixed set of parts, "alternative" for + representing the same data in multiple formats, + "parallel" for parts intended to be viewed + simultaneously, and "digest" for multipart entities in + which each part has a default type of "message/rfc822". + + + + + + +Freed & Borenstein Standards Track [Page 5] + +RFC 2046 Media Types November 1996 + + + (2) message -- an encapsulated message. A body of media + type "message" is itself all or a portion of some kind + of message object. Such objects may or may not in turn + contain other entities. The "rfc822" subtype is used + when the encapsulated content is itself an RFC 822 + message. The "partial" subtype is defined for partial + RFC 822 messages, to permit the fragmented transmission + of bodies that are thought to be too large to be passed + through transport facilities in one piece. Another + subtype, "external-body", is defined for specifying + large bodies by reference to an external data source. + + It should be noted that the list of media type values given here may + be augmented in time, via the mechanisms described above, and that + the set of subtypes is expected to grow substantially. + +4. Discrete Media Type Values + + Five of the seven initial media type values refer to discrete bodies. + The content of these types must be handled by non-MIME mechanisms; + they are opaque to MIME processors. + +4.1. Text Media Type + + The "text" media type is intended for sending material which is + principally textual in form. A "charset" parameter may be used to + indicate the character set of the body text for "text" subtypes, + notably including the subtype "text/plain", which is a generic + subtype for plain text. Plain text does not provide for or allow + formatting commands, font attribute specifications, processing + instructions, interpretation directives, or content markup. Plain + text is seen simply as a linear sequence of characters, possibly + interrupted by line breaks or page breaks. Plain text may allow the + stacking of several characters in the same position in the text. + Plain text in scripts like Arabic and Hebrew may also include + facilitites that allow the arbitrary mixing of text segments with + opposite writing directions. + + Beyond plain text, there are many formats for representing what might + be known as "rich text". An interesting characteristic of many such + representations is that they are to some extent readable even without + the software that interprets them. It is useful, then, to + distinguish them, at the highest level, from such unreadable data as + images, audio, or text represented in an unreadable form. In the + absence of appropriate interpretation software, it is reasonable to + show subtypes of "text" to the user, while it is not reasonable to do + so with most nontextual data. Such formatted textual data should be + represented using subtypes of "text". + + + +Freed & Borenstein Standards Track [Page 6] + +RFC 2046 Media Types November 1996 + + +4.1.1. Representation of Line Breaks + + The canonical form of any MIME "text" subtype MUST always represent a + line break as a CRLF sequence. Similarly, any occurrence of CRLF in + MIME "text" MUST represent a line break. Use of CR and LF outside of + line break sequences is also forbidden. + + This rule applies regardless of format or character set or sets + involved. + + NOTE: The proper interpretation of line breaks when a body is + displayed depends on the media type. In particular, while it is + appropriate to treat a line break as a transition to a new line when + displaying a "text/plain" body, this treatment is actually incorrect + for other subtypes of "text" like "text/enriched" [RFC-1896]. + Similarly, whether or not line breaks should be added during display + operations is also a function of the media type. It should not be + necessary to add any line breaks to display "text/plain" correctly, + whereas proper display of "text/enriched" requires the appropriate + addition of line breaks. + + NOTE: Some protocols defines a maximum line length. E.g. SMTP [RFC- + 821] allows a maximum of 998 octets before the next CRLF sequence. + To be transported by such protocols, data which includes too long + segments without CRLF sequences must be encoded with a suitable + content-transfer-encoding. + +4.1.2. Charset Parameter + + A critical parameter that may be specified in the Content-Type field + for "text/plain" data is the character set. This is specified with a + "charset" parameter, as in: + + Content-type: text/plain; charset=iso-8859-1 + + Unlike some other parameter values, the values of the charset + parameter are NOT case sensitive. The default character set, which + must be assumed in the absence of a charset parameter, is US-ASCII. + + The specification for any future subtypes of "text" must specify + whether or not they will also utilize a "charset" parameter, and may + possibly restrict its values as well. For other subtypes of "text" + than "text/plain", the semantics of the "charset" parameter should be + defined to be identical to those specified here for "text/plain", + i.e., the body consists entirely of characters in the given charset. + In particular, definers of future "text" subtypes should pay close + attention to the implications of multioctet character sets for their + subtype definitions. + + + +Freed & Borenstein Standards Track [Page 7] + +RFC 2046 Media Types November 1996 + + + The charset parameter for subtypes of "text" gives a name of a + character set, as "character set" is defined in RFC 2045. The rules + regarding line breaks detailed in the previous section must also be + observed -- a character set whose definition does not conform to + these rules cannot be used in a MIME "text" subtype. + + An initial list of predefined character set names can be found at the + end of this section. Additional character sets may be registered + with IANA. + + Other media types than subtypes of "text" might choose to employ the + charset parameter as defined here, but with the CRLF/line break + restriction removed. Therefore, all character sets that conform to + the general definition of "character set" in RFC 2045 can be + registered for MIME use. + + Note that if the specified character set includes 8-bit characters + and such characters are used in the body, a Content-Transfer-Encoding + header field and a corresponding encoding on the data are required in + order to transmit the body via some mail transfer protocols, such as + SMTP [RFC-821]. + + The default character set, US-ASCII, has been the subject of some + confusion and ambiguity in the past. Not only were there some + ambiguities in the definition, there have been wide variations in + practice. In order to eliminate such ambiguity and variations in the + future, it is strongly recommended that new user agents explicitly + specify a character set as a media type parameter in the Content-Type + header field. "US-ASCII" does not indicate an arbitrary 7-bit + character set, but specifies that all octets in the body must be + interpreted as characters according to the US-ASCII character set. + National and application-oriented versions of ISO 646 [ISO-646] are + usually NOT identical to US-ASCII, and in that case their use in + Internet mail is explicitly discouraged. The omission of the ISO 646 + character set from this document is deliberate in this regard. The + character set name of "US-ASCII" explicitly refers to the character + set defined in ANSI X3.4-1986 [US- ASCII]. The new international + reference version (IRV) of the 1991 edition of ISO 646 is identical + to US-ASCII. The character set name "ASCII" is reserved and must not + be used for any purpose. + + NOTE: RFC 821 explicitly specifies "ASCII", and references an earlier + version of the American Standard. Insofar as one of the purposes of + specifying a media type and character set is to permit the receiver + to unambiguously determine how the sender intended the coded message + to be interpreted, assuming anything other than "strict ASCII" as the + default would risk unintentional and incompatible changes to the + semantics of messages now being transmitted. This also implies that + + + +Freed & Borenstein Standards Track [Page 8] + +RFC 2046 Media Types November 1996 + + + messages containing characters coded according to other versions of + ISO 646 than US-ASCII and the 1991 IRV, or using code-switching + procedures (e.g., those of ISO 2022), as well as 8bit or multiple + octet character encodings MUST use an appropriate character set + specification to be consistent with MIME. + + The complete US-ASCII character set is listed in ANSI X3.4- 1986. + Note that the control characters including DEL (0-31, 127) have no + defined meaning in apart from the combination CRLF (US-ASCII values + 13 and 10) indicating a new line. Two of the characters have de + facto meanings in wide use: FF (12) often means "start subsequent + text on the beginning of a new page"; and TAB or HT (9) often (though + not always) means "move the cursor to the next available column after + the current position where the column number is a multiple of 8 + (counting the first column as column 0)." Aside from these + conventions, any use of the control characters or DEL in a body must + either occur + + (1) because a subtype of text other than "plain" + specifically assigns some additional meaning, or + + (2) within the context of a private agreement between the + sender and recipient. Such private agreements are + discouraged and should be replaced by the other + capabilities of this document. + + NOTE: An enormous proliferation of character sets exist beyond US- + ASCII. A large number of partially or totally overlapping character + sets is NOT a good thing. A SINGLE character set that can be used + universally for representing all of the world's languages in Internet + mail would be preferrable. Unfortunately, existing practice in + several communities seems to point to the continued use of multiple + character sets in the near future. A small number of standard + character sets are, therefore, defined for Internet use in this + document. + + The defined charset values are: + + (1) US-ASCII -- as defined in ANSI X3.4-1986 [US-ASCII]. + + (2) ISO-8859-X -- where "X" is to be replaced, as + necessary, for the parts of ISO-8859 [ISO-8859]. Note + that the ISO 646 character sets have deliberately been + omitted in favor of their 8859 replacements, which are + the designated character sets for Internet mail. As of + the publication of this document, the legitimate values + for "X" are the digits 1 through 10. + + + + +Freed & Borenstein Standards Track [Page 9] + +RFC 2046 Media Types November 1996 + + + Characters in the range 128-159 has no assigned meaning in ISO-8859- + X. Characters with values below 128 in ISO-8859-X have the same + assigned meaning as they do in US-ASCII. + + Part 6 of ISO 8859 (Latin/Arabic alphabet) and part 8 (Latin/Hebrew + alphabet) includes both characters for which the normal writing + direction is right to left and characters for which it is left to + right, but do not define a canonical ordering method for representing + bi-directional text. The charset values "ISO-8859-6" and "ISO-8859- + 8", however, specify that the visual method is used [RFC-1556]. + + All of these character sets are used as pure 7bit or 8bit sets + without any shift or escape functions. The meaning of shift and + escape sequences in these character sets is not defined. + + The character sets specified above are the ones that were relatively + uncontroversial during the drafting of MIME. This document does not + endorse the use of any particular character set other than US-ASCII, + and recognizes that the future evolution of world character sets + remains unclear. + + Note that the character set used, if anything other than US- ASCII, + must always be explicitly specified in the Content-Type field. + + No character set name other than those defined above may be used in + Internet mail without the publication of a formal specification and + its registration with IANA, or by private agreement, in which case + the character set name must begin with "X-". + + Implementors are discouraged from defining new character sets unless + absolutely necessary. + + The "charset" parameter has been defined primarily for the purpose of + textual data, and is described in this section for that reason. + However, it is conceivable that non-textual data might also wish to + specify a charset value for some purpose, in which case the same + syntax and values should be used. + + In general, composition software should always use the "lowest common + denominator" character set possible. For example, if a body contains + only US-ASCII characters, it SHOULD be marked as being in the US- + ASCII character set, not ISO-8859-1, which, like all the ISO-8859 + family of character sets, is a superset of US-ASCII. More generally, + if a widely-used character set is a subset of another character set, + and a body contains only characters in the widely-used subset, it + should be labelled as being in that subset. This will increase the + chances that the recipient will be able to view the resulting entity + correctly. + + + +Freed & Borenstein Standards Track [Page 10] + +RFC 2046 Media Types November 1996 + + +4.1.3. Plain Subtype + + The simplest and most important subtype of "text" is "plain". This + indicates plain text that does not contain any formatting commands or + directives. Plain text is intended to be displayed "as-is", that is, + no interpretation of embedded formatting commands, font attribute + specifications, processing instructions, interpretation directives, + or content markup should be necessary for proper display. The + default media type of "text/plain; charset=us-ascii" for Internet + mail describes existing Internet practice. That is, it is the type + of body defined by RFC 822. + + No other "text" subtype is defined by this document. + +4.1.4. Unrecognized Subtypes + + Unrecognized subtypes of "text" should be treated as subtype "plain" + as long as the MIME implementation knows how to handle the charset. + Unrecognized subtypes which also specify an unrecognized charset + should be treated as "application/octet- stream". + +4.2. Image Media Type + + A media type of "image" indicates that the body contains an image. + The subtype names the specific image format. These names are not + case sensitive. An initial subtype is "jpeg" for the JPEG format + using JFIF encoding [JPEG]. + + The list of "image" subtypes given here is neither exclusive nor + exhaustive, and is expected to grow as more types are registered with + IANA, as described in RFC 2048. + + Unrecognized subtypes of "image" should at a miniumum be treated as + "application/octet-stream". Implementations may optionally elect to + pass subtypes of "image" that they do not specifically recognize to a + secure and robust general-purpose image viewing application, if such + an application is available. + + NOTE: Using of a generic-purpose image viewing application this way + inherits the security problems of the most dangerous type supported + by the application. + +4.3. Audio Media Type + + A media type of "audio" indicates that the body contains audio data. + Although there is not yet a consensus on an "ideal" audio format for + use with computers, there is a pressing need for a format capable of + providing interoperable behavior. + + + +Freed & Borenstein Standards Track [Page 11] + +RFC 2046 Media Types November 1996 + + + The initial subtype of "basic" is specified to meet this requirement + by providing an absolutely minimal lowest common denominator audio + format. It is expected that richer formats for higher quality and/or + lower bandwidth audio will be defined by a later document. + + The content of the "audio/basic" subtype is single channel audio + encoded using 8bit ISDN mu-law [PCM] at a sample rate of 8000 Hz. + + Unrecognized subtypes of "audio" should at a miniumum be treated as + "application/octet-stream". Implementations may optionally elect to + pass subtypes of "audio" that they do not specifically recognize to a + robust general-purpose audio playing application, if such an + application is available. + +4.4. Video Media Type + + A media type of "video" indicates that the body contains a time- + varying-picture image, possibly with color and coordinated sound. + The term 'video' is used in its most generic sense, rather than with + reference to any particular technology or format, and is not meant to + preclude subtypes such as animated drawings encoded compactly. The + subtype "mpeg" refers to video coded according to the MPEG standard + [MPEG]. + + Note that although in general this document strongly discourages the + mixing of multiple media in a single body, it is recognized that many + so-called video formats include a representation for synchronized + audio, and this is explicitly permitted for subtypes of "video". + + Unrecognized subtypes of "video" should at a minumum be treated as + "application/octet-stream". Implementations may optionally elect to + pass subtypes of "video" that they do not specifically recognize to a + robust general-purpose video display application, if such an + application is available. + +4.5. Application Media Type + + The "application" media type is to be used for discrete data which do + not fit in any of the other categories, and particularly for data to + be processed by some type of application program. This is + information which must be processed by an application before it is + viewable or usable by a user. Expected uses for the "application" + media type include file transfer, spreadsheets, data for mail-based + scheduling systems, and languages for "active" (computational) + material. (The latter, in particular, can pose security problems + which must be understood by implementors, and are considered in + detail in the discussion of the "application/PostScript" media type.) + + + + +Freed & Borenstein Standards Track [Page 12] + +RFC 2046 Media Types November 1996 + + + For example, a meeting scheduler might define a standard + representation for information about proposed meeting dates. An + intelligent user agent would use this information to conduct a dialog + with the user, and might then send additional material based on that + dialog. More generally, there have been several "active" messaging + languages developed in which programs in a suitably specialized + language are transported to a remote location and automatically run + in the recipient's environment. + + Such applications may be defined as subtypes of the "application" + media type. This document defines two subtypes: + + octet-stream, and PostScript. + + The subtype of "application" will often be either the name or include + part of the name of the application for which the data are intended. + This does not mean, however, that any application program name may be + used freely as a subtype of "application". + +4.5.1. Octet-Stream Subtype + + The "octet-stream" subtype is used to indicate that a body contains + arbitrary binary data. The set of currently defined parameters is: + + (1) TYPE -- the general type or category of binary data. + This is intended as information for the human recipient + rather than for any automatic processing. + + (2) PADDING -- the number of bits of padding that were + appended to the bit-stream comprising the actual + contents to produce the enclosed 8bit byte-oriented + data. This is useful for enclosing a bit-stream in a + body when the total number of bits is not a multiple of + 8. + + Both of these parameters are optional. + + An additional parameter, "CONVERSIONS", was defined in RFC 1341 but + has since been removed. RFC 1341 also defined the use of a "NAME" + parameter which gave a suggested file name to be used if the data + were to be written to a file. This has been deprecated in + anticipation of a separate Content-Disposition header field, to be + defined in a subsequent RFC. + + The recommended action for an implementation that receives an + "application/octet-stream" entity is to simply offer to put the data + in a file, with any Content-Transfer-Encoding undone, or perhaps to + use it as input to a user-specified process. + + + +Freed & Borenstein Standards Track [Page 13] + +RFC 2046 Media Types November 1996 + + + To reduce the danger of transmitting rogue programs, it is strongly + recommended that implementations NOT implement a path-search + mechanism whereby an arbitrary program named in the Content-Type + parameter (e.g., an "interpreter=" parameter) is found and executed + using the message body as input. + +4.5.2. PostScript Subtype + + A media type of "application/postscript" indicates a PostScript + program. Currently two variants of the PostScript language are + allowed; the original level 1 variant is described in [POSTSCRIPT] + and the more recent level 2 variant is described in [POSTSCRIPT2]. + + PostScript is a registered trademark of Adobe Systems, Inc. Use of + the MIME media type "application/postscript" implies recognition of + that trademark and all the rights it entails. + + The PostScript language definition provides facilities for internal + labelling of the specific language features a given program uses. + This labelling, called the PostScript document structuring + conventions, or DSC, is very general and provides substantially more + information than just the language level. The use of document + structuring conventions, while not required, is strongly recommended + as an aid to interoperability. Documents which lack proper + structuring conventions cannot be tested to see whether or not they + will work in a given environment. As such, some systems may assume + the worst and refuse to process unstructured documents. + + The execution of general-purpose PostScript interpreters entails + serious security risks, and implementors are discouraged from simply + sending PostScript bodies to "off- the-shelf" interpreters. While it + is usually safe to send PostScript to a printer, where the potential + for harm is greatly constrained by typical printer environments, + implementors should consider all of the following before they add + interactive display of PostScript bodies to their MIME readers. + + The remainder of this section outlines some, though probably not all, + of the possible problems with the transport of PostScript entities. + + (1) Dangerous operations in the PostScript language + include, but may not be limited to, the PostScript + operators "deletefile", "renamefile", "filenameforall", + and "file". "File" is only dangerous when applied to + something other than standard input or output. + Implementations may also define additional nonstandard + file operators; these may also pose a threat to + security. "Filenameforall", the wildcard file search + operator, may appear at first glance to be harmless. + + + +Freed & Borenstein Standards Track [Page 14] + +RFC 2046 Media Types November 1996 + + + Note, however, that this operator has the potential to + reveal information about what files the recipient has + access to, and this information may itself be + sensitive. Message senders should avoid the use of + potentially dangerous file operators, since these + operators are quite likely to be unavailable in secure + PostScript implementations. Message receiving and + displaying software should either completely disable + all potentially dangerous file operators or take + special care not to delegate any special authority to + their operation. These operators should be viewed as + being done by an outside agency when interpreting + PostScript documents. Such disabling and/or checking + should be done completely outside of the reach of the + PostScript language itself; care should be taken to + insure that no method exists for re-enabling full- + function versions of these operators. + + (2) The PostScript language provides facilities for exiting + the normal interpreter, or server, loop. Changes made + in this "outer" environment are customarily retained + across documents, and may in some cases be retained + semipermanently in nonvolatile memory. The operators + associated with exiting the interpreter loop have the + potential to interfere with subsequent document + processing. As such, their unrestrained use + constitutes a threat of service denial. PostScript + operators that exit the interpreter loop include, but + may not be limited to, the exitserver and startjob + operators. Message sending software should not + generate PostScript that depends on exiting the + interpreter loop to operate, since the ability to exit + will probably be unavailable in secure PostScript + implementations. Message receiving and displaying + software should completely disable the ability to make + retained changes to the PostScript environment by + eliminating or disabling the "startjob" and + "exitserver" operations. If these operations cannot be + eliminated or completely disabled the password + associated with them should at least be set to a hard- + to-guess value. + + (3) PostScript provides operators for setting system-wide + and device-specific parameters. These parameter + settings may be retained across jobs and may + potentially pose a threat to the correct operation of + the interpreter. The PostScript operators that set + system and device parameters include, but may not be + + + +Freed & Borenstein Standards Track [Page 15] + +RFC 2046 Media Types November 1996 + + + limited to, the "setsystemparams" and "setdevparams" + operators. Message sending software should not + generate PostScript that depends on the setting of + system or device parameters to operate correctly. The + ability to set these parameters will probably be + unavailable in secure PostScript implementations. + Message receiving and displaying software should + disable the ability to change system and device + parameters. If these operators cannot be completely + disabled the password associated with them should at + least be set to a hard-to-guess value. + + (4) Some PostScript implementations provide nonstandard + facilities for the direct loading and execution of + machine code. Such facilities are quite obviously open + to substantial abuse. Message sending software should + not make use of such features. Besides being totally + hardware-specific, they are also likely to be + unavailable in secure implementations of PostScript. + Message receiving and displaying software should not + allow such operators to be used if they exist. + + (5) PostScript is an extensible language, and many, if not + most, implementations of it provide a number of their + own extensions. This document does not deal with such + extensions explicitly since they constitute an unknown + factor. Message sending software should not make use + of nonstandard extensions; they are likely to be + missing from some implementations. Message receiving + and displaying software should make sure that any + nonstandard PostScript operators are secure and don't + present any kind of threat. + + (6) It is possible to write PostScript that consumes huge + amounts of various system resources. It is also + possible to write PostScript programs that loop + indefinitely. Both types of programs have the + potential to cause damage if sent to unsuspecting + recipients. Message-sending software should avoid the + construction and dissemination of such programs, which + is antisocial. Message receiving and displaying + software should provide appropriate mechanisms to abort + processing after a reasonable amount of time has + elapsed. In addition, PostScript interpreters should be + limited to the consumption of only a reasonable amount + of any given system resource. + + + + + +Freed & Borenstein Standards Track [Page 16] + +RFC 2046 Media Types November 1996 + + + (7) It is possible to include raw binary information inside + PostScript in various forms. This is not recommended + for use in Internet mail, both because it is not + supported by all PostScript interpreters and because it + significantly complicates the use of a MIME Content- + Transfer-Encoding. (Without such binary, PostScript + may typically be viewed as line-oriented data. The + treatment of CRLF sequences becomes extremely + problematic if binary and line-oriented data are mixed + in a single Postscript data stream.) + + (8) Finally, bugs may exist in some PostScript interpreters + which could possibly be exploited to gain unauthorized + access to a recipient's system. Apart from noting this + possibility, there is no specific action to take to + prevent this, apart from the timely correction of such + bugs if any are found. + +4.5.3. Other Application Subtypes + + It is expected that many other subtypes of "application" will be + defined in the future. MIME implementations must at a minimum treat + any unrecognized subtypes as being equivalent to "application/octet- + stream". + +5. Composite Media Type Values + + The remaining two of the seven initial Content-Type values refer to + composite entities. Composite entities are handled using MIME + mechanisms -- a MIME processor typically handles the body directly. + +5.1. Multipart Media Type + + In the case of multipart entities, in which one or more different + sets of data are combined in a single body, a "multipart" media type + field must appear in the entity's header. The body must then contain + one or more body parts, each preceded by a boundary delimiter line, + and the last one followed by a closing boundary delimiter line. + After its boundary delimiter line, each body part then consists of a + header area, a blank line, and a body area. Thus a body part is + similar to an RFC 822 message in syntax, but different in meaning. + + A body part is an entity and hence is NOT to be interpreted as + actually being an RFC 822 message. To begin with, NO header fields + are actually required in body parts. A body part that starts with a + blank line, therefore, is allowed and is a body part for which all + default values are to be assumed. In such a case, the absence of a + Content-Type header usually indicates that the corresponding body has + + + +Freed & Borenstein Standards Track [Page 17] + +RFC 2046 Media Types November 1996 + + + a content-type of "text/plain; charset=US-ASCII". + + The only header fields that have defined meaning for body parts are + those the names of which begin with "Content-". All other header + fields may be ignored in body parts. Although they should generally + be retained if at all possible, they may be discarded by gateways if + necessary. Such other fields are permitted to appear in body parts + but must not be depended on. "X-" fields may be created for + experimental or private purposes, with the recognition that the + information they contain may be lost at some gateways. + + NOTE: The distinction between an RFC 822 message and a body part is + subtle, but important. A gateway between Internet and X.400 mail, + for example, must be able to tell the difference between a body part + that contains an image and a body part that contains an encapsulated + message, the body of which is a JPEG image. In order to represent + the latter, the body part must have "Content-Type: message/rfc822", + and its body (after the blank line) must be the encapsulated message, + with its own "Content-Type: image/jpeg" header field. The use of + similar syntax facilitates the conversion of messages to body parts, + and vice versa, but the distinction between the two must be + understood by implementors. (For the special case in which parts + actually are messages, a "digest" subtype is also defined.) + + As stated previously, each body part is preceded by a boundary + delimiter line that contains the boundary delimiter. The boundary + delimiter MUST NOT appear inside any of the encapsulated parts, on a + line by itself or as the prefix of any line. This implies that it is + crucial that the composing agent be able to choose and specify a + unique boundary parameter value that does not contain the boundary + parameter value of an enclosing multipart as a prefix. + + All present and future subtypes of the "multipart" type must use an + identical syntax. Subtypes may differ in their semantics, and may + impose additional restrictions on syntax, but must conform to the + required syntax for the "multipart" type. This requirement ensures + that all conformant user agents will at least be able to recognize + and separate the parts of any multipart entity, even those of an + unrecognized subtype. + + As stated in the definition of the Content-Transfer-Encoding field + [RFC 2045], no encoding other than "7bit", "8bit", or "binary" is + permitted for entities of type "multipart". The "multipart" boundary + delimiters and header fields are always represented as 7bit US-ASCII + in any case (though the header fields may encode non-US-ASCII header + text as per RFC 2047) and data within the body parts can be encoded + on a part-by-part basis, with Content-Transfer-Encoding fields for + each appropriate body part. + + + +Freed & Borenstein Standards Track [Page 18] + +RFC 2046 Media Types November 1996 + + +5.1.1. Common Syntax + + This section defines a common syntax for subtypes of "multipart". + All subtypes of "multipart" must use this syntax. A simple example + of a multipart message also appears in this section. An example of a + more complex multipart message is given in RFC 2049. + + The Content-Type field for multipart entities requires one parameter, + "boundary". The boundary delimiter line is then defined as a line + consisting entirely of two hyphen characters ("-", decimal value 45) + followed by the boundary parameter value from the Content-Type header + field, optional linear whitespace, and a terminating CRLF. + + NOTE: The hyphens are for rough compatibility with the earlier RFC + 934 method of message encapsulation, and for ease of searching for + the boundaries in some implementations. However, it should be noted + that multipart messages are NOT completely compatible with RFC 934 + encapsulations; in particular, they do not obey RFC 934 quoting + conventions for embedded lines that begin with hyphens. This + mechanism was chosen over the RFC 934 mechanism because the latter + causes lines to grow with each level of quoting. The combination of + this growth with the fact that SMTP implementations sometimes wrap + long lines made the RFC 934 mechanism unsuitable for use in the event + that deeply-nested multipart structuring is ever desired. + + WARNING TO IMPLEMENTORS: The grammar for parameters on the Content- + type field is such that it is often necessary to enclose the boundary + parameter values in quotes on the Content-type line. This is not + always necessary, but never hurts. Implementors should be sure to + study the grammar carefully in order to avoid producing invalid + Content-type fields. Thus, a typical "multipart" Content-Type header + field might look like this: + + Content-Type: multipart/mixed; boundary=gc0p4Jq0M2Yt08j34c0p + + But the following is not valid: + + Content-Type: multipart/mixed; boundary=gc0pJq0M:08jU534c0p + + (because of the colon) and must instead be represented as + + Content-Type: multipart/mixed; boundary="gc0pJq0M:08jU534c0p" + + This Content-Type value indicates that the content consists of one or + more parts, each with a structure that is syntactically identical to + an RFC 822 message, except that the header area is allowed to be + completely empty, and that the parts are each preceded by the line + + + + +Freed & Borenstein Standards Track [Page 19] + +RFC 2046 Media Types November 1996 + + + --gc0pJq0M:08jU534c0p + + The boundary delimiter MUST occur at the beginning of a line, i.e., + following a CRLF, and the initial CRLF is considered to be attached + to the boundary delimiter line rather than part of the preceding + part. The boundary may be followed by zero or more characters of + linear whitespace. It is then terminated by either another CRLF and + the header fields for the next part, or by two CRLFs, in which case + there are no header fields for the next part. If no Content-Type + field is present it is assumed to be "message/rfc822" in a + "multipart/digest" and "text/plain" otherwise. + + NOTE: The CRLF preceding the boundary delimiter line is conceptually + attached to the boundary so that it is possible to have a part that + does not end with a CRLF (line break). Body parts that must be + considered to end with line breaks, therefore, must have two CRLFs + preceding the boundary delimiter line, the first of which is part of + the preceding body part, and the second of which is part of the + encapsulation boundary. + + Boundary delimiters must not appear within the encapsulated material, + and must be no longer than 70 characters, not counting the two + leading hyphens. + + The boundary delimiter line following the last body part is a + distinguished delimiter that indicates that no further body parts + will follow. Such a delimiter line is identical to the previous + delimiter lines, with the addition of two more hyphens after the + boundary parameter value. + + --gc0pJq0M:08jU534c0p-- + + NOTE TO IMPLEMENTORS: Boundary string comparisons must compare the + boundary value with the beginning of each candidate line. An exact + match of the entire candidate line is not required; it is sufficient + that the boundary appear in its entirety following the CRLF. + + There appears to be room for additional information prior to the + first boundary delimiter line and following the final boundary + delimiter line. These areas should generally be left blank, and + implementations must ignore anything that appears before the first + boundary delimiter line or after the last one. + + NOTE: These "preamble" and "epilogue" areas are generally not used + because of the lack of proper typing of these parts and the lack of + clear semantics for handling these areas at gateways, particularly + X.400 gateways. However, rather than leaving the preamble area + blank, many MIME implementations have found this to be a convenient + + + +Freed & Borenstein Standards Track [Page 20] + +RFC 2046 Media Types November 1996 + + + place to insert an explanatory note for recipients who read the + message with pre-MIME software, since such notes will be ignored by + MIME-compliant software. + + NOTE: Because boundary delimiters must not appear in the body parts + being encapsulated, a user agent must exercise care to choose a + unique boundary parameter value. The boundary parameter value in the + example above could have been the result of an algorithm designed to + produce boundary delimiters with a very low probability of already + existing in the data to be encapsulated without having to prescan the + data. Alternate algorithms might result in more "readable" boundary + delimiters for a recipient with an old user agent, but would require + more attention to the possibility that the boundary delimiter might + appear at the beginning of some line in the encapsulated part. The + simplest boundary delimiter line possible is something like "---", + with a closing boundary delimiter line of "-----". + + As a very simple example, the following multipart message has two + parts, both of them plain text, one of them explicitly typed and one + of them implicitly typed: + + From: Nathaniel Borenstein + To: Ned Freed + Date: Sun, 21 Mar 1993 23:56:48 -0800 (PST) + Subject: Sample message + MIME-Version: 1.0 + Content-type: multipart/mixed; boundary="simple boundary" + + This is the preamble. It is to be ignored, though it + is a handy place for composition agents to include an + explanatory note to non-MIME conformant readers. + + --simple boundary + + This is implicitly typed plain US-ASCII text. + It does NOT end with a linebreak. + --simple boundary + Content-type: text/plain; charset=us-ascii + + This is explicitly typed plain US-ASCII text. + It DOES end with a linebreak. + + --simple boundary-- + + This is the epilogue. It is also to be ignored. + + + + + + +Freed & Borenstein Standards Track [Page 21] + +RFC 2046 Media Types November 1996 + + + The use of a media type of "multipart" in a body part within another + "multipart" entity is explicitly allowed. In such cases, for obvious + reasons, care must be taken to ensure that each nested "multipart" + entity uses a different boundary delimiter. See RFC 2049 for an + example of nested "multipart" entities. + + The use of the "multipart" media type with only a single body part + may be useful in certain contexts, and is explicitly permitted. + + NOTE: Experience has shown that a "multipart" media type with a + single body part is useful for sending non-text media types. It has + the advantage of providing the preamble as a place to include + decoding instructions. In addition, a number of SMTP gateways move + or remove the MIME headers, and a clever MIME decoder can take a good + guess at multipart boundaries even in the absence of the Content-Type + header and thereby successfully decode the message. + + The only mandatory global parameter for the "multipart" media type is + the boundary parameter, which consists of 1 to 70 characters from a + set of characters known to be very robust through mail gateways, and + NOT ending with white space. (If a boundary delimiter line appears to + end with white space, the white space must be presumed to have been + added by a gateway, and must be deleted.) It is formally specified + by the following BNF: + + boundary := 0*69 bcharsnospace + + bchars := bcharsnospace / " " + + bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / + "+" / "_" / "," / "-" / "." / + "/" / ":" / "=" / "?" + + Overall, the body of a "multipart" entity may be specified as + follows: + + dash-boundary := "--" boundary + ; boundary taken from the value of + ; boundary parameter of the + ; Content-Type field. + + multipart-body := [preamble CRLF] + dash-boundary transport-padding CRLF + body-part *encapsulation + close-delimiter transport-padding + [CRLF epilogue] + + + + + +Freed & Borenstein Standards Track [Page 22] + +RFC 2046 Media Types November 1996 + + + transport-padding := *LWSP-char + ; Composers MUST NOT generate + ; non-zero length transport + ; padding, but receivers MUST + ; be able to handle padding + ; added by message transports. + + encapsulation := delimiter transport-padding + CRLF body-part + + delimiter := CRLF dash-boundary + + close-delimiter := delimiter "--" + + preamble := discard-text + + epilogue := discard-text + + discard-text := *(*text CRLF) *text + ; May be ignored or discarded. + + body-part := MIME-part-headers [CRLF *OCTET] + ; Lines in a body-part must not start + ; with the specified dash-boundary and + ; the delimiter must not appear anywhere + ; in the body part. Note that the + ; semantics of a body-part differ from + ; the semantics of a message, as + ; described in the text. + + OCTET := + + IMPORTANT: The free insertion of linear-white-space and RFC 822 + comments between the elements shown in this BNF is NOT allowed since + this BNF does not specify a structured header field. + + NOTE: In certain transport enclaves, RFC 822 restrictions such as + the one that limits bodies to printable US-ASCII characters may not + be in force. (That is, the transport domains may exist that resemble + standard Internet mail transport as specified in RFC 821 and assumed + by RFC 822, but without certain restrictions.) The relaxation of + these restrictions should be construed as locally extending the + definition of bodies, for example to include octets outside of the + US-ASCII range, as long as these extensions are supported by the + transport and adequately documented in the Content- Transfer-Encoding + header field. However, in no event are headers (either message + headers or body part headers) allowed to contain anything other than + US-ASCII characters. + + + +Freed & Borenstein Standards Track [Page 23] + +RFC 2046 Media Types November 1996 + + + NOTE: Conspicuously missing from the "multipart" type is a notion of + structured, related body parts. It is recommended that those wishing + to provide more structured or integrated multipart messaging + facilities should define subtypes of multipart that are syntactically + identical but define relationships between the various parts. For + example, subtypes of multipart could be defined that include a + distinguished part which in turn is used to specify the relationships + between the other parts, probably referring to them by their + Content-ID field. Old implementations will not recognize the new + subtype if this approach is used, but will treat it as + multipart/mixed and will thus be able to show the user the parts that + are recognized. + +5.1.2. Handling Nested Messages and Multiparts + + The "message/rfc822" subtype defined in a subsequent section of this + document has no terminating condition other than running out of data. + Similarly, an improperly truncated "multipart" entity may not have + any terminating boundary marker, and can turn up operationally due to + mail system malfunctions. + + It is essential that such entities be handled correctly when they are + themselves imbedded inside of another "multipart" structure. MIME + implementations are therefore required to recognize outer level + boundary markers at ANY level of inner nesting. It is not sufficient + to only check for the next expected marker or other terminating + condition. + +5.1.3. Mixed Subtype + + The "mixed" subtype of "multipart" is intended for use when the body + parts are independent and need to be bundled in a particular order. + Any "multipart" subtypes that an implementation does not recognize + must be treated as being of subtype "mixed". + +5.1.4. Alternative Subtype + + The "multipart/alternative" type is syntactically identical to + "multipart/mixed", but the semantics are different. In particular, + each of the body parts is an "alternative" version of the same + information. + + Systems should recognize that the content of the various parts are + interchangeable. Systems should choose the "best" type based on the + local environment and references, in some cases even through user + interaction. As with "multipart/mixed", the order of body parts is + significant. In this case, the alternatives appear in an order of + increasing faithfulness to the original content. In general, the + + + +Freed & Borenstein Standards Track [Page 24] + +RFC 2046 Media Types November 1996 + + + best choice is the LAST part of a type supported by the recipient + system's local environment. + + "Multipart/alternative" may be used, for example, to send a message + in a fancy text format in such a way that it can easily be displayed + anywhere: + + From: Nathaniel Borenstein + To: Ned Freed + Date: Mon, 22 Mar 1993 09:41:09 -0800 (PST) + Subject: Formatted text mail + MIME-Version: 1.0 + Content-Type: multipart/alternative; boundary=boundary42 + + --boundary42 + Content-Type: text/plain; charset=us-ascii + + ... plain text version of message goes here ... + + --boundary42 + Content-Type: text/enriched + + ... RFC 1896 text/enriched version of same message + goes here ... + + --boundary42 + Content-Type: application/x-whatever + + ... fanciest version of same message goes here ... + + --boundary42-- + + In this example, users whose mail systems understood the + "application/x-whatever" format would see only the fancy version, + while other users would see only the enriched or plain text version, + depending on the capabilities of their system. + + In general, user agents that compose "multipart/alternative" entities + must place the body parts in increasing order of preference, that is, + with the preferred format last. For fancy text, the sending user + agent should put the plainest format first and the richest format + last. Receiving user agents should pick and display the last format + they are capable of displaying. In the case where one of the + alternatives is itself of type "multipart" and contains unrecognized + sub-parts, the user agent may choose either to show that alternative, + an earlier alternative, or both. + + + + + +Freed & Borenstein Standards Track [Page 25] + +RFC 2046 Media Types November 1996 + + + NOTE: From an implementor's perspective, it might seem more sensible + to reverse this ordering, and have the plainest alternative last. + However, placing the plainest alternative first is the friendliest + possible option when "multipart/alternative" entities are viewed + using a non-MIME-conformant viewer. While this approach does impose + some burden on conformant MIME viewers, interoperability with older + mail readers was deemed to be more important in this case. + + It may be the case that some user agents, if they can recognize more + than one of the formats, will prefer to offer the user the choice of + which format to view. This makes sense, for example, if a message + includes both a nicely- formatted image version and an easily-edited + text version. What is most critical, however, is that the user not + automatically be shown multiple versions of the same data. Either + the user should be shown the last recognized version or should be + given the choice. + + THE SEMANTICS OF CONTENT-ID IN MULTIPART/ALTERNATIVE: Each part of a + "multipart/alternative" entity represents the same data, but the + mappings between the two are not necessarily without information + loss. For example, information is lost when translating ODA to + PostScript or plain text. It is recommended that each part should + have a different Content-ID value in the case where the information + content of the two parts is not identical. And when the information + content is identical -- for example, where several parts of type + "message/external-body" specify alternate ways to access the + identical data -- the same Content-ID field value should be used, to + optimize any caching mechanisms that might be present on the + recipient's end. However, the Content-ID values used by the parts + should NOT be the same Content-ID value that describes the + "multipart/alternative" as a whole, if there is any such Content-ID + field. That is, one Content-ID value will refer to the + "multipart/alternative" entity, while one or more other Content-ID + values will refer to the parts inside it. + +5.1.5. Digest Subtype + + This document defines a "digest" subtype of the "multipart" Content- + Type. This type is syntactically identical to "multipart/mixed", but + the semantics are different. In particular, in a digest, the default + Content-Type value for a body part is changed from "text/plain" to + "message/rfc822". This is done to allow a more readable digest + format that is largely compatible (except for the quoting convention) + with RFC 934. + + Note: Though it is possible to specify a Content-Type value for a + body part in a digest which is other than "message/rfc822", such as a + "text/plain" part containing a description of the material in the + + + +Freed & Borenstein Standards Track [Page 26] + +RFC 2046 Media Types November 1996 + + + digest, actually doing so is undesireble. The "multipart/digest" + Content-Type is intended to be used to send collections of messages. + If a "text/plain" part is needed, it should be included as a seperate + part of a "multipart/mixed" message. + + A digest in this format might, then, look something like this: + + From: Moderator-Address + To: Recipient-List + Date: Mon, 22 Mar 1994 13:34:51 +0000 + Subject: Internet Digest, volume 42 + MIME-Version: 1.0 + Content-Type: multipart/mixed; + boundary="---- main boundary ----" + + ------ main boundary ---- + + ...Introductory text or table of contents... + + ------ main boundary ---- + Content-Type: multipart/digest; + boundary="---- next message ----" + + ------ next message ---- + + From: someone-else + Date: Fri, 26 Mar 1993 11:13:32 +0200 + Subject: my opinion + + ...body goes here ... + + ------ next message ---- + + From: someone-else-again + Date: Fri, 26 Mar 1993 10:07:13 -0500 + Subject: my different opinion + + ... another body goes here ... + + ------ next message ------ + + ------ main boundary ------ + +5.1.6. Parallel Subtype + + This document defines a "parallel" subtype of the "multipart" + Content-Type. This type is syntactically identical to + "multipart/mixed", but the semantics are different. In particular, + + + +Freed & Borenstein Standards Track [Page 27] + +RFC 2046 Media Types November 1996 + + + in a parallel entity, the order of body parts is not significant. + + A common presentation of this type is to display all of the parts + simultaneously on hardware and software that are capable of doing so. + However, composing agents should be aware that many mail readers will + lack this capability and will show the parts serially in any event. + +5.1.7. Other Multipart Subtypes + + Other "multipart" subtypes are expected in the future. MIME + implementations must in general treat unrecognized subtypes of + "multipart" as being equivalent to "multipart/mixed". + +5.2. Message Media Type + + It is frequently desirable, in sending mail, to encapsulate another + mail message. A special media type, "message", is defined to + facilitate this. In particular, the "rfc822" subtype of "message" is + used to encapsulate RFC 822 messages. + + NOTE: It has been suggested that subtypes of "message" might be + defined for forwarded or rejected messages. However, forwarded and + rejected messages can be handled as multipart messages in which the + first part contains any control or descriptive information, and a + second part, of type "message/rfc822", is the forwarded or rejected + message. Composing rejection and forwarding messages in this manner + will preserve the type information on the original message and allow + it to be correctly presented to the recipient, and hence is strongly + encouraged. + + Subtypes of "message" often impose restrictions on what encodings are + allowed. These restrictions are described in conjunction with each + specific subtype. + + Mail gateways, relays, and other mail handling agents are commonly + known to alter the top-level header of an RFC 822 message. In + particular, they frequently add, remove, or reorder header fields. + These operations are explicitly forbidden for the encapsulated + headers embedded in the bodies of messages of type "message." + +5.2.1. RFC822 Subtype + + A media type of "message/rfc822" indicates that the body contains an + encapsulated message, with the syntax of an RFC 822 message. + However, unlike top-level RFC 822 messages, the restriction that each + "message/rfc822" body must include a "From", "Date", and at least one + destination header is removed and replaced with the requirement that + at least one of "From", "Subject", or "Date" must be present. + + + +Freed & Borenstein Standards Track [Page 28] + +RFC 2046 Media Types November 1996 + + + It should be noted that, despite the use of the numbers "822", a + "message/rfc822" entity isn't restricted to material in strict + conformance to RFC822, nor are the semantics of "message/rfc822" + objects restricted to the semantics defined in RFC822. More + specifically, a "message/rfc822" message could well be a News article + or a MIME message. + + No encoding other than "7bit", "8bit", or "binary" is permitted for + the body of a "message/rfc822" entity. The message header fields are + always US-ASCII in any case, and data within the body can still be + encoded, in which case the Content-Transfer-Encoding header field in + the encapsulated message will reflect this. Non-US-ASCII text in the + headers of an encapsulated message can be specified using the + mechanisms described in RFC 2047. + +5.2.2. Partial Subtype + + The "partial" subtype is defined to allow large entities to be + delivered as several separate pieces of mail and automatically + reassembled by a receiving user agent. (The concept is similar to IP + fragmentation and reassembly in the basic Internet Protocols.) This + mechanism can be used when intermediate transport agents limit the + size of individual messages that can be sent. The media type + "message/partial" thus indicates that the body contains a fragment of + a larger entity. + + Because data of type "message" may never be encoded in base64 or + quoted-printable, a problem might arise if "message/partial" entities + are constructed in an environment that supports binary or 8bit + transport. The problem is that the binary data would be split into + multiple "message/partial" messages, each of them requiring binary + transport. If such messages were encountered at a gateway into a + 7bit transport environment, there would be no way to properly encode + them for the 7bit world, aside from waiting for all of the fragments, + reassembling the inner message, and then encoding the reassembled + data in base64 or quoted-printable. Since it is possible that + different fragments might go through different gateways, even this is + not an acceptable solution. For this reason, it is specified that + entities of type "message/partial" must always have a content- + transfer-encoding of 7bit (the default). In particular, even in + environments that support binary or 8bit transport, the use of a + content- transfer-encoding of "8bit" or "binary" is explicitly + prohibited for MIME entities of type "message/partial". This in turn + implies that the inner message must not use "8bit" or "binary" + encoding. + + + + + + +Freed & Borenstein Standards Track [Page 29] + +RFC 2046 Media Types November 1996 + + + Because some message transfer agents may choose to automatically + fragment large messages, and because such agents may use very + different fragmentation thresholds, it is possible that the pieces of + a partial message, upon reassembly, may prove themselves to comprise + a partial message. This is explicitly permitted. + + Three parameters must be specified in the Content-Type field of type + "message/partial": The first, "id", is a unique identifier, as close + to a world-unique identifier as possible, to be used to match the + fragments together. (In general, the identifier is essentially a + message-id; if placed in double quotes, it can be ANY message-id, in + accordance with the BNF for "parameter" given in RFC 2045.) The + second, "number", an integer, is the fragment number, which indicates + where this fragment fits into the sequence of fragments. The third, + "total", another integer, is the total number of fragments. This + third subfield is required on the final fragment, and is optional + (though encouraged) on the earlier fragments. Note also that these + parameters may be given in any order. + + Thus, the second piece of a 3-piece message may have either of the + following header fields: + + Content-Type: Message/Partial; number=2; total=3; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com" + + Content-Type: Message/Partial; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com"; + number=2 + + But the third piece MUST specify the total number of fragments: + + Content-Type: Message/Partial; number=3; total=3; + id="oc=jpbe0M2Yt4s@thumper.bellcore.com" + + Note that fragment numbering begins with 1, not 0. + + When the fragments of an entity broken up in this manner are put + together, the result is always a complete MIME entity, which may have + its own Content-Type header field, and thus may contain any other + data type. + +5.2.2.1. Message Fragmentation and Reassembly + + The semantics of a reassembled partial message must be those of the + "inner" message, rather than of a message containing the inner + message. This makes it possible, for example, to send a large audio + message as several partial messages, and still have it appear to the + recipient as a simple audio message rather than as an encapsulated + + + +Freed & Borenstein Standards Track [Page 30] + +RFC 2046 Media Types November 1996 + + + message containing an audio message. That is, the encapsulation of + the message is considered to be "transparent". + + When generating and reassembling the pieces of a "message/partial" + message, the headers of the encapsulated message must be merged with + the headers of the enclosing entities. In this process the following + rules must be observed: + + (1) Fragmentation agents must split messages at line + boundaries only. This restriction is imposed because + splits at points other than the ends of lines in turn + depends on message transports being able to preserve + the semantics of messages that don't end with a CRLF + sequence. Many transports are incapable of preserving + such semantics. + + (2) All of the header fields from the initial enclosing + message, except those that start with "Content-" and + the specific header fields "Subject", "Message-ID", + "Encrypted", and "MIME-Version", must be copied, in + order, to the new message. + + (3) The header fields in the enclosed message which start + with "Content-", plus the "Subject", "Message-ID", + "Encrypted", and "MIME-Version" fields, must be + appended, in order, to the header fields of the new + message. Any header fields in the enclosed message + which do not start with "Content-" (except for the + "Subject", "Message-ID", "Encrypted", and "MIME- + Version" fields) will be ignored and dropped. + + (4) All of the header fields from the second and any + subsequent enclosing messages are discarded by the + reassembly process. + +5.2.2.2. Fragmentation and Reassembly Example + + If an audio message is broken into two pieces, the first piece might + look something like this: + + X-Weird-Header-1: Foo + From: Bill@host.com + To: joe@otherhost.com + Date: Fri, 26 Mar 1993 12:59:38 -0500 (EST) + Subject: Audio mail (part 1 of 2) + Message-ID: + MIME-Version: 1.0 + Content-type: message/partial; id="ABC@host.com"; + + + +Freed & Borenstein Standards Track [Page 31] + +RFC 2046 Media Types November 1996 + + + number=1; total=2 + + X-Weird-Header-1: Bar + X-Weird-Header-2: Hello + Message-ID: + Subject: Audio mail + MIME-Version: 1.0 + Content-type: audio/basic + Content-transfer-encoding: base64 + + ... first half of encoded audio data goes here ... + + and the second half might look something like this: + + From: Bill@host.com + To: joe@otherhost.com + Date: Fri, 26 Mar 1993 12:59:38 -0500 (EST) + Subject: Audio mail (part 2 of 2) + MIME-Version: 1.0 + Message-ID: + Content-type: message/partial; + id="ABC@host.com"; number=2; total=2 + + ... second half of encoded audio data goes here ... + + Then, when the fragmented message is reassembled, the resulting + message to be displayed to the user should look something like this: + + X-Weird-Header-1: Foo + From: Bill@host.com + To: joe@otherhost.com + Date: Fri, 26 Mar 1993 12:59:38 -0500 (EST) + Subject: Audio mail + Message-ID: + MIME-Version: 1.0 + Content-type: audio/basic + Content-transfer-encoding: base64 + + ... first half of encoded audio data goes here ... + ... second half of encoded audio data goes here ... + + The inclusion of a "References" field in the headers of the second + and subsequent pieces of a fragmented message that references the + Message-Id on the previous piece may be of benefit to mail readers + that understand and track references. However, the generation of + such "References" fields is entirely optional. + + + + + +Freed & Borenstein Standards Track [Page 32] + +RFC 2046 Media Types November 1996 + + + Finally, it should be noted that the "Encrypted" header field has + been made obsolete by Privacy Enhanced Messaging (PEM) [RFC-1421, + RFC-1422, RFC-1423, RFC-1424], but the rules above are nevertheless + believed to describe the correct way to treat it if it is encountered + in the context of conversion to and from "message/partial" fragments. + +5.2.3. External-Body Subtype + + The external-body subtype indicates that the actual body data are not + included, but merely referenced. In this case, the parameters + describe a mechanism for accessing the external data. + + When a MIME entity is of type "message/external-body", it consists of + a header, two consecutive CRLFs, and the message header for the + encapsulated message. If another pair of consecutive CRLFs appears, + this of course ends the message header for the encapsulated message. + However, since the encapsulated message's body is itself external, it + does NOT appear in the area that follows. For example, consider the + following message: + + Content-type: message/external-body; + access-type=local-file; + name="/u/nsb/Me.jpeg" + + Content-type: image/jpeg + Content-ID: + Content-Transfer-Encoding: binary + + THIS IS NOT REALLY THE BODY! + + The area at the end, which might be called the "phantom body", is + ignored for most external-body messages. However, it may be used to + contain auxiliary information for some such messages, as indeed it is + when the access-type is "mail- server". The only access-type defined + in this document that uses the phantom body is "mail-server", but + other access-types may be defined in the future in other + specifications that use this area. + + The encapsulated headers in ALL "message/external-body" entities MUST + include a Content-ID header field to give a unique identifier by + which to reference the data. This identifier may be used for caching + mechanisms, and for recognizing the receipt of the data when the + access-type is "mail-server". + + Note that, as specified here, the tokens that describe external-body + data, such as file names and mail server commands, are required to be + in the US-ASCII character set. + + + + +Freed & Borenstein Standards Track [Page 33] + +RFC 2046 Media Types November 1996 + + + If this proves problematic in practice, a new mechanism may be + required as a future extension to MIME, either as newly defined + access-types for "message/external-body" or by some other mechanism. + + As with "message/partial", MIME entities of type "message/external- + body" MUST have a content-transfer-encoding of 7bit (the default). + In particular, even in environments that support binary or 8bit + transport, the use of a content- transfer-encoding of "8bit" or + "binary" is explicitly prohibited for entities of type + "message/external-body". + +5.2.3.1. General External-Body Parameters + + The parameters that may be used with any "message/external- body" + are: + + (1) ACCESS-TYPE -- A word indicating the supported access + mechanism by which the file or data may be obtained. + This word is not case sensitive. Values include, but + are not limited to, "FTP", "ANON-FTP", "TFTP", "LOCAL- + FILE", and "MAIL-SERVER". Future values, except for + experimental values beginning with "X-", must be + registered with IANA, as described in RFC 2048. + This parameter is unconditionally mandatory and MUST be + present on EVERY "message/external-body". + + (2) EXPIRATION -- The date (in the RFC 822 "date-time" + syntax, as extended by RFC 1123 to permit 4 digits in + the year field) after which the existence of the + external data is not guaranteed. This parameter may be + used with ANY access-type and is ALWAYS optional. + + (3) SIZE -- The size (in octets) of the data. The intent + of this parameter is to help the recipient decide + whether or not to expend the necessary resources to + retrieve the external data. Note that this describes + the size of the data in its canonical form, that is, + before any Content-Transfer-Encoding has been applied + or after the data have been decoded. This parameter + may be used with ANY access-type and is ALWAYS + optional. + + (4) PERMISSION -- A case-insensitive field that indicates + whether or not it is expected that clients might also + attempt to overwrite the data. By default, or if + permission is "read", the assumption is that they are + not, and that if the data is retrieved once, it is + never needed again. If PERMISSION is "read-write", + + + +Freed & Borenstein Standards Track [Page 34] + +RFC 2046 Media Types November 1996 + + + this assumption is invalid, and any local copy must be + considered no more than a cache. "Read" and "Read- + write" are the only defined values of permission. This + parameter may be used with ANY access-type and is + ALWAYS optional. + + The precise semantics of the access-types defined here are described + in the sections that follow. + +5.2.3.2. The 'ftp' and 'tftp' Access-Types + + An access-type of FTP or TFTP indicates that the message body is + accessible as a file using the FTP [RFC-959] or TFTP [RFC- 783] + protocols, respectively. For these access-types, the following + additional parameters are mandatory: + + (1) NAME -- The name of the file that contains the actual + body data. + + (2) SITE -- A machine from which the file may be obtained, + using the given protocol. This must be a fully + qualified domain name, not a nickname. + + (3) Before any data are retrieved, using FTP, the user will + generally need to be asked to provide a login id and a + password for the machine named by the site parameter. + For security reasons, such an id and password are not + specified as content-type parameters, but must be + obtained from the user. + + In addition, the following parameters are optional: + + (1) DIRECTORY -- A directory from which the data named by + NAME should be retrieved. + + (2) MODE -- A case-insensitive string indicating the mode + to be used when retrieving the information. The valid + values for access-type "TFTP" are "NETASCII", "OCTET", + and "MAIL", as specified by the TFTP protocol [RFC- + 783]. The valid values for access-type "FTP" are + "ASCII", "EBCDIC", "IMAGE", and "LOCALn" where "n" is a + decimal integer, typically 8. These correspond to the + representation types "A" "E" "I" and "L n" as specified + by the FTP protocol [RFC-959]. Note that "BINARY" and + "TENEX" are not valid values for MODE and that "OCTET" + or "IMAGE" or "LOCAL8" should be used instead. IF MODE + is not specified, the default value is "NETASCII" for + TFTP and "ASCII" otherwise. + + + +Freed & Borenstein Standards Track [Page 35] + +RFC 2046 Media Types November 1996 + + +5.2.3.3. The 'anon-ftp' Access-Type + + The "anon-ftp" access-type is identical to the "ftp" access type, + except that the user need not be asked to provide a name and password + for the specified site. Instead, the ftp protocol will be used with + login "anonymous" and a password that corresponds to the user's mail + address. + +5.2.3.4. The 'local-file' Access-Type + + An access-type of "local-file" indicates that the actual body is + accessible as a file on the local machine. Two additional parameters + are defined for this access type: + + (1) NAME -- The name of the file that contains the actual + body data. This parameter is mandatory for the + "local-file" access-type. + + (2) SITE -- A domain specifier for a machine or set of + machines that are known to have access to the data + file. This optional parameter is used to describe the + locality of reference for the data, that is, the site + or sites at which the file is expected to be visible. + Asterisks may be used for wildcard matching to a part + of a domain name, such as "*.bellcore.com", to indicate + a set of machines on which the data should be directly + visible, while a single asterisk may be used to + indicate a file that is expected to be universally + available, e.g., via a global file system. + +5.2.3.5. The 'mail-server' Access-Type + + The "mail-server" access-type indicates that the actual body is + available from a mail server. Two additional parameters are defined + for this access-type: + + (1) SERVER -- The addr-spec of the mail server from which + the actual body data can be obtained. This parameter + is mandatory for the "mail-server" access-type. + + (2) SUBJECT -- The subject that is to be used in the mail + that is sent to obtain the data. Note that keying mail + servers on Subject lines is NOT recommended, but such + mail servers are known to exist. This is an optional + parameter. + + + + + + +Freed & Borenstein Standards Track [Page 36] + +RFC 2046 Media Types November 1996 + + + Because mail servers accept a variety of syntaxes, some of which is + multiline, the full command to be sent to a mail server is not + included as a parameter in the content-type header field. Instead, + it is provided as the "phantom body" when the media type is + "message/external-body" and the access-type is mail-server. + + Note that MIME does not define a mail server syntax. Rather, it + allows the inclusion of arbitrary mail server commands in the phantom + body. Implementations must include the phantom body in the body of + the message it sends to the mail server address to retrieve the + relevant data. + + Unlike other access-types, mail-server access is asynchronous and + will happen at an unpredictable time in the future. For this reason, + it is important that there be a mechanism by which the returned data + can be matched up with the original "message/external-body" entity. + MIME mail servers must use the same Content-ID field on the returned + message that was used in the original "message/external-body" + entities, to facilitate such matching. + +5.2.3.6. External-Body Security Issues + + "Message/external-body" entities give rise to two important security + issues: + + (1) Accessing data via a "message/external-body" reference + effectively results in the message recipient performing + an operation that was specified by the message + originator. It is therefore possible for the message + originator to trick a recipient into doing something + they would not have done otherwise. For example, an + originator could specify a action that attempts + retrieval of material that the recipient is not + authorized to obtain, causing the recipient to + unwittingly violate some security policy. For this + reason, user agents capable of resolving external + references must always take steps to describe the + action they are to take to the recipient and ask for + explicit permisssion prior to performing it. + + The 'mail-server' access-type is particularly + vulnerable, in that it causes the recipient to send a + new message whose contents are specified by the + original message's originator. Given the potential for + abuse, any such request messages that are constructed + should contain a clear indication that they were + generated automatically (e.g. in a Comments: header + field) in an attempt to resolve a MIME + + + +Freed & Borenstein Standards Track [Page 37] + +RFC 2046 Media Types November 1996 + + + "message/external-body" reference. + + (2) MIME will sometimes be used in environments that + provide some guarantee of message integrity and + authenticity. If present, such guarantees may apply + only to the actual direct content of messages -- they + may or may not apply to data accessed through MIME's + "message/external-body" mechanism. In particular, it + may be possible to subvert certain access mechanisms + even when the messaging system itself is secure. + + It should be noted that this problem exists either with + or without the availabilty of MIME mechanisms. A + casual reference to an FTP site containing a document + in the text of a secure message brings up similar + issues -- the only difference is that MIME provides for + automatic retrieval of such material, and users may + place unwarranted trust is such automatic retrieval + mechanisms. + +5.2.3.7. Examples and Further Explanations + + When the external-body mechanism is used in conjunction with the + "multipart/alternative" media type it extends the functionality of + "multipart/alternative" to include the case where the same entity is + provided in the same format but via different accces mechanisms. + When this is done the originator of the message must order the parts + first in terms of preferred formats and then by preferred access + mechanisms. The recipient's viewer should then evaluate the list + both in terms of format and access mechanisms. + + With the emerging possibility of very wide-area file systems, it + becomes very hard to know in advance the set of machines where a file + will and will not be accessible directly from the file system. + Therefore it may make sense to provide both a file name, to be tried + directly, and the name of one or more sites from which the file is + known to be accessible. An implementation can try to retrieve remote + files using FTP or any other protocol, using anonymous file retrieval + or prompting the user for the necessary name and password. If an + external body is accessible via multiple mechanisms, the sender may + include multiple entities of type "message/external-body" within the + body parts of an enclosing "multipart/alternative" entity. + + However, the external-body mechanism is not intended to be limited to + file retrieval, as shown by the mail-server access-type. Beyond + this, one can imagine, for example, using a video server for external + references to video clips. + + + + +Freed & Borenstein Standards Track [Page 38] + +RFC 2046 Media Types November 1996 + + + The embedded message header fields which appear in the body of the + "message/external-body" data must be used to declare the media type + of the external body if it is anything other than plain US-ASCII + text, since the external body does not have a header section to + declare its type. Similarly, any Content-transfer-encoding other + than "7bit" must also be declared here. Thus a complete + "message/external-body" message, referring to an object in PostScript + format, might look like this: + + From: Whomever + To: Someone + Date: Whenever + Subject: whatever + MIME-Version: 1.0 + Message-ID: + Content-Type: multipart/alternative; boundary=42 + Content-ID: + + --42 + Content-Type: message/external-body; name="BodyFormats.ps"; + site="thumper.bellcore.com"; mode="image"; + access-type=ANON-FTP; directory="pub"; + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + Content-ID: + + --42 + Content-Type: message/external-body; access-type=local-file; + name="/u/nsb/writing/rfcs/RFC-MIME.ps"; + site="thumper.bellcore.com"; + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + Content-ID: + + --42 + Content-Type: message/external-body; + access-type=mail-server + server="listserv@bogus.bitnet"; + expiration="Fri, 14 Jun 1991 19:13:14 -0400 (EDT)" + + Content-type: application/postscript + Content-ID: + + get RFC-MIME.DOC + + --42-- + + + +Freed & Borenstein Standards Track [Page 39] + +RFC 2046 Media Types November 1996 + + + Note that in the above examples, the default Content-transfer- + encoding of "7bit" is assumed for the external postscript data. + + Like the "message/partial" type, the "message/external-body" media + type is intended to be transparent, that is, to convey the data type + in the external body rather than to convey a message with a body of + that type. Thus the headers on the outer and inner parts must be + merged using the same rules as for "message/partial". In particular, + this means that the Content-type and Subject fields are overridden, + but the From field is preserved. + + Note that since the external bodies are not transported along with + the external body reference, they need not conform to transport + limitations that apply to the reference itself. In particular, + Internet mail transports may impose 7bit and line length limits, but + these do not automatically apply to binary external body references. + Thus a Content-Transfer-Encoding is not generally necessary, though + it is permitted. + + Note that the body of a message of type "message/external-body" is + governed by the basic syntax for an RFC 822 message. In particular, + anything before the first consecutive pair of CRLFs is header + information, while anything after it is body information, which is + ignored for most access-types. + +5.2.4. Other Message Subtypes + + MIME implementations must in general treat unrecognized subtypes of + "message" as being equivalent to "application/octet-stream". + + Future subtypes of "message" intended for use with email should be + restricted to "7bit" encoding. A type other than "message" should be + used if restriction to "7bit" is not possible. + +6. Experimental Media Type Values + + A media type value beginning with the characters "X-" is a private + value, to be used by consenting systems by mutual agreement. Any + format without a rigorous and public definition must be named with an + "X-" prefix, and publicly specified values shall never begin with + "X-". (Older versions of the widely used Andrew system use the "X- + BE2" name, so new systems should probably choose a different name.) + + In general, the use of "X-" top-level types is strongly discouraged. + Implementors should invent subtypes of the existing types whenever + possible. In many cases, a subtype of "application" will be more + appropriate than a new top-level type. + + + + +Freed & Borenstein Standards Track [Page 40] + +RFC 2046 Media Types November 1996 + + +7. Summary + + The five discrete media types provide provide a standardized + mechanism for tagging entities as "audio", "image", or several other + kinds of data. The composite "multipart" and "message" media types + allow mixing and hierarchical structuring of entities of different + types in a single message. A distinguished parameter syntax allows + further specification of data format details, particularly the + specification of alternate character sets. Additional optional + header fields provide mechanisms for certain extensions deemed + desirable by many implementors. Finally, a number of useful media + types are defined for general use by consenting user agents, notably + "message/partial" and "message/external-body". + +9. Security Considerations + + Security issues are discussed in the context of the + "application/postscript" type, the "message/external-body" type, and + in RFC 2048. Implementors should pay special attention to the + security implications of any media types that can cause the remote + execution of any actions in the recipient's environment. In such + cases, the discussion of the "application/postscript" type may serve + as a model for considering other media types with remote execution + capabilities. + + + + + + + + + + + + + + + + + + + + + + + + + + + +Freed & Borenstein Standards Track [Page 41] + +RFC 2046 Media Types November 1996 + + +9. Authors' Addresses + + For more information, the authors of this document are best contacted + via Internet mail: + + Ned Freed + Innosoft International, Inc. + 1050 East Garvey Avenue South + West Covina, CA 91790 + USA + + Phone: +1 818 919 3600 + Fax: +1 818 919 3614 + EMail: ned@innosoft.com + + + Nathaniel S. Borenstein + First Virtual Holdings + 25 Washington Avenue + Morristown, NJ 07960 + USA + + Phone: +1 201 540 8967 + Fax: +1 201 993 3032 + EMail: nsb@nsb.fv.com + + + MIME is a result of the work of the Internet Engineering Task Force + Working Group on RFC 822 Extensions. The chairman of that group, + Greg Vaudreuil, may be reached at: + + Gregory M. Vaudreuil + Octel Network Services + 17080 Dallas Parkway + Dallas, TX 75248-1905 + USA + + EMail: Greg.Vaudreuil@Octel.Com + + + + + + + + + + + + + +Freed & Borenstein Standards Track [Page 42] + +RFC 2046 Media Types November 1996 + + +Appendix A -- Collected Grammar + + This appendix contains the complete BNF grammar for all the syntax + specified by this document. + + By itself, however, this grammar is incomplete. It refers by name to + several syntax rules that are defined by RFC 822. Rather than + reproduce those definitions here, and risk unintentional differences + between the two, this document simply refers the reader to RFC 822 + for the remaining definitions. Wherever a term is undefined, it + refers to the RFC 822 definition. + + boundary := 0*69 bcharsnospace + + bchars := bcharsnospace / " " + + bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / + "+" / "_" / "," / "-" / "." / + "/" / ":" / "=" / "?" + + body-part := <"message" as defined in RFC 822, with all + header fields optional, not starting with the + specified dash-boundary, and with the + delimiter not occurring anywhere in the + body part. Note that the semantics of a + part differ from the semantics of a message, + as described in the text.> + + close-delimiter := delimiter "--" + + dash-boundary := "--" boundary + ; boundary taken from the value of + ; boundary parameter of the + ; Content-Type field. + + delimiter := CRLF dash-boundary + + discard-text := *(*text CRLF) + ; May be ignored or discarded. + + encapsulation := delimiter transport-padding + CRLF body-part + + epilogue := discard-text + + multipart-body := [preamble CRLF] + dash-boundary transport-padding CRLF + body-part *encapsulation + + + +Freed & Borenstein Standards Track [Page 43] + +RFC 2046 Media Types November 1996 + + + close-delimiter transport-padding + [CRLF epilogue] + + preamble := discard-text + + transport-padding := *LWSP-char + ; Composers MUST NOT generate + ; non-zero length transport + ; padding, but receivers MUST + ; be able to handle padding + ; added by message transports. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Freed & Borenstein Standards Track [Page 44] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2047.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2047.txt new file mode 100644 index 0000000..ff9a744 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2047.txt @@ -0,0 +1,843 @@ + + + + + + +Network Working Group K. Moore +Request for Comments: 2047 University of Tennessee +Obsoletes: 1521, 1522, 1590 November 1996 +Category: Standards Track + + + MIME (Multipurpose Internet Mail Extensions) Part Three: + Message Header Extensions for Non-ASCII Text + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Abstract + + STD 11, RFC 822, defines a message representation protocol specifying + considerable detail about US-ASCII message headers, and leaves the + message content, or message body, as flat US-ASCII text. This set of + documents, collectively called the Multipurpose Internet Mail + Extensions, or MIME, redefines the format of messages to allow for + + (1) textual message bodies in character sets other than US-ASCII, + + (2) an extensible set of different formats for non-textual message + bodies, + + (3) multi-part message bodies, and + + (4) textual header information in character sets other than US-ASCII. + + These documents are based on earlier work documented in RFC 934, STD + 11, and RFC 1049, but extends and revises them. Because RFC 822 said + so little about message bodies, these documents are largely + orthogonal to (rather than a revision of) RFC 822. + + This particular document is the third document in the series. It + describes extensions to RFC 822 to allow non-US-ASCII text data in + Internet mail header fields. + + + + + + + + + +Moore Standards Track [Page 1] + +RFC 2047 Message Header Extensions November 1996 + + + Other documents in this series include: + + + RFC 2045, which specifies the various headers used to describe + the structure of MIME messages. + + + RFC 2046, which defines the general structure of the MIME media + typing system and defines an initial set of media types, + + + RFC 2048, which specifies various IANA registration procedures + for MIME-related facilities, and + + + RFC 2049, which describes MIME conformance criteria and + provides some illustrative examples of MIME message formats, + acknowledgements, and the bibliography. + + These documents are revisions of RFCs 1521, 1522, and 1590, which + themselves were revisions of RFCs 1341 and 1342. An appendix in RFC + 2049 describes differences and changes from previous versions. + +1. Introduction + + RFC 2045 describes a mechanism for denoting textual body parts which + are coded in various character sets, as well as methods for encoding + such body parts as sequences of printable US-ASCII characters. This + memo describes similar techniques to allow the encoding of non-ASCII + text in various portions of a RFC 822 [2] message header, in a manner + which is unlikely to confuse existing message handling software. + + Like the encoding techniques described in RFC 2045, the techniques + outlined here were designed to allow the use of non-ASCII characters + in message headers in a way which is unlikely to be disturbed by the + quirks of existing Internet mail handling programs. In particular, + some mail relaying programs are known to (a) delete some message + header fields while retaining others, (b) rearrange the order of + addresses in To or Cc fields, (c) rearrange the (vertical) order of + header fields, and/or (d) "wrap" message headers at different places + than those in the original message. In addition, some mail reading + programs are known to have difficulty correctly parsing message + headers which, while legal according to RFC 822, make use of + backslash-quoting to "hide" special characters such as "<", ",", or + ":", or which exploit other infrequently-used features of that + specification. + + While it is unfortunate that these programs do not correctly + interpret RFC 822 headers, to "break" these programs would cause + severe operational problems for the Internet mail system. The + extensions described in this memo therefore do not rely on little- + used features of RFC 822. + + + +Moore Standards Track [Page 2] + +RFC 2047 Message Header Extensions November 1996 + + + Instead, certain sequences of "ordinary" printable ASCII characters + (known as "encoded-words") are reserved for use as encoded data. The + syntax of encoded-words is such that they are unlikely to + "accidentally" appear as normal text in message headers. + Furthermore, the characters used in encoded-words are restricted to + those which do not have special meanings in the context in which the + encoded-word appears. + + Generally, an "encoded-word" is a sequence of printable ASCII + characters that begins with "=?", ends with "?=", and has two "?"s in + between. It specifies a character set and an encoding method, and + also includes the original text encoded as graphic ASCII characters, + according to the rules for that encoding method. + + A mail composer that implements this specification will provide a + means of inputting non-ASCII text in header fields, but will + translate these fields (or appropriate portions of these fields) into + encoded-words before inserting them into the message header. + + A mail reader that implements this specification will recognize + encoded-words when they appear in certain portions of the message + header. Instead of displaying the encoded-word "as is", it will + reverse the encoding and display the original text in the designated + character set. + +NOTES + + This memo relies heavily on notation and terms defined RFC 822 and + RFC 2045. In particular, the syntax for the ABNF used in this memo + is defined in RFC 822, as well as many of the terminal or nonterminal + symbols from RFC 822 are used in the grammar for the header + extensions defined here. Among the symbols defined in RFC 822 and + referenced in this memo are: 'addr-spec', 'atom', 'CHAR', 'comment', + 'CTLs', 'ctext', 'linear-white-space', 'phrase', 'quoted-pair'. + 'quoted-string', 'SPACE', and 'word'. Successful implementation of + this protocol extension requires careful attention to the RFC 822 + definitions of these terms. + + When the term "ASCII" appears in this memo, it refers to the "7-Bit + American Standard Code for Information Interchange", ANSI X3.4-1986. + The MIME charset name for this character set is "US-ASCII". When not + specifically referring to the MIME charset name, this document uses + the term "ASCII", both for brevity and for consistency with RFC 822. + However, implementors are warned that the character set name must be + spelled "US-ASCII" in MIME message and body part headers. + + + + + + +Moore Standards Track [Page 3] + +RFC 2047 Message Header Extensions November 1996 + + + This memo specifies a protocol for the representation of non-ASCII + text in message headers. It specifically DOES NOT define any + translation between "8-bit headers" and pure ASCII headers, nor is + any such translation assumed to be possible. + +2. Syntax of encoded-words + + An 'encoded-word' is defined by the following ABNF grammar. The + notation of RFC 822 is used, with the exception that white space + characters MUST NOT appear between components of an 'encoded-word'. + + encoded-word = "=?" charset "?" encoding "?" encoded-text "?=" + + charset = token ; see section 3 + + encoding = token ; see section 4 + + token = 1* + + especials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / " + <"> / "/" / "[" / "]" / "?" / "." / "=" + + encoded-text = 1* + ; (but see "Use of encoded-words in message + ; headers", section 5) + + Both 'encoding' and 'charset' names are case-independent. Thus the + charset name "ISO-8859-1" is equivalent to "iso-8859-1", and the + encoding named "Q" may be spelled either "Q" or "q". + + An 'encoded-word' may not be more than 75 characters long, including + 'charset', 'encoding', 'encoded-text', and delimiters. If it is + desirable to encode more text than will fit in an 'encoded-word' of + 75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may + be used. + + While there is no limit to the length of a multiple-line header + field, each line of a header field that contains one or more + 'encoded-word's is limited to 76 characters. + + The length restrictions are included both to ease interoperability + through internetwork mail gateways, and to impose a limit on the + amount of lookahead a header parser must employ (while looking for a + final ?= delimiter) before it can decide whether a token is an + "encoded-word" or something else. + + + + + +Moore Standards Track [Page 4] + +RFC 2047 Message Header Extensions November 1996 + + + IMPORTANT: 'encoded-word's are designed to be recognized as 'atom's + by an RFC 822 parser. As a consequence, unencoded white space + characters (such as SPACE and HTAB) are FORBIDDEN within an + 'encoded-word'. For example, the character sequence + + =?iso-8859-1?q?this is some text?= + + would be parsed as four 'atom's, rather than as a single 'atom' (by + an RFC 822 parser) or 'encoded-word' (by a parser which understands + 'encoded-words'). The correct way to encode the string "this is some + text" is to encode the SPACE characters as well, e.g. + + =?iso-8859-1?q?this=20is=20some=20text?= + + The characters which may appear in 'encoded-text' are further + restricted by the rules in section 5. + +3. Character sets + + The 'charset' portion of an 'encoded-word' specifies the character + set associated with the unencoded text. A 'charset' can be any of + the character set names allowed in an MIME "charset" parameter of a + "text/plain" body part, or any character set name registered with + IANA for use with the MIME text/plain content-type. + + Some character sets use code-switching techniques to switch between + "ASCII mode" and other modes. If unencoded text in an 'encoded-word' + contains a sequence which causes the charset interpreter to switch + out of ASCII mode, it MUST contain additional control codes such that + ASCII mode is again selected at the end of the 'encoded-word'. (This + rule applies separately to each 'encoded-word', including adjacent + 'encoded-word's within a single header field.) + + When there is a possibility of using more than one character set to + represent the text in an 'encoded-word', and in the absence of + private agreements between sender and recipients of a message, it is + recommended that members of the ISO-8859-* series be used in + preference to other character sets. + +4. Encodings + + Initially, the legal values for "encoding" are "Q" and "B". These + encodings are described below. The "Q" encoding is recommended for + use when most of the characters to be encoded are in the ASCII + character set; otherwise, the "B" encoding should be used. + Nevertheless, a mail reader which claims to recognize 'encoded-word's + MUST be able to accept either encoding for any character set which it + supports. + + + +Moore Standards Track [Page 5] + +RFC 2047 Message Header Extensions November 1996 + + + Only a subset of the printable ASCII characters may be used in + 'encoded-text'. Space and tab characters are not allowed, so that + the beginning and end of an 'encoded-word' are obvious. The "?" + character is used within an 'encoded-word' to separate the various + portions of the 'encoded-word' from one another, and thus cannot + appear in the 'encoded-text' portion. Other characters are also + illegal in certain contexts. For example, an 'encoded-word' in a + 'phrase' preceding an address in a From header field may not contain + any of the "specials" defined in RFC 822. Finally, certain other + characters are disallowed in some contexts, to ensure reliability for + messages that pass through internetwork mail gateways. + + The "B" encoding automatically meets these requirements. The "Q" + encoding allows a wide range of printable characters to be used in + non-critical locations in the message header (e.g., Subject), with + fewer characters available for use in other locations. + +4.1. The "B" encoding + + The "B" encoding is identical to the "BASE64" encoding defined by RFC + 2045. + +4.2. The "Q" encoding + + The "Q" encoding is similar to the "Quoted-Printable" content- + transfer-encoding defined in RFC 2045. It is designed to allow text + containing mostly ASCII characters to be decipherable on an ASCII + terminal without decoding. + + (1) Any 8-bit value may be represented by a "=" followed by two + hexadecimal digits. For example, if the character set in use + were ISO-8859-1, the "=" character would thus be encoded as + "=3D", and a SPACE by "=20". (Upper case should be used for + hexadecimal digits "A" through "F".) + + (2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be + represented as "_" (underscore, ASCII 95.). (This character may + not pass through some internetwork mail gateways, but its use + will greatly enhance readability of "Q" encoded data with mail + readers that do not support this encoding.) Note that the "_" + always represents hexadecimal 20, even if the SPACE character + occupies a different code position in the character set in use. + + (3) 8-bit values which correspond to printable ASCII characters other + than "=", "?", and "_" (underscore), MAY be represented as those + characters. (But see section 5 for restrictions.) In + particular, SPACE and TAB MUST NOT be represented as themselves + within encoded words. + + + +Moore Standards Track [Page 6] + +RFC 2047 Message Header Extensions November 1996 + + +5. Use of encoded-words in message headers + + An 'encoded-word' may appear in a message header or body part header + according to the following rules: + +(1) An 'encoded-word' may replace a 'text' token (as defined by RFC 822) + in any Subject or Comments header field, any extension message + header field, or any MIME body part field for which the field body + is defined as '*text'. An 'encoded-word' may also appear in any + user-defined ("X-") message or body part header field. + + Ordinary ASCII text and 'encoded-word's may appear together in the + same header field. However, an 'encoded-word' that appears in a + header field defined as '*text' MUST be separated from any adjacent + 'encoded-word' or 'text' by 'linear-white-space'. + +(2) An 'encoded-word' may appear within a 'comment' delimited by "(" and + ")", i.e., wherever a 'ctext' is allowed. More precisely, the RFC + 822 ABNF definition for 'comment' is amended as follows: + + comment = "(" *(ctext / quoted-pair / comment / encoded-word) ")" + + A "Q"-encoded 'encoded-word' which appears in a 'comment' MUST NOT + contain the characters "(", ")" or " + 'encoded-word' that appears in a 'comment' MUST be separated from + any adjacent 'encoded-word' or 'ctext' by 'linear-white-space'. + + It is important to note that 'comment's are only recognized inside + "structured" field bodies. In fields whose bodies are defined as + '*text', "(" and ")" are treated as ordinary characters rather than + comment delimiters, and rule (1) of this section applies. (See RFC + 822, sections 3.1.2 and 3.1.3) + +(3) As a replacement for a 'word' entity within a 'phrase', for example, + one that precedes an address in a From, To, or Cc header. The ABNF + definition for 'phrase' from RFC 822 thus becomes: + + phrase = 1*( encoded-word / word ) + + In this case the set of characters that may be used in a "Q"-encoded + 'encoded-word' is restricted to: . An 'encoded-word' that appears within a + 'phrase' MUST be separated from any adjacent 'word', 'text' or + 'special' by 'linear-white-space'. + + + + + + +Moore Standards Track [Page 7] + +RFC 2047 Message Header Extensions November 1996 + + + These are the ONLY locations where an 'encoded-word' may appear. In + particular: + + + An 'encoded-word' MUST NOT appear in any portion of an 'addr-spec'. + + + An 'encoded-word' MUST NOT appear within a 'quoted-string'. + + + An 'encoded-word' MUST NOT be used in a Received header field. + + + An 'encoded-word' MUST NOT be used in parameter of a MIME + Content-Type or Content-Disposition field, or in any structured + field body except within a 'comment' or 'phrase'. + + The 'encoded-text' in an 'encoded-word' must be self-contained; + 'encoded-text' MUST NOT be continued from one 'encoded-word' to + another. This implies that the 'encoded-text' portion of a "B" + 'encoded-word' will be a multiple of 4 characters long; for a "Q" + 'encoded-word', any "=" character that appears in the 'encoded-text' + portion will be followed by two hexadecimal characters. + + Each 'encoded-word' MUST encode an integral number of octets. The + 'encoded-text' in each 'encoded-word' must be well-formed according + to the encoding specified; the 'encoded-text' may not be continued in + the next 'encoded-word'. (For example, "=?charset?Q?=?= + =?charset?Q?AB?=" would be illegal, because the two hex digits "AB" + must follow the "=" in the same 'encoded-word'.) + + Each 'encoded-word' MUST represent an integral number of characters. + A multi-octet character may not be split across adjacent 'encoded- + word's. + + Only printable and white space character data should be encoded using + this scheme. However, since these encoding schemes allow the + encoding of arbitrary octet values, mail readers that implement this + decoding should also ensure that display of the decoded data on the + recipient's terminal will not cause unwanted side-effects. + + Use of these methods to encode non-textual data (e.g., pictures or + sounds) is not defined by this memo. Use of 'encoded-word's to + represent strings of purely ASCII characters is allowed, but + discouraged. In rare cases it may be necessary to encode ordinary + text that looks like an 'encoded-word'. + + + + + + + + + +Moore Standards Track [Page 8] + +RFC 2047 Message Header Extensions November 1996 + + +6. Support of 'encoded-word's by mail readers + +6.1. Recognition of 'encoded-word's in message headers + + A mail reader must parse the message and body part headers according + to the rules in RFC 822 to correctly recognize 'encoded-word's. + + 'encoded-word's are to be recognized as follows: + + (1) Any message or body part header field defined as '*text', or any + user-defined header field, should be parsed as follows: Beginning + at the start of the field-body and immediately following each + occurrence of 'linear-white-space', each sequence of up to 75 + printable characters (not containing any 'linear-white-space') + should be examined to see if it is an 'encoded-word' according to + the syntax rules in section 2. Any other sequence of printable + characters should be treated as ordinary ASCII text. + + (2) Any header field not defined as '*text' should be parsed + according to the syntax rules for that header field. However, + any 'word' that appears within a 'phrase' should be treated as an + 'encoded-word' if it meets the syntax rules in section 2. + Otherwise it should be treated as an ordinary 'word'. + + (3) Within a 'comment', any sequence of up to 75 printable characters + (not containing 'linear-white-space'), that meets the syntax + rules in section 2, should be treated as an 'encoded-word'. + Otherwise it should be treated as normal comment text. + + (4) A MIME-Version header field is NOT required to be present for + 'encoded-word's to be interpreted according to this + specification. One reason for this is that the mail reader is + not expected to parse the entire message header before displaying + lines that may contain 'encoded-word's. + +6.2. Display of 'encoded-word's + + Any 'encoded-word's so recognized are decoded, and if possible, the + resulting unencoded text is displayed in the original character set. + + NOTE: Decoding and display of encoded-words occurs *after* a + structured field body is parsed into tokens. It is therefore + possible to hide 'special' characters in encoded-words which, when + displayed, will be indistinguishable from 'special' characters in the + surrounding text. For this and other reasons, it is NOT generally + possible to translate a message header containing 'encoded-word's to + an unencoded form which can be parsed by an RFC 822 mail reader. + + + + +Moore Standards Track [Page 9] + +RFC 2047 Message Header Extensions November 1996 + + + When displaying a particular header field that contains multiple + 'encoded-word's, any 'linear-white-space' that separates a pair of + adjacent 'encoded-word's is ignored. (This is to allow the use of + multiple 'encoded-word's to represent long strings of unencoded text, + without having to separate 'encoded-word's where spaces occur in the + unencoded text.) + + In the event other encodings are defined in the future, and the mail + reader does not support the encoding used, it may either (a) display + the 'encoded-word' as ordinary text, or (b) substitute an appropriate + message indicating that the text could not be decoded. + + If the mail reader does not support the character set used, it may + (a) display the 'encoded-word' as ordinary text (i.e., as it appears + in the header), (b) make a "best effort" to display using such + characters as are available, or (c) substitute an appropriate message + indicating that the decoded text could not be displayed. + + If the character set being used employs code-switching techniques, + display of the encoded text implicitly begins in "ASCII mode". In + addition, the mail reader must ensure that the output device is once + again in "ASCII mode" after the 'encoded-word' is displayed. + +6.3. Mail reader handling of incorrectly formed 'encoded-word's + + It is possible that an 'encoded-word' that is legal according to the + syntax defined in section 2, is incorrectly formed according to the + rules for the encoding being used. For example: + + (1) An 'encoded-word' which contains characters which are not legal + for a particular encoding (for example, a "-" in the "B" + encoding, or a SPACE or HTAB in either the "B" or "Q" encoding), + is incorrectly formed. + + (2) Any 'encoded-word' which encodes a non-integral number of + characters or octets is incorrectly formed. + + A mail reader need not attempt to display the text associated with an + 'encoded-word' that is incorrectly formed. However, a mail reader + MUST NOT prevent the display or handling of a message because an + 'encoded-word' is incorrectly formed. + +7. Conformance + + A mail composing program claiming compliance with this specification + MUST ensure that any string of non-white-space printable ASCII + characters within a '*text' or '*ctext' that begins with "=?" and + ends with "?=" be a valid 'encoded-word'. ("begins" means: at the + + + +Moore Standards Track [Page 10] + +RFC 2047 Message Header Extensions November 1996 + + + start of the field-body, immediately following 'linear-white-space', + or immediately following a "(" for an 'encoded-word' within '*ctext'; + "ends" means: at the end of the field-body, immediately preceding + 'linear-white-space', or immediately preceding a ")" for an + 'encoded-word' within '*ctext'.) In addition, any 'word' within a + 'phrase' that begins with "=?" and ends with "?=" must be a valid + 'encoded-word'. + + A mail reading program claiming compliance with this specification + must be able to distinguish 'encoded-word's from 'text', 'ctext', or + 'word's, according to the rules in section 6, anytime they appear in + appropriate places in message headers. It must support both the "B" + and "Q" encodings for any character set which it supports. The + program must be able to display the unencoded text if the character + set is "US-ASCII". For the ISO-8859-* character sets, the mail + reading program must at least be able to display the characters which + are also in the ASCII set. + +8. Examples + + The following are examples of message headers containing 'encoded- + word's: + + From: =?US-ASCII?Q?Keith_Moore?= + To: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= + CC: =?ISO-8859-1?Q?Andr=E9?= Pirard + Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?= + =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?= + + Note: In the first 'encoded-word' of the Subject field above, the + last "=" at the end of the 'encoded-text' is necessary because each + 'encoded-word' must be self-contained (the "=" character completes a + group of 4 base64 characters representing 2 octets). An additional + octet could have been encoded in the first 'encoded-word' (so that + the encoded-word would contain an exact multiple of 3 encoded + octets), except that the second 'encoded-word' uses a different + 'charset' than the first one. + + From: =?ISO-8859-1?Q?Olle_J=E4rnefors?= + To: ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se + Subject: Time for ISO 10646? + + To: Dave Crocker + Cc: ietf-822@dimacs.rutgers.edu, paf@comsol.se + From: =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= + Subject: Re: RFC-HDR care and feeding + + + + + +Moore Standards Track [Page 11] + +RFC 2047 Message Header Extensions November 1996 + + + From: Nathaniel Borenstein + (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=) + To: Greg Vaudreuil , Ned Freed + , Keith Moore + Subject: Test of new header generator + MIME-Version: 1.0 + Content-type: text/plain; charset=ISO-8859-1 + + The following examples illustrate how text containing 'encoded-word's + which appear in a structured field body. The rules are slightly + different for fields defined as '*text' because "(" and ")" are not + recognized as 'comment' delimiters. [Section 5, paragraph (1)]. + + In each of the following examples, if the same sequence were to occur + in a '*text' field, the "displayed as" form would NOT be treated as + encoded words, but be identical to the "encoded form". This is + because each of the encoded-words in the following examples is + adjacent to a "(" or ")" character. + + encoded form displayed as + --------------------------------------------------------------------- + (=?ISO-8859-1?Q?a?=) (a) + + (=?ISO-8859-1?Q?a?= b) (a b) + + Within a 'comment', white space MUST appear between an + 'encoded-word' and surrounding text. [Section 5, + paragraph (2)]. However, white space is not needed between + the initial "(" that begins the 'comment', and the + 'encoded-word'. + + + (=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=) (ab) + + White space between adjacent 'encoded-word's is not + displayed. + + (=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=) (ab) + + Even multiple SPACEs between 'encoded-word's are ignored + for the purpose of display. + + (=?ISO-8859-1?Q?a?= (ab) + =?ISO-8859-1?Q?b?=) + + Any amount of linear-space-white between 'encoded-word's, + even if it includes a CRLF followed by one or more SPACEs, + is ignored for the purposes of display. + + + +Moore Standards Track [Page 12] + +RFC 2047 Message Header Extensions November 1996 + + + (=?ISO-8859-1?Q?a_b?=) (a b) + + In order to cause a SPACE to be displayed within a portion + of encoded text, the SPACE MUST be encoded as part of the + 'encoded-word'. + + (=?ISO-8859-1?Q?a?= =?ISO-8859-2?Q?_b?=) (a b) + + In order to cause a SPACE to be displayed between two strings + of encoded text, the SPACE MAY be encoded as part of one of + the 'encoded-word's. + +9. References + + [RFC 822] Crocker, D., "Standard for the Format of ARPA Internet Text + Messages", STD 11, RFC 822, UDEL, August 1982. + + [RFC 2049] Borenstein, N., and N. Freed, "Multipurpose Internet Mail + Extensions (MIME) Part Five: Conformance Criteria and Examples", + RFC 2049, November 1996. + + [RFC 2045] Borenstein, N., and N. Freed, "Multipurpose Internet Mail + Extensions (MIME) Part One: Format of Internet Message Bodies", + RFC 2045, November 1996. + + [RFC 2046] Borenstein N., and N. Freed, "Multipurpose Internet Mail + Extensions (MIME) Part Two: Media Types", RFC 2046, + November 1996. + + [RFC 2048] Freed, N., Klensin, J., and J. Postel, "Multipurpose + Internet Mail Extensions (MIME) Part Four: Registration + Procedures", RFC 2048, November 1996. + + + + + + + + + + + + + + + + + + + +Moore Standards Track [Page 13] + +RFC 2047 Message Header Extensions November 1996 + + +10. Security Considerations + + Security issues are not discussed in this memo. + +11. Acknowledgements + + The author wishes to thank Nathaniel Borenstein, Issac Chan, Lutz + Donnerhacke, Paul Eggert, Ned Freed, Andreas M. Kirchwitz, Olle + Jarnefors, Mike Rosin, Yutaka Sato, Bart Schaefer, and Kazuhiko + Yamamoto, for their helpful advice, insightful comments, and + illuminating questions in response to earlier versions of this + specification. + +12. Author's Address + + Keith Moore + University of Tennessee + 107 Ayres Hall + Knoxville TN 37996-1301 + + EMail: moore@cs.utk.edu + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Moore Standards Track [Page 14] + +RFC 2047 Message Header Extensions November 1996 + + +Appendix - changes since RFC 1522 (in no particular order) + + + explicitly state that the MIME-Version is not requried to use + 'encoded-word's. + + + add explicit note that SPACEs and TABs are not allowed within + 'encoded-word's, explaining that an 'encoded-word' must look like an + 'atom' to an RFC822 parser.values, to be precise). + + + add examples from Olle Jarnefors (thanks!) which illustrate how + encoded-words with adjacent linear-white-space are displayed. + + + explicitly list terms defined in RFC822 and referenced in this memo + + + fix transcription typos that caused one or two lines and a couple of + characters to disappear in the resulting text, due to nroff quirks. + + + clarify that encoded-words are allowed in '*text' fields in both + RFC822 headers and MIME body part headers, but NOT as parameter + values. + + + clarify the requirement to switch back to ASCII within the encoded + portion of an 'encoded-word', for any charset that uses code switching + sequences. + + + add a note about 'encoded-word's being delimited by "(" and ")" + within a comment, but not in a *text (how bizarre!). + + + fix the Andre Pirard example to get rid of the trailing "_" after + the =E9. (no longer needed post-1342). + + + clarification: an 'encoded-word' may appear immediately following + the initial "(" or immediately before the final ")" that delimits a + comment, not just adjacent to "(" and ")" *within* *ctext. + + + add a note to explain that a "B" 'encoded-word' will always have a + multiple of 4 characters in the 'encoded-text' portion. + + + add note about the "=" in the examples + + + note that processing of 'encoded-word's occurs *after* parsing, and + some of the implications thereof. + + + explicitly state that you can't expect to translate between + 1522 and either vanilla 822 or so-called "8-bit headers". + + + explicitly state that 'encoded-word's are not valid within a + 'quoted-string'. + + + +Moore Standards Track [Page 15] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2048.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2048.txt new file mode 100644 index 0000000..a3b18b3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2048.txt @@ -0,0 +1,1180 @@ + + + + + + +Network Working Group N. Freed +Request for Comments: 2048 Innosoft +BCP: 13 J. Klensin +Obsoletes: 1521, 1522, 1590 MCI +Category: Best Current Practice J. Postel + ISI + November 1996 + + + Multipurpose Internet Mail Extensions + (MIME) Part Four: + Registration Procedures + +Status of this Memo + + This document specifies an Internet Best Current Practices for the + Internet Community, and requests discussion and suggestions for + improvements. Distribution of this memo is unlimited. + +Abstract + + STD 11, RFC 822, defines a message representation protocol specifying + considerable detail about US-ASCII message headers, and leaves the + message content, or message body, as flat US-ASCII text. This set of + documents, collectively called the Multipurpose Internet Mail + Extensions, or MIME, redefines the format of messages to allow for + + (1) textual message bodies in character sets other than + US-ASCII, + + (2) an extensible set of different formats for non-textual + message bodies, + + (3) multi-part message bodies, and + + (4) textual header information in character sets other than + US-ASCII. + + These documents are based on earlier work documented in RFC 934, STD + 11, and RFC 1049, but extends and revises them. Because RFC 822 said + so little about message bodies, these documents are largely + orthogonal to (rather than a revision of) RFC 822. + + + + + + + + + +Freed, et. al. Best Current Practice [Page 1] + +RFC 2048 MIME Registration Procedures November 1996 + + + This fourth document, RFC 2048, specifies various IANA registration + procedures for the following MIME facilities: + + (1) media types, + + (2) external body access types, + + (3) content-transfer-encodings. + + Registration of character sets for use in MIME is covered elsewhere + and is no longer addressed by this document. + + These documents are revisions of RFCs 1521 and 1522, which themselves + were revisions of RFCs 1341 and 1342. An appendix in RFC 2049 + describes differences and changes from previous versions. + +Table of Contents + + 1. Introduction ......................................... 3 + 2. Media Type Registration .............................. 4 + 2.1 Registration Trees and Subtype Names ................ 4 + 2.1.1 IETF Tree ......................................... 4 + 2.1.2 Vendor Tree ....................................... 4 + 2.1.3 Personal or Vanity Tree ........................... 5 + 2.1.4 Special `x.' Tree ................................. 5 + 2.1.5 Additional Registration Trees ..................... 6 + 2.2 Registration Requirements ........................... 6 + 2.2.1 Functionality Requirement ......................... 6 + 2.2.2 Naming Requirements ............................... 6 + 2.2.3 Parameter Requirements ............................ 7 + 2.2.4 Canonicalization and Format Requirements .......... 7 + 2.2.5 Interchange Recommendations ....................... 8 + 2.2.6 Security Requirements ............................. 8 + 2.2.7 Usage and Implementation Non-requirements ......... 9 + 2.2.8 Publication Requirements .......................... 10 + 2.2.9 Additional Information ............................ 10 + 2.3 Registration Procedure .............................. 11 + 2.3.1 Present the Media Type to the Community for Review 11 + 2.3.2 IESG Approval ..................................... 12 + 2.3.3 IANA Registration ................................. 12 + 2.4 Comments on Media Type Registrations ................ 12 + 2.5 Location of Registered Media Type List .............. 12 + 2.6 IANA Procedures for Registering Media Types ......... 12 + 2.7 Change Control ...................................... 13 + 2.8 Registration Template ............................... 14 + 3. External Body Access Types ........................... 14 + 3.1 Registration Requirements ........................... 15 + 3.1.1 Naming Requirements ............................... 15 + + + +Freed, et. al. Best Current Practice [Page 2] + +RFC 2048 MIME Registration Procedures November 1996 + + + 3.1.2 Mechanism Specification Requirements .............. 15 + 3.1.3 Publication Requirements .......................... 15 + 3.1.4 Security Requirements ............................. 15 + 3.2 Registration Procedure .............................. 15 + 3.2.1 Present the Access Type to the Community .......... 16 + 3.2.2 Access Type Reviewer .............................. 16 + 3.2.3 IANA Registration ................................. 16 + 3.3 Location of Registered Access Type List ............. 16 + 3.4 IANA Procedures for Registering Access Types ........ 16 + 4. Transfer Encodings ................................... 17 + 4.1 Transfer Encoding Requirements ...................... 17 + 4.1.1 Naming Requirements ............................... 17 + 4.1.2 Algorithm Specification Requirements .............. 18 + 4.1.3 Input Domain Requirements ......................... 18 + 4.1.4 Output Range Requirements ......................... 18 + 4.1.5 Data Integrity and Generality Requirements ........ 18 + 4.1.6 New Functionality Requirements .................... 18 + 4.2 Transfer Encoding Definition Procedure .............. 19 + 4.3 IANA Procedures for Transfer Encoding Registration... 19 + 4.4 Location of Registered Transfer Encodings List ...... 19 + 5. Authors' Addresses ................................... 20 + A. Grandfathered Media Types ............................ 21 + +1. Introduction + + Recent Internet protocols have been carefully designed to be easily + extensible in certain areas. In particular, MIME [RFC 2045] is an + open-ended framework and can accommodate additional object types, + character sets, and access methods without any changes to the basic + protocol. A registration process is needed, however, to ensure that + the set of such values is developed in an orderly, well-specified, + and public manner. + + This document defines registration procedures which use the Internet + Assigned Numbers Authority (IANA) as a central registry for such + values. + + Historical Note: The registration process for media types was + initially defined in the context of the asynchronous Internet mail + environment. In this mail environment there is a need to limit the + number of possible media types to increase the likelihood of + interoperability when the capabilities of the remote mail system are + not known. As media types are used in new environments, where the + proliferation of media types is not a hindrance to interoperability, + the original procedure was excessively restrictive and had to be + generalized. + + + + + +Freed, et. al. Best Current Practice [Page 3] + +RFC 2048 MIME Registration Procedures November 1996 + + +2. Media Type Registration + + Registration of a new media type or types starts with the + construction of a registration proposal. Registration may occur in + several different registration trees, which have different + requirements as discussed below. In general, the new registration + proposal is circulated and reviewed in a fashion appropriate to the + tree involved. The media type is then registered if the proposal is + acceptable. The following sections describe the requirements and + procedures used for each of the different registration trees. + +2.1. Registration Trees and Subtype Names + + In order to increase the efficiency and flexibility of the + registration process, different structures of subtype names may be + registered to accomodate the different natural requirements for, + e.g., a subtype that will be recommended for wide support and + implementation by the Internet Community or a subtype that is used to + move files associated with proprietary software. The following + subsections define registration "trees", distinguished by the use of + faceted names (e.g., names of the form "tree.subtree...type"). Note + that some media types defined prior to this document do not conform + to the naming conventions described below. See Appendix A for a + discussion of them. + +2.1.1. IETF Tree + + The IETF tree is intended for types of general interest to the + Internet Community. Registration in the IETF tree requires approval + by the IESG and publication of the media type registration as some + form of RFC. + + Media types in the IETF tree are normally denoted by names that are + not explicitly faceted, i.e., do not contain period (".", full stop) + characters. + + The "owner" of a media type registration in the IETF tree is assumed + to be the IETF itself. Modification or alteration of the + specification requires the same level of processing (e.g. standards + track) required for the initial registration. + +2.1.2. Vendor Tree + + The vendor tree is used for media types associated with commercially + available products. "Vendor" or "producer" are construed as + equivalent and very broadly in this context. + + + + + +Freed, et. al. Best Current Practice [Page 4] + +RFC 2048 MIME Registration Procedures November 1996 + + + A registration may be placed in the vendor tree by anyone who has + need to interchange files associated with the particular product. + However, the registration formally belongs to the vendor or + organization producing the software or file format. Changes to the + specification will be made at their request, as discussed in + subsequent sections. + + Registrations in the vendor tree will be distinguished by the leading + facet "vnd.". That may be followed, at the discretion of the + registration, by either a media type name from a well-known producer + (e.g., "vnd.mudpie") or by an IANA-approved designation of the + producer's name which is then followed by a media type or product + designation (e.g., vnd.bigcompany.funnypictures). + + While public exposure and review of media types to be registered in + the vendor tree is not required, using the ietf-types list for review + is strongly encouraged to improve the quality of those + specifications. Registrations in the vendor tree may be submitted + directly to the IANA. + +2.1.3. Personal or Vanity Tree + + Registrations for media types created experimentally or as part of + products that are not distributed commercially may be registered in + the personal or vanity tree. The registrations are distinguished by + the leading facet "prs.". + + The owner of "personal" registrations and associated specifications + is the person or entity making the registration, or one to whom + responsibility has been transferred as described below. + + While public exposure and review of media types to be registered in + the personal tree is not required, using the ietf-types list for + review is strongly encouraged to improve the quality of those + specifications. Registrations in the personl tree may be submitted + directly to the IANA. + +2.1.4. Special `x.' Tree + + For convenience and symmetry with this registration scheme, media + type names with "x." as the first facet may be used for the same + purposes for which names starting in "x-" are normally used. These + types are unregistered, experimental, and should be used only with + the active agreement of the parties exchanging them. + + + + + + + +Freed, et. al. Best Current Practice [Page 5] + +RFC 2048 MIME Registration Procedures November 1996 + + + However, with the simplified registration procedures described above + for vendor and personal trees, it should rarely, if ever, be + necessary to use unregistered experimental types, and as such use of + both "x-" and "x." forms is discouraged. + +2.1.5. Additional Registration Trees + + From time to time and as required by the community, the IANA may, + with the advice and consent of the IESG, create new top-level + registration trees. It is explicitly assumed that these trees may be + created for external registration and management by well-known + permanent bodies, such as scientific societies for media types + specific to the sciences they cover. In general, the quality of + review of specifications for one of these additional registration + trees is expected to be equivalent to that which IETF would give to + registrations in its own tree. Establishment of these new trees will + be announced through RFC publication approved by the IESG. + +2.2. Registration Requirements + + Media type registration proposals are all expected to conform to + various requirements laid out in the following sections. Note that + requirement specifics sometimes vary depending on the registration + tree, again as detailed in the following sections. + +2.2.1. Functionality Requirement + + Media types must function as an actual media format: Registration of + things that are better thought of as a transfer encoding, as a + character set, or as a collection of separate entities of another + type, is not allowed. For example, although applications exist to + decode the base64 transfer encoding [RFC 2045], base64 cannot be + registered as a media type. + + This requirement applies regardless of the registration tree + involved. + +2.2.2. Naming Requirements + + All registered media types must be assigned MIME type and subtype + names. The combination of these names then serves to uniquely + identify the media type and the format of the subtype name identifies + the registration tree. + + The choice of top-level type name must take the nature of media type + involved into account. For example, media normally used for + representing still images should be a subtype of the image content + type, whereas media capable of representing audio information belongs + + + +Freed, et. al. Best Current Practice [Page 6] + +RFC 2048 MIME Registration Procedures November 1996 + + + under the audio content type. See RFC 2046 for additional information + on the basic set of top-level types and their characteristics. + + New subtypes of top-level types must conform to the restrictions of + the top-level type, if any. For example, all subtypes of the + multipart content type must use the same encapsulation syntax. + + In some cases a new media type may not "fit" under any currently + defined top-level content type. Such cases are expected to be quite + rare. However, if such a case arises a new top-level type can be + defined to accommodate it. Such a definition must be done via + standards-track RFC; no other mechanism can be used to define + additional top-level content types. + + These requirements apply regardless of the registration tree + involved. + +2.2.3. Parameter Requirements + + Media types may elect to use one or more MIME content type + parameters, or some parameters may be automatically made available to + the media type by virtue of being a subtype of a content type that + defines a set of parameters applicable to any of its subtypes. In + either case, the names, values, and meanings of any parameters must + be fully specified when a media type is registered in the IETF tree, + and should be specified as completely as possible when media types + are registered in the vendor or personal trees. + + New parameters must not be defined as a way to introduce new + functionality in types registered in the IETF tree, although new + parameters may be added to convey additional information that does + not otherwise change existing functionality. An example of this + would be a "revision" parameter to indicate a revision level of an + external specification such as JPEG. Similar behavior is encouraged + for media types registered in the vendor or personal trees but is not + required. + +2.2.4. Canonicalization and Format Requirements + + All registered media types must employ a single, canonical data + format, regardless of registration tree. + + A precise and openly available specification of the format of each + media type is required for all types registered in the IETF tree and + must at a minimum be referenced by, if it isn't actually included in, + the media type registration proposal itself. + + + + + +Freed, et. al. Best Current Practice [Page 7] + +RFC 2048 MIME Registration Procedures November 1996 + + + The specifications of format and processing particulars may or may + not be publically available for media types registered in the vendor + tree, and such registration proposals are explicitly permitted to + include only a specification of which software and version produce or + process such media types. References to or inclusion of format + specifications in registration proposals is encouraged but not + required. + + Format specifications are still required for registration in the + personal tree, but may be either published as RFCs or otherwise + deposited with IANA. The deposited specifications will meet the same + criteria as those required to register a well-known TCP port and, in + particular, need not be made public. + + Some media types involve the use of patented technology. The + registration of media types involving patented technology is + specifically permitted. However, the restrictions set forth in RFC + 1602 on the use of patented technology in standards-track protocols + must be respected when the specification of a media type is part of a + standards-track protocol. + +2.2.5. Interchange Recommendations + + Media types should, whenever possible, interoperate across as many + systems and applications as possible. However, some media types will + inevitably have problems interoperating across different platforms. + Problems with different versions, byte ordering, and specifics of + gateway handling can and will arise. + + Universal interoperability of media types is not required, but known + interoperability issues should be identified whenever possible. + Publication of a media type does not require an exhaustive review of + interoperability, and the interoperability considerations section is + subject to continuing evaluation. + + These recommendations apply regardless of the registration tree + involved. + +2.2.6. Security Requirements + + An analysis of security issues is required for for all types + registered in the IETF Tree. (This is in accordance with the basic + requirements for all IETF protocols.) A similar analysis for media + types registered in the vendor or personal trees is encouraged but + not required. However, regardless of what security analysis has or + has not been done, all descriptions of security issues must be as + accurate as possible regardless of registration tree. In particular, + a statement that there are "no security issues associated with this + + + +Freed, et. al. Best Current Practice [Page 8] + +RFC 2048 MIME Registration Procedures November 1996 + + + type" must not be confused with "the security issues associates with + this type have not been assessed". + + There is absolutely no requirement that media types registered in any + tree be secure or completely free from risks. Nevertheless, all + known security risks must be identified in the registration of a + media type, again regardless of registration tree. + + The security considerations section of all registrations is subject + to continuing evaluation and modification, and in particular may be + extended by use of the "comments on media types" mechanism described + in subsequent sections. + + Some of the issues that should be looked at in a security analysis of + a media type are: + + (1) Complex media types may include provisions for + directives that institute actions on a recipient's + files or other resources. In many cases provision is + made for originators to specify arbitrary actions in an + unrestricted fashion which may then have devastating + effects. See the registration of the + application/postscript media type in RFC 2046 for + an example of such directives and how to handle them. + + (2) Complex media types may include provisions for + directives that institute actions which, while not + directly harmful to the recipient, may result in + disclosure of information that either facilitates a + subsequent attack or else violates a recipient's + privacy in some way. Again, the registration of the + application/postscript media type illustrates how such + directives can be handled. + + (3) A media type might be targeted for applications that + require some sort of security assurance but not provide + the necessary security mechanisms themselves. For + example, a media type could be defined for storage of + confidential medical information which in turn requires + an external confidentiality service. + +2.2.7. Usage and Implementation Non-requirements + + In the asynchronous mail environment, where information on the + capabilities of the remote mail agent is frequently not available to + the sender, maximum interoperability is attained by restricting the + number of media types used to those "common" formats expected to be + widely implemented. This was asserted in the past as a reason to + + + +Freed, et. al. Best Current Practice [Page 9] + +RFC 2048 MIME Registration Procedures November 1996 + + + limit the number of possible media types and resulted in a + registration process with a significant hurdle and delay for those + registering media types. + + However, the need for "common" media types does not require limiting + the registration of new media types. If a limited set of media types + is recommended for a particular application, that should be asserted + by a separate applicability statement specific for the application + and/or environment. + + As such, universal support and implementation of a media type is NOT + a requirement for registration. If, however, a media type is + explicitly intended for limited use, this should be noted in its + registration. + +2.2.8. Publication Requirements + + Proposals for media types registered in the IETF tree must be + published as RFCs. RFC publication of vendor and personal media type + proposals is encouraged but not required. In all cases IANA will + retain copies of all media type proposals and "publish" them as part + of the media types registration tree itself. + + Other than in the IETF tree, the registration of a data type does not + imply endorsement, approval, or recommendation by IANA or IETF or + even certification that the specification is adequate. To become + Internet Standards, protocol, data objects, or whatever must go + through the IETF standards process. This is too difficult and too + lengthy a process for the convenient registration of media types. + + The IETF tree exists for media types that do require require a + substantive review and approval process with the vendor and personal + trees exist for those that do not. It is expected that applicability + statements for particular applications will be published from time to + time that recommend implementation of, and support for, media types + that have proven particularly useful in those contexts. + + As discussed above, registration of a top-level type requires + standards-track processing and, hence, RFC publication. + +2.2.9. Additional Information + + Various sorts of optional information may be included in the + specification of a media type if it is available: + + (1) Magic number(s) (length, octet values). Magic numbers + are byte sequences that are always present and thus can + be used to identify entities as being of a given media + + + +Freed, et. al. Best Current Practice [Page 10] + +RFC 2048 MIME Registration Procedures November 1996 + + + type. + + (2) File extension(s) commonly used on one or more + platforms to indicate that some file containing a given + type of media. + + (3) Macintosh File Type code(s) (4 octets) used to label + files containing a given type of media. + + Such information is often quite useful to implementors and if + available should be provided. + +2.3. Registration Procedure + + The following procedure has been implemented by the IANA for review + and approval of new media types. This is not a formal standards + process, but rather an administrative procedure intended to allow + community comment and sanity checking without excessive time delay. + For registration in the IETF tree, the normal IETF processes should + be followed, treating posting of an internet-draft and announcement + on the ietf-types list (as described in the next subsection) as a + first step. For registrations in the vendor or personal tree, the + initial review step described below may be omitted and the type + registered directly by submitting the template and an explanation + directly to IANA (at iana@iana.org). However, authors of vendor or + personal media type specifications are encouraged to seek community + review and comment whenever that is feasible. + +2.3.1. Present the Media Type to the Community for Review + + Send a proposed media type registration to the "ietf-types@iana.org" + mailing list for a two week review period. This mailing list has + been established for the purpose of reviewing proposed media and + access types. Proposed media types are not formally registered and + must not be used; the "x-" prefix specified in RFC 2045 can be used + until registration is complete. + + The intent of the public posting is to solicit comments and feedback + on the choice of type/subtype name, the unambiguity of the references + with respect to versions and external profiling information, and a + review of any interoperability or security considerations. The + submitter may submit a revised registration, or withdraw the + registration completely, at any time. + + + + + + + + +Freed, et. al. Best Current Practice [Page 11] + +RFC 2048 MIME Registration Procedures November 1996 + + +2.3.2. IESG Approval + + Media types registered in the IETF tree must be submitted to the IESG + for approval. + +2.3.3. IANA Registration + + Provided that the media type meets the requirements for media types + and has obtained approval that is necessary, the author may submit + the registration request to the IANA, which will register the media + type and make the media type registration available to the community. + +2.4. Comments on Media Type Registrations + + Comments on registered media types may be submitted by members of the + community to IANA. These comments will be passed on to the "owner" + of the media type if possible. Submitters of comments may request + that their comment be attached to the media type registration itself, + and if IANA approves of this the comment will be made accessible in + conjunction with the type registration itself. + +2.5. Location of Registered Media Type List + + Media type registrations will be posted in the anonymous FTP + directory "ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/" + and all registered media types will be listed in the periodically + issued "Assigned Numbers" RFC [currently STD 2, RFC 1700]. The media + type description and other supporting material may also be published + as an Informational RFC by sending it to "rfc-editor@isi.edu" (please + follow the instructions to RFC authors [RFC-1543]). + +2.6. IANA Procedures for Registering Media Types + + The IANA will only register media types in the IETF tree in response + to a communication from the IESG stating that a given registration + has been approved. Vendor and personal types will be registered by + the IANA automatically and without any formal review as long as the + following minimal conditions are met: + + (1) Media types must function as an actual media format. + In particular, character sets and transfer encodings + may not be registered as media types. + + (2) All media types must have properly formed type and + subtype names. All type names must be defined by a + standards-track RFC. All subtype names must be unique, + must conform to the MIME grammar for such names, and + must contain the proper tree prefix. + + + +Freed, et. al. Best Current Practice [Page 12] + +RFC 2048 MIME Registration Procedures November 1996 + + + (3) Types registered in the personal tree must either + provide a format specification or a pointer to one. + + (4) Any security considerations given must not be obviously + bogus. (It is neither possible nor necessary for the + IANA to conduct a comprehensive security review of + media type registrations. Nevertheless, IANA has the + authority to identify obviously incompetent material + and exclude it.) + +2.7. Change Control + + Once a media type has been published by IANA, the author may request + a change to its definition. The descriptions of the different + registration trees above designate the "owners" of each type of + registration. The change request follows the same procedure as the + registration request: + + (1) Publish the revised template on the ietf-types list. + + (2) Leave at least two weeks for comments. + + (3) Publish using IANA after formal review if required. + + Changes should be requested only when there are serious omission or + errors in the published specification. When review is required, a + change request may be denied if it renders entities that were valid + under the previous definition invalid under the new definition. + + The owner of a content type may pass responsibility for the content + type to another person or agency by informing IANA and the ietf-types + list; this can be done without discussion or review. + + The IESG may reassign responsibility for a media type. The most + common case of this will be to enable changes to be made to types + where the author of the registration has died, moved out of contact + or is otherwise unable to make changes that are important to the + community. + + Media type registrations may not be deleted; media types which are no + longer believed appropriate for use can be declared OBSOLETE by a + change to their "intended use" field; such media types will be + clearly marked in the lists published by IANA. + + + + + + + + +Freed, et. al. Best Current Practice [Page 13] + +RFC 2048 MIME Registration Procedures November 1996 + + +2.8. Registration Template + + To: ietf-types@iana.org + Subject: Registration of MIME media type XXX/YYY + + MIME media type name: + + MIME subtype name: + + Required parameters: + + Optional parameters: + + Encoding considerations: + + Security considerations: + + Interoperability considerations: + + Published specification: + + Applications which use this media type: + + Additional information: + + Magic number(s): + File extension(s): + Macintosh File Type Code(s): + + Person & email address to contact for further information: + + Intended usage: + + (One of COMMON, LIMITED USE or OBSOLETE) + + Author/Change controller: + + (Any other information that the author deems interesting may be + added below this line.) + +3. External Body Access Types + + RFC 2046 defines the message/external-body media type, whereby a MIME + entity can act as pointer to the actual body data in lieu of + including the data directly in the entity body. Each + message/external-body reference specifies an access type, which + determines the mechanism used to retrieve the actual body data. RFC + 2046 defines an initial set of access types, but allows for the + + + +Freed, et. al. Best Current Practice [Page 14] + +RFC 2048 MIME Registration Procedures November 1996 + + + registration of additional access types to accommodate new retrieval + mechanisms. + +3.1. Registration Requirements + + New access type specifications must conform to a number of + requirements as described below. + +3.1.1. Naming Requirements + + Each access type must have a unique name. This name appears in the + access-type parameter in the message/external-body content-type + header field, and must conform to MIME content type parameter syntax. + +3.1.2. Mechanism Specification Requirements + + All of the protocols, transports, and procedures used by a given + access type must be described, either in the specification of the + access type itself or in some other publicly available specification, + in sufficient detail for the access type to be implemented by any + competent implementor. Use of secret and/or proprietary methods in + access types are expressly prohibited. The restrictions imposed by + RFC 1602 on the standardization of patented algorithms must be + respected as well. + +3.1.3. Publication Requirements + + All access types must be described by an RFC. The RFC may be + informational rather than standards-track, although standard-track + review and approval are encouraged for all access types. + +3.1.4. Security Requirements + + Any known security issues that arise from the use of the access type + must be completely and fully described. It is not required that the + access type be secure or that it be free from risks, but that the + known risks be identified. Publication of a new access type does not + require an exhaustive security review, and the security + considerations section is subject to continuing evaluation. + Additional security considerations should be addressed by publishing + revised versions of the access type specification. + +3.2. Registration Procedure + + Registration of a new access type starts with the construction of a + draft of an RFC. + + + + + +Freed, et. al. Best Current Practice [Page 15] + +RFC 2048 MIME Registration Procedures November 1996 + + +3.2.1. Present the Access Type to the Community + + Send a proposed access type specification to the "ietf- + types@iana.org" mailing list for a two week review period. This + mailing list has been established for the purpose of reviewing + proposed access and media types. Proposed access types are not + formally registered and must not be used. + + The intent of the public posting is to solicit comments and feedback + on the access type specification and a review of any security + considerations. + +3.2.2. Access Type Reviewer + + When the two week period has passed, the access type reviewer, who is + appointed by the IETF Applications Area Director, either forwards the + request to iana@isi.edu, or rejects it because of significant + objections raised on the list. + + Decisions made by the reviewer must be posted to the ietf-types + mailing list within 14 days. Decisions made by the reviewer may be + appealed to the IESG. + +3.2.3. IANA Registration + + Provided that the access type has either passed review or has been + successfully appealed to the IESG, the IANA will register the access + type and make the registration available to the community. The + specification of the access type must also be published as an RFC. + Informational RFCs are published by sending them to "rfc- + editor@isi.edu" (please follow the instructions to RFC authors [RFC- + 1543]). + +3.3. Location of Registered Access Type List + + Access type registrations will be posted in the anonymous FTP + directory "ftp://ftp.isi.edu/in-notes/iana/assignments/access-types/" + and all registered access types will be listed in the periodically + issued "Assigned Numbers" RFC [currently RFC-1700]. + +3.4. IANA Procedures for Registering Access Types + + The identity of the access type reviewer is communicated to the IANA + by the IESG. The IANA then only acts in response to access type + definitions that either are approved by the access type reviewer and + forwarded by the reviewer to the IANA for registration, or in + response to a communication from the IESG that an access type + definition appeal has overturned the access type reviewer's ruling. + + + +Freed, et. al. Best Current Practice [Page 16] + +RFC 2048 MIME Registration Procedures November 1996 + + +4. Transfer Encodings + + Transfer encodings are tranformations applied to MIME media types + after conversion to the media type's canonical form. Transfer + encodings are used for several purposes: + + (1) Many transports, especially message transports, can + only handle data consisting of relatively short lines + of text. There can also be severe restrictions on what + characters can be used in these lines of text -- some + transports are restricted to a small subset of US-ASCII + and others cannot handle certain character sequences. + Transfer encodings are used to transform binary data + into textual form that can survive such transports. + Examples of this sort of transfer encoding include the + base64 and quoted-printable transfer encodings defined + in RFC 2045. + + (2) Image, audio, video, and even application entities are + sometimes quite large. Compression algorithms are often + quite effective in reducing the size of large entities. + Transfer encodings can be used to apply general-purpose + non-lossy compression algorithms to MIME entities. + + (3) Transport encodings can be defined as a means of + representing existing encoding formats in a MIME + context. + + IMPORTANT: The standardization of a large numbers of different + transfer encodings is seen as a significant barrier to widespread + interoperability and is expressely discouraged. Nevertheless, the + following procedure has been defined to provide a means of defining + additional transfer encodings, should standardization actually be + justified. + +4.1. Transfer Encoding Requirements + + Transfer encoding specifications must conform to a number of + requirements as described below. + +4.1.1. Naming Requirements + + Each transfer encoding must have a unique name. This name appears in + the Content-Transfer-Encoding header field and must conform to the + syntax of that field. + + + + + + +Freed, et. al. Best Current Practice [Page 17] + +RFC 2048 MIME Registration Procedures November 1996 + + +4.1.2. Algorithm Specification Requirements + + All of the algorithms used in a transfer encoding (e.g. conversion + to printable form, compression) must be described in their entirety + in the transfer encoding specification. Use of secret and/or + proprietary algorithms in standardized transfer encodings are + expressly prohibited. The restrictions imposed by RFC 1602 on the + standardization of patented algorithms must be respected as well. + +4.1.3. Input Domain Requirements + + All transfer encodings must be applicable to an arbitrary sequence of + octets of any length. Dependence on particular input forms is not + allowed. + + It should be noted that the 7bit and 8bit encodings do not conform to + this requirement. Aside from the undesireability of having + specialized encodings, the intent here is to forbid the addition of + additional encodings along the lines of 7bit and 8bit. + +4.1.4. Output Range Requirements + + There is no requirement that a particular tranfer encoding produce a + particular form of encoded output. However, the output format for + each transfer encoding must be fully and completely documented. In + particular, each specification must clearly state whether the output + format always lies within the confines of 7bit data, 8bit data, or is + simply pure binary data. + +4.1.5. Data Integrity and Generality Requirements + + All transfer encodings must be fully invertible on any platform; it + must be possible for anyone to recover the original data by + performing the corresponding decoding operation. Note that this + requirement effectively excludes all forms of lossy compression as + well as all forms of encryption from use as a transfer encoding. + +4.1.6. New Functionality Requirements + + All transfer encodings must provide some sort of new functionality. + Some degree of functionality overlap with previously defined transfer + encodings is acceptable, but any new transfer encoding must also + offer something no other transfer encoding provides. + + + + + + + + +Freed, et. al. Best Current Practice [Page 18] + +RFC 2048 MIME Registration Procedures November 1996 + + +4.2. Transfer Encoding Definition Procedure + + Definition of a new transfer encoding starts with the construction of + a draft of a standards-track RFC. The RFC must define the transfer + encoding precisely and completely, and must also provide substantial + justification for defining and standardizing a new transfer encoding. + This specification must then be presented to the IESG for + consideration. The IESG can + + (1) reject the specification outright as being + inappropriate for standardization, + + (2) approve the formation of an IETF working group to work + on the specification in accordance with IETF + procedures, or, + + (3) accept the specification as-is and put it directly on + the standards track. + + Transfer encoding specifications on the standards track follow normal + IETF rules for standards track documents. A transfer encoding is + considered to be defined and available for use once it is on the + standards track. + +4.3. IANA Procedures for Transfer Encoding Registration + + There is no need for a special procedure for registering Transfer + Encodings with the IANA. All legitimate transfer encoding + registrations must appear as a standards-track RFC, so it is the + IESG's responsibility to notify the IANA when a new transfer encoding + has been approved. + +4.4. Location of Registered Transfer Encodings List + + Transfer encoding registrations will be posted in the anonymous FTP + directory "ftp://ftp.isi.edu/in-notes/iana/assignments/transfer- + encodings/" and all registered transfer encodings will be listed in + the periodically issued "Assigned Numbers" RFC [currently RFC-1700]. + + + + + + + + + + + + + +Freed, et. al. Best Current Practice [Page 19] + +RFC 2048 MIME Registration Procedures November 1996 + + +5. Authors' Addresses + + For more information, the authors of this document are best + contacted via Internet mail: + + Ned Freed + Innosoft International, Inc. + 1050 East Garvey Avenue South + West Covina, CA 91790 + USA + + Phone: +1 818 919 3600 + Fax: +1 818 919 3614 + EMail: ned@innosoft.com + + + John Klensin + MCI + 2100 Reston Parkway + Reston, VA 22091 + + Phone: +1 703 715-7361 + Fax: +1 703 715-7436 + EMail: klensin@mci.net + + + Jon Postel + USC/Information Sciences Institute + 4676 Admiralty Way + Marina del Rey, CA 90292 + USA + + + Phone: +1 310 822 1511 + Fax: +1 310 823 6714 + EMail: Postel@ISI.EDU + + + + + + + + + + + + + + + +Freed, et. al. Best Current Practice [Page 20] + +RFC 2048 MIME Registration Procedures November 1996 + + +Appendix A -- Grandfathered Media Types + + A number of media types, registered prior to 1996, would, if + registered under the guidelines in this document, be placed into + either the vendor or personal trees. Reregistration of those types + to reflect the appropriate trees is encouraged, but not required. + Ownership and change control principles outlined in this document + apply to those types as if they had been registered in the trees + described above. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Freed, et. al. Best Current Practice [Page 21] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2049.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2049.txt new file mode 100644 index 0000000..99f174b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2049.txt @@ -0,0 +1,1347 @@ + + + + + + +Network Working Group N. Freed +Request for Comments: 2049 Innosoft +Obsoletes: 1521, 1522, 1590 N. Borenstein +Category: Standards Track First Virtual + November 1996 + + + Multipurpose Internet Mail Extensions + (MIME) Part Five: + Conformance Criteria and Examples + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Abstract + + STD 11, RFC 822, defines a message representation protocol specifying + considerable detail about US-ASCII message headers, and leaves the + message content, or message body, as flat US-ASCII text. This set of + documents, collectively called the Multipurpose Internet Mail + Extensions, or MIME, redefines the format of messages to allow for + + (1) textual message bodies in character sets other than + US-ASCII, + + (2) an extensible set of different formats for non-textual + message bodies, + + (3) multi-part message bodies, and + + (4) textual header information in character sets other than + US-ASCII. + + These documents are based on earlier work documented in RFC 934, STD + 11, and RFC 1049, but extends and revises them. Because RFC 822 said + so little about message bodies, these documents are largely + orthogonal to (rather than a revision of) RFC 822. + + The initial document in this set, RFC 2045, specifies the various + headers used to describe the structure of MIME messages. The second + document defines the general structure of the MIME media typing + system and defines an initial set of media types. The third + document, RFC 2047, describes extensions to RFC 822 to allow non-US- + + + +Freed & Borenstein Standards Track [Page 1] + +RFC 2049 MIME Conformance November 1996 + + + ASCII text data in Internet mail header fields. The fourth document, + RFC 2048, specifies various IANA registration procedures for MIME- + related facilities. This fifth and final document describes MIME + conformance criteria as well as providing some illustrative examples + of MIME message formats, acknowledgements, and the bibliography. + + These documents are revisions of RFCs 1521, 1522, and 1590, which + themselves were revisions of RFCs 1341 and 1342. Appendix B of this + document describes differences and changes from previous versions. + +Table of Contents + + 1. Introduction .......................................... 2 + 2. MIME Conformance ...................................... 2 + 3. Guidelines for Sending Email Data ..................... 6 + 4. Canonical Encoding Model .............................. 9 + 5. Summary ............................................... 12 + 6. Security Considerations ............................... 12 + 7. Authors' Addresses .................................... 12 + 8. Acknowledgements ...................................... 13 + A. A Complex Multipart Example ........................... 15 + B. Changes from RFC 1521, 1522, and 1590 ................. 16 + C. References ............................................ 20 + +1. Introduction + + The first and second documents in this set define MIME header fields + and the initial set of MIME media types. The third document + describes extensions to RFC822 formats to allow for character sets + other than US-ASCII. This document describes what portions of MIME + must be supported by a conformant MIME implementation. It also + describes various pitfalls of contemporary messaging systems as well + as the canonical encoding model MIME is based on. + +2. MIME Conformance + + The mechanisms described in these documents are open-ended. It is + definitely not expected that all implementations will support all + available media types, nor that they will all share the same + extensions. In order to promote interoperability, however, it is + useful to define the concept of "MIME-conformance" to define a + certain level of implementation that allows the useful interworking + of messages with content that differs from US-ASCII text. In this + section, we specify the requirements for such conformance. + + + + + + + +Freed & Borenstein Standards Track [Page 2] + +RFC 2049 MIME Conformance November 1996 + + + A mail user agent that is MIME-conformant MUST: + + (1) Always generate a "MIME-Version: 1.0" header field in + any message it creates. + + (2) Recognize the Content-Transfer-Encoding header field + and decode all received data encoded by either quoted- + printable or base64 implementations. The identity + transformations 7bit, 8bit, and binary must also be + recognized. + + Any non-7bit data that is sent without encoding must be + properly labelled with a content-transfer-encoding of + 8bit or binary, as appropriate. If the underlying + transport does not support 8bit or binary (as SMTP + [RFC-821] does not), the sender is required to both + encode and label data using an appropriate Content- + Transfer-Encoding such as quoted-printable or base64. + + (3) Must treat any unrecognized Content-Transfer-Encoding + as if it had a Content-Type of "application/octet- + stream", regardless of whether or not the actual + Content-Type is recognized. + + (4) Recognize and interpret the Content-Type header field, + and avoid showing users raw data with a Content-Type + field other than text. Implementations must be able + to send at least text/plain messages, with the + character set specified with the charset parameter if + it is not US-ASCII. + + (5) Ignore any content type parameters whose names they do + not recognize. + + (6) Explicitly handle the following media type values, to + at least the following extents: + + Text: + + -- Recognize and display "text" mail with the + character set "US-ASCII." + + -- Recognize other character sets at least to the + extent of being able to inform the user about what + character set the message uses. + + + + + + +Freed & Borenstein Standards Track [Page 3] + +RFC 2049 MIME Conformance November 1996 + + + -- Recognize the "ISO-8859-*" character sets to the + extent of being able to display those characters that + are common to ISO-8859-* and US-ASCII, namely all + characters represented by octet values 1-127. + + -- For unrecognized subtypes in a known character + set, show or offer to show the user the "raw" version + of the data after conversion of the content from + canonical form to local form. + + -- Treat material in an unknown character set as if + it were "application/octet-stream". + + Image, audio, and video: + + -- At a minumum provide facilities to treat any + unrecognized subtypes as if they were + "application/octet-stream". + + Application: + + -- Offer the ability to remove either of the quoted- + printable or base64 encodings defined in this + document if they were used and put the resulting + information in a user file. + + Multipart: + + -- Recognize the mixed subtype. Display all relevant + information on the message level and the body part + header level and then display or offer to display + each of the body parts individually. + + -- Recognize the "alternative" subtype, and avoid + showing the user redundant parts of + multipart/alternative mail. + + -- Recognize the "multipart/digest" subtype, + specifically using "message/rfc822" rather than + "text/plain" as the default media type for body parts + inside "multipart/digest" entities. + + -- Treat any unrecognized subtypes as if they were + "mixed". + + + + + + + +Freed & Borenstein Standards Track [Page 4] + +RFC 2049 MIME Conformance November 1996 + + + Message: + + -- Recognize and display at least the RFC822 message + encapsulation (message/rfc822) in such a way as to + preserve any recursive structure, that is, displaying + or offering to display the encapsulated data in + accordance with its media type. + + -- Treat any unrecognized subtypes as if they were + "application/octet-stream". + + (7) Upon encountering any unrecognized Content-Type field, + an implementation must treat it as if it had a media + type of "application/octet-stream" with no parameter + sub-arguments. How such data are handled is up to an + implementation, but likely options for handling such + unrecognized data include offering the user to write it + into a file (decoded from its mail transport format) or + offering the user to name a program to which the + decoded data should be passed as input. + + (8) Conformant user agents are required, if they provide + non-standard support for non-MIME messages employing + character sets other than US-ASCII, to do so on + received messages only. Conforming user agents must not + send non-MIME messages containing anything other than + US-ASCII text. + + In particular, the use of non-US-ASCII text in mail + messages without a MIME-Version field is strongly + discouraged as it impedes interoperability when sending + messages between regions with different localization + conventions. Conforming user agents MUST include proper + MIME labelling when sending anything other than plain + text in the US-ASCII character set. + + In addition, non-MIME user agents should be upgraded if + at all possible to include appropriate MIME header + information in the messages they send even if nothing + else in MIME is supported. This upgrade will have + little, if any, effect on non-MIME recipients and will + aid MIME in correctly displaying such messages. It + also provides a smooth transition path to eventual + adoption of other MIME capabilities. + + (9) Conforming user agents must ensure that any string of + non-white-space printable US-ASCII characters within a + "*text" or "*ctext" that begins with "=?" and ends with + + + +Freed & Borenstein Standards Track [Page 5] + +RFC 2049 MIME Conformance November 1996 + + + "?=" be a valid encoded-word. ("begins" means: At the + start of the field-body or immediately following + linear-white-space; "ends" means: At the end of the + field-body or immediately preceding linear-white- + space.) In addition, any "word" within a "phrase" that + begins with "=?" and ends with "?=" must be a valid + encoded-word. + + (10) Conforming user agents must be able to distinguish + encoded-words from "text", "ctext", or "word"s, + according to the rules in section 4, anytime they + appear in appropriate places in message headers. It + must support both the "B" and "Q" encodings for any + character set which it supports. The program must be + able to display the unencoded text if the character set + is "US-ASCII". For the ISO-8859-* character sets, the + mail reading program must at least be able to display + the characters which are also in the US-ASCII set. + + A user agent that meets the above conditions is said to be MIME- + conformant. The meaning of this phrase is that it is assumed to be + "safe" to send virtually any kind of properly-marked data to users of + such mail systems, because such systems will at least be able to + treat the data as undifferentiated binary, and will not simply splash + it onto the screen of unsuspecting users. + + There is another sense in which it is always "safe" to send data in a + format that is MIME-conformant, which is that such data will not + break or be broken by any known systems that are conformant with RFC + 821 and RFC 822. User agents that are MIME-conformant have the + additional guarantee that the user will not be shown data that were + never intended to be viewed as text. + +3. Guidelines for Sending Email Data + + Internet email is not a perfect, homogeneous system. Mail may become + corrupted at several stages in its travel to a final destination. + Specifically, email sent throughout the Internet may travel across + many networking technologies. Many networking and mail technologies + do not support the full functionality possible in the SMTP transport + environment. Mail traversing these systems is likely to be modified + in order that it can be transported. + + There exist many widely-deployed non-conformant MTAs in the Internet. + These MTAs, speaking the SMTP protocol, alter messages on the fly to + take advantage of the internal data structure of the hosts they are + implemented on, or are just plain broken. + + + + +Freed & Borenstein Standards Track [Page 6] + +RFC 2049 MIME Conformance November 1996 + + + The following guidelines may be useful to anyone devising a data + format (media type) that is supposed to survive the widest range of + networking technologies and known broken MTAs unscathed. Note that + anything encoded in the base64 encoding will satisfy these rules, but + that some well-known mechanisms, notably the UNIX uuencode facility, + will not. Note also that anything encoded in the Quoted-Printable + encoding will survive most gateways intact, but possibly not some + gateways to systems that use the EBCDIC character set. + + (1) Under some circumstances the encoding used for data may + change as part of normal gateway or user agent + operation. In particular, conversion from base64 to + quoted-printable and vice versa may be necessary. This + may result in the confusion of CRLF sequences with line + breaks in text bodies. As such, the persistence of + CRLF as something other than a line break must not be + relied on. + + (2) Many systems may elect to represent and store text data + using local newline conventions. Local newline + conventions may not match the RFC822 CRLF convention -- + systems are known that use plain CR, plain LF, CRLF, or + counted records. The result is that isolated CR and LF + characters are not well tolerated in general; they may + be lost or converted to delimiters on some systems, and + hence must not be relied on. + + (3) The transmission of NULs (US-ASCII value 0) is + problematic in Internet mail. (This is largely the + result of NULs being used as a termination character by + many of the standard runtime library routines in the C + programming language.) The practice of using NULs as + termination characters is so entrenched now that + messages should not rely on them being preserved. + + (4) TAB (HT) characters may be misinterpreted or may be + automatically converted to variable numbers of spaces. + This is unavoidable in some environments, notably those + not based on the US-ASCII character set. Such + conversion is STRONGLY DISCOURAGED, but it may occur, + and mail formats must not rely on the persistence of + TAB (HT) characters. + + (5) Lines longer than 76 characters may be wrapped or + truncated in some environments. Line wrapping or line + truncation imposed by mail transports is STRONGLY + DISCOURAGED, but unavoidable in some cases. + Applications which require long lines must somehow + + + +Freed & Borenstein Standards Track [Page 7] + +RFC 2049 MIME Conformance November 1996 + + + differentiate between soft and hard line breaks. (A + simple way to do this is to use the quoted-printable + encoding.) + + (6) Trailing "white space" characters (SPACE, TAB (HT)) on + a line may be discarded by some transport agents, while + other transport agents may pad lines with these + characters so that all lines in a mail file are of + equal length. The persistence of trailing white space, + therefore, must not be relied on. + + (7) Many mail domains use variations on the US-ASCII + character set, or use character sets such as EBCDIC + which contain most but not all of the US-ASCII + characters. The correct translation of characters not + in the "invariant" set cannot be depended on across + character converting gateways. For example, this + situation is a problem when sending uuencoded + information across BITNET, an EBCDIC system. Similar + problems can occur without crossing a gateway, since + many Internet hosts use character sets other than US- + ASCII internally. The definition of Printable Strings + in X.400 adds further restrictions in certain special + cases. In particular, the only characters that are + known to be consistent across all gateways are the 73 + characters that correspond to the upper and lower case + letters A-Z and a-z, the 10 digits 0-9, and the + following eleven special characters: + + "'" (US-ASCII decimal value 39) + "(" (US-ASCII decimal value 40) + ")" (US-ASCII decimal value 41) + "+" (US-ASCII decimal value 43) + "," (US-ASCII decimal value 44) + "-" (US-ASCII decimal value 45) + "." (US-ASCII decimal value 46) + "/" (US-ASCII decimal value 47) + ":" (US-ASCII decimal value 58) + "=" (US-ASCII decimal value 61) + "?" (US-ASCII decimal value 63) + + A maximally portable mail representation will confine + itself to relatively short lines of text in which the + only meaningful characters are taken from this set of + 73 characters. The base64 encoding follows this rule. + + (8) Some mail transport agents will corrupt data that + includes certain literal strings. In particular, a + + + +Freed & Borenstein Standards Track [Page 8] + +RFC 2049 MIME Conformance November 1996 + + + period (".") alone on a line is known to be corrupted + by some (incorrect) SMTP implementations, and a line + that starts with the five characters "From " (the fifth + character is a SPACE) are commonly corrupted as well. + A careful composition agent can prevent these + corruptions by encoding the data (e.g., in the quoted- + printable encoding using "=46rom " in place of "From " + at the start of a line, and "=2E" in place of "." alone + on a line). + + Please note that the above list is NOT a list of recommended + practices for MTAs. RFC 821 MTAs are prohibited from altering the + character of white space or wrapping long lines. These BAD and + invalid practices are known to occur on established networks, and + implementations should be robust in dealing with the bad effects they + can cause. + +4. Canonical Encoding Model + + There was some confusion, in earlier versions of these documents, + regarding the model for when email data was to be converted to + canonical form and encoded, and in particular how this process would + affect the treatment of CRLFs, given that the representation of + newlines varies greatly from system to system. For this reason, a + canonical model for encoding is presented below. + + The process of composing a MIME entity can be modeled as being done + in a number of steps. Note that these steps are roughly similar to + those steps used in PEM [RFC-1421] and are performed for each + "innermost level" body: + + (1) Creation of local form. + + The body to be transmitted is created in the system's + native format. The native character set is used and, + where appropriate, local end of line conventions are + used as well. The body may be a UNIX-style text file, + or a Sun raster image, or a VMS indexed file, or audio + data in a system-dependent format stored only in + memory, or anything else that corresponds to the local + model for the representation of some form of + information. Fundamentally, the data is created in the + "native" form that corresponds to the type specified by + the media type. + + + + + + + +Freed & Borenstein Standards Track [Page 9] + +RFC 2049 MIME Conformance November 1996 + + + (2) Conversion to canonical form. + + The entire body, including "out-of-band" information + such as record lengths and possibly file attribute + information, is converted to a universal canonical + form. The specific media type of the body as well as + its associated attributes dictate the nature of the + canonical form that is used. Conversion to the proper + canonical form may involve character set conversion, + transformation of audio data, compression, or various + other operations specific to the various media types. + If character set conversion is involved, however, care + must be taken to understand the semantics of the media + type, which may have strong implications for any + character set conversion, e.g. with regard to + syntactically meaningful characters in a text subtype + other than "plain". + + For example, in the case of text/plain data, the text + must be converted to a supported character set and + lines must be delimited with CRLF delimiters in + accordance with RFC 822. Note that the restriction on + line lengths implied by RFC 822 is eliminated if the + next step employs either quoted-printable or base64 + encoding. + + (3) Apply transfer encoding. + + A Content-Transfer-Encoding appropriate for this body + is applied. Note that there is no fixed relationship + between the media type and the transfer encoding. In + particular, it may be appropriate to base the choice of + base64 or quoted-printable on character frequency + counts which are specific to a given instance of a + body. + + (4) Insertion into entity. + + The encoded body is inserted into a MIME entity with + appropriate headers. The entity is then inserted into + the body of a higher-level entity (message or + multipart) as needed. + + Conversion from entity form to local form is accomplished by + reversing these steps. Note that reversal of these steps may produce + differing results since there is no guarantee that the original and + final local forms are the same. + + + + +Freed & Borenstein Standards Track [Page 10] + +RFC 2049 MIME Conformance November 1996 + + + It is vital to note that these steps are only a model; they are + specifically NOT a blueprint for how an actual system would be built. + In particular, the model fails to account for two common designs: + + (1) In many cases the conversion to a canonical form prior + to encoding will be subsumed into the encoder itself, + which understands local formats directly. For example, + the local newline convention for text bodies might be + carried through to the encoder itself along with + knowledge of what that format is. + + (2) The output of the encoders may have to pass through one + or more additional steps prior to being transmitted as + a message. As such, the output of the encoder may not + be conformant with the formats specified by RFC 822. + In particular, once again it may be appropriate for the + converter's output to be expressed using local newline + conventions rather than using the standard RFC 822 CRLF + delimiters. + + Other implementation variations are conceivable as well. The vital + aspect of this discussion is that, in spite of any optimizations, + collapsings of required steps, or insertion of additional processing, + the resulting messages must be consistent with those produced by the + model described here. For example, a message with the following + header fields: + + Content-type: text/foo; charset=bar + Content-Transfer-Encoding: base64 + + must be first represented in the text/foo form, then (if necessary) + represented in the "bar" character set, and finally transformed via + the base64 algorithm into a mail-safe form. + + NOTE: Some confusion has been caused by systems that represent + messages in a format which uses local newline conventions which + differ from the RFC822 CRLF convention. It is important to note that + these formats are not canonical RFC822/MIME. These formats are + instead *encodings* of RFC822, where CRLF sequences in the canonical + representation of the message are encoded as the local newline + convention. Note that formats which encode CRLF sequences as, for + example, LF are not capable of representing MIME messages containing + binary data which contains LF octets not part of CRLF line separation + sequences. + + + + + + + +Freed & Borenstein Standards Track [Page 11] + +RFC 2049 MIME Conformance November 1996 + + +5. Summary + + This document defines what is meant by MIME Conformance. It also + details various problems known to exist in the Internet email system + and how to use MIME to overcome them. Finally, it describes MIME's + canonical encoding model. + +6. Security Considerations + + Security issues are discussed in the second document in this set, RFC + 2046. + +7. Authors' Addresses + + For more information, the authors of this document are best contacted + via Internet mail: + + Ned Freed + Innosoft International, Inc. + 1050 East Garvey Avenue South + West Covina, CA 91790 + USA + + Phone: +1 818 919 3600 + Fax: +1 818 919 3614 + EMail: ned@innosoft.com + + Nathaniel S. Borenstein + First Virtual Holdings + 25 Washington Avenue + Morristown, NJ 07960 + USA + + Phone: +1 201 540 8967 + Fax: +1 201 993 3032 + EMail: nsb@nsb.fv.com + + MIME is a result of the work of the Internet Engineering Task Force + Working Group on RFC 822 Extensions. The chairman of that group, + Greg Vaudreuil, may be reached at: + + Gregory M. Vaudreuil + Octel Network Services + 17080 Dallas Parkway + Dallas, TX 75248-1905 + USA + + EMail: Greg.Vaudreuil@Octel.Com + + + +Freed & Borenstein Standards Track [Page 12] + +RFC 2049 MIME Conformance November 1996 + + +8. Acknowledgements + + This document is the result of the collective effort of a large + number of people, at several IETF meetings, on the IETF-SMTP and + IETF-822 mailing lists, and elsewhere. Although any enumeration + seems doomed to suffer from egregious omissions, the following are + among the many contributors to this effort: + + Harald Tveit Alvestrand Marc Andreessen + Randall Atkinson Bob Braden + Philippe Brandon Brian Capouch + Kevin Carosso Uhhyung Choi + Peter Clitherow Dave Collier-Brown + Cristian Constantinof John Coonrod + Mark Crispin Dave Crocker + Stephen Crocker Terry Crowley + Walt Daniels Jim Davis + Frank Dawson Axel Deininger + Hitoshi Doi Kevin Donnelly + Steve Dorner Keith Edwards + Chris Eich Dana S. Emery + Johnny Eriksson Craig Everhart + Patrik Faltstrom Erik E. Fair + Roger Fajman Alain Fontaine + Martin Forssen James M. Galvin + Stephen Gildea Philip Gladstone + Thomas Gordon Keld Simonsen + Terry Gray Phill Gross + James Hamilton David Herron + Mark Horton Bruce Howard + Bill Janssen Olle Jarnefors + Risto Kankkunen Phil Karn + Alan Katz Tim Kehres + Neil Katin Steve Kille + Kyuho Kim Anders Klemets + John Klensin Valdis Kletniek + Jim Knowles Stev Knowles + Bob Kummerfeld Pekka Kytolaakso + Stellan Lagerstrom Vincent Lau + Timo Lehtinen Donald Lindsay + Warner Losh Carlyn Lowery + Laurence Lundblade Charles Lynn + John R. MacMillan Larry Masinter + Rick McGowan Michael J. McInerny + Leo Mclaughlin Goli Montaser-Kohsari + Tom Moore John Gardiner Myers + Erik Naggum Mark Needleman + Chris Newman John Noerenberg + + + +Freed & Borenstein Standards Track [Page 13] + +RFC 2049 MIME Conformance November 1996 + + + Mats Ohrman Julian Onions + Michael Patton David J. Pepper + Erik van der Poel Blake C. Ramsdell + Christer Romson Luc Rooijakkers + Marshall T. Rose Jonathan Rosenberg + Guido van Rossum Jan Rynning + Harri Salminen Michael Sanderson + Yutaka Sato Markku Savela + Richard Alan Schafer Masahiro Sekiguchi + Mark Sherman Bob Smart + Peter Speck Henry Spencer + Einar Stefferud Michael Stein + Klaus Steinberger Peter Svanberg + James Thompson Steve Uhler + Stuart Vance Peter Vanderbilt + Greg Vaudreuil Ed Vielmetti + Larry W. Virden Ryan Waldron + Rhys Weatherly Jay Weber + Dave Wecker Wally Wedel + Sven-Ove Westberg Brian Wideen + John Wobus Glenn Wright + Rayan Zachariassen David Zimmerman + + The authors apologize for any omissions from this list, which are + certainly unintentional. + + + + + + + + + + + + + + + + + + + + + + + + + + +Freed & Borenstein Standards Track [Page 14] + +RFC 2049 MIME Conformance November 1996 + + +Appendix A -- A Complex Multipart Example + + What follows is the outline of a complex multipart message. This + message contains five parts that are to be displayed serially: two + introductory plain text objects, an embedded multipart message, a + text/enriched object, and a closing encapsulated text message in a + non-ASCII character set. The embedded multipart message itself + contains two objects to be displayed in parallel, a picture and an + audio fragment. + + MIME-Version: 1.0 + From: Nathaniel Borenstein + To: Ned Freed + Date: Fri, 07 Oct 1994 16:15:05 -0700 (PDT) + Subject: A multipart example + Content-Type: multipart/mixed; + boundary=unique-boundary-1 + + This is the preamble area of a multipart message. + Mail readers that understand multipart format + should ignore this preamble. + + If you are reading this text, you might want to + consider changing to a mail reader that understands + how to properly display multipart messages. + + --unique-boundary-1 + + ... Some text appears here ... + + [Note that the blank between the boundary and the start + of the text in this part means no header fields were + given and this is text in the US-ASCII character set. + It could have been done with explicit typing as in the + next part.] + + --unique-boundary-1 + Content-type: text/plain; charset=US-ASCII + + This could have been part of the previous part, but + illustrates explicit versus implicit typing of body + parts. + + --unique-boundary-1 + Content-Type: multipart/parallel; boundary=unique-boundary-2 + + --unique-boundary-2 + Content-Type: audio/basic + + + +Freed & Borenstein Standards Track [Page 15] + +RFC 2049 MIME Conformance November 1996 + + + Content-Transfer-Encoding: base64 + + ... base64-encoded 8000 Hz single-channel + mu-law-format audio data goes here ... + + --unique-boundary-2 + Content-Type: image/jpeg + Content-Transfer-Encoding: base64 + + ... base64-encoded image data goes here ... + + --unique-boundary-2-- + + --unique-boundary-1 + Content-type: text/enriched + + This is enriched. + as defined in RFC 1896 + + Isn't it + cool? + + --unique-boundary-1 + Content-Type: message/rfc822 + + From: (mailbox in US-ASCII) + To: (address in US-ASCII) + Subject: (subject in US-ASCII) + Content-Type: Text/plain; charset=ISO-8859-1 + Content-Transfer-Encoding: Quoted-printable + + ... Additional text in ISO-8859-1 goes here ... + + --unique-boundary-1-- + +Appendix B -- Changes from RFC 1521, 1522, and 1590 + + These documents are a revision of RFC 1521, 1522, and 1590. For the + convenience of those familiar with the earlier documents, the changes + from those documents are summarized in this appendix. For further + history, note that Appendix H in RFC 1521 specified how that document + differed from its predecessor, RFC 1341. + + (1) This document has been completely reformatted and split + into multiple documents. This was done to improve the + quality of the plain text version of this document, + which is required to be the reference copy. + + + + +Freed & Borenstein Standards Track [Page 16] + +RFC 2049 MIME Conformance November 1996 + + + (2) BNF describing the overall structure of MIME object + headers has been added. This is a documentation change + only -- the underlying syntax has not changed in any + way. + + (3) The specific BNF for the seven media types in MIME has + been removed. This BNF was incorrect, incomplete, amd + inconsistent with the type-indendependent BNF. And + since the type-independent BNF already fully specifies + the syntax of the various MIME headers, the type- + specific BNF was, in the final analysis, completely + unnecessary and caused more problems than it solved. + + (4) The more specific "US-ASCII" character set name has + replaced the use of the informal term ASCII in many + parts of these documents. + + (5) The informal concept of a primary subtype has been + removed. + + (6) The term "object" was being used inconsistently. The + definition of this term has been clarified, along with + the related terms "body", "body part", and "entity", + and usage has been corrected where appropriate. + + (7) The BNF for the multipart media type has been + rearranged to make it clear that the CRLF preceeding + the boundary marker is actually part of the marker + itself rather than the preceeding body part. + + (8) The prose and BNF describing the multipart media type + have been changed to make it clear that the body parts + within a multipart object MUST NOT contain any lines + beginning with the boundary parameter string. + + (9) In the rules on reassembling "message/partial" MIME + entities, "Subject" is added to the list of headers to + take from the inner message, and the example is + modified to clarify this point. + + (10) "Message/partial" fragmenters are restricted to + splitting MIME objects only at line boundaries. + + (11) In the discussion of the application/postscript type, + an additional paragraph has been added warning about + possible interoperability problems caused by embedding + of binary data inside a PostScript MIME entity. + + + + +Freed & Borenstein Standards Track [Page 17] + +RFC 2049 MIME Conformance November 1996 + + + (12) Added a clarifying note to the basic syntax rules for + the Content-Type header field to make it clear that the + following two forms: + + Content-type: text/plain; charset=us-ascii (comment) + + Content-type: text/plain; charset="us-ascii" + + are completely equivalent. + + (13) The following sentence has been removed from the + discussion of the MIME-Version header: "However, + conformant software is encouraged to check the version + number and at least warn the user if an unrecognized + MIME-version is encountered." + + (14) A typo was fixed that said "application/external-body" + instead of "message/external-body". + + (15) The definition of a character set has been reorganized + to make the requirements clearer. + + (16) The definition of the "image/gif" media type has been + moved to a separate document. This change was made + because of potential conflicts with IETF rules + governing the standardization of patented technology. + + (17) The definitions of "7bit" and "8bit" have been + tightened so that use of bare CR, LF can only be used + as end-of-line sequences. The document also no longer + requires that NUL characters be preserved, which brings + MIME into alignment with real-world implementations. + + (18) The definition of canonical text in MIME has been + tightened so that line breaks must be represented by a + CRLF sequence. CR and LF characters are not allowed + outside of this usage. The definition of quoted- + printable encoding has been altered accordingly. + + (19) The definition of the quoted-printable encoding now + includes a number of suggestions for how quoted- + printable encoders might best handle improperly encoded + material. + + (20) Prose was added to clarify the use of the "7bit", + "8bit", and "binary" transfer-encodings on multipart or + message entities encapsulating "8bit" or "binary" data. + + + + +Freed & Borenstein Standards Track [Page 18] + +RFC 2049 MIME Conformance November 1996 + + + (21) In the section on MIME Conformance, "multipart/digest" + support was added to the list of requirements for + minimal MIME conformance. Also, the requirement for + "message/rfc822" support were strengthened to clarify + the importance of recognizing recursive structure. + + (22) The various restrictions on subtypes of "message" are + now specified entirely on a subtype by subtype basis. + + (23) The definition of "message/rfc822" was changed to + indicate that at least one of the "From", "Subject", or + "Date" headers must be present. + + (24) The required handling of unrecognized subtypes as + "application/octet-stream" has been made more explicit + in both the type definitions sections and the + conformance guidelines. + + (25) Examples using text/richtext were changed to + text/enriched. + + (26) The BNF definition of subtype has been changed to make + it clear that either an IANA registered subtype or a + nonstandard "X-" subtype must be used in a Content-Type + header field. + + (27) MIME media types that are simply registered for use and + those that are standardized by the IETF are now + distinguished in the MIME BNF. + + (28) All of the various MIME registration procedures have + been extensively revised. IANA registration procedures + for character sets have been moved to a separate + document that is no included in this set of documents. + + (29) The use of escape and shift mechanisms in the US-ASCII + and ISO-8859-X character sets these documents define + have been clarified: Such mechanisms should never be + used in conjunction with these character sets and their + effect if they are used is undefined. + + (30) The definition of the AFS access-type for + message/external-body has been removed. + + (31) The handling of the combination of + multipart/alternative and message/external-body is now + specifically addressed. + + + + +Freed & Borenstein Standards Track [Page 19] + +RFC 2049 MIME Conformance November 1996 + + + (32) Security issues specific to message/external-body are + now discussed in some detail. + +Appendix C -- References + + [ATK] + Borenstein, Nathaniel S., Multimedia Applications + Development with the Andrew Toolkit, Prentice-Hall, 1990. + + [ISO-2022] + International Standard -- Information Processing -- + Character Code Structure and Extension Techniques, + ISO/IEC 2022:1994, 4th ed. + + [ISO-8859] + International Standard -- Information Processing -- 8-bit + Single-Byte Coded Graphic Character Sets + - Part 1: Latin Alphabet No. 1, ISO 8859-1:1987, 1st ed. + - Part 2: Latin Alphabet No. 2, ISO 8859-2:1987, 1st ed. + - Part 3: Latin Alphabet No. 3, ISO 8859-3:1988, 1st ed. + - Part 4: Latin Alphabet No. 4, ISO 8859-4:1988, 1st ed. + - Part 5: Latin/Cyrillic Alphabet, ISO 8859-5:1988, 1st + ed. + - Part 6: Latin/Arabic Alphabet, ISO 8859-6:1987, 1st ed. + - Part 7: Latin/Greek Alphabet, ISO 8859-7:1987, 1st ed. + - Part 8: Latin/Hebrew Alphabet, ISO 8859-8:1988, 1st ed. + - Part 9: Latin Alphabet No. 5, ISO/IEC 8859-9:1989, 1st + ed. + International Standard -- Information Technology -- 8-bit + Single-Byte Coded Graphic Character Sets + - Part 10: Latin Alphabet No. 6, ISO/IEC 8859-10:1992, + 1st ed. + + [ISO-646] + International Standard -- Information Technology -- ISO + 7-bit Coded Character Set for Information Interchange, + ISO 646:1991, 3rd ed.. + + [JPEG] + JPEG Draft Standard ISO 10918-1 CD. + + [MPEG] + Video Coding Draft Standard ISO 11172 CD, ISO + IEC/JTC1/SC2/WG11 (Motion Picture Experts Group), May, + 1991. + + + + + + +Freed & Borenstein Standards Track [Page 20] + +RFC 2049 MIME Conformance November 1996 + + + [PCM] + CCITT, Fascicle III.4 - Recommendation G.711, "Pulse Code + Modulation (PCM) of Voice Frequencies", Geneva, 1972. + + [POSTSCRIPT] + Adobe Systems, Inc., PostScript Language Reference + Manual, Addison-Wesley, 1985. + + [POSTSCRIPT2] + Adobe Systems, Inc., PostScript Language Reference + Manual, Addison-Wesley, Second Ed., 1990. + + [RFC-783] + Sollins, K.R., "TFTP Protocol (revision 2)", RFC-783, + MIT, June 1981. + + [RFC-821] + Postel, J.B., "Simple Mail Transfer Protocol", STD 10, + RFC 821, USC/Information Sciences Institute, August 1982. + + [RFC-822] + Crocker, D., "Standard for the Format of ARPA Internet + Text Messages", STD 11, RFC 822, UDEL, August 1982. + + [RFC-934] + Rose, M. and E. Stefferud, "Proposed Standard for Message + Encapsulation", RFC 934, Delaware and NMA, January 1985. + + [RFC-959] + Postel, J. and J. Reynolds, "File Transfer Protocol", STD + 9, RFC 959, USC/Information Sciences Institute, October + 1985. + + [RFC-1049] + Sirbu, M., "Content-Type Header Field for Internet + Messages", RFC 1049, CMU, March 1988. + + [RFC-1154] + Robinson, D., and R. Ullmann, "Encoding Header Field for + Internet Messages", RFC 1154, Prime Computer, Inc., April + 1990. + + [RFC-1341] + Borenstein, N., and N. Freed, "MIME (Multipurpose + Internet Mail Extensions): Mechanisms for Specifying and + Describing the Format of Internet Message Bodies", RFC + 1341, Bellcore, Innosoft, June 1992. + + + + +Freed & Borenstein Standards Track [Page 21] + +RFC 2049 MIME Conformance November 1996 + + + [RFC-1342] + Moore, K., "Representation of Non-Ascii Text in Internet + Message Headers", RFC 1342, University of Tennessee, June + 1992. + + [RFC-1344] + Borenstein, N., "Implications of MIME for Internet Mail + Gateways", RFC 1344, Bellcore, June 1992. + + [RFC-1345] + Simonsen, K., "Character Mnemonics & Character Sets", RFC + 1345, Rationel Almen Planlaegning, June 1992. + + [RFC-1421] + Linn, J., "Privacy Enhancement for Internet Electronic + Mail: Part I -- Message Encryption and Authentication + Procedures", RFC 1421, IAB IRTF PSRG, IETF PEM WG, + February 1993. + + [RFC-1422] + Kent, S., "Privacy Enhancement for Internet Electronic + Mail: Part II -- Certificate-Based Key Management", RFC + 1422, IAB IRTF PSRG, IETF PEM WG, February 1993. + + [RFC-1423] + Balenson, D., "Privacy Enhancement for Internet + Electronic Mail: Part III -- Algorithms, Modes, and + Identifiers", IAB IRTF PSRG, IETF PEM WG, February 1993. + + [RFC-1424] + Kaliski, B., "Privacy Enhancement for Internet Electronic + Mail: Part IV -- Key Certification and Related + Services", IAB IRTF PSRG, IETF PEM WG, February 1993. + + [RFC-1521] + Borenstein, N., and Freed, N., "MIME (Multipurpose + Internet Mail Extensions): Mechanisms for Specifying and + Describing the Format of Internet Message Bodies", RFC + 1521, Bellcore, Innosoft, September, 1993. + + [RFC-1522] + Moore, K., "Representation of Non-ASCII Text in Internet + Message Headers", RFC 1522, University of Tennessee, + September 1993. + + + + + + + +Freed & Borenstein Standards Track [Page 22] + +RFC 2049 MIME Conformance November 1996 + + + [RFC-1524] + Borenstein, N., "A User Agent Configuration Mechanism for + Multimedia Mail Format Information", RFC 1524, Bellcore, + September 1993. + + [RFC-1543] + Postel, J., "Instructions to RFC Authors", RFC 1543, + USC/Information Sciences Institute, October 1993. + + [RFC-1556] + Nussbacher, H., "Handling of Bi-directional Texts in + MIME", RFC 1556, Israeli Inter-University Computer + Center, December 1993. + + [RFC-1590] + Postel, J., "Media Type Registration Procedure", RFC + 1590, USC/Information Sciences Institute, March 1994. + + [RFC-1602] + Internet Architecture Board, Internet Engineering + Steering Group, Huitema, C., Gross, P., "The Internet + Standards Process -- Revision 2", March 1994. + + [RFC-1652] + Klensin, J., (WG Chair), Freed, N., (Editor), Rose, M., + Stefferud, E., and Crocker, D., "SMTP Service Extension + for 8bit-MIME transport", RFC 1652, United Nations + University, Innosoft, Dover Beach Consulting, Inc., + Network Management Associates, Inc., The Branch Office, + March 1994. + + [RFC-1700] + Reynolds, J. and J. Postel, "Assigned Numbers", STD 2, + RFC 1700, USC/Information Sciences Institute, October + 1994. + + [RFC-1741] + Faltstrom, P., Crocker, D., and Fair, E., "MIME Content + Type for BinHex Encoded Files", December 1994. + + [RFC-1896] + Resnick, P., and A. Walker, "The text/enriched MIME + Content-type", RFC 1896, February, 1996. + + + + + + + + +Freed & Borenstein Standards Track [Page 23] + +RFC 2049 MIME Conformance November 1996 + + + [RFC-2045] + Freed, N., and and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part One: Format of Internet Message + Bodies", RFC 2045, Innosoft, First Virtual Holdings, + November 1996. + + [RFC-2046] + Freed, N., and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part Two: Media Types", RFC 2046, + Innosoft, First Virtual Holdings, November 1996. + + [RFC-2047] + Moore, K., "Multipurpose Internet Mail Extensions (MIME) + Part Three: Representation of Non-ASCII Text in Internet + Message Headers", RFC 2047, University of + Tennessee, November 1996. + + [RFC-2048] + Freed, N., Klensin, J., and J. Postel, "Multipurpose + Internet Mail Extensions (MIME) Part Four: MIME + Registration Procedures", RFC 2048, Innosoft, MCI, + ISI, November 1996. + + [RFC-2049] + Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part Five: Conformance Criteria and + Examples", RFC 2049 (this document), Innosoft, First + Virtual Holdings, November 1996. + + [US-ASCII] + Coded Character Set -- 7-Bit American Standard Code for + Information Interchange, ANSI X3.4-1986. + + [X400] + Schicker, Pietro, "Message Handling Systems, X.400", + Message Handling Systems and Distributed Applications, E. + Stefferud, O-j. Jacobsen, and P. Schicker, eds., North- + Holland, 1989, pp. 3-41. + + + + + + + + + + + + + +Freed & Borenstein Standards Track [Page 24] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2183.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2183.txt new file mode 100644 index 0000000..f16f127 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2183.txt @@ -0,0 +1,675 @@ + + + + + + +Network Working Group R. Troost +Request for Comments: 2183 New Century Systems +Updates: 1806 S. Dorner +Category: Standards Track QUALCOMM Incorporated + K. Moore, Editor + University of Tennessee + August 1997 + + + Communicating Presentation Information in + Internet Messages: + The Content-Disposition Header Field + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Abstract + + This memo provides a mechanism whereby messages conforming to the + MIME specifications [RFC 2045, RFC 2046, RFC 2047, RFC 2048, RFC + 2049] can convey presentational information. It specifies the + "Content-Disposition" header field, which is optional and valid for + any MIME entity ("message" or "body part"). Two values for this + header field are described in this memo; one for the ordinary linear + presentation of the body part, and another to facilitate the use of + mail to transfer files. It is expected that more values will be + defined in the future, and procedures are defined for extending this + set of values. + + This document is intended as an extension to MIME. As such, the + reader is assumed to be familiar with the MIME specifications, and + [RFC 822]. The information presented herein supplements but does not + replace that found in those documents. + + This document is a revision to the Experimental protocol defined in + RFC 1806. As compared to RFC 1806, this document contains minor + editorial updates, adds new parameters needed to support the File + Transfer Body Part, and references a separate specification for the + handling of non-ASCII and/or very long parameter values. + + + + + + + +Troost, et. al. Standards Track [Page 1] + +RFC 2183 Content-Disposition August 1997 + + +1. Introduction + + MIME specifies a standard format for encapsulating multiple pieces of + data into a single Internet message. That document does not address + the issue of presentation styles; it provides a framework for the + interchange of message content, but leaves presentation issues solely + in the hands of mail user agent (MUA) implementors. + + Two common ways of presenting multipart electronic messages are as a + main document with a list of separate attachments, and as a single + document with the various parts expanded (displayed) inline. The + display of an attachment is generally construed to require positive + action on the part of the recipient, while inline message components + are displayed automatically when the message is viewed. A mechanism + is needed to allow the sender to transmit this sort of presentational + information to the recipient; the Content-Disposition header provides + this mechanism, allowing each component of a message to be tagged + with an indication of its desired presentation semantics. + + Tagging messages in this manner will often be sufficient for basic + message formatting. However, in many cases a more powerful and + flexible approach will be necessary. The definition of such + approaches is beyond the scope of this memo; however, such approaches + can benefit from additional Content-Disposition values and + parameters, to be defined at a later date. + + In addition to allowing the sender to specify the presentational + disposition of a message component, it is desirable to allow her to + indicate a default archival disposition; a filename. The optional + "filename" parameter provides for this. Further, the creation-date, + modification-date, and read-date parameters allow preservation of + those file attributes when the file is transmitted over MIME email. + + NB: The keywords MUST, MUST NOT, REQUIRED, SHALL, SHALL NOT, SHOULD, + SHOULD NOT, RECOMMENDED, MAY, and OPTIONAL, when they appear in this + document, are to be interpreted as described in [RFC 2119]. + +2. The Content-Disposition Header Field + + Content-Disposition is an optional header field. In its absence, the + MUA may use whatever presentation method it deems suitable. + + It is desirable to keep the set of possible disposition types small + and well defined, to avoid needless complexity. Even so, evolving + usage will likely require the definition of additional disposition + types or parameters, so the set of disposition values is extensible; + see below. + + + + +Troost, et. al. Standards Track [Page 2] + +RFC 2183 Content-Disposition August 1997 + + + In the extended BNF notation of [RFC 822], the Content-Disposition + header field is defined as follows: + + disposition := "Content-Disposition" ":" + disposition-type + *(";" disposition-parm) + + disposition-type := "inline" + / "attachment" + / extension-token + ; values are not case-sensitive + + disposition-parm := filename-parm + / creation-date-parm + / modification-date-parm + / read-date-parm + / size-parm + / parameter + + filename-parm := "filename" "=" value + + creation-date-parm := "creation-date" "=" quoted-date-time + + modification-date-parm := "modification-date" "=" quoted-date-time + + read-date-parm := "read-date" "=" quoted-date-time + + size-parm := "size" "=" 1*DIGIT + + quoted-date-time := quoted-string + ; contents MUST be an RFC 822 `date-time' + ; numeric timezones (+HHMM or -HHMM) MUST be used + + + + NOTE ON PARAMETER VALUE LENGHTS: A short (length <= 78 characters) + parameter value containing only non-`tspecials' characters SHOULD be + represented as a single `token'. A short parameter value containing + only ASCII characters, but including `tspecials' characters, SHOULD + be represented as `quoted-string'. Parameter values longer than 78 + characters, or which contain non-ASCII characters, MUST be encoded as + specified in [RFC 2184]. + + `Extension-token', `parameter', `tspecials' and `value' are defined + according to [RFC 2045] (which references [RFC 822] in the definition + of some of these tokens). `quoted-string' and `DIGIT' are defined in + [RFC 822]. + + + + +Troost, et. al. Standards Track [Page 3] + +RFC 2183 Content-Disposition August 1997 + + +2.1 The Inline Disposition Type + + A bodypart should be marked `inline' if it is intended to be + displayed automatically upon display of the message. Inline + bodyparts should be presented in the order in which they occur, + subject to the normal semantics of multipart messages. + +2.2 The Attachment Disposition Type + + Bodyparts can be designated `attachment' to indicate that they are + separate from the main body of the mail message, and that their + display should not be automatic, but contingent upon some further + action of the user. The MUA might instead present the user of a + bitmap terminal with an iconic representation of the attachments, or, + on character terminals, with a list of attachments from which the + user could select for viewing or storage. + +2.3 The Filename Parameter + + The sender may want to suggest a filename to be used if the entity is + detached and stored in a separate file. If the receiving MUA writes + the entity to a file, the suggested filename should be used as a + basis for the actual filename, where possible. + + It is important that the receiving MUA not blindly use the suggested + filename. The suggested filename SHOULD be checked (and possibly + changed) to see that it conforms to local filesystem conventions, + does not overwrite an existing file, and does not present a security + problem (see Security Considerations below). + + The receiving MUA SHOULD NOT respect any directory path information + that may seem to be present in the filename parameter. The filename + should be treated as a terminal component only. Portable + specification of directory paths might possibly be done in the future + via a separate Content-Disposition parameter, but no provision is + made for it in this draft. + + Current [RFC 2045] grammar restricts parameter values (and hence + Content-Disposition filenames) to US-ASCII. We recognize the great + desirability of allowing arbitrary character sets in filenames, but + it is beyond the scope of this document to define the necessary + mechanisms. We expect that the basic [RFC 1521] `value' + specification will someday be amended to allow use of non-US-ASCII + characters, at which time the same mechanism should be used in the + Content-Disposition filename parameter. + + + + + + +Troost, et. al. Standards Track [Page 4] + +RFC 2183 Content-Disposition August 1997 + + + Beyond the limitation to US-ASCII, the sending MUA may wish to bear + in mind the limitations of common filesystems. Many have severe + length and character set restrictions. Short alphanumeric filenames + are least likely to require modification by the receiving system. + + The presence of the filename parameter does not force an + implementation to write the entity to a separate file. It is + perfectly acceptable for implementations to leave the entity as part + of the normal mail stream unless the user requests otherwise. As a + consequence, the parameter may be used on any MIME entity, even + `inline' ones. These will not normally be written to files, but the + parameter could be used to provide a filename if the receiving user + should choose to write the part to a file. + +2.4 The Creation-Date parameter + + The creation-date parameter MAY be used to indicate the date at which + the file was created. If this parameter is included, the paramter + value MUST be a quoted-string which contains a representation of the + creation date of the file in [RFC 822] `date-time' format. + + UNIX and POSIX implementors are cautioned that the `st_ctime' file + attribute of the `stat' structure is not the creation time of the + file; it is thus not appropriate as a source for the creation-date + parameter value. + +2.5 The Modification-Date parameter + + The modification-date parameter MAY be used to indicate the date at + which the file was last modified. If the modification-date parameter + is included, the paramter value MUST be a quoted-string which + contains a representation of the last modification date of the file + in [RFC 822] `date-time' format. + +2.6 The Read-Date parameter + + The read-date parameter MAY be used to indicate the date at which the + file was last read. If the read-date parameter is included, the + parameter value MUST be a quoted-string which contains a + representation of the last-read date of the file in [RFC 822] `date- + time' format. + +2.7 The Size parameter + + The size parameter indicates an approximate size of the file in + octets. It can be used, for example, to pre-allocate space before + attempting to store the file, or to determine whether enough space + exists. + + + +Troost, et. al. Standards Track [Page 5] + +RFC 2183 Content-Disposition August 1997 + + +2.8 Future Extensions and Unrecognized Disposition Types + + In the likely event that new parameters or disposition types are + needed, they should be registered with the Internet Assigned Numbers + Authority (IANA), in the manner specified in Section 9 of this memo. + + Once new disposition types and parameters are defined, there is of + course the likelihood that implementations will see disposition types + and parameters they do not understand. Furthermore, since x-tokens + are allowed, implementations may also see entirely unregistered + disposition types and parameters. + + Unrecognized parameters should be ignored. Unrecognized disposition + types should be treated as `attachment'. The choice of `attachment' + for unrecognized types is made because a sender who goes to the + trouble of producing a Content-Disposition header with a new + disposition type is more likely aiming for something more elaborate + than inline presentation. + + Unless noted otherwise in the definition of a parameter, Content- + Disposition parameters are valid for all dispositions. (In contrast + to MIME content-type parameters, which are defined on a per-content- + type basis.) Thus, for example, the `filename' parameter still means + the name of the file to which the part should be written, even if the + disposition itself is unrecognized. + +2.9 Content-Disposition and Multipart + + If a Content-Disposition header is used on a multipart body part, it + applies to the multipart as a whole, not the individual subparts. + The disposition types of the subparts do not need to be consulted + until the multipart itself is presented. When the multipart is + displayed, then the dispositions of the subparts should be respected. + + If the `inline' disposition is used, the multipart should be + displayed as normal; however, an `attachment' subpart should require + action from the user to display. + + If the `attachment' disposition is used, presentation of the + multipart should not proceed without explicit user action. Once the + user has chosen to display the multipart, the individual subpart + dispositions should be consulted to determine how to present the + subparts. + + + + + + + + +Troost, et. al. Standards Track [Page 6] + +RFC 2183 Content-Disposition August 1997 + + +2.10 Content-Disposition and the Main Message + + It is permissible to use Content-Disposition on the main body of an + [RFC 822] message. + +3. Examples + + Here is a an example of a body part containing a JPEG image that is + intended to be viewed by the user immediately: + + Content-Type: image/jpeg + Content-Disposition: inline + Content-Description: just a small picture of me + + + + The following body part contains a JPEG image that should be + displayed to the user only if the user requests it. If the JPEG is + written to a file, the file should be named "genome.jpg". The + recipient's user might also choose to set the last-modified date of + the stored file to date in the modification-date parameter: + + Content-Type: image/jpeg + Content-Disposition: attachment; filename=genome.jpeg; + modification-date="Wed, 12 Feb 1997 16:29:51 -0500"; + Content-Description: a complete map of the human genome + + + + The following is an example of the use of the `attachment' + disposition with a multipart body part. The user should see text- + part-1 immediately, then take some action to view multipart-2. After + taking action to view multipart-2, the user will see text-part-2 + right away, and be required to take action to view jpeg-1. Subparts + are indented for clarity; they would not be so indented in a real + message. + + + + + + + + + + + + + + + +Troost, et. al. Standards Track [Page 7] + +RFC 2183 Content-Disposition August 1997 + + + Content-Type: multipart/mixed; boundary=outer + Content-Description: multipart-1 + + --outer + Content-Type: text/plain + Content-Disposition: inline + Content-Description: text-part-1 + + Some text goes here + + --outer + Content-Type: multipart/mixed; boundary=inner + Content-Disposition: attachment + Content-Description: multipart-2 + + --inner + Content-Type: text/plain + Content-Disposition: inline + Content-Description: text-part-2 + + Some more text here. + + --inner + Content-Type: image/jpeg + Content-Disposition: attachment + Content-Description: jpeg-1 + + + --inner-- + --outer-- + +4. Summary + + Content-Disposition takes one of two values, `inline' and + `attachment'. `Inline' indicates that the entity should be + immediately displayed to the user, whereas `attachment' means that + the user should take additional action to view the entity. + + The `filename' parameter can be used to suggest a filename for + storing the bodypart, if the user wishes to store it in an external + file. + + + + + + + + + + +Troost, et. al. Standards Track [Page 8] + +RFC 2183 Content-Disposition August 1997 + + +5. Security Considerations + + There are security issues involved any time users exchange data. + While these are not to be minimized, neither does this memo change + the status quo in that regard, except in one instance. + + Since this memo provides a way for the sender to suggest a filename, + a receiving MUA must take care that the sender's suggested filename + does not represent a hazard. Using UNIX as an example, some hazards + would be: + + + Creating startup files (e.g., ".login"). + + + Creating or overwriting system files (e.g., "/etc/passwd"). + + + Overwriting any existing file. + + + Placing executable files into any command search path + (e.g., "~/bin/more"). + + + Sending the file to a pipe (e.g., "| sh"). + + In general, the receiving MUA should not name or place the file such + that it will get interpreted or executed without the user explicitly + initiating the action. + + It is very important to note that this is not an exhaustive list; it + is intended as a small set of examples only. Implementors must be + alert to the potential hazards on their target systems. + +6. References + + [RFC 2119] + Bradner, S., "Key words for use in RFCs to Indicate Requirement + Levels", RFC 2119, March 1997. + + [RFC 2184] + Freed, N. and K. Moore, "MIME Parameter value and Encoded Words: + Character Sets, Lanaguage, and Continuations", RFC 2184, August + 1997. + + [RFC 2045] + Freed, N. and N. Borenstein, "MIME (Multipurpose Internet Mail + Extensions) Part One: Format of Internet Message Bodies", RFC + 2045, December 1996. + + + + + + +Troost, et. al. Standards Track [Page 9] + +RFC 2183 Content-Disposition August 1997 + + + [RFC 2046] + Freed, N. and N. Borenstein, "MIME (Multipurpose Internet Mail + Extensions) Part Two: Media Types", RFC 2046, December 1996. + + [RFC 2047] + Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part + Three: Message Header Extensions for non-ASCII Text", RFC 2047, + December 1996. + + [RFC 2048] + Freed, N., Klensin, J. and J. Postel, "MIME (Multipurpose + Internet Mail Extensions) Part Four: Registration Procedures", + RFC 2048, December 1996. + + [RFC 2049] + Freed, N. and N. Borenstein, "MIME (Multipurpose Internet Mail + Extensions) Part Five: Conformance Criteria and Examples", RFC + 2049, December 1996. + + [RFC 822] + Crocker, D., "Standard for the Format of ARPA Internet Text + Messages", STD 11, RFC 822, UDEL, August 1982. + +7. Acknowledgements + + We gratefully acknowledge the help these people provided during the + preparation of this draft: + + Nathaniel Borenstein + Ned Freed + Keith Moore + Dave Crocker + Dan Pritchett + + + + + + + + + + + + + + + + + + +Troost, et. al. Standards Track [Page 10] + +RFC 2183 Content-Disposition August 1997 + + +8. Authors' Addresses + + You should blame the editor of this version of the document for any + changes since RFC 1806: + + Keith Moore + Department of Computer Science + University of Tennessee, Knoxville + 107 Ayres Hall + Knoxville TN 37996-1301 + USA + + Phone: +1 (423) 974-5067 + Fax: +1 (423) 974-8296 + Email: moore@cs.utk.edu + + + The authors of RFC 1806 are: + + Rens Troost + New Century Systems + 324 East 41st Street #804 + New York, NY, 10017 USA + + Phone: +1 (212) 557-2050 + Fax: +1 (212) 557-2049 + EMail: rens@century.com + + + Steve Dorner + QUALCOMM Incorporated + 6455 Lusk Boulevard + San Diego, CA 92121 + USA + + EMail: sdorner@qualcomm.com + + +9. Registration of New Content-Disposition Values and Parameters + + New Content-Disposition values (besides "inline" and "attachment") + may be defined only by Internet standards-track documents, or in + Experimental documents approved by the Internet Engineering Steering + Group. + + + + + + + +Troost, et. al. Standards Track [Page 11] + +RFC 2183 Content-Disposition August 1997 + + + New content-disposition parameters may be registered by supplying the + information in the following template and sending it via electronic + mail to IANA@IANA.ORG: + + To: IANA@IANA.ORG + Subject: Registration of new Content-Disposition parameter + + Content-Disposition parameter name: + + Allowable values for this parameter: + (If the parameter can only assume a small number of values, + list each of those values. Otherwise, describe the values + that the parameter can assume.) + Description: + (What is the purpose of this parameter and how is it used?) + +10. Changes since RFC 1806 + + The following changes have been made since the earlier version of + this document, published in RFC 1806 as an Experimental protocol: + + + Updated references to MIME documents. In some cases this + involved substituting a reference to one of the current MIME + RFCs for a reference to RFC 1521; in other cases, a reference to + RFC 1521 was simply replaced with the word "MIME". + + + Added a section on registration procedures, since none of the + procedures in RFC 2048 seemed to be appropriate. + + + Added new parameter types: creation-date, modification-date, + read-date, and size. + + + + Incorporated a reference to draft-freed-pvcsc-* for encoding + long or non-ASCII parameter values. + + + Added reference to RFC 2119 to define MUST, SHOULD, etc. + keywords. + + + + + + + + + + + + + +Troost, et. al. Standards Track [Page 12] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2222.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2222.txt new file mode 100644 index 0000000..2b0a2ab --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2222.txt @@ -0,0 +1,899 @@ + + + + + + +Network Working Group J. Myers +Request for Comments: 2222 Netscape Communications +Category: Standards Track October 1997 + + + Simple Authentication and Security Layer (SASL) + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (1997). All Rights Reserved. + +Table of Contents + + 1. Abstract .............................................. 2 + 2. Organization of this Document ......................... 2 + 2.1. How to Read This Document ............................. 2 + 2.2. Conventions Used in this Document ..................... 2 + 2.3. Examples .............................................. 3 + 3. Introduction and Overview ............................. 3 + 4. Profiling requirements ................................ 4 + 5. Specific issues ....................................... 5 + 5.1. Client sends data first ............................... 5 + 5.2. Server returns success with additional data ........... 5 + 5.3. Multiple authentications .............................. 5 + 6. Registration procedures ............................... 6 + 6.1. Comments on SASL mechanism registrations .............. 6 + 6.2. Location of Registered SASL Mechanism List ............ 6 + 6.3. Change Control ........................................ 7 + 6.4. Registration Template ................................. 7 + 7. Mechanism definitions ................................. 8 + 7.1. Kerberos version 4 mechanism .......................... 8 + 7.2. GSSAPI mechanism ...................................... 9 + 7.2.1 Client side of authentication protocol exchange ....... 9 + 7.2.2 Server side of authentication protocol exchange ....... 10 + 7.2.3 Security layer ........................................ 11 + 7.3. S/Key mechanism ....................................... 11 + 7.4. External mechanism .................................... 12 + 8. References ............................................ 13 + 9. Security Considerations ............................... 13 + 10. Author's Address ...................................... 14 + + + +Myers Standards Track [Page 1] + +RFC 2222 SASL October 1997 + + + Appendix A. Relation of SASL to Transport Security .......... 15 + Full Copyright Statement .................................... 16 + +1. Abstract + + This document describes a method for adding authentication support to + connection-based protocols. To use this specification, a protocol + includes a command for identifying and authenticating a user to a + server and for optionally negotiating protection of subsequent + protocol interactions. If its use is negotiated, a security layer is + inserted between the protocol and the connection. This document + describes how a protocol specifies such a command, defines several + mechanisms for use by the command, and defines the protocol used for + carrying a negotiated security layer over the connection. + +2. Organization of this Document + +2.1. How to Read This Document + + This document is written to serve two different audiences, protocol + designers using this specification to support authentication in their + protocol, and implementors of clients or servers for those protocols + using this specification. + + The sections "Introduction and Overview", "Profiling requirements", + and "Security Considerations" cover issues that protocol designers + need to understand and address in profiling this specification for + use in a specific protocol. + + Implementors of a protocol using this specification need the + protocol-specific profiling information in addition to the + information in this document. + +2.2. Conventions Used in this Document + + In examples, "C:" and "S:" indicate lines sent by the client and + server respectively. + + The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" + in this document are to be interpreted as defined in "Key words for + use in RFCs to Indicate Requirement Levels" [RFC 2119]. + + + + + + + + + + +Myers Standards Track [Page 2] + +RFC 2222 SASL October 1997 + + +2.3. Examples + + Examples in this document are for the IMAP profile [RFC 2060] of this + specification. The base64 encoding of challenges and responses, as + well as the "+ " preceding the responses are part of the IMAP4 + profile, not part of the SASL specification itself. + +3. Introduction and Overview + + The Simple Authentication and Security Layer (SASL) is a method for + adding authentication support to connection-based protocols. To use + this specification, a protocol includes a command for identifying and + authenticating a user to a server and for optionally negotiating a + security layer for subsequent protocol interactions. + + The command has a required argument identifying a SASL mechanism. + SASL mechanisms are named by strings, from 1 to 20 characters in + length, consisting of upper-case letters, digits, hyphens, and/or + underscores. SASL mechanism names must be registered with the IANA. + Procedures for registering new SASL mechanisms are given in the + section "Registration procedures" + + If a server supports the requested mechanism, it initiates an + authentication protocol exchange. This consists of a series of + server challenges and client responses that are specific to the + requested mechanism. The challenges and responses are defined by the + mechanisms as binary tokens of arbitrary length. The protocol's + profile then specifies how these binary tokens are then encoded for + transfer over the connection. + + After receiving the authentication command or any client response, a + server may issue a challenge, indicate failure, or indicate + completion. The protocol's profile specifies how the server + indicates which of the above it is doing. + + After receiving a challenge, a client may issue a response or abort + the exchange. The protocol's profile specifies how the client + indicates which of the above it is doing. + + During the authentication protocol exchange, the mechanism performs + authentication, transmits an authorization identity (frequently known + as a userid) from the client to server, and negotiates the use of a + mechanism-specific security layer. If the use of a security layer is + agreed upon, then the mechanism must also define or negotiate the + maximum cipher-text buffer size that each side is able to receive. + + + + + + +Myers Standards Track [Page 3] + +RFC 2222 SASL October 1997 + + + The transmitted authorization identity may be different than the + identity in the client's authentication credentials. This permits + agents such as proxy servers to authenticate using their own + credentials, yet request the access privileges of the identity for + which they are proxying. With any mechanism, transmitting an + authorization identity of the empty string directs the server to + derive an authorization identity from the client's authentication + credentials. + + If use of a security layer is negotiated, it is applied to all + subsequent data sent over the connection. The security layer takes + effect immediately following the last response of the authentication + exchange for data sent by the client and the completion indication + for data sent by the server. Once the security layer is in effect, + the protocol stream is processed by the security layer into buffers + of cipher-text. Each buffer is transferred over the connection as a + stream of octets prepended with a four octet field in network byte + order that represents the length of the following buffer. The length + of the cipher-text buffer must be no larger than the maximum size + that was defined or negotiated by the other side. + +4. Profiling requirements + + In order to use this specification, a protocol definition must supply + the following information: + + 1. A service name, to be selected from the IANA registry of "service" + elements for the GSSAPI host-based service name form [RFC 2078]. + + 2. A definition of the command to initiate the authentication + protocol exchange. This command must have as a parameter the + mechanism name being selected by the client. + + The command SHOULD have an optional parameter giving an initial + response. This optional parameter allows the client to avoid a + round trip when using a mechanism which is defined to have the + client send data first. When this initial response is sent by the + client and the selected mechanism is defined to have the server + start with an initial challenge, the command fails. See section + 5.1 of this document for further information. + + 3. A definition of the method by which the authentication protocol + exchange is carried out, including how the challenges and + responses are encoded, how the server indicates completion or + failure of the exchange, how the client aborts an exchange, and + how the exchange method interacts with any line length limits in + the protocol. + + + + +Myers Standards Track [Page 4] + +RFC 2222 SASL October 1997 + + + 4. Identification of the octet where any negotiated security layer + starts to take effect, in both directions. + + 5. A specification of how the authorization identity passed from the + client to the server is to be interpreted. + +5. Specific issues + +5.1. Client sends data first + + Some mechanisms specify that the first data sent in the + authentication protocol exchange is from the client to the server. + + If a protocol's profile permits the command which initiates an + authentication protocol exchange to contain an initial client + response, this parameter SHOULD be used with such mechanisms. + + If the initial client response parameter is not given, or if a + protocol's profile does not permit the command which initiates an + authentication protocol exchange to contain an initial client + response, then the server issues a challenge with no data. The + client's response to this challenge is then used as the initial + client response. (The server then proceeds to send the next + challenge, indicates completion, or indicates failure.) + +5.2. Server returns success with additional data + + Some mechanisms may specify that server challenge data be sent to the + client along with an indication of successful completion of the + exchange. This data would, for example, authenticate the server to + the client. + + If a protocol's profile does not permit this server challenge to be + returned with a success indication, then the server issues the server + challenge without an indication of successful completion. The client + then responds with no data. After receiving this empty response, the + server then indicates successful completion. + +5.3. Multiple authentications + + Unless otherwise stated by the protocol's profile, only one + successful SASL negotiation may occur in a protocol session. In this + case, once an authentication protocol exchange has successfully + completed, further attempts to initiate an authentication protocol + exchange fail. + + + + + + +Myers Standards Track [Page 5] + +RFC 2222 SASL October 1997 + + + In the case that a profile explicitly permits multiple successful + SASL negotiations to occur, then in no case may multiple security + layers be simultaneously in effect. If a security layer is in effect + and a subsequent SASL negotiation selects no security layer, the + original security layer remains in effect. If a security layer is in + effect and a subsequent SASL negotiation selects a second security + layer, then the second security layer replaces the first. + +6. Registration procedures + + Registration of a SASL mechanism is done by filling in the template + in section 6.4 and sending it in to iana@isi.edu. IANA has the right + to reject obviously bogus registrations, but will perform no review + of clams made in the registration form. + + There is no naming convention for SASL mechanisms; any name that + conforms to the syntax of a SASL mechanism name can be registered. + + While the registration procedures do not require it, authors of SASL + mechanisms are encouraged to seek community review and comment + whenever that is feasible. Authors may seek community review by + posting a specification of their proposed mechanism as an internet- + draft. SASL mechanisms intended for widespread use should be + standardized through the normal IETF process, when appropriate. + +6.1. Comments on SASL mechanism registrations + + Comments on registered SASL mechanisms should first be sent to the + "owner" of the mechanism. Submitters of comments may, after a + reasonable attempt to contact the owner, request IANA to attach their + comment to the SASL mechanism registration itself. If IANA approves + of this the comment will be made accessible in conjunction with the + SASL mechanism registration itself. + +6.2. Location of Registered SASL Mechanism List + + SASL mechanism registrations will be posted in the anonymous FTP + directory "ftp://ftp.isi.edu/in-notes/iana/assignments/sasl- + mechanisms/" and all registered SASL mechanisms will be listed in the + periodically issued "Assigned Numbers" RFC [currently STD 2, RFC + 1700]. The SASL mechanism description and other supporting material + may also be published as an Informational RFC by sending it to "rfc- + editor@isi.edu" (please follow the instructions to RFC authors [RFC + 2223]). + + + + + + + +Myers Standards Track [Page 6] + +RFC 2222 SASL October 1997 + + +6.3. Change Control + + Once a SASL mechanism registration has been published by IANA, the + author may request a change to its definition. The change request + follows the same procedure as the registration request. + + The owner of a SASL mechanism may pass responsibility for the SASL + mechanism to another person or agency by informing IANA; this can be + done without discussion or review. + + The IESG may reassign responsibility for a SASL mechanism. The most + common case of this will be to enable changes to be made to + mechanisms where the author of the registration has died, moved out + of contact or is otherwise unable to make changes that are important + to the community. + + SASL mechanism registrations may not be deleted; mechanisms which are + no longer believed appropriate for use can be declared OBSOLETE by a + change to their "intended use" field; such SASL mechanisms will be + clearly marked in the lists published by IANA. + + The IESG is considered to be the owner of all SASL mechanisms which + are on the IETF standards track. + +6.4. Registration Template + + To: iana@iana.org + Subject: Registration of SASL mechanism X + + SASL mechanism name: + + Security considerations: + + Published specification (optional, recommended): + + Person & email address to contact for further information: + + Intended usage: + + (One of COMMON, LIMITED USE or OBSOLETE) + + Author/Change controller: + + (Any other information that the author deems interesting may be + added below this line.) + + + + + + +Myers Standards Track [Page 7] + +RFC 2222 SASL October 1997 + + +7. Mechanism definitions + + The following mechanisms are hereby defined. + +7.1. Kerberos version 4 mechanism + + The mechanism name associated with Kerberos version 4 is + "KERBEROS_V4". + + The first challenge consists of a random 32-bit number in network + byte order. The client responds with a Kerberos ticket and an + authenticator for the principal "service.hostname@realm", where + "service" is the service name specified in the protocol's profile, + "hostname" is the first component of the host name of the server with + all letters in lower case, and where "realm" is the Kerberos realm of + the server. The encrypted checksum field included within the + Kerberos authenticator contains the server provided challenge in + network byte order. + + Upon decrypting and verifying the ticket and authenticator, the + server verifies that the contained checksum field equals the original + server provided random 32-bit number. Should the verification be + successful, the server must add one to the checksum and construct 8 + octets of data, with the first four octets containing the incremented + checksum in network byte order, the fifth octet containing a bit-mask + specifying the security layers supported by the server, and the sixth + through eighth octets containing, in network byte order, the maximum + cipher-text buffer size the server is able to receive. The server + must encrypt using DES ECB mode the 8 octets of data in the session + key and issue that encrypted data in a second challenge. The client + considers the server authenticated if the first four octets of the + un-encrypted data is equal to one plus the checksum it previously + sent. + + The client must construct data with the first four octets containing + the original server-issued checksum in network byte order, the fifth + octet containing the bit-mask specifying the selected security layer, + the sixth through eighth octets containing in network byte order the + maximum cipher-text buffer size the client is able to receive, and + the following octets containing the authorization identity. The + client must then append from one to eight zero-valued octets so that + the length of the data is a multiple of eight octets. The client must + then encrypt using DES PCBC mode the data with the session key and + respond with the encrypted data. The server decrypts the data and + verifies the contained checksum. The server must verify that the + principal identified in the Kerberos ticket is authorized to connect + as that authorization identity. After this verification, the + authentication process is complete. + + + +Myers Standards Track [Page 8] + +RFC 2222 SASL October 1997 + + + The security layers and their corresponding bit-masks are as follows: + + 1 No security layer + 2 Integrity (krb_mk_safe) protection + 4 Privacy (krb_mk_priv) protection + + Other bit-masks may be defined in the future; bits which are not + understood must be negotiated off. + + EXAMPLE: The following are two Kerberos version 4 login scenarios to + the IMAP4 protocol (note that the line breaks in the sample + authenticators are for editorial clarity and are not in real + authenticators) + + S: * OK IMAP4 Server + C: A001 AUTHENTICATE KERBEROS_V4 + S: + AmFYig== + C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT + +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd + WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh + S: + or//EoAADZI= + C: DiAF5A4gA+oOIALuBkAAmw== + S: A001 OK Kerberos V4 authentication successful + + + S: * OK IMAP4 Server + C: A001 AUTHENTICATE KERBEROS_V4 + S: + gcfgCA== + C: BAcAQU5EUkVXLkNNVS5FRFUAOCAsho84kLN3/IJmrMG+25a4DT + +nZImJjnTNHJUtxAA+o0KPKfHEcAFs9a3CL5Oebe/ydHJUwYFd + WwuQ1MWiy6IesKvjL5rL9WjXUb9MwT9bpObYLGOKi1Qh + S: A001 NO Kerberos V4 authentication failed + +7.2. GSSAPI mechanism + + The mechanism name associated with all mechanisms employing the + GSSAPI [RFC 2078] is "GSSAPI". + +7.2.1 Client side of authentication protocol exchange + + The client calls GSS_Init_sec_context, passing in 0 for + input_context_handle (initially) and a targ_name equal to output_name + from GSS_Import_Name called with input_name_type of + GSS_C_NT_HOSTBASED_SERVICE and input_name_string of + "service@hostname" where "service" is the service name specified in + the protocol's profile, and "hostname" is the fully qualified host + name of the server. The client then responds with the resulting + output_token. If GSS_Init_sec_context returns GSS_S_CONTINUE_NEEDED, + + + +Myers Standards Track [Page 9] + +RFC 2222 SASL October 1997 + + + then the client should expect the server to issue a token in a + subsequent challenge. The client must pass the token to another call + to GSS_Init_sec_context, repeating the actions in this paragraph. + + When GSS_Init_sec_context returns GSS_S_COMPLETE, the client takes + the following actions: If the last call to GSS_Init_sec_context + returned an output_token, then the client responds with the + output_token, otherwise the client responds with no data. The client + should then expect the server to issue a token in a subsequent + challenge. The client passes this token to GSS_Unwrap and interprets + the first octet of resulting cleartext as a bit-mask specifying the + security layers supported by the server and the second through fourth + octets as the maximum size output_message to send to the server. The + client then constructs data, with the first octet containing the + bit-mask specifying the selected security layer, the second through + fourth octets containing in network byte order the maximum size + output_message the client is able to receive, and the remaining + octets containing the authorization identity. The client passes the + data to GSS_Wrap with conf_flag set to FALSE, and responds with the + generated output_message. The client can then consider the server + authenticated. + +7.2.2 Server side of authentication protocol exchange + + The server passes the initial client response to + GSS_Accept_sec_context as input_token, setting input_context_handle + to 0 (initially). If GSS_Accept_sec_context returns + GSS_S_CONTINUE_NEEDED, the server returns the generated output_token + to the client in challenge and passes the resulting response to + another call to GSS_Accept_sec_context, repeating the actions in this + paragraph. + + When GSS_Accept_sec_context returns GSS_S_COMPLETE, the client takes + the following actions: If the last call to GSS_Accept_sec_context + returned an output_token, the server returns it to the client in a + challenge and expects a reply from the client with no data. Whether + or not an output_token was returned (and after receipt of any + response from the client to such an output_token), the server then + constructs 4 octets of data, with the first octet containing a bit- + mask specifying the security layers supported by the server and the + second through fourth octets containing in network byte order the + maximum size output_token the server is able to receive. The server + must then pass the plaintext to GSS_Wrap with conf_flag set to FALSE + and issue the generated output_message to the client in a challenge. + The server must then pass the resulting response to GSS_Unwrap and + interpret the first octet of resulting cleartext as the bit-mask for + the selected security layer, the second through fourth octets as the + maximum size output_message to send to the client, and the remaining + + + +Myers Standards Track [Page 10] + +RFC 2222 SASL October 1997 + + + octets as the authorization identity. The server must verify that + the src_name is authorized to authenticate as the authorization + identity. After these verifications, the authentication process is + complete. + +7.2.3 Security layer + + The security layers and their corresponding bit-masks are as follows: + + 1 No security layer + 2 Integrity protection. + Sender calls GSS_Wrap with conf_flag set to FALSE + 4 Privacy protection. + Sender calls GSS_Wrap with conf_flag set to TRUE + + Other bit-masks may be defined in the future; bits which are not + understood must be negotiated off. + +7.3. S/Key mechanism + + The mechanism name associated with S/Key [RFC 1760] using the MD4 + digest algorithm is "SKEY". + + The client sends an initial response with the authorization identity. + + The server then issues a challenge which contains the decimal + sequence number followed by a single space and the seed string for + the indicated authorization identity. The client responds with the + one-time-password, as either a 64-bit value in network byte order or + encoded in the "six English words" format. + + The server must verify the one-time-password. After this + verification, the authentication process is complete. + + S/Key authentication does not provide for any security layers. + + EXAMPLE: The following are two S/Key login scenarios in the IMAP4 + protocol. + + S: * OK IMAP4 Server + C: A001 AUTHENTICATE SKEY + S: + + C: bW9yZ2Fu + S: + OTUgUWE1ODMwOA== + C: Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA== + S: A001 OK S/Key authentication successful + + + + + +Myers Standards Track [Page 11] + +RFC 2222 SASL October 1997 + + + S: * OK IMAP4 Server + C: A001 AUTHENTICATE SKEY + S: + + C: c21pdGg= + S: + OTUgUWE1ODMwOA== + C: BsAY3g4gBNo= + S: A001 NO S/Key authentication failed + + The following is an S/Key login scenario in an IMAP4-like protocol + which has an optional "initial response" argument to the AUTHENTICATE + command. + + S: * OK IMAP4-Like Server + C: A001 AUTHENTICATE SKEY bW9yZ2Fu + S: + OTUgUWE1ODMwOA== + C: Rk9VUiBNQU5OIFNPT04gRklSIFZBUlkgTUFTSA== + S: A001 OK S/Key authentication successful + +7.4. External mechanism + + The mechanism name associated with external authentication is + "EXTERNAL". + + The client sends an initial response with the authorization identity. + + The server uses information, external to SASL, to determine whether + the client is authorized to authenticate as the authorization + identity. If the client is so authorized, the server indicates + successful completion of the authentication exchange; otherwise the + server indicates failure. + + The system providing this external information may be, for example, + IPsec or TLS. + + If the client sends the empty string as the authorization identity + (thus requesting the authorization identity be derived from the + client's authentication credentials), the authorization identity is + to be derived from authentication credentials which exist in the + system which is providing the external authentication. + + + + + + + + + + + + +Myers Standards Track [Page 12] + +RFC 2222 SASL October 1997 + + +8. References + + [RFC 2060] Crispin, M., "Internet Message Access Protocol - Version + 4rev1", RFC 2060, December 1996. + + [RFC 2078] Linn, J., "Generic Security Service Application Program + Interface, Version 2", RFC 2078, January 1997. + + [RFC 2119] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", RFC 2119, March 1997. + + [RFC 2223] Postel, J., and J. Reynolds, "Instructions to RFC + Authors", RFC 2223, October 1997. + + [RFC 1760] Haller, N., "The S/Key One-Time Password System", RFC + 1760, February 1995. + + [RFC 1700] Reynolds, J., and J. Postel, "Assigned Numbers", STD 2, + RFC 1700, October 1994. + +9. Security Considerations + + Security issues are discussed throughout this memo. + + The mechanisms that support integrity protection are designed such + that the negotiation of the security layer and authorization identity + is integrity protected. When the client selects a security layer + with at least integrity protection, this protects against an active + attacker hijacking the connection and modifying the authentication + exchange to negotiate a plaintext connection. + + When a server or client supports multiple authentication mechanisms, + each of which has a different security strength, it is possible for + an active attacker to cause a party to use the least secure mechanism + supported. To protect against this sort of attack, a client or + server which supports mechanisms of different strengths should have a + configurable minimum strength that it will use. It is not sufficient + for this minimum strength check to only be on the server, since an + active attacker can change which mechanisms the client sees as being + supported, causing the client to send authentication credentials for + its weakest supported mechanism. + + + + + + + + + + +Myers Standards Track [Page 13] + +RFC 2222 SASL October 1997 + + + The client's selection of a SASL mechanism is done in the clear and + may be modified by an active attacker. It is important for any new + SASL mechanisms to be designed such that an active attacker cannot + obtain an authentication with weaker security properties by modifying + the SASL mechanism name and/or the challenges and responses. + + Any protocol interactions prior to authentication are performed in + the clear and may be modified by an active attacker. In the case + where a client selects integrity protection, it is important that any + security-sensitive protocol negotiations be performed after + authentication is complete. Protocols should be designed such that + negotiations performed prior to authentication should be either + ignored or revalidated once authentication is complete. + +10. Author's Address + + John G. Myers + Netscape Communications + 501 E. Middlefield Road + Mail Stop MV-029 + Mountain View, CA 94043-4042 + + EMail: jgmyers@netscape.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Myers Standards Track [Page 14] + +RFC 2222 SASL October 1997 + + +Appendix A. Relation of SASL to Transport Security + + Questions have been raised about the relationship between SASL and + various services (such as IPsec and TLS) which provide a secured + connection. + + Two of the key features of SASL are: + + 1. The separation of the authorization identity from the identity in + the client's credentials. This permits agents such as proxy + servers to authenticate using their own credentials, yet request + the access privileges of the identity for which they are proxying. + + 2. Upon successful completion of an authentication exchange, the + server knows the authorization identity the client wishes to use. + This allows servers to move to a "user is authenticated" state in + the protocol. + + These features are extremely important to some application protocols, + yet Transport Security services do not always provide them. To + define SASL mechanisms based on these services would be a very messy + task, as the framing of these services would be redundant with the + framing of SASL and some method of providing these important SASL + features would have to be devised. + + Sometimes it is desired to enable within an existing connection the + use of a security service which does not fit the SASL model. (TLS is + an example of such a service.) This can be done by adding a command, + for example "STARTTLS", to the protocol. Such a command is outside + the scope of SASL, and should be different from the command which + starts a SASL authentication protocol exchange. + + In certain situations, it is reasonable to use SASL underneath one of + these Transport Security services. The transport service would + secure the connection, either service would authenticate the client, + and SASL would negotiate the authorization identity. The SASL + negotiation would be what moves the protocol from "unauthenticated" + to "authenticated" state. The "EXTERNAL" SASL mechanism is + explicitly intended to handle the case where the transport service + secures the connection and authenticates the client and SASL + negotiates the authorization identity. + + When using SASL underneath a sufficiently strong Transport Security + service, a SASL security layer would most likely be redundant. The + client and server would thus probably want to negotiate off the use + of a SASL security layer. + + + + + +Myers Standards Track [Page 15] + +RFC 2222 SASL October 1997 + + +Full Copyright Statement + + Copyright (C) The Internet Society (1997). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implmentation may be prepared, copied, published + andand distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + + + + + + + + + + + + + + + + + + + + + + + +Myers Standards Track [Page 16] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2231.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2231.txt new file mode 100644 index 0000000..120f98f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2231.txt @@ -0,0 +1,563 @@ + + + + + + +Network Working Group N. Freed +Request for Comments: 2231 Innosoft +Updates: 2045, 2047, 2183 K. Moore +Obsoletes: 2184 University of Tennessee +Category: Standards Track November 1997 + + + MIME Parameter Value and Encoded Word Extensions: + Character Sets, Languages, and Continuations + + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (1997). All Rights Reserved. + +1. Abstract + + This memo defines extensions to the RFC 2045 media type and RFC 2183 + disposition parameter value mechanisms to provide + + (1) a means to specify parameter values in character sets + other than US-ASCII, + + (2) to specify the language to be used should the value be + displayed, and + + (3) a continuation mechanism for long parameter values to + avoid problems with header line wrapping. + + This memo also defines an extension to the encoded words defined in + RFC 2047 to allow the specification of the language to be used for + display as well as the character set. + +2. Introduction + + The Multipurpose Internet Mail Extensions, or MIME [RFC-2045, RFC- + 2046, RFC-2047, RFC-2048, RFC-2049], define a message format that + allows for: + + + + + +Freed & Moore Standards Track [Page 1] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + + (1) textual message bodies in character sets other than + US-ASCII, + + (2) non-textual message bodies, + + (3) multi-part message bodies, and + + (4) textual header information in character sets other than + US-ASCII. + + MIME is now widely deployed and is used by a variety of Internet + protocols, including, of course, Internet email. However, MIME's + success has resulted in the need for additional mechanisms that were + not provided in the original protocol specification. + + In particular, existing MIME mechanisms provide for named media type + (content-type field) parameters as well as named disposition + (content-disposition field). A MIME media type may specify any + number of parameters associated with all of its subtypes, and any + specific subtype may specify additional parameters for its own use. A + MIME disposition value may specify any number of associated + parameters, the most important of which is probably the attachment + disposition's filename parameter. + + These parameter names and values end up appearing in the content-type + and content-disposition header fields in Internet email. This + inherently imposes three crucial limitations: + + (1) Lines in Internet email header fields are folded + according to RFC 822 folding rules. This makes long + parameter values problematic. + + (2) MIME headers, like the RFC 822 headers they often + appear in, are limited to 7bit US-ASCII, and the + encoded-word mechanisms of RFC 2047 are not available + to parameter values. This makes it impossible to have + parameter values in character sets other than US-ASCII + without specifying some sort of private per-parameter + encoding. + + (3) It has recently become clear that character set + information is not sufficient to properly display some + sorts of information -- language information is also + needed [RFC-2130]. For example, support for + handicapped users may require reading text string + + + + + + +Freed & Moore Standards Track [Page 2] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + + aloud. The language the text is written in is needed + for this to be done correctly. Some parameter values + may need to be displayed, hence there is a need to + allow for the inclusion of language information. + + The last problem on this list is also an issue for the encoded words + defined by RFC 2047, as encoded words are intended primarily for + display purposes. + + This document defines extensions that address all of these + limitations. All of these extensions are implemented in a fashion + that is completely compatible at a syntactic level with existing MIME + implementations. In addition, the extensions are designed to have as + little impact as possible on existing uses of MIME. + + IMPORTANT NOTE: These mechanisms end up being somewhat gibbous when + they actually are used. As such, these mechanisms should not be used + lightly; they should be reserved for situations where a real need for + them exists. + +2.1. Requirements notation + + This document occasionally uses terms that appear in capital letters. + When the terms "MUST", "SHOULD", "MUST NOT", "SHOULD NOT", and "MAY" + appear capitalized, they are being used to indicate particular + requirements of this specification. A discussion of the meanings of + these terms appears in [RFC- 2119]. + +3. Parameter Value Continuations + + Long MIME media type or disposition parameter values do not interact + well with header line wrapping conventions. In particular, proper + header line wrapping depends on there being places where linear + whitespace (LWSP) is allowed, which may or may not be present in a + parameter value, and even if present may not be recognizable as such + since specific knowledge of parameter value syntax may not be + available to the agent doing the line wrapping. The result is that + long parameter values may end up getting truncated or otherwise + damaged by incorrect line wrapping implementations. + + A mechanism is therefore needed to break up parameter values into + smaller units that are amenable to line wrapping. Any such mechanism + MUST be compatible with existing MIME processors. This means that + + (1) the mechanism MUST NOT change the syntax of MIME media + type and disposition lines, and + + + + + +Freed & Moore Standards Track [Page 3] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + + (2) the mechanism MUST NOT depend on parameter ordering + since MIME states that parameters are not order + sensitive. Note that while MIME does prohibit + modification of MIME headers during transport, it is + still possible that parameters will be reordered when + user agent level processing is done. + + The obvious solution, then, is to use multiple parameters to contain + a single parameter value and to use some kind of distinguished name + to indicate when this is being done. And this obvious solution is + exactly what is specified here: The asterisk character ("*") followed + by a decimal count is employed to indicate that multiple parameters + are being used to encapsulate a single parameter value. The count + starts at 0 and increments by 1 for each subsequent section of the + parameter value. Decimal values are used and neither leading zeroes + nor gaps in the sequence are allowed. + + The original parameter value is recovered by concatenating the + various sections of the parameter, in order. For example, the + content-type field + + Content-Type: message/external-body; access-type=URL; + URL*0="ftp://"; + URL*1="cs.utk.edu/pub/moore/bulk-mailer/bulk-mailer.tar" + + is semantically identical to + + Content-Type: message/external-body; access-type=URL; + URL="ftp://cs.utk.edu/pub/moore/bulk-mailer/bulk-mailer.tar" + + Note that quotes around parameter values are part of the value + syntax; they are NOT part of the value itself. Furthermore, it is + explicitly permitted to have a mixture of quoted and unquoted + continuation fields. + +4. Parameter Value Character Set and Language Information + + Some parameter values may need to be qualified with character set or + language information. It is clear that a distinguished parameter + name is needed to identify when this information is present along + with a specific syntax for the information in the value itself. In + addition, a lightweight encoding mechanism is needed to accommodate 8 + bit information in parameter values. + + + + + + + + +Freed & Moore Standards Track [Page 4] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + + Asterisks ("*") are reused to provide the indicator that language and + character set information is present and encoding is being used. A + single quote ("'") is used to delimit the character set and language + information at the beginning of the parameter value. Percent signs + ("%") are used as the encoding flag, which agrees with RFC 2047. + + Specifically, an asterisk at the end of a parameter name acts as an + indicator that character set and language information may appear at + the beginning of the parameter value. A single quote is used to + separate the character set, language, and actual value information in + the parameter value string, and an percent sign is used to flag + octets encoded in hexadecimal. For example: + + Content-Type: application/x-stuff; + title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A + + Note that it is perfectly permissible to leave either the character + set or language field blank. Note also that the single quote + delimiters MUST be present even when one of the field values is + omitted. This is done when either character set, language, or both + are not relevant to the parameter value at hand. This MUST NOT be + done in order to indicate a default character set or language -- + parameter field definitions MUST NOT assign a default character set + or language. + +4.1. Combining Character Set, Language, and Parameter Continuations + + Character set and language information may be combined with the + parameter continuation mechanism. For example: + + Content-Type: application/x-stuff + title*0*=us-ascii'en'This%20is%20even%20more%20 + title*1*=%2A%2A%2Afun%2A%2A%2A%20 + title*2="isn't it!" + + Note that: + + (1) Language and character set information only appear at + the beginning of a given parameter value. + + (2) Continuations do not provide a facility for using more + than one character set or language in the same + parameter value. + + (3) A value presented using multiple continuations may + contain a mixture of encoded and unencoded segments. + + + + + +Freed & Moore Standards Track [Page 5] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + + (4) The first segment of a continuation MUST be encoded if + language and character set information are given. + + (5) If the first segment of a continued parameter value is + encoded the language and character set field delimiters + MUST be present even when the fields are left blank. + +5. Language specification in Encoded Words + + RFC 2047 provides support for non-US-ASCII character sets in RFC 822 + message header comments, phrases, and any unstructured text field. + This is done by defining an encoded word construct which can appear + in any of these places. Given that these are fields intended for + display, it is sometimes necessary to associate language information + with encoded words as well as just the character set. This + specification extends the definition of an encoded word to allow the + inclusion of such information. This is simply done by suffixing the + character set specification with an asterisk followed by the language + tag. For example: + + From: =?US-ASCII*EN?Q?Keith_Moore?= + +6. IMAP4 Handling of Parameter Values + + IMAP4 [RFC-2060] servers SHOULD decode parameter value continuations + when generating the BODY and BODYSTRUCTURE fetch attributes. + +7. Modifications to MIME ABNF + + The ABNF for MIME parameter values given in RFC 2045 is: + + parameter := attribute "=" value + + attribute := token + ; Matching of attributes + ; is ALWAYS case-insensitive. + + This specification changes this ABNF to: + + parameter := regular-parameter / extended-parameter + + regular-parameter := regular-parameter-name "=" value + + regular-parameter-name := attribute [section] + + attribute := 1*attribute-char + + + + + +Freed & Moore Standards Track [Page 6] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + + attribute-char := + + section := initial-section / other-sections + + initial-section := "*0" + + other-sections := "*" ("1" / "2" / "3" / "4" / "5" / + "6" / "7" / "8" / "9") *DIGIT) + + extended-parameter := (extended-initial-name "=" + extended-value) / + (extended-other-names "=" + extended-other-values) + + extended-initial-name := attribute [initial-section] "*" + + extended-other-names := attribute other-sections "*" + + extended-initial-value := [charset] "'" [language] "'" + extended-other-values + + extended-other-values := *(ext-octet / attribute-char) + + ext-octet := "%" 2(DIGIT / "A" / "B" / "C" / "D" / "E" / "F") + + charset := + + language := + + The ABNF given in RFC 2047 for encoded-words is: + + encoded-word := "=?" charset "?" encoding "?" encoded-text "?=" + + This specification changes this ABNF to: + + encoded-word := "=?" charset ["*" language] "?" encoded-text "?=" + +8. Character sets which allow specification of language + + In the future it is likely that some character sets will provide + facilities for inline language labeling. Such facilities are + inherently more flexible than those defined here as they allow for + language switching in the middle of a string. + + + + + + + +Freed & Moore Standards Track [Page 7] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + + If and when such facilities are developed they SHOULD be used in + preference to the language labeling facilities specified here. Note + that all the mechanisms defined here allow for the omission of + language labels so as to be able to accommodate this possible future + usage. + +9. Security Considerations + + This RFC does not discuss security issues and is not believed to + raise any security issues not already endemic in electronic mail and + present in fully conforming implementations of MIME. + +10. References + + [RFC-822] + Crocker, D., "Standard for the Format of ARPA Internet + Text Messages", STD 11, RFC 822 August 1982. + + [RFC-1766] + Alvestrand, H., "Tags for the Identification of + Languages", RFC 1766, March 1995. + + [RFC-2045] + Freed, N., and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part One: Format of Internet Message + Bodies", RFC 2045, December 1996. + + [RFC-2046] + Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part Two: Media Types", RFC 2046, + December 1996. + + [RFC-2047] + Moore, K., "Multipurpose Internet Mail Extensions (MIME) + Part Three: Representation of Non-ASCII Text in Internet + Message Headers", RFC 2047, December 1996. + + [RFC-2048] + Freed, N., Klensin, J. and J. Postel, "Multipurpose + Internet Mail Extensions (MIME) Part Four: MIME + Registration Procedures", RFC 2048, December 1996. + + [RFC-2049] + Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part Five: Conformance Criteria and + Examples", RFC 2049, December 1996. + + + + + +Freed & Moore Standards Track [Page 8] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + + [RFC-2060] + Crispin, M., "Internet Message Access Protocol - Version + 4rev1", RFC 2060, December 1996. + + [RFC-2119] + Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", RFC 2119, March 1997. + + [RFC-2130] + Weider, C., Preston, C., Simonsen, K., Alvestrand, H., + Atkinson, R., Crispin, M., and P. Svanberg, "Report from the + IAB Character Set Workshop", RFC 2130, April 1997. + + [RFC-2183] + Troost, R., Dorner, S. and K. Moore, "Communicating + Presentation Information in Internet Messages: The + Content-Disposition Header", RFC 2183, August 1997. + +11. Authors' Addresses + + Ned Freed + Innosoft International, Inc. + 1050 Lakes Drive + West Covina, CA 91790 + USA + + Phone: +1 626 919 3600 + Fax: +1 626 919 3614 + EMail: ned.freed@innosoft.com + + + Keith Moore + Computer Science Dept. + University of Tennessee + 107 Ayres Hall + Knoxville, TN 37996-1301 + USA + + EMail: moore@cs.utk.edu + + + + + + + + + + + + +Freed & Moore Standards Track [Page 9] + +RFC 2231 MIME Value and Encoded Word Extensions November 1997 + + +12. Full Copyright Statement + + Copyright (C) The Internet Society (1997). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + + + + + + + + + + + + + + + + + + + + + + + +Freed & Moore Standards Track [Page 10] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2234.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2234.txt new file mode 100644 index 0000000..edea302 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2234.txt @@ -0,0 +1,787 @@ + + + + + + +Network Working Group D. Crocker, Ed. +Request for Comments: 2234 Internet Mail Consortium +Category: Standards Track P. Overell + Demon Internet Ltd. + November 1997 + + + Augmented BNF for Syntax Specifications: ABNF + + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (1997). All Rights Reserved. + +TABLE OF CONTENTS + + 1. INTRODUCTION .................................................. 2 + + 2. RULE DEFINITION ............................................... 2 + 2.1 RULE NAMING .................................................. 2 + 2.2 RULE FORM .................................................... 3 + 2.3 TERMINAL VALUES .............................................. 3 + 2.4 EXTERNAL ENCODINGS ........................................... 5 + + 3. OPERATORS ..................................................... 5 + 3.1 CONCATENATION RULE1 RULE2 ............................. 5 + 3.2 ALTERNATIVES RULE1 / RULE2 ................................... 6 + 3.3 INCREMENTAL ALTERNATIVES RULE1 =/ RULE2 .................... 6 + 3.4 VALUE RANGE ALTERNATIVES %C##-## ........................... 7 + 3.5 SEQUENCE GROUP (RULE1 RULE2) ................................. 7 + 3.6 VARIABLE REPETITION *RULE .................................... 8 + 3.7 SPECIFIC REPETITION NRULE .................................... 8 + 3.8 OPTIONAL SEQUENCE [RULE] ..................................... 8 + 3.9 ; COMMENT .................................................... 8 + 3.10 OPERATOR PRECEDENCE ......................................... 9 + + 4. ABNF DEFINITION OF ABNF ....................................... 9 + + 5. SECURITY CONSIDERATIONS ....................................... 10 + + + + +Crocker & Overell Standards Track [Page 1] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + + 6. APPENDIX A - CORE ............................................. 11 + 6.1 CORE RULES ................................................... 11 + 6.2 COMMON ENCODING .............................................. 12 + + 7. ACKNOWLEDGMENTS ............................................... 12 + + 8. REFERENCES .................................................... 13 + + 9. CONTACT ....................................................... 13 + + 10. FULL COPYRIGHT STATEMENT ..................................... 14 + +1. INTRODUCTION + + Internet technical specifications often need to define a format + syntax and are free to employ whatever notation their authors deem + useful. Over the years, a modified version of Backus-Naur Form + (BNF), called Augmented BNF (ABNF), has been popular among many + Internet specifications. It balances compactness and simplicity, + with reasonable representational power. In the early days of the + Arpanet, each specification contained its own definition of ABNF. + This included the email specifications, RFC733 and then RFC822 which + have come to be the common citations for defining ABNF. The current + document separates out that definition, to permit selective + reference. Predictably, it also provides some modifications and + enhancements. + + The differences between standard BNF and ABNF involve naming rules, + repetition, alternatives, order-independence, and value ranges. + Appendix A (Core) supplies rule definitions and encoding for a core + lexical analyzer of the type common to several Internet + specifications. It is provided as a convenience and is otherwise + separate from the meta language defined in the body of this document, + and separate from its formal status. + +2. RULE DEFINITION + +2.1 Rule Naming + + The name of a rule is simply the name itself; that is, a sequence of + characters, beginning with an alphabetic character, and followed by + a combination of alphabetics, digits and hyphens (dashes). + + NOTE: Rule names are case-insensitive + + The names , , and all refer + to the same rule. + + + + +Crocker & Overell Standards Track [Page 2] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + + Unlike original BNF, angle brackets ("<", ">") are not required. + However, angle brackets may be used around a rule name whenever their + presence will facilitate discerning the use of a rule name. This is + typically restricted to rule name references in free-form prose, or + to distinguish partial rules that combine into a string not separated + by white space, such as shown in the discussion about repetition, + below. + +2.2 Rule Form + + A rule is defined by the following sequence: + + name = elements crlf + + where is the name of the rule, is one or more rule + names or terminal specifications and is the end-of- line + indicator, carriage return followed by line feed. The equal sign + separates the name from the definition of the rule. The elements + form a sequence of one or more rule names and/or value definitions, + combined according to the various operators, defined in this + document, such as alternative and repetition. + + For visual ease, rule definitions are left aligned. When a rule + requires multiple lines, the continuation lines are indented. The + left alignment and indentation are relative to the first lines of the + ABNF rules and need not match the left margin of the document. + +2.3 Terminal Values + + Rules resolve into a string of terminal values, sometimes called + characters. In ABNF a character is merely a non-negative integer. + In certain contexts a specific mapping (encoding) of values into a + character set (such as ASCII) will be specified. + + Terminals are specified by one or more numeric characters with the + base interpretation of those characters indicated explicitly. The + following bases are currently defined: + + b = binary + + d = decimal + + x = hexadecimal + + + + + + + + +Crocker & Overell Standards Track [Page 3] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + + Hence: + + CR = %d13 + + CR = %x0D + + respectively specify the decimal and hexadecimal representation of + [US-ASCII] for carriage return. + + A concatenated string of such values is specified compactly, using a + period (".") to indicate separation of characters within that value. + Hence: + + CRLF = %d13.10 + + ABNF permits specifying literal text string directly, enclosed in + quotation-marks. Hence: + + command = "command string" + + Literal text strings are interpreted as a concatenated set of + printable characters. + + NOTE: ABNF strings are case-insensitive and + the character set for these strings is us-ascii. + + Hence: + + rulename = "abc" + + and: + + rulename = "aBc" + + will match "abc", "Abc", "aBc", "abC", "ABc", "aBC", "AbC" and "ABC". + + To specify a rule which IS case SENSITIVE, + specify the characters individually. + + For example: + + rulename = %d97 %d98 %d99 + + or + + rulename = %d97.98.99 + + + + + +Crocker & Overell Standards Track [Page 4] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + + will match only the string which comprises only lowercased + characters, abc. + +2.4 External Encodings + + External representations of terminal value characters will vary + according to constraints in the storage or transmission environment. + Hence, the same ABNF-based grammar may have multiple external + encodings, such as one for a 7-bit US-ASCII environment, another for + a binary octet environment and still a different one when 16-bit + Unicode is used. Encoding details are beyond the scope of ABNF, + although Appendix A (Core) provides definitions for a 7-bit US-ASCII + environment as has been common to much of the Internet. + + By separating external encoding from the syntax, it is intended that + alternate encoding environments can be used for the same syntax. + +3. OPERATORS + +3.1 Concatenation Rule1 Rule2 + + A rule can define a simple, ordered string of values -- i.e., a + concatenation of contiguous characters -- by listing a sequence of + rule names. For example: + + foo = %x61 ; a + + bar = %x62 ; b + + mumble = foo bar foo + + So that the rule matches the lowercase string "aba". + + LINEAR WHITE SPACE: Concatenation is at the core of the ABNF + parsing model. A string of contiguous characters (values) is + parsed according to the rules defined in ABNF. For Internet + specifications, there is some history of permitting linear white + space (space and horizontal tab) to be freelyPand + implicitlyPinterspersed around major constructs, such as + delimiting special characters or atomic strings. + + NOTE: This specification for ABNF does not + provide for implicit specification of linear white + space. + + Any grammar which wishes to permit linear white space around + delimiters or string segments must specify it explicitly. It is + often useful to provide for such white space in "core" rules that are + + + +Crocker & Overell Standards Track [Page 5] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + + then used variously among higher-level rules. The "core" rules might + be formed into a lexical analyzer or simply be part of the main + ruleset. + +3.2 Alternatives Rule1 / Rule2 + + Elements separated by forward slash ("/") are alternatives. + Therefore, + + foo / bar + + will accept or . + + NOTE: A quoted string containing alphabetic + characters is special form for specifying alternative + characters and is interpreted as a non-terminal + representing the set of combinatorial strings with the + contained characters, in the specified order but with + any mixture of upper and lower case.. + +3.3 Incremental Alternatives Rule1 =/ Rule2 + + It is sometimes convenient to specify a list of alternatives in + fragments. That is, an initial rule may match one or more + alternatives, with later rule definitions adding to the set of + alternatives. This is particularly useful for otherwise- independent + specifications which derive from the same parent rule set, such as + often occurs with parameter lists. ABNF permits this incremental + definition through the construct: + + oldrule =/ additional-alternatives + + So that the rule set + + ruleset = alt1 / alt2 + + ruleset =/ alt3 + + ruleset =/ alt4 / alt5 + + is the same as specifying + + ruleset = alt1 / alt2 / alt3 / alt4 / alt5 + + + + + + + + +Crocker & Overell Standards Track [Page 6] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + +3.4 Value Range Alternatives %c##-## + + A range of alternative numeric values can be specified compactly, + using dash ("-") to indicate the range of alternative values. Hence: + + DIGIT = %x30-39 + + is equivalent to: + + DIGIT = "0" / "1" / "2" / "3" / "4" / "5" / "6" / + + "7" / "8" / "9" + + Concatenated numeric values and numeric value ranges can not be + specified in the same string. A numeric value may use the dotted + notation for concatenation or it may use the dash notation to specify + one value range. Hence, to specify one printable character, between + end of line sequences, the specification could be: + + char-line = %x0D.0A %x20-7E %x0D.0A + +3.5 Sequence Group (Rule1 Rule2) + + Elements enclosed in parentheses are treated as a single element, + whose contents are STRICTLY ORDERED. Thus, + + elem (foo / bar) blat + + which matches (elem foo blat) or (elem bar blat). + + elem foo / bar blat + + matches (elem foo) or (bar blat). + + NOTE: It is strongly advised to use grouping + notation, rather than to rely on proper reading of + "bare" alternations, when alternatives consist of + multiple rule names or literals. + + Hence it is recommended that instead of the above form, the form: + + (elem foo) / (bar blat) + + be used. It will avoid misinterpretation by casual readers. + + The sequence group notation is also used within free text to set off + an element sequence from the prose. + + + + +Crocker & Overell Standards Track [Page 7] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + +3.6 Variable Repetition *Rule + + The operator "*" preceding an element indicates repetition. The full + form is: + + *element + + where and are optional decimal values, indicating at least + and at most occurrences of element. + + Default values are 0 and infinity so that * allows any + number, including zero; 1* requires at least one; + 3*3 allows exactly 3 and 1*2 allows one or two. + +3.7 Specific Repetition nRule + + A rule of the form: + + element + + is equivalent to + + *element + + That is, exactly occurrences of . Thus 2DIGIT is a + 2-digit number, and 3ALPHA is a string of three alphabetic + characters. + +3.8 Optional Sequence [RULE] + + Square brackets enclose an optional element sequence: + + [foo bar] + + is equivalent to + + *1(foo bar). + +3.9 ; Comment + + A semi-colon starts a comment that continues to the end of line. + This is a simple way of including useful notes in parallel with the + specifications. + + + + + + + + +Crocker & Overell Standards Track [Page 8] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + +3.10 Operator Precedence + + The various mechanisms described above have the following precedence, + from highest (binding tightest) at the top, to lowest and loosest at + the bottom: + + Strings, Names formation + Comment + Value range + Repetition + Grouping, Optional + Concatenation + Alternative + + Use of the alternative operator, freely mixed with concatenations can + be confusing. + + Again, it is recommended that the grouping operator be used to + make explicit concatenation groups. + +4. ABNF DEFINITION OF ABNF + + This syntax uses the rules provided in Appendix A (Core). + + rulelist = 1*( rule / (*c-wsp c-nl) ) + + rule = rulename defined-as elements c-nl + ; continues if next line starts + ; with white space + + rulename = ALPHA *(ALPHA / DIGIT / "-") + + defined-as = *c-wsp ("=" / "=/") *c-wsp + ; basic rules definition and + ; incremental alternatives + + elements = alternation *c-wsp + + c-wsp = WSP / (c-nl WSP) + + c-nl = comment / CRLF + ; comment or newline + + comment = ";" *(WSP / VCHAR) CRLF + + alternation = concatenation + *(*c-wsp "/" *c-wsp concatenation) + + + + +Crocker & Overell Standards Track [Page 9] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + + concatenation = repetition *(1*c-wsp repetition) + + repetition = [repeat] element + + repeat = 1*DIGIT / (*DIGIT "*" *DIGIT) + + element = rulename / group / option / + char-val / num-val / prose-val + + group = "(" *c-wsp alternation *c-wsp ")" + + option = "[" *c-wsp alternation *c-wsp "]" + + char-val = DQUOTE *(%x20-21 / %x23-7E) DQUOTE + ; quoted string of SP and VCHAR + without DQUOTE + + num-val = "%" (bin-val / dec-val / hex-val) + + bin-val = "b" 1*BIT + [ 1*("." 1*BIT) / ("-" 1*BIT) ] + ; series of concatenated bit values + ; or single ONEOF range + + dec-val = "d" 1*DIGIT + [ 1*("." 1*DIGIT) / ("-" 1*DIGIT) ] + + hex-val = "x" 1*HEXDIG + [ 1*("." 1*HEXDIG) / ("-" 1*HEXDIG) ] + + prose-val = "<" *(%x20-3D / %x3F-7E) ">" + ; bracketed string of SP and VCHAR + without angles + ; prose description, to be used as + last resort + + +5. SECURITY CONSIDERATIONS + + Security is truly believed to be irrelevant to this document. + + + + + + + + + + + +Crocker & Overell Standards Track [Page 10] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + +6. APPENDIX A - CORE + + This Appendix is provided as a convenient core for specific grammars. + The definitions may be used as a core set of rules. + +6.1 Core Rules + + Certain basic rules are in uppercase, such as SP, HTAB, CRLF, + DIGIT, ALPHA, etc. + + ALPHA = %x41-5A / %x61-7A ; A-Z / a-z + + BIT = "0" / "1" + + CHAR = %x01-7F + ; any 7-bit US-ASCII character, + excluding NUL + + CR = %x0D + ; carriage return + + CRLF = CR LF + ; Internet standard newline + + CTL = %x00-1F / %x7F + ; controls + + DIGIT = %x30-39 + ; 0-9 + + DQUOTE = %x22 + ; " (Double Quote) + + HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F" + + HTAB = %x09 + ; horizontal tab + + LF = %x0A + ; linefeed + + LWSP = *(WSP / CRLF WSP) + ; linear white space (past newline) + + OCTET = %x00-FF + ; 8 bits of data + + SP = %x20 + + + +Crocker & Overell Standards Track [Page 11] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + + ; space + + VCHAR = %x21-7E + ; visible (printing) characters + + WSP = SP / HTAB + ; white space + +6.2 Common Encoding + + Externally, data are represented as "network virtual ASCII", namely + 7-bit US-ASCII in an 8-bit field, with the high (8th) bit set to + zero. A string of values is in "network byte order" with the + higher-valued bytes represented on the left-hand side and being sent + over the network first. + +7. ACKNOWLEDGMENTS + + The syntax for ABNF was originally specified in RFC 733. Ken L. + Harrenstien, of SRI International, was responsible for re-coding the + BNF into an augmented BNF that makes the representation smaller and + easier to understand. + + This recent project began as a simple effort to cull out the portion + of RFC 822 which has been repeatedly cited by non-email specification + writers, namely the description of augmented BNF. Rather than simply + and blindly converting the existing text into a separate document, + the working group chose to give careful consideration to the + deficiencies, as well as benefits, of the existing specification and + related specifications available over the last 15 years and therefore + to pursue enhancement. This turned the project into something rather + more ambitious than first intended. Interestingly the result is not + massively different from that original, although decisions such as + removing the list notation came as a surprise. + + The current round of specification was part of the DRUMS working + group, with significant contributions from Jerome Abela , Harald + Alvestrand, Robert Elz, Roger Fajman, Aviva Garrett, Tom Harsch, Dan + Kohn, Bill McQuillan, Keith Moore, Chris Newman , Pete Resnick and + Henning Schulzrinne. + + + + + + + + + + + +Crocker & Overell Standards Track [Page 12] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + +8. REFERENCES + + [US-ASCII] Coded Character Set--7-Bit American Standard Code for + Information Interchange, ANSI X3.4-1986. + + [RFC733] Crocker, D., Vittal, J., Pogran, K., and D. Henderson, + "Standard for the Format of ARPA Network Text Message," RFC 733, + November 1977. + + [RFC822] Crocker, D., "Standard for the Format of ARPA Internet Text + Messages", STD 11, RFC 822, August 1982. + +9. CONTACT + + David H. Crocker Paul Overell + + Internet Mail Consortium Demon Internet Ltd + 675 Spruce Dr. Dorking Business Park + Sunnyvale, CA 94086 USA Dorking + Surrey, RH4 1HN + UK + + Phone: +1 408 246 8253 + Fax: +1 408 249 6205 + EMail: dcrocker@imc.org paulo@turnpike.com + + + + + + + + + + + + + + + + + + + + + + + + + + +Crocker & Overell Standards Track [Page 13] + +RFC 2234 ABNF for Syntax Specifications November 1997 + + +10. Full Copyright Statement + + Copyright (C) The Internet Society (1997). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + + + + + + + + + + + + + + + + + + + + + + + +Crocker & Overell Standards Track [Page 14] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2487.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2487.txt new file mode 100644 index 0000000..fb1305f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2487.txt @@ -0,0 +1,451 @@ + + + + + + +Network Working Group P. Hoffman +Request for Comments: 2487 Internet Mail Consortium +Category: Standards Track January 1999 + + + SMTP Service Extension for Secure SMTP over TLS + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (1999). All Rights Reserved. + +1. Abstract + + This document describes an extension to the SMTP service that allows + an SMTP server and client to use transport-layer security to provide + private, authenticated communication over the Internet. This gives + SMTP agents the ability to protect some or all of their + communications from eavesdroppers and attackers. + +2. Introduction + + SMTP [RFC-821] servers and clients normally communicate in the clear + over the Internet. In many cases, this communication goes through one + or more router that is not controlled or trusted by either entity. + Such an untrusted router might allow a third party to monitor or + alter the communications between the server and client. + + Further, there is often a desire for two SMTP agents to be able to + authenticate each others' identities. For example, a secure SMTP + server might only allow communications from other SMTP agents it + knows, or it might act differently for messages received from an + agent it knows than from one it doesn't know. + + TLS [TLS], more commonly known as SSL, is a popular mechanism for + enhancing TCP communications with privacy and authentication. TLS is + in wide use with the HTTP protocol, and is also being used for adding + security to many other common protocols that run over TCP. + + + + + + +Hoffman Standards Track [Page 1] + +RFC 2487 SMTP Service Extension January 1999 + + +2.1 Terminology + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in [RFC-2119]. + +3. STARTTLS Extension + + The STARTTLS extension to SMTP is laid out as follows: + + (1) the name of the SMTP service defined here is STARTTLS; + + (2) the EHLO keyword value associated with the extension is STARTTLS; + + (3) the STARTTLS keyword has no parameters; + + (4) a new SMTP verb, "STARTTLS", is defined; + + (5) no additional parameters are added to any SMTP command. + +4. The STARTTLS Keyword + + The STARTTLS keyword is used to tell the SMTP client that the SMTP + server allows use of TLS. It takes no parameters. + +5. The STARTTLS Command + + The format for the STARTTLS command is: + + STARTTLS + + with no parameters. + + After the client gives the STARTTLS command, the server responds with + one of the following reply codes: + + 220 Ready to start TLS + 501 Syntax error (no parameters allowed) + 454 TLS not available due to temporary reason + + A publicly-referenced SMTP server MUST NOT require use of the + STARTTLS extension in order to deliver mail locally. This rule + prevents the STARTTLS extension from damaging the interoperability of + the Internet's SMTP infrastructure. A publicly-referenced SMTP server + is an SMTP server which runs on port 25 of an Internet host listed in + the MX record (or A record if an MX record is not present) for the + domain name on the right hand side of an Internet mail address. + + + + +Hoffman Standards Track [Page 2] + +RFC 2487 SMTP Service Extension January 1999 + + + Any SMTP server may refuse to accept messages for relay based on + authentication supplied during the TLS negotiation. An SMTP server + that is not publicly referenced may refuse to accept any messages for + relay or local delivery based on authentication supplied during the + TLS negotiation. + + A SMTP server that is not publicly referenced may choose to require + that the client perform a TLS negotiation before accepting any + commands. In this case, the server SHOULD return the reply code: + + 530 Must issue a STARTTLS command first + + to every command other than NOOP, EHLO, STARTTLS, or QUIT. If the + client and server are using the ENHANCEDSTATUSCODES ESMTP extension + [RFC-2034], the status code to be returned SHOULD be 5.7.0. + + After receiving a 220 response to a STARTTLS command, the client + SHOULD start the TLS negotiation before giving any other SMTP + commands. + + If the SMTP client is using pipelining as defined in RFC 1854, the + STARTTLS command must be the last command in a group. + +5.1 Processing After the STARTTLS Command + + After the TLS handshake has been completed, both parties MUST + immediately decide whether or not to continue based on the + authentication and privacy achieved. The SMTP client and server may + decide to move ahead even if the TLS negotiation ended with no + authentication and/or no privacy because most SMTP services are + performed with no authentication and no privacy, but some SMTP + clients or servers may want to continue only if a particular level of + authentication and/or privacy was achieved. + + If the SMTP client decides that the level of authentication or + privacy is not high enough for it to continue, it SHOULD issue an + SMTP QUIT command immediately after the TLS negotiation is complete. + If the SMTP server decides that the level of authentication or + privacy is not high enough for it to continue, it SHOULD reply to + every SMTP command from the client (other than a QUIT command) with + the 554 reply code (with a possible text string such as "Command + refused due to lack of security"). + + The decision of whether or not to believe the authenticity of the + other party in a TLS negotiation is a local matter. However, some + general rules for the decisions are: + + + + + +Hoffman Standards Track [Page 3] + +RFC 2487 SMTP Service Extension January 1999 + + + - A SMTP client would probably only want to authenticate an SMTP + server whose server certificate has a domain name that is the + domain name that the client thought it was connecting to. + - A publicly-referenced SMTP server would probably want to accept + any certificate from an SMTP client, and would possibly want to + put distinguishing information about the certificate in the + Received header of messages that were relayed or submitted from + the client. + +5.2 Result of the STARTTLS Command + + Upon completion of the TLS handshake, the SMTP protocol is reset to + the initial state (the state in SMTP after a server issues a 220 + service ready greeting). The server MUST discard any knowledge + obtained from the client, such as the argument to the EHLO command, + which was not obtained from the TLS negotiation itself. The client + MUST discard any knowledge obtained from the server, such as the list + of SMTP service extensions, which was not obtained from the TLS + negotiation itself. The client SHOULD send an EHLO command as the + first command after a successful TLS negotiation. + + The list of SMTP service extensions returned in response to an EHLO + command received after the TLS handshake MAY be different than the + list returned before the TLS handshake. For example, an SMTP server + might not want to advertise support for a particular SASL mechanism + [SASL] unless a client has sent an appropriate client certificate + during a TLS handshake. + + Both the client and the server MUST know if there is a TLS session + active. A client MUST NOT attempt to start a TLS session if a TLS + session is already active. A server MUST NOT return the TLS extension + in response to an EHLO command received after a TLS handshake has + completed. + +6. Usage Example + + The following dialog illustrates how a client and server can start a + TLS session: + + S: + C: + S: 220 mail.imc.org SMTP service ready + C: EHLO mail.ietf.org + S: 250-mail.imc.org offers a warm hug of welcome + S: 250 STARTTLS + C: STARTTLS + S: 220 Go ahead + C: + + + +Hoffman Standards Track [Page 4] + +RFC 2487 SMTP Service Extension January 1999 + + + C & S: + C & S: + C: + . . . + +7. Security Considerations + + It should be noted that SMTP is not an end-to-end mechanism. Thus, if + an SMTP client/server pair decide to add TLS privacy, they are not + securing the transport from the originating mail user agent to the + recipient. Further, because delivery of a single piece of mail may + go between more than two SMTP servers, adding TLS privacy to one pair + of servers does not mean that the entire SMTP chain has been made + private. Further, just because an SMTP server can authenticate an + SMTP client, it does not mean that the mail from the SMTP client was + authenticated by the SMTP client when the client received it. + + Both the STMP client and server must check the result of the TLS + negotiation to see whether acceptable authentication or privacy was + achieved. Ignoring this step completely invalidates using TLS for + security. The decision about whether acceptable authentication or + privacy was achieved is made locally, is implementation-dependant, + and is beyond the scope of this document. + + The SMTP client and server should note carefully the result of the + TLS negotiation. If the negotiation results in no privacy, or if it + results in privacy using algorithms or key lengths that are deemed + not strong enough, or if the authentication is not good enough for + either party, the client may choose to end the SMTP session with an + immediate QUIT command, or the server may choose to not accept any + more SMTP commands. + + A server announcing in an EHLO response that it uses a particular TLS + protocol should not pose any security issues, since any use of TLS + will be at least as secure as no use of TLS. + + A man-in-the-middle attack can be launched by deleting the "250 + STARTTLS" response from the server. This would cause the client not + to try to start a TLS session. An SMTP client can protect against + this attack by recording the fact that a particular SMTP server + offers TLS during one session and generating an alarm if it does not + appear in the EHLO response for a later session. The lack of TLS + during a session SHOULD NOT result in the bouncing of email, although + it could result in delayed processing. + + + + + + + +Hoffman Standards Track [Page 5] + +RFC 2487 SMTP Service Extension January 1999 + + + Before the TLS handshake has begun, any protocol interactions are + performed in the clear and may be modified by an active attacker. For + this reason, clients and servers MUST discard any knowledge obtained + prior to the start of the TLS handshake upon completion of the TLS + handshake. + + The STARTTLS extension is not suitable for authenticating the author + of an email message unless every hop in the delivery chain, including + the submission to the first SMTP server, is authenticated. Another + proposal [SMTP-AUTH] can be used to authenticate delivery and MIME + security multiparts [MIME-SEC] can be used to authenticate the author + of an email message. In addition, the [SMTP-AUTH] proposal offers + simpler and more flexible options to authenticate an SMTP client and + the SASL EXTERNAL mechanism [SASL] MAY be used in conjunction with + the STARTTLS command to provide an authorization identity. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Hoffman Standards Track [Page 6] + +RFC 2487 SMTP Service Extension January 1999 + + +A. References + + [RFC-821] Postel, J., "Simple Mail Transfer Protocol", RFC 821, + August 1982. + + [RFC-1869] Klensin, J., Freed, N, Rose, M, Stefferud, E. and D. + Crocker, "SMTP Service Extensions", STD 10, RFC 1869, + November 1995. + + [RFC-2034] Freed, N., "SMTP Service Extension for Returning Enhanced + Error Codes", RFC 2034, October 1996. + + [RFC-2119] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119, March 1997. + + [SASL] Myers, J., "Simple Authentication and Security Layer + (SASL)", RFC 2222, October 1997. + + [SMTP-AUTH] "SMTP Service Extension for Authentication", Work in + Progress. + + [TLS] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", + RFC 2246, January 1999. + +B. Author's Address + + Paul Hoffman + Internet Mail Consortium + 127 Segre Place + Santa Cruz, CA 95060 + + Phone: (831) 426-9827 + EMail: phoffman@imc.org + + + + + + + + + + + + + + + + + + +Hoffman Standards Track [Page 7] + +RFC 2487 SMTP Service Extension January 1999 + + +C. Full Copyright Statement + + Copyright (C) The Internet Society (1999). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + + + + + + + + + + + + + + + + + + + + + + + +Hoffman Standards Track [Page 8] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2554.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2554.txt new file mode 100644 index 0000000..2922dea --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2554.txt @@ -0,0 +1,619 @@ + + + + + + +Network Working Group J. Myers +Request for Comments: 2554 Netscape Communications +Category: Standards Track March 1999 + + + SMTP Service Extension + for Authentication + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (1999). All Rights Reserved. + + +1. Introduction + + This document defines an SMTP service extension [ESMTP] whereby an + SMTP client may indicate an authentication mechanism to the server, + perform an authentication protocol exchange, and optionally negotiate + a security layer for subsequent protocol interactions. This + extension is a profile of the Simple Authentication and Security + Layer [SASL]. + + +2. Conventions Used in this Document + + In examples, "C:" and "S:" indicate lines sent by the client and + server respectively. + + The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" + in this document are to be interpreted as defined in "Key words for + use in RFCs to Indicate Requirement Levels" [KEYWORDS]. + + +3. The Authentication service extension + + + (1) the name of the SMTP service extension is "Authentication" + + (2) the EHLO keyword value associated with this extension is "AUTH" + + + + +Myers Standards Track [Page 1] + +RFC 2554 SMTP Authentication March 1999 + + + (3) The AUTH EHLO keyword contains as a parameter a space separated + list of the names of supported SASL mechanisms. + + (4) a new SMTP verb "AUTH" is defined + + (5) an optional parameter using the keyword "AUTH" is added to the + MAIL FROM command, and extends the maximum line length of the + MAIL FROM command by 500 characters. + + (6) this extension is appropriate for the submission protocol + [SUBMIT]. + + +4. The AUTH command + + AUTH mechanism [initial-response] + + Arguments: + a string identifying a SASL authentication mechanism. + an optional base64-encoded response + + Restrictions: + After an AUTH command has successfully completed, no more AUTH + commands may be issued in the same session. After a successful + AUTH command completes, a server MUST reject any further AUTH + commands with a 503 reply. + + The AUTH command is not permitted during a mail transaction. + + Discussion: + The AUTH command indicates an authentication mechanism to the + server. If the server supports the requested authentication + mechanism, it performs an authentication protocol exchange to + authenticate and identify the user. Optionally, it also + negotiates a security layer for subsequent protocol + interactions. If the requested authentication mechanism is not + supported, the server rejects the AUTH command with a 504 + reply. + + The authentication protocol exchange consists of a series of + server challenges and client answers that are specific to the + authentication mechanism. A server challenge, otherwise known + as a ready response, is a 334 reply with the text part + containing a BASE64 encoded string. The client answer consists + of a line containing a BASE64 encoded string. If the client + wishes to cancel an authentication exchange, it issues a line + with a single "*". If the server receives such an answer, it + MUST reject the AUTH command by sending a 501 reply. + + + +Myers Standards Track [Page 2] + +RFC 2554 SMTP Authentication March 1999 + + + The optional initial-response argument to the AUTH command is + used to save a round trip when using authentication mechanisms + that are defined to send no data in the initial challenge. + When the initial-response argument is used with such a + mechanism, the initial empty challenge is not sent to the + client and the server uses the data in the initial-response + argument as if it were sent in response to the empty challenge. + Unlike a zero-length client answer to a 334 reply, a zero- + length initial response is sent as a single equals sign ("="). + If the client uses an initial-response argument to the AUTH + command with a mechanism that sends data in the initial + challenge, the server rejects the AUTH command with a 535 + reply. + + If the server cannot BASE64 decode the argument, it rejects the + AUTH command with a 501 reply. If the server rejects the + authentication data, it SHOULD reject the AUTH command with a + 535 reply unless a more specific error code, such as one listed + in section 6, is appropriate. Should the client successfully + complete the authentication exchange, the SMTP server issues a + 235 reply. + + The service name specified by this protocol's profile of SASL + is "smtp". + + If a security layer is negotiated through the SASL + authentication exchange, it takes effect immediately following + the CRLF that concludes the authentication exchange for the + client, and the CRLF of the success reply for the server. Upon + a security layer's taking effect, the SMTP protocol is reset to + the initial state (the state in SMTP after a server issues a + 220 service ready greeting). The server MUST discard any + knowledge obtained from the client, such as the argument to the + EHLO command, which was not obtained from the SASL negotiation + itself. The client MUST discard any knowledge obtained from + the server, such as the list of SMTP service extensions, which + was not obtained from the SASL negotiation itself (with the + exception that a client MAY compare the list of advertised SASL + mechanisms before and after authentication in order to detect + an active down-negotiation attack). The client SHOULD send an + EHLO command as the first command after a successful SASL + negotiation which results in the enabling of a security layer. + + The server is not required to support any particular + authentication mechanism, nor are authentication mechanisms + required to support any security layers. If an AUTH command + fails, the client may try another authentication mechanism by + issuing another AUTH command. + + + +Myers Standards Track [Page 3] + +RFC 2554 SMTP Authentication March 1999 + + + If an AUTH command fails, the server MUST behave the same as if + the client had not issued the AUTH command. + + The BASE64 string may in general be arbitrarily long. Clients + and servers MUST be able to support challenges and responses + that are as long as are generated by the authentication + mechanisms they support, independent of any line length + limitations the client or server may have in other parts of its + protocol implementation. + + Examples: + S: 220 smtp.example.com ESMTP server ready + C: EHLO jgm.example.com + S: 250-smtp.example.com + S: 250 AUTH CRAM-MD5 DIGEST-MD5 + C: AUTH FOOBAR + S: 504 Unrecognized authentication type. + C: AUTH CRAM-MD5 + S: 334 + PENCeUxFREJoU0NnbmhNWitOMjNGNndAZWx3b29kLmlubm9zb2Z0LmNvbT4= + C: ZnJlZCA5ZTk1YWVlMDljNDBhZjJiODRhMGMyYjNiYmFlNzg2ZQ== + S: 235 Authentication successful. + + + +5. The AUTH parameter to the MAIL FROM command + + AUTH=addr-spec + + Arguments: + An addr-spec containing the identity which submitted the message + to the delivery system, or the two character sequence "<>" + indicating such an identity is unknown or insufficiently + authenticated. To comply with the restrictions imposed on ESMTP + parameters, the addr-spec is encoded inside an xtext. The syntax + of an xtext is described in section 5 of [ESMTP-DSN]. + + Discussion: + The optional AUTH parameter to the MAIL FROM command allows + cooperating agents in a trusted environment to communicate the + authentication of individual messages. + + If the server trusts the authenticated identity of the client to + assert that the message was originally submitted by the supplied + addr-spec, then the server SHOULD supply the same addr-spec in an + AUTH parameter when relaying the message to any server which + supports the AUTH extension. + + + + +Myers Standards Track [Page 4] + +RFC 2554 SMTP Authentication March 1999 + + + A MAIL FROM parameter of AUTH=<> indicates that the original + submitter of the message is not known. The server MUST NOT treat + the message as having been originally submitted by the client. + + If the AUTH parameter to the MAIL FROM is not supplied, the + client has authenticated, and the server believes the message is + an original submission by the client, the server MAY supply the + client's identity in the addr-spec in an AUTH parameter when + relaying the message to any server which supports the AUTH + extension. + + If the server does not sufficiently trust the authenticated + identity of the client, or if the client is not authenticated, + then the server MUST behave as if the AUTH=<> parameter was + supplied. The server MAY, however, write the value of the AUTH + parameter to a log file. + + If an AUTH=<> parameter was supplied, either explicitly or due to + the requirement in the previous paragraph, then the server MUST + supply the AUTH=<> parameter when relaying the message to any + server which it has authenticated to using the AUTH extension. + + A server MAY treat expansion of a mailing list as a new + submission, setting the AUTH parameter to the mailing list + address or mailing list administration address when relaying the + message to list subscribers. + + It is conforming for an implementation to be hard-coded to treat + all clients as being insufficiently trusted. In that case, the + implementation does nothing more than parse and discard + syntactically valid AUTH parameters to the MAIL FROM command and + supply AUTH=<> parameters to any servers to which it + authenticates using the AUTH extension. + + Examples: + C: MAIL FROM: AUTH=e+3Dmc2@example.com + S: 250 OK + + + + + + + + + + + + + + +Myers Standards Track [Page 5] + +RFC 2554 SMTP Authentication March 1999 + + +6. Error Codes + + The following error codes may be used to indicate various conditions + as described. + + 432 A password transition is needed + + This response to the AUTH command indicates that the user needs to + transition to the selected authentication mechanism. This typically + done by authenticating once using the PLAIN authentication mechanism. + + 534 Authentication mechanism is too weak + + This response to the AUTH command indicates that the selected + authentication mechanism is weaker than server policy permits for + that user. + + 538 Encryption required for requested authentication mechanism + + This response to the AUTH command indicates that the selected + authentication mechanism may only be used when the underlying SMTP + connection is encrypted. + + 454 Temporary authentication failure + + This response to the AUTH command indicates that the authentication + failed due to a temporary server failure. + + 530 Authentication required + + This response may be returned by any command other than AUTH, EHLO, + HELO, NOOP, RSET, or QUIT. It indicates that server policy requires + authentication in order to perform the requested action. + + + + + + + + + + + + + + + + + + +Myers Standards Track [Page 6] + +RFC 2554 SMTP Authentication March 1999 + + +7. Formal Syntax + + The following syntax specification uses the augmented Backus-Naur + Form (BNF) notation as specified in [ABNF]. + + Except as noted otherwise, all alphabetic characters are case- + insensitive. The use of upper or lower case characters to define + token strings is for editorial clarity only. Implementations MUST + accept these strings in a case-insensitive fashion. + + UPALPHA = %x41-5A ;; Uppercase: A-Z + + LOALPHA = %x61-7A ;; Lowercase: a-z + + ALPHA = UPALPHA / LOALPHA ;; case insensitive + + DIGIT = %x30-39 ;; Digits 0-9 + + HEXDIGIT = %x41-46 / DIGIT ;; hexidecimal digit (uppercase) + + hexchar = "+" HEXDIGIT HEXDIGIT + + xchar = %x21-2A / %x2C-3C / %x3E-7E + ;; US-ASCII except for "+", "=", SPACE and CTL + + xtext = *(xchar / hexchar) + + AUTH_CHAR = ALPHA / DIGIT / "-" / "_" + + auth_type = 1*20AUTH_CHAR + + auth_command = "AUTH" SPACE auth_type [SPACE (base64 / "=")] + *(CRLF [base64]) CRLF + + auth_param = "AUTH=" xtext + ;; The decoded form of the xtext MUST be either + ;; an addr-spec or the two characters "<>" + + base64 = base64_terminal / + ( 1*(4base64_CHAR) [base64_terminal] ) + + base64_char = UPALPHA / LOALPHA / DIGIT / "+" / "/" + ;; Case-sensitive + + base64_terminal = (2base64_char "==") / (3base64_char "=") + + continue_req = "334" SPACE [base64] CRLF + + + + +Myers Standards Track [Page 7] + +RFC 2554 SMTP Authentication March 1999 + + + CR = %x0C ;; ASCII CR, carriage return + + CRLF = CR LF + + CTL = %x00-1F / %x7F ;; any ASCII control character and DEL + + LF = %x0A ;; ASCII LF, line feed + + SPACE = %x20 ;; ASCII SP, space + + + + +8. References + + [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax + Specifications: ABNF", RFC 2234, November 1997. + + [CRAM-MD5] Klensin, J., Catoe, R. and P. Krumviede, "IMAP/POP + AUTHorize Extension for Simple Challenge/Response", RFC + 2195, September 1997. + + [ESMTP] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. + Crocker, "SMTP Service Extensions", RFC 1869, November + 1995. + + [ESMTP-DSN] Moore, K, "SMTP Service Extension for Delivery Status + Notifications", RFC 1891, January 1996. + + [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119, March 1997. + + [SASL] Myers, J., "Simple Authentication and Security Layer + (SASL)", RFC 2222, October 1997. + + [SUBMIT] Gellens, R. and J. Klensin, "Message Submission", RFC + 2476, December 1998. + + [RFC821] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC + 821, August 1982. + + [RFC822] Crocker, D., "Standard for the Format of ARPA Internet + Text Messages", STD 11, RFC 822, August 1982. + + + + + + + + +Myers Standards Track [Page 8] + +RFC 2554 SMTP Authentication March 1999 + + +9. Security Considerations + + Security issues are discussed throughout this memo. + + If a client uses this extension to get an encrypted tunnel through an + insecure network to a cooperating server, it needs to be configured + to never send mail to that server when the connection is not mutually + authenticated and encrypted. Otherwise, an attacker could steal the + client's mail by hijacking the SMTP connection and either pretending + the server does not support the Authentication extension or causing + all AUTH commands to fail. + + Before the SASL negotiation has begun, any protocol interactions are + performed in the clear and may be modified by an active attacker. + For this reason, clients and servers MUST discard any knowledge + obtained prior to the start of the SASL negotiation upon completion + of a SASL negotiation which results in a security layer. + + This mechanism does not protect the TCP port, so an active attacker + may redirect a relay connection attempt to the submission port + [SUBMIT]. The AUTH=<> parameter prevents such an attack from causing + an relayed message without an envelope authentication to pick up the + authentication of the relay client. + + A message submission client may require the user to authenticate + whenever a suitable SASL mechanism is advertised. Therefore, it may + not be desirable for a submission server [SUBMIT] to advertise a SASL + mechanism when use of that mechanism grants the client no benefits + over anonymous submission. + + This extension is not intended to replace or be used instead of end- + to-end message signature and encryption systems such as S/MIME or + PGP. This extension addresses a different problem than end-to-end + systems; it has the following key differences: + + (1) it is generally useful only within a trusted enclave + + (2) it protects the entire envelope of a message, not just the + message's body. + + (3) it authenticates the message submission, not authorship of the + message content + + (4) it can give the sender some assurance the message was + delivered to the next hop in the case where the sender + mutually authenticates with the next hop and negotiates an + appropriate security layer. + + + + +Myers Standards Track [Page 9] + +RFC 2554 SMTP Authentication March 1999 + + + Additional security considerations are mentioned in the SASL + specification [SASL]. + + + +10. Author's Address + + John Gardiner Myers + Netscape Communications + 501 East Middlefield Road + Mail Stop MV-029 + Mountain View, CA 94043 + + EMail: jgmyers@netscape.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Myers Standards Track [Page 10] + +RFC 2554 SMTP Authentication March 1999 + + +11. Full Copyright Statement + + Copyright (C) The Internet Society (1999). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + + + + + + + + + + + + + + + + + + + + + + + + +Myers Standards Track [Page 11] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2821.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2821.txt new file mode 100644 index 0000000..0eac911 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2821.txt @@ -0,0 +1,4427 @@ + + + + + + +Network Working Group J. Klensin, Editor +Request for Comments: 2821 AT&T Laboratories +Obsoletes: 821, 974, 1869 April 2001 +Updates: 1123 +Category: Standards Track + + + Simple Mail Transfer Protocol + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2001). All Rights Reserved. + +Abstract + + This document is a self-contained specification of the basic protocol + for the Internet electronic mail transport. It consolidates, updates + and clarifies, but doesn't add new or change existing functionality + of the following: + + - the original SMTP (Simple Mail Transfer Protocol) specification of + RFC 821 [30], + + - domain name system requirements and implications for mail + transport from RFC 1035 [22] and RFC 974 [27], + + - the clarifications and applicability statements in RFC 1123 [2], + and + + - material drawn from the SMTP Extension mechanisms [19]. + + It obsoletes RFC 821, RFC 974, and updates RFC 1123 (replaces the + mail transport materials of RFC 1123). However, RFC 821 specifies + some features that were not in significant use in the Internet by the + mid-1990s and (in appendices) some additional transport models. + Those sections are omitted here in the interest of clarity and + brevity; readers needing them should refer to RFC 821. + + + + + + +Klensin Standards Track [Page 1] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + It also includes some additional material from RFC 1123 that required + amplification. This material has been identified in multiple ways, + mostly by tracking flaming on various lists and newsgroups and + problems of unusual readings or interpretations that have appeared as + the SMTP extensions have been deployed. Where this specification + moves beyond consolidation and actually differs from earlier + documents, it supersedes them technically as well as textually. + + Although SMTP was designed as a mail transport and delivery protocol, + this specification also contains information that is important to its + use as a 'mail submission' protocol, as recommended for POP [3, 26] + and IMAP [6]. Additional submission issues are discussed in RFC 2476 + [15]. + + Section 2.3 provides definitions of terms specific to this document. + Except when the historical terminology is necessary for clarity, this + document uses the current 'client' and 'server' terminology to + identify the sending and receiving SMTP processes, respectively. + + A companion document [32] discusses message headers, message bodies + and formats and structures for them, and their relationship. + +Table of Contents + + 1. Introduction .................................................. 4 + 2. The SMTP Model ................................................ 5 + 2.1 Basic Structure .............................................. 5 + 2.2 The Extension Model .......................................... 7 + 2.2.1 Background ................................................. 7 + 2.2.2 Definition and Registration of Extensions .................. 8 + 2.3 Terminology .................................................. 9 + 2.3.1 Mail Objects ............................................... 10 + 2.3.2 Senders and Receivers ...................................... 10 + 2.3.3 Mail Agents and Message Stores ............................. 10 + 2.3.4 Host ....................................................... 11 + 2.3.5 Domain ..................................................... 11 + 2.3.6 Buffer and State Table ..................................... 11 + 2.3.7 Lines ...................................................... 12 + 2.3.8 Originator, Delivery, Relay, and Gateway Systems ........... 12 + 2.3.9 Message Content and Mail Data .............................. 13 + 2.3.10 Mailbox and Address ....................................... 13 + 2.3.11 Reply ..................................................... 13 + 2.4 General Syntax Principles and Transaction Model .............. 13 + 3. The SMTP Procedures: An Overview .............................. 15 + 3.1 Session Initiation ........................................... 15 + 3.2 Client Initiation ............................................ 16 + 3.3 Mail Transactions ............................................ 16 + 3.4 Forwarding for Address Correction or Updating ................ 19 + + + +Klensin Standards Track [Page 2] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + 3.5 Commands for Debugging Addresses ............................. 20 + 3.5.1 Overview ................................................... 20 + 3.5.2 VRFY Normal Response ....................................... 22 + 3.5.3 Meaning of VRFY or EXPN Success Response ................... 22 + 3.5.4 Semantics and Applications of EXPN ......................... 23 + 3.6 Domains ...................................................... 23 + 3.7 Relaying ..................................................... 24 + 3.8 Mail Gatewaying .............................................. 25 + 3.8.1 Header Fields in Gatewaying ................................ 26 + 3.8.2 Received Lines in Gatewaying ............................... 26 + 3.8.3 Addresses in Gatewaying .................................... 26 + 3.8.4 Other Header Fields in Gatewaying .......................... 27 + 3.8.5 Envelopes in Gatewaying .................................... 27 + 3.9 Terminating Sessions and Connections ......................... 27 + 3.10 Mailing Lists and Aliases ................................... 28 + 3.10.1 Alias ..................................................... 28 + 3.10.2 List ...................................................... 28 + 4. The SMTP Specifications ....................................... 29 + 4.1 SMTP Commands ................................................ 29 + 4.1.1 Command Semantics and Syntax ............................... 29 + 4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO) ................... 29 + 4.1.1.2 MAIL (MAIL) .............................................. 31 + 4.1.1.3 RECIPIENT (RCPT) ......................................... 31 + 4.1.1.4 DATA (DATA) .............................................. 33 + 4.1.1.5 RESET (RSET) ............................................. 34 + 4.1.1.6 VERIFY (VRFY) ............................................ 35 + 4.1.1.7 EXPAND (EXPN) ............................................ 35 + 4.1.1.8 HELP (HELP) .............................................. 35 + 4.1.1.9 NOOP (NOOP) .............................................. 35 + 4.1.1.10 QUIT (QUIT) ............................................. 36 + 4.1.2 Command Argument Syntax .................................... 36 + 4.1.3 Address Literals ........................................... 38 + 4.1.4 Order of Commands .......................................... 39 + 4.1.5 Private-use Commands ....................................... 40 + 4.2 SMTP Replies ................................................ 40 + 4.2.1 Reply Code Severities and Theory ........................... 42 + 4.2.2 Reply Codes by Function Groups ............................. 44 + 4.2.3 Reply Codes in Numeric Order .............................. 45 + 4.2.4 Reply Code 502 ............................................. 46 + 4.2.5 Reply Codes After DATA and the Subsequent . .... 46 + 4.3 Sequencing of Commands and Replies ........................... 47 + 4.3.1 Sequencing Overview ........................................ 47 + 4.3.2 Command-Reply Sequences .................................... 48 + 4.4 Trace Information ............................................ 49 + 4.5 Additional Implementation Issues ............................. 53 + 4.5.1 Minimum Implementation ..................................... 53 + 4.5.2 Transparency ............................................... 53 + 4.5.3 Sizes and Timeouts ......................................... 54 + + + +Klensin Standards Track [Page 3] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + 4.5.3.1 Size limits and minimums ................................. 54 + 4.5.3.2 Timeouts ................................................. 56 + 4.5.4 Retry Strategies ........................................... 57 + 4.5.4.1 Sending Strategy ......................................... 58 + 4.5.4.2 Receiving Strategy ....................................... 59 + 4.5.5 Messages with a null reverse-path .......................... 59 + 5. Address Resolution and Mail Handling .......................... 60 + 6. Problem Detection and Handling ................................ 62 + 6.1 Reliable Delivery and Replies by Email ....................... 62 + 6.2 Loop Detection ............................................... 63 + 6.3 Compensating for Irregularities .............................. 63 + 7. Security Considerations ....................................... 64 + 7.1 Mail Security and Spoofing ................................... 64 + 7.2 "Blind" Copies ............................................... 65 + 7.3 VRFY, EXPN, and Security ..................................... 65 + 7.4 Information Disclosure in Announcements ...................... 66 + 7.5 Information Disclosure in Trace Fields ....................... 66 + 7.6 Information Disclosure in Message Forwarding ................. 67 + 7.7 Scope of Operation of SMTP Servers ........................... 67 + 8. IANA Considerations ........................................... 67 + 9. References .................................................... 68 + 10. Editor's Address ............................................. 70 + 11. Acknowledgments .............................................. 70 + Appendices ....................................................... 71 + A. TCP Transport Service ......................................... 71 + B. Generating SMTP Commands from RFC 822 Headers ................. 71 + C. Source Routes ................................................. 72 + D. Scenarios ..................................................... 73 + E. Other Gateway Issues .......................................... 76 + F. Deprecated Features of RFC 821 ................................ 76 + Full Copyright Statement ......................................... 79 + +1. Introduction + + The objective of the Simple Mail Transfer Protocol (SMTP) is to + transfer mail reliably and efficiently. + + SMTP is independent of the particular transmission subsystem and + requires only a reliable ordered data stream channel. While this + document specifically discusses transport over TCP, other transports + are possible. Appendices to RFC 821 describe some of them. + + An important feature of SMTP is its capability to transport mail + across networks, usually referred to as "SMTP mail relaying" (see + section 3.8). A network consists of the mutually-TCP-accessible + hosts on the public Internet, the mutually-TCP-accessible hosts on a + firewall-isolated TCP/IP Intranet, or hosts in some other LAN or WAN + environment utilizing a non-TCP transport-level protocol. Using + + + +Klensin Standards Track [Page 4] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + SMTP, a process can transfer mail to another process on the same + network or to some other network via a relay or gateway process + accessible to both networks. + + In this way, a mail message may pass through a number of intermediate + relay or gateway hosts on its path from sender to ultimate recipient. + The Mail eXchanger mechanisms of the domain name system [22, 27] (and + section 5 of this document) are used to identify the appropriate + next-hop destination for a message being transported. + +2. The SMTP Model + +2.1 Basic Structure + + The SMTP design can be pictured as: + + +----------+ +----------+ + +------+ | | | | + | User |<-->| | SMTP | | + +------+ | Client- |Commands/Replies| Server- | + +------+ | SMTP |<-------------->| SMTP | +------+ + | File |<-->| | and Mail | |<-->| File | + |System| | | | | |System| + +------+ +----------+ +----------+ +------+ + SMTP client SMTP server + + When an SMTP client has a message to transmit, it establishes a two- + way transmission channel to an SMTP server. The responsibility of an + SMTP client is to transfer mail messages to one or more SMTP servers, + or report its failure to do so. + + The means by which a mail message is presented to an SMTP client, and + how that client determines the domain name(s) to which mail messages + are to be transferred is a local matter, and is not addressed by this + document. In some cases, the domain name(s) transferred to, or + determined by, an SMTP client will identify the final destination(s) + of the mail message. In other cases, common with SMTP clients + associated with implementations of the POP [3, 26] or IMAP [6] + protocols, or when the SMTP client is inside an isolated transport + service environment, the domain name determined will identify an + intermediate destination through which all mail messages are to be + relayed. SMTP clients that transfer all traffic, regardless of the + target domain names associated with the individual messages, or that + do not maintain queues for retrying message transmissions that + initially cannot be completed, may otherwise conform to this + specification but are not considered fully-capable. Fully-capable + SMTP implementations, including the relays used by these less capable + + + + +Klensin Standards Track [Page 5] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + ones, and their destinations, are expected to support all of the + queuing, retrying, and alternate address functions discussed in this + specification. + + The means by which an SMTP client, once it has determined a target + domain name, determines the identity of an SMTP server to which a + copy of a message is to be transferred, and then performs that + transfer, is covered by this document. To effect a mail transfer to + an SMTP server, an SMTP client establishes a two-way transmission + channel to that SMTP server. An SMTP client determines the address + of an appropriate host running an SMTP server by resolving a + destination domain name to either an intermediate Mail eXchanger host + or a final target host. + + An SMTP server may be either the ultimate destination or an + intermediate "relay" (that is, it may assume the role of an SMTP + client after receiving the message) or "gateway" (that is, it may + transport the message further using some protocol other than SMTP). + SMTP commands are generated by the SMTP client and sent to the SMTP + server. SMTP replies are sent from the SMTP server to the SMTP + client in response to the commands. + + In other words, message transfer can occur in a single connection + between the original SMTP-sender and the final SMTP-recipient, or can + occur in a series of hops through intermediary systems. In either + case, a formal handoff of responsibility for the message occurs: the + protocol requires that a server accept responsibility for either + delivering a message or properly reporting the failure to do so. + + Once the transmission channel is established and initial handshaking + completed, the SMTP client normally initiates a mail transaction. + Such a transaction consists of a series of commands to specify the + originator and destination of the mail and transmission of the + message content (including any headers or other structure) itself. + When the same message is sent to multiple recipients, this protocol + encourages the transmission of only one copy of the data for all + recipients at the same destination (or intermediate relay) host. + + The server responds to each command with a reply; replies may + indicate that the command was accepted, that additional commands are + expected, or that a temporary or permanent error condition exists. + Commands specifying the sender or recipients may include server- + permitted SMTP service extension requests as discussed in section + 2.2. The dialog is purposely lock-step, one-at-a-time, although this + can be modified by mutually-agreed extension requests such as command + pipelining [13]. + + + + + +Klensin Standards Track [Page 6] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + Once a given mail message has been transmitted, the client may either + request that the connection be shut down or may initiate other mail + transactions. In addition, an SMTP client may use a connection to an + SMTP server for ancillary services such as verification of email + addresses or retrieval of mailing list subscriber addresses. + + As suggested above, this protocol provides mechanisms for the + transmission of mail. This transmission normally occurs directly + from the sending user's host to the receiving user's host when the + two hosts are connected to the same transport service. When they are + not connected to the same transport service, transmission occurs via + one or more relay SMTP servers. An intermediate host that acts as + either an SMTP relay or as a gateway into some other transmission + environment is usually selected through the use of the domain name + service (DNS) Mail eXchanger mechanism. + + Usually, intermediate hosts are determined via the DNS MX record, not + by explicit "source" routing (see section 5 and appendices C and + F.2). + +2.2 The Extension Model + +2.2.1 Background + + In an effort that started in 1990, approximately a decade after RFC + 821 was completed, the protocol was modified with a "service + extensions" model that permits the client and server to agree to + utilize shared functionality beyond the original SMTP requirements. + The SMTP extension mechanism defines a means whereby an extended SMTP + client and server may recognize each other, and the server can inform + the client as to the service extensions that it supports. + + Contemporary SMTP implementations MUST support the basic extension + mechanisms. For instance, servers MUST support the EHLO command even + if they do not implement any specific extensions and clients SHOULD + preferentially utilize EHLO rather than HELO. (However, for + compatibility with older conforming implementations, SMTP clients and + servers MUST support the original HELO mechanisms as a fallback.) + Unless the different characteristics of HELO must be identified for + interoperability purposes, this document discusses only EHLO. + + SMTP is widely deployed and high-quality implementations have proven + to be very robust. However, the Internet community now considers + some services to be important that were not anticipated when the + protocol was first designed. If support for those services is to be + added, it must be done in a way that permits older implementations to + continue working acceptably. The extension framework consists of: + + + + +Klensin Standards Track [Page 7] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + - The SMTP command EHLO, superseding the earlier HELO, + + - a registry of SMTP service extensions, + + - additional parameters to the SMTP MAIL and RCPT commands, and + + - optional replacements for commands defined in this protocol, such + as for DATA in non-ASCII transmissions [33]. + + SMTP's strength comes primarily from its simplicity. Experience with + many protocols has shown that protocols with few options tend towards + ubiquity, whereas protocols with many options tend towards obscurity. + + Each and every extension, regardless of its benefits, must be + carefully scrutinized with respect to its implementation, deployment, + and interoperability costs. In many cases, the cost of extending the + SMTP service will likely outweigh the benefit. + +2.2.2 Definition and Registration of Extensions + + The IANA maintains a registry of SMTP service extensions. A + corresponding EHLO keyword value is associated with each extension. + Each service extension registered with the IANA must be defined in a + formal standards-track or IESG-approved experimental protocol + document. The definition must include: + + - the textual name of the SMTP service extension; + + - the EHLO keyword value associated with the extension; + + - the syntax and possible values of parameters associated with the + EHLO keyword value; + + - any additional SMTP verbs associated with the extension + (additional verbs will usually be, but are not required to be, the + same as the EHLO keyword value); + + - any new parameters the extension associates with the MAIL or RCPT + verbs; + + - a description of how support for the extension affects the + behavior of a server and client SMTP; and, + + - the increment by which the extension is increasing the maximum + length of the commands MAIL and/or RCPT, over that specified in + this standard. + + + + + +Klensin Standards Track [Page 8] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + In addition, any EHLO keyword value starting with an upper or lower + case "X" refers to a local SMTP service extension used exclusively + through bilateral agreement. Keywords beginning with "X" MUST NOT be + used in a registered service extension. Conversely, keyword values + presented in the EHLO response that do not begin with "X" MUST + correspond to a standard, standards-track, or IESG-approved + experimental SMTP service extension registered with IANA. A + conforming server MUST NOT offer non-"X"-prefixed keyword values that + are not described in a registered extension. + + Additional verbs and parameter names are bound by the same rules as + EHLO keywords; specifically, verbs beginning with "X" are local + extensions that may not be registered or standardized. Conversely, + verbs not beginning with "X" must always be registered. + +2.3 Terminology + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described below. + + 1. MUST This word, or the terms "REQUIRED" or "SHALL", mean that + the definition is an absolute requirement of the specification. + + 2. MUST NOT This phrase, or the phrase "SHALL NOT", mean that the + definition is an absolute prohibition of the specification. + + 3. SHOULD This word, or the adjective "RECOMMENDED", mean that + there may exist valid reasons in particular circumstances to + ignore a particular item, but the full implications must be + understood and carefully weighed before choosing a different + course. + + 4. SHOULD NOT This phrase, or the phrase "NOT RECOMMENDED" mean + that there may exist valid reasons in particular circumstances + when the particular behavior is acceptable or even useful, but the + full implications should be understood and the case carefully + weighed before implementing any behavior described with this + label. + + 5. MAY This word, or the adjective "OPTIONAL", mean that an item is + truly optional. One vendor may choose to include the item because + a particular marketplace requires it or because the vendor feels + that it enhances the product while another vendor may omit the + same item. An implementation which does not include a particular + option MUST be prepared to interoperate with another + implementation which does include the option, though perhaps with + reduced functionality. In the same vein an implementation which + + + +Klensin Standards Track [Page 9] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + does include a particular option MUST be prepared to interoperate + with another implementation which does not include the option + (except, of course, for the feature the option provides.) + +2.3.1 Mail Objects + + SMTP transports a mail object. A mail object contains an envelope + and content. + + The SMTP envelope is sent as a series of SMTP protocol units + (described in section 3). It consists of an originator address (to + which error reports should be directed); one or more recipient + addresses; and optional protocol extension material. Historically, + variations on the recipient address specification command (RCPT TO) + could be used to specify alternate delivery modes, such as immediate + display; those variations have now been deprecated (see appendix F, + section F.6). + + The SMTP content is sent in the SMTP DATA protocol unit and has two + parts: the headers and the body. If the content conforms to other + contemporary standards, the headers form a collection of field/value + pairs structured as in the message format specification [32]; the + body, if structured, is defined according to MIME [12]. The content + is textual in nature, expressed using the US-ASCII repertoire [1]. + Although SMTP extensions (such as "8BITMIME" [20]) may relax this + restriction for the content body, the content headers are always + encoded using the US-ASCII repertoire. A MIME extension [23] defines + an algorithm for representing header values outside the US-ASCII + repertoire, while still encoding them using the US-ASCII repertoire. + +2.3.2 Senders and Receivers + + In RFC 821, the two hosts participating in an SMTP transaction were + described as the "SMTP-sender" and "SMTP-receiver". This document + has been changed to reflect current industry terminology and hence + refers to them as the "SMTP client" (or sometimes just "the client") + and "SMTP server" (or just "the server"), respectively. Since a + given host may act both as server and client in a relay situation, + "receiver" and "sender" terminology is still used where needed for + clarity. + +2.3.3 Mail Agents and Message Stores + + Additional mail system terminology became common after RFC 821 was + published and, where convenient, is used in this specification. In + particular, SMTP servers and clients provide a mail transport service + and therefore act as "Mail Transfer Agents" (MTAs). "Mail User + Agents" (MUAs or UAs) are normally thought of as the sources and + + + +Klensin Standards Track [Page 10] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + targets of mail. At the source, an MUA might collect mail to be + transmitted from a user and hand it off to an MTA; the final + ("delivery") MTA would be thought of as handing the mail off to an + MUA (or at least transferring responsibility to it, e.g., by + depositing the message in a "message store"). However, while these + terms are used with at least the appearance of great precision in + other environments, the implied boundaries between MUAs and MTAs + often do not accurately match common, and conforming, practices with + Internet mail. Hence, the reader should be cautious about inferring + the strong relationships and responsibilities that might be implied + if these terms were used elsewhere. + +2.3.4 Host + + For the purposes of this specification, a host is a computer system + attached to the Internet (or, in some cases, to a private TCP/IP + network) and supporting the SMTP protocol. Hosts are known by names + (see "domain"); identifying them by numerical address is discouraged. + +2.3.5 Domain + + A domain (or domain name) consists of one or more dot-separated + components. These components ("labels" in DNS terminology [22]) are + restricted for SMTP purposes to consist of a sequence of letters, + digits, and hyphens drawn from the ASCII character set [1]. Domain + names are used as names of hosts and of other entities in the domain + name hierarchy. For example, a domain may refer to an alias (label + of a CNAME RR) or the label of Mail eXchanger records to be used to + deliver mail instead of representing a host name. See [22] and + section 5 of this specification. + + The domain name, as described in this document and in [22], is the + entire, fully-qualified name (often referred to as an "FQDN"). A + domain name that is not in FQDN form is no more than a local alias. + Local aliases MUST NOT appear in any SMTP transaction. + +2.3.6 Buffer and State Table + + SMTP sessions are stateful, with both parties carefully maintaining a + common view of the current state. In this document we model this + state by a virtual "buffer" and a "state table" on the server which + may be used by the client to, for example, "clear the buffer" or + "reset the state table," causing the information in the buffer to be + discarded and the state to be returned to some previous state. + + + + + + + +Klensin Standards Track [Page 11] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +2.3.7 Lines + + SMTP commands and, unless altered by a service extension, message + data, are transmitted in "lines". Lines consist of zero or more data + characters terminated by the sequence ASCII character "CR" (hex value + 0D) followed immediately by ASCII character "LF" (hex value 0A). + This termination sequence is denoted as in this document. + Conforming implementations MUST NOT recognize or generate any other + character or character sequence as a line terminator. Limits MAY be + imposed on line lengths by servers (see section 4.5.3). + + In addition, the appearance of "bare" "CR" or "LF" characters in text + (i.e., either without the other) has a long history of causing + problems in mail implementations and applications that use the mail + system as a tool. SMTP client implementations MUST NOT transmit + these characters except when they are intended as line terminators + and then MUST, as indicated above, transmit them only as a + sequence. + +2.3.8 Originator, Delivery, Relay, and Gateway Systems + + This specification makes a distinction among four types of SMTP + systems, based on the role those systems play in transmitting + electronic mail. An "originating" system (sometimes called an SMTP + originator) introduces mail into the Internet or, more generally, + into a transport service environment. A "delivery" SMTP system is + one that receives mail from a transport service environment and + passes it to a mail user agent or deposits it in a message store + which a mail user agent is expected to subsequently access. A + "relay" SMTP system (usually referred to just as a "relay") receives + mail from an SMTP client and transmits it, without modification to + the message data other than adding trace information, to another SMTP + server for further relaying or for delivery. + + A "gateway" SMTP system (usually referred to just as a "gateway") + receives mail from a client system in one transport environment and + transmits it to a server system in another transport environment. + Differences in protocols or message semantics between the transport + environments on either side of a gateway may require that the gateway + system perform transformations to the message that are not permitted + to SMTP relay systems. For the purposes of this specification, + firewalls that rewrite addresses should be considered as gateways, + even if SMTP is used on both sides of them (see [11]). + + + + + + + + +Klensin Standards Track [Page 12] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +2.3.9 Message Content and Mail Data + + The terms "message content" and "mail data" are used interchangeably + in this document to describe the material transmitted after the DATA + command is accepted and before the end of data indication is + transmitted. Message content includes message headers and the + possibly-structured message body. The MIME specification [12] + provides the standard mechanisms for structured message bodies. + +2.3.10 Mailbox and Address + + As used in this specification, an "address" is a character string + that identifies a user to whom mail will be sent or a location into + which mail will be deposited. The term "mailbox" refers to that + depository. The two terms are typically used interchangeably unless + the distinction between the location in which mail is placed (the + mailbox) and a reference to it (the address) is important. An + address normally consists of user and domain specifications. The + standard mailbox naming convention is defined to be "local- + part@domain": contemporary usage permits a much broader set of + applications than simple "user names". Consequently, and due to a + long history of problems when intermediate hosts have attempted to + optimize transport by modifying them, the local-part MUST be + interpreted and assigned semantics only by the host specified in the + domain part of the address. + +2.3.11 Reply + + An SMTP reply is an acknowledgment (positive or negative) sent from + receiver to sender via the transmission channel in response to a + command. The general form of a reply is a numeric completion code + (indicating failure or success) usually followed by a text string. + The codes are for use by programs and the text is usually intended + for human users. Recent work [34] has specified further structuring + of the reply strings, including the use of supplemental and more + specific completion codes. + +2.4 General Syntax Principles and Transaction Model + + SMTP commands and replies have a rigid syntax. All commands begin + with a command verb. All Replies begin with a three digit numeric + code. In some commands and replies, arguments MUST follow the verb + or reply code. Some commands do not accept arguments (after the + verb), and some reply codes are followed, sometimes optionally, by + free form text. In both cases, where text appears, it is separated + from the verb or reply code by a space character. Complete + definitions of commands and replies appear in section 4. + + + + +Klensin Standards Track [Page 13] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + Verbs and argument values (e.g., "TO:" or "to:" in the RCPT command + and extension name keywords) are not case sensitive, with the sole + exception in this specification of a mailbox local-part (SMTP + Extensions may explicitly specify case-sensitive elements). That is, + a command verb, an argument value other than a mailbox local-part, + and free form text MAY be encoded in upper case, lower case, or any + mixture of upper and lower case with no impact on its meaning. This + is NOT true of a mailbox local-part. The local-part of a mailbox + MUST BE treated as case sensitive. Therefore, SMTP implementations + MUST take care to preserve the case of mailbox local-parts. Mailbox + domains are not case sensitive. In particular, for some hosts the + user "smith" is different from the user "Smith". However, exploiting + the case sensitivity of mailbox local-parts impedes interoperability + and is discouraged. + + A few SMTP servers, in violation of this specification (and RFC 821) + require that command verbs be encoded by clients in upper case. + Implementations MAY wish to employ this encoding to accommodate those + servers. + + The argument field consists of a variable length character string + ending with the end of the line, i.e., with the character sequence + . The receiver will take no action until this sequence is + received. + + The syntax for each command is shown with the discussion of that + command. Common elements and parameters are shown in section 4.1.2. + + Commands and replies are composed of characters from the ASCII + character set [1]. When the transport service provides an 8-bit byte + (octet) transmission channel, each 7-bit character is transmitted + right justified in an octet with the high order bit cleared to zero. + More specifically, the unextended SMTP service provides seven bit + transport only. An originating SMTP client which has not + successfully negotiated an appropriate extension with a particular + server MUST NOT transmit messages with information in the high-order + bit of octets. If such messages are transmitted in violation of this + rule, receiving SMTP servers MAY clear the high-order bit or reject + the message as invalid. In general, a relay SMTP SHOULD assume that + the message content it has received is valid and, assuming that the + envelope permits doing so, relay it without inspecting that content. + Of course, if the content is mislabeled and the data path cannot + accept the actual content, this may result in ultimate delivery of a + severely garbled message to the recipient. Delivery SMTP systems MAY + reject ("bounce") such messages rather than deliver them. No sending + SMTP system is permitted to send envelope commands in any character + + + + + +Klensin Standards Track [Page 14] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + set other than US-ASCII; receiving systems SHOULD reject such + commands, normally using "500 syntax error - invalid character" + replies. + + Eight-bit message content transmission MAY be requested of the server + by a client using extended SMTP facilities, notably the "8BITMIME" + extension [20]. 8BITMIME SHOULD be supported by SMTP servers. + However, it MUST not be construed as authorization to transmit + unrestricted eight bit material. 8BITMIME MUST NOT be requested by + senders for material with the high bit on that is not in MIME format + with an appropriate content-transfer encoding; servers MAY reject + such messages. + + The metalinguistic notation used in this document corresponds to the + "Augmented BNF" used in other Internet mail system documents. The + reader who is not familiar with that syntax should consult the ABNF + specification [8]. Metalanguage terms used in running text are + surrounded by pointed brackets (e.g., ) for clarity. + +3. The SMTP Procedures: An Overview + + This section contains descriptions of the procedures used in SMTP: + session initiation, the mail transaction, forwarding mail, verifying + mailbox names and expanding mailing lists, and the opening and + closing exchanges. Comments on relaying, a note on mail domains, and + a discussion of changing roles are included at the end of this + section. Several complete scenarios are presented in appendix D. + +3.1 Session Initiation + + An SMTP session is initiated when a client opens a connection to a + server and the server responds with an opening message. + + SMTP server implementations MAY include identification of their + software and version information in the connection greeting reply + after the 220 code, a practice that permits more efficient isolation + and repair of any problems. Implementations MAY make provision for + SMTP servers to disable the software and version announcement where + it causes security concerns. While some systems also identify their + contact point for mail problems, this is not a substitute for + maintaining the required "postmaster" address (see section 4.5.1). + + The SMTP protocol allows a server to formally reject a transaction + while still allowing the initial connection as follows: a 554 + response MAY be given in the initial connection opening message + instead of the 220. A server taking this approach MUST still wait + for the client to send a QUIT (see section 4.1.1.10) before closing + the connection and SHOULD respond to any intervening commands with + + + +Klensin Standards Track [Page 15] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + "503 bad sequence of commands". Since an attempt to make an SMTP + connection to such a system is probably in error, a server returning + a 554 response on connection opening SHOULD provide enough + information in the reply text to facilitate debugging of the sending + system. + +3.2 Client Initiation + + Once the server has sent the welcoming message and the client has + received it, the client normally sends the EHLO command to the + server, indicating the client's identity. In addition to opening the + session, use of EHLO indicates that the client is able to process + service extensions and requests that the server provide a list of the + extensions it supports. Older SMTP systems which are unable to + support service extensions and contemporary clients which do not + require service extensions in the mail session being initiated, MAY + use HELO instead of EHLO. Servers MUST NOT return the extended + EHLO-style response to a HELO command. For a particular connection + attempt, if the server returns a "command not recognized" response to + EHLO, the client SHOULD be able to fall back and send HELO. + + In the EHLO command the host sending the command identifies itself; + the command may be interpreted as saying "Hello, I am " (and, + in the case of EHLO, "and I support service extension requests"). + +3.3 Mail Transactions + + There are three steps to SMTP mail transactions. The transaction + starts with a MAIL command which gives the sender identification. + (In general, the MAIL command may be sent only when no mail + transaction is in progress; see section 4.1.4.) A series of one or + more RCPT commands follows giving the receiver information. Then a + DATA command initiates transfer of the mail data and is terminated by + the "end of mail" data indicator, which also confirms the + transaction. + + The first step in the procedure is the MAIL command. + + MAIL FROM: [SP ] + + This command tells the SMTP-receiver that a new mail transaction is + starting and to reset all its state tables and buffers, including any + recipients or mail data. The portion of the first or + only argument contains the source mailbox (between "<" and ">" + brackets), which can be used to report errors (see section 4.2 for a + discussion of error reporting). If accepted, the SMTP server returns + a 250 OK reply. If the mailbox specification is not acceptable for + some reason, the server MUST return a reply indicating whether the + + + +Klensin Standards Track [Page 16] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + failure is permanent (i.e., will occur again if the client tries to + send the same address again) or temporary (i.e., the address might be + accepted if the client tries again later). Despite the apparent + scope of this requirement, there are circumstances in which the + acceptability of the reverse-path may not be determined until one or + more forward-paths (in RCPT commands) can be examined. In those + cases, the server MAY reasonably accept the reverse-path (with a 250 + reply) and then report problems after the forward-paths are received + and examined. Normally, failures produce 550 or 553 replies. + + Historically, the can contain more than just a + mailbox, however, contemporary systems SHOULD NOT use source routing + (see appendix C). + + The optional are associated with negotiated SMTP + service extensions (see section 2.2). + + The second step in the procedure is the RCPT command. + + RCPT TO: [ SP ] + + The first or only argument to this command includes a forward-path + (normally a mailbox and domain, always surrounded by "<" and ">" + brackets) identifying one recipient. If accepted, the SMTP server + returns a 250 OK reply and stores the forward-path. If the recipient + is known not to be a deliverable address, the SMTP server returns a + 550 reply, typically with a string such as "no such user - " and the + mailbox name (other circumstances and reply codes are possible). + This step of the procedure can be repeated any number of times. + + The can contain more than just a mailbox. + Historically, the can be a source routing list of + hosts and the destination mailbox, however, contemporary SMTP clients + SHOULD NOT utilize source routes (see appendix C). Servers MUST be + prepared to encounter a list of source routes in the forward path, + but SHOULD ignore the routes or MAY decline to support the relaying + they imply. Similarly, servers MAY decline to accept mail that is + destined for other hosts or systems. These restrictions make a + server useless as a relay for clients that do not support full SMTP + functionality. Consequently, restricted-capability clients MUST NOT + assume that any SMTP server on the Internet can be used as their mail + processing (relaying) site. If a RCPT command appears without a + previous MAIL command, the server MUST return a 503 "Bad sequence of + commands" response. The optional are associated + with negotiated SMTP service extensions (see section 2.2). + + The third step in the procedure is the DATA command (or some + alternative specified in a service extension). + + + +Klensin Standards Track [Page 17] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + DATA + + If accepted, the SMTP server returns a 354 Intermediate reply and + considers all succeeding lines up to but not including the end of + mail data indicator to be the message text. When the end of text is + successfully received and stored the SMTP-receiver sends a 250 OK + reply. + + Since the mail data is sent on the transmission channel, the end of + mail data must be indicated so that the command and reply dialog can + be resumed. SMTP indicates the end of the mail data by sending a + line containing only a "." (period or full stop). A transparency + procedure is used to prevent this from interfering with the user's + text (see section 4.5.2). + + The end of mail data indicator also confirms the mail transaction and + tells the SMTP server to now process the stored recipients and mail + data. If accepted, the SMTP server returns a 250 OK reply. The DATA + command can fail at only two points in the protocol exchange: + + - If there was no MAIL, or no RCPT, command, or all such commands + were rejected, the server MAY return a "command out of sequence" + (503) or "no valid recipients" (554) reply in response to the DATA + command. If one of those replies (or any other 5yz reply) is + received, the client MUST NOT send the message data; more + generally, message data MUST NOT be sent unless a 354 reply is + received. + + - If the verb is initially accepted and the 354 reply issued, the + DATA command should fail only if the mail transaction was + incomplete (for example, no recipients), or if resources were + unavailable (including, of course, the server unexpectedly + becoming unavailable), or if the server determines that the + message should be rejected for policy or other reasons. + + However, in practice, some servers do not perform recipient + verification until after the message text is received. These servers + SHOULD treat a failure for one or more recipients as a "subsequent + failure" and return a mail message as discussed in section 6. Using + a "550 mailbox not found" (or equivalent) reply code after the data + are accepted makes it difficult or impossible for the client to + determine which recipients failed. + + When RFC 822 format [7, 32] is being used, the mail data include the + memo header items such as Date, Subject, To, Cc, From. Server SMTP + systems SHOULD NOT reject messages based on perceived defects in the + RFC 822 or MIME [12] message header or message body. In particular, + + + + +Klensin Standards Track [Page 18] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + they MUST NOT reject messages in which the numbers of Resent-fields + do not match or Resent-to appears without Resent-from and/or Resent- + date. + + Mail transaction commands MUST be used in the order discussed above. + +3.4 Forwarding for Address Correction or Updating + + Forwarding support is most often required to consolidate and simplify + addresses within, or relative to, some enterprise and less frequently + to establish addresses to link a person's prior address with current + one. Silent forwarding of messages (without server notification to + the sender), for security or non-disclosure purposes, is common in + the contemporary Internet. + + In both the enterprise and the "new address" cases, information + hiding (and sometimes security) considerations argue against exposure + of the "final" address through the SMTP protocol as a side-effect of + the forwarding activity. This may be especially important when the + final address may not even be reachable by the sender. Consequently, + the "forwarding" mechanisms described in section 3.2 of RFC 821, and + especially the 251 (corrected destination) and 551 reply codes from + RCPT must be evaluated carefully by implementers and, when they are + available, by those configuring systems. + + In particular: + + * Servers MAY forward messages when they are aware of an address + change. When they do so, they MAY either provide address-updating + information with a 251 code, or may forward "silently" and return + a 250 code. But, if a 251 code is used, they MUST NOT assume that + the client will actually update address information or even return + that information to the user. + + Alternately, + + * Servers MAY reject or bounce messages when they are not + deliverable when addressed. When they do so, they MAY either + provide address-updating information with a 551 code, or may + reject the message as undeliverable with a 550 code and no + address-specific information. But, if a 551 code is used, they + MUST NOT assume that the client will actually update address + information or even return that information to the user. + + SMTP server implementations that support the 251 and/or 551 reply + codes are strongly encouraged to provide configuration mechanisms so + that sites which conclude that they would undesirably disclose + information can disable or restrict their use. + + + +Klensin Standards Track [Page 19] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +3.5 Commands for Debugging Addresses + +3.5.1 Overview + + SMTP provides commands to verify a user name or obtain the content of + a mailing list. This is done with the VRFY and EXPN commands, which + have character string arguments. Implementations SHOULD support VRFY + and EXPN (however, see section 3.5.2 and 7.3). + + For the VRFY command, the string is a user name or a user name and + domain (see below). If a normal (i.e., 250) response is returned, + the response MAY include the full name of the user and MUST include + the mailbox of the user. It MUST be in either of the following + forms: + + User Name + local-part@domain + + When a name that is the argument to VRFY could identify more than one + mailbox, the server MAY either note the ambiguity or identify the + alternatives. In other words, any of the following are legitimate + response to VRFY: + + 553 User ambiguous + + or + + 553- Ambiguous; Possibilities are + 553-Joe Smith + 553-Harry Smith + 553 Melvin Smith + + or + + 553-Ambiguous; Possibilities + 553- + 553- + 553 + + Under normal circumstances, a client receiving a 553 reply would be + expected to expose the result to the user. Use of exactly the forms + given, and the "user ambiguous" or "ambiguous" keywords, possibly + supplemented by extended reply codes such as those described in [34], + will facilitate automated translation into other languages as needed. + Of course, a client that was highly automated or that was operating + in another language than English, might choose to try to translate + the response, to return some other indication to the user than the + + + + +Klensin Standards Track [Page 20] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + literal text of the reply, or to take some automated action such as + consulting a directory service for additional information before + reporting to the user. + + For the EXPN command, the string identifies a mailing list, and the + successful (i.e., 250) multiline response MAY include the full name + of the users and MUST give the mailboxes on the mailing list. + + In some hosts the distinction between a mailing list and an alias for + a single mailbox is a bit fuzzy, since a common data structure may + hold both types of entries, and it is possible to have mailing lists + containing only one mailbox. If a request is made to apply VRFY to a + mailing list, a positive response MAY be given if a message so + addressed would be delivered to everyone on the list, otherwise an + error SHOULD be reported (e.g., "550 That is a mailing list, not a + user" or "252 Unable to verify members of mailing list"). If a + request is made to expand a user name, the server MAY return a + positive response consisting of a list containing one name, or an + error MAY be reported (e.g., "550 That is a user name, not a mailing + list"). + + In the case of a successful multiline reply (normal for EXPN) exactly + one mailbox is to be specified on each line of the reply. The case + of an ambiguous request is discussed above. + + "User name" is a fuzzy term and has been used deliberately. An + implementation of the VRFY or EXPN commands MUST include at least + recognition of local mailboxes as "user names". However, since + current Internet practice often results in a single host handling + mail for multiple domains, hosts, especially hosts that provide this + functionality, SHOULD accept the "local-part@domain" form as a "user + name"; hosts MAY also choose to recognize other strings as "user + names". + + The case of expanding a mailbox list requires a multiline reply, such + as: + + C: EXPN Example-People + S: 250-Jon Postel + S: 250-Fred Fonebone + S: 250 Sam Q. Smith + + or + + C: EXPN Executive-Washroom-List + S: 550 Access Denied to You. + + + + + +Klensin Standards Track [Page 21] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + The character string arguments of the VRFY and EXPN commands cannot + be further restricted due to the variety of implementations of the + user name and mailbox list concepts. On some systems it may be + appropriate for the argument of the EXPN command to be a file name + for a file containing a mailing list, but again there are a variety + of file naming conventions in the Internet. Similarly, historical + variations in what is returned by these commands are such that the + response SHOULD be interpreted very carefully, if at all, and SHOULD + generally only be used for diagnostic purposes. + +3.5.2 VRFY Normal Response + + When normal (2yz or 551) responses are returned from a VRFY or EXPN + request, the reply normally includes the mailbox name, i.e., + "", where "domain" is a fully qualified domain + name, MUST appear in the syntax. In circumstances exceptional enough + to justify violating the intent of this specification, free-form text + MAY be returned. In order to facilitate parsing by both computers + and people, addresses SHOULD appear in pointed brackets. When + addresses, rather than free-form debugging information, are returned, + EXPN and VRFY MUST return only valid domain addresses that are usable + in SMTP RCPT commands. Consequently, if an address implies delivery + to a program or other system, the mailbox name used to reach that + target MUST be given. Paths (explicit source routes) MUST NOT be + returned by VRFY or EXPN. + + Server implementations SHOULD support both VRFY and EXPN. For + security reasons, implementations MAY provide local installations a + way to disable either or both of these commands through configuration + options or the equivalent. When these commands are supported, they + are not required to work across relays when relaying is supported. + Since they were both optional in RFC 821, they MUST be listed as + service extensions in an EHLO response, if they are supported. + +3.5.3 Meaning of VRFY or EXPN Success Response + + A server MUST NOT return a 250 code in response to a VRFY or EXPN + command unless it has actually verified the address. In particular, + a server MUST NOT return 250 if all it has done is to verify that the + syntax given is valid. In that case, 502 (Command not implemented) + or 500 (Syntax error, command unrecognized) SHOULD be returned. As + stated elsewhere, implementation (in the sense of actually validating + addresses and returning information) of VRFY and EXPN are strongly + recommended. Hence, implementations that return 500 or 502 for VRFY + are not in full compliance with this specification. + + + + + + +Klensin Standards Track [Page 22] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + There may be circumstances where an address appears to be valid but + cannot reasonably be verified in real time, particularly when a + server is acting as a mail exchanger for another server or domain. + "Apparent validity" in this case would normally involve at least + syntax checking and might involve verification that any domains + specified were ones to which the host expected to be able to relay + mail. In these situations, reply code 252 SHOULD be returned. These + cases parallel the discussion of RCPT verification discussed in + section 2.1. Similarly, the discussion in section 3.4 applies to the + use of reply codes 251 and 551 with VRFY (and EXPN) to indicate + addresses that are recognized but that would be forwarded or bounced + were mail received for them. Implementations generally SHOULD be + more aggressive about address verification in the case of VRFY than + in the case of RCPT, even if it takes a little longer to do so. + +3.5.4 Semantics and Applications of EXPN + + EXPN is often very useful in debugging and understanding problems + with mailing lists and multiple-target-address aliases. Some systems + have attempted to use source expansion of mailing lists as a means of + eliminating duplicates. The propagation of aliasing systems with + mail on the Internet, for hosts (typically with MX and CNAME DNS + records), for mailboxes (various types of local host aliases), and in + various proxying arrangements, has made it nearly impossible for + these strategies to work consistently, and mail systems SHOULD NOT + attempt them. + +3.6 Domains + + Only resolvable, fully-qualified, domain names (FQDNs) are permitted + when domain names are used in SMTP. In other words, names that can + be resolved to MX RRs or A RRs (as discussed in section 5) are + permitted, as are CNAME RRs whose targets can be resolved, in turn, + to MX or A RRs. Local nicknames or unqualified names MUST NOT be + used. There are two exceptions to the rule requiring FQDNs: + + - The domain name given in the EHLO command MUST BE either a primary + host name (a domain name that resolves to an A RR) or, if the host + has no name, an address literal as described in section 4.1.1.1. + + - The reserved mailbox name "postmaster" may be used in a RCPT + command without domain qualification (see section 4.1.1.3) and + MUST be accepted if so used. + + + + + + + + +Klensin Standards Track [Page 23] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +3.7 Relaying + + In general, the availability of Mail eXchanger records in the domain + name system [22, 27] makes the use of explicit source routes in the + Internet mail system unnecessary. Many historical problems with + their interpretation have made their use undesirable. SMTP clients + SHOULD NOT generate explicit source routes except under unusual + circumstances. SMTP servers MAY decline to act as mail relays or to + accept addresses that specify source routes. When route information + is encountered, SMTP servers are also permitted to ignore the route + information and simply send to the final destination specified as the + last element in the route and SHOULD do so. There has been an + invalid practice of using names that do not appear in the DNS as + destination names, with the senders counting on the intermediate + hosts specified in source routing to resolve any problems. If source + routes are stripped, this practice will cause failures. This is one + of several reasons why SMTP clients MUST NOT generate invalid source + routes or depend on serial resolution of names. + + When source routes are not used, the process described in RFC 821 for + constructing a reverse-path from the forward-path is not applicable + and the reverse-path at the time of delivery will simply be the + address that appeared in the MAIL command. + + A relay SMTP server is usually the target of a DNS MX record that + designates it, rather than the final delivery system. The relay + server may accept or reject the task of relaying the mail in the same + way it accepts or rejects mail for a local user. If it accepts the + task, it then becomes an SMTP client, establishes a transmission + channel to the next SMTP server specified in the DNS (according to + the rules in section 5), and sends it the mail. If it declines to + relay mail to a particular address for policy reasons, a 550 response + SHOULD be returned. + + Many mail-sending clients exist, especially in conjunction with + facilities that receive mail via POP3 or IMAP, that have limited + capability to support some of the requirements of this specification, + such as the ability to queue messages for subsequent delivery + attempts. For these clients, it is common practice to make private + arrangements to send all messages to a single server for processing + and subsequent distribution. SMTP, as specified here, is not ideally + suited for this role, and work is underway on standardized mail + submission protocols that might eventually supercede the current + practices. In any event, because these arrangements are private and + fall outside the scope of this specification, they are not described + here. + + + + + +Klensin Standards Track [Page 24] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + It is important to note that MX records can point to SMTP servers + which act as gateways into other environments, not just SMTP relays + and final delivery systems; see sections 3.8 and 5. + + If an SMTP server has accepted the task of relaying the mail and + later finds that the destination is incorrect or that the mail cannot + be delivered for some other reason, then it MUST construct an + "undeliverable mail" notification message and send it to the + originator of the undeliverable mail (as indicated by the reverse- + path). Formats specified for non-delivery reports by other standards + (see, for example, [24, 25]) SHOULD be used if possible. + + This notification message must be from the SMTP server at the relay + host or the host that first determines that delivery cannot be + accomplished. Of course, SMTP servers MUST NOT send notification + messages about problems transporting notification messages. One way + to prevent loops in error reporting is to specify a null reverse-path + in the MAIL command of a notification message. When such a message + is transmitted the reverse-path MUST be set to null (see section + 4.5.5 for additional discussion). A MAIL command with a null + reverse-path appears as follows: + + MAIL FROM:<> + + As discussed in section 2.4.1, a relay SMTP has no need to inspect or + act upon the headers or body of the message data and MUST NOT do so + except to add its own "Received:" header (section 4.4) and, + optionally, to attempt to detect looping in the mail system (see + section 6.2). + +3.8 Mail Gatewaying + + While the relay function discussed above operates within the Internet + SMTP transport service environment, MX records or various forms of + explicit routing may require that an intermediate SMTP server perform + a translation function between one transport service and another. As + discussed in section 2.3.8, when such a system is at the boundary + between two transport service environments, we refer to it as a + "gateway" or "gateway SMTP". + + Gatewaying mail between different mail environments, such as + different mail formats and protocols, is complex and does not easily + yield to standardization. However, some general requirements may be + given for a gateway between the Internet and another mail + environment. + + + + + + +Klensin Standards Track [Page 25] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +3.8.1 Header Fields in Gatewaying + + Header fields MAY be rewritten when necessary as messages are + gatewayed across mail environment boundaries. This may involve + inspecting the message body or interpreting the local-part of the + destination address in spite of the prohibitions in section 2.4.1. + + Other mail systems gatewayed to the Internet often use a subset of + RFC 822 headers or provide similar functionality with a different + syntax, but some of these mail systems do not have an equivalent to + the SMTP envelope. Therefore, when a message leaves the Internet + environment, it may be necessary to fold the SMTP envelope + information into the message header. A possible solution would be to + create new header fields to carry the envelope information (e.g., + "X-SMTP-MAIL:" and "X-SMTP-RCPT:"); however, this would require + changes in mail programs in foreign environments and might risk + disclosure of private information (see section 7.2). + +3.8.2 Received Lines in Gatewaying + + When forwarding a message into or out of the Internet environment, a + gateway MUST prepend a Received: line, but it MUST NOT alter in any + way a Received: line that is already in the header. + + "Received:" fields of messages originating from other environments + may not conform exactly to this specification. However, the most + important use of Received: lines is for debugging mail faults, and + this debugging can be severely hampered by well-meaning gateways that + try to "fix" a Received: line. As another consequence of trace + fields arising in non-SMTP environments, receiving systems MUST NOT + reject mail based on the format of a trace field and SHOULD be + extremely robust in the light of unexpected information or formats in + those fields. + + The gateway SHOULD indicate the environment and protocol in the "via" + clauses of Received field(s) that it supplies. + +3.8.3 Addresses in Gatewaying + + From the Internet side, the gateway SHOULD accept all valid address + formats in SMTP commands and in RFC 822 headers, and all valid RFC + 822 messages. Addresses and headers generated by gateways MUST + conform to applicable Internet standards (including this one and RFC + 822). Gateways are, of course, subject to the same rules for + handling source routes as those described for other SMTP systems in + section 3.3. + + + + + +Klensin Standards Track [Page 26] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +3.8.4 Other Header Fields in Gatewaying + + The gateway MUST ensure that all header fields of a message that it + forwards into the Internet mail environment meet the requirements for + Internet mail. In particular, all addresses in "From:", "To:", + "Cc:", etc., fields MUST be transformed (if necessary) to satisfy RFC + 822 syntax, MUST reference only fully-qualified domain names, and + MUST be effective and useful for sending replies. The translation + algorithm used to convert mail from the Internet protocols to another + environment's protocol SHOULD ensure that error messages from the + foreign mail environment are delivered to the return path from the + SMTP envelope, not to the sender listed in the "From:" field (or + other fields) of the RFC 822 message. + +3.8.5 Envelopes in Gatewaying + + Similarly, when forwarding a message from another environment into + the Internet, the gateway SHOULD set the envelope return path in + accordance with an error message return address, if supplied by the + foreign environment. If the foreign environment has no equivalent + concept, the gateway must select and use a best approximation, with + the message originator's address as the default of last resort. + +3.9 Terminating Sessions and Connections + + An SMTP connection is terminated when the client sends a QUIT + command. The server responds with a positive reply code, after which + it closes the connection. + + An SMTP server MUST NOT intentionally close the connection except: + + - After receiving a QUIT command and responding with a 221 reply. + + - After detecting the need to shut down the SMTP service and + returning a 421 response code. This response code can be issued + after the server receives any command or, if necessary, + asynchronously from command receipt (on the assumption that the + client will receive it after the next command is issued). + + In particular, a server that closes connections in response to + commands that are not understood is in violation of this + specification. Servers are expected to be tolerant of unknown + commands, issuing a 500 reply and awaiting further instructions from + the client. + + + + + + + +Klensin Standards Track [Page 27] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + An SMTP server which is forcibly shut down via external means SHOULD + attempt to send a line containing a 421 response code to the SMTP + client before exiting. The SMTP client will normally read the 421 + response code after sending its next command. + + SMTP clients that experience a connection close, reset, or other + communications failure due to circumstances not under their control + (in violation of the intent of this specification but sometimes + unavoidable) SHOULD, to maintain the robustness of the mail system, + treat the mail transaction as if a 451 response had been received and + act accordingly. + +3.10 Mailing Lists and Aliases + + An SMTP-capable host SHOULD support both the alias and the list + models of address expansion for multiple delivery. When a message is + delivered or forwarded to each address of an expanded list form, the + return address in the envelope ("MAIL FROM:") MUST be changed to be + the address of a person or other entity who administers the list. + However, in this case, the message header [32] MUST be left + unchanged; in particular, the "From" field of the message header is + unaffected. + + An important mail facility is a mechanism for multi-destination + delivery of a single message, by transforming (or "expanding" or + "exploding") a pseudo-mailbox address into a list of destination + mailbox addresses. When a message is sent to such a pseudo-mailbox + (sometimes called an "exploder"), copies are forwarded or + redistributed to each mailbox in the expanded list. Servers SHOULD + simply utilize the addresses on the list; application of heuristics + or other matching rules to eliminate some addresses, such as that of + the originator, is strongly discouraged. We classify such a pseudo- + mailbox as an "alias" or a "list", depending upon the expansion + rules. + +3.10.1 Alias + + To expand an alias, the recipient mailer simply replaces the pseudo- + mailbox address in the envelope with each of the expanded addresses + in turn; the rest of the envelope and the message body are left + unchanged. The message is then delivered or forwarded to each + expanded address. + +3.10.2 List + + A mailing list may be said to operate by "redistribution" rather than + by "forwarding". To expand a list, the recipient mailer replaces the + pseudo-mailbox address in the envelope with all of the expanded + + + +Klensin Standards Track [Page 28] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + addresses. The return address in the envelope is changed so that all + error messages generated by the final deliveries will be returned to + a list administrator, not to the message originator, who generally + has no control over the contents of the list and will typically find + error messages annoying. + +4. The SMTP Specifications + +4.1 SMTP Commands + +4.1.1 Command Semantics and Syntax + + The SMTP commands define the mail transfer or the mail system + function requested by the user. SMTP commands are character strings + terminated by . The commands themselves are alphabetic + characters terminated by if parameters follow and + otherwise. (In the interest of improved interoperability, SMTP + receivers are encouraged to tolerate trailing white space before the + terminating .) The syntax of the local part of a mailbox must + conform to receiver site conventions and the syntax specified in + section 4.1.2. The SMTP commands are discussed below. The SMTP + replies are discussed in section 4.2. + + A mail transaction involves several data objects which are + communicated as arguments to different commands. The reverse-path is + the argument of the MAIL command, the forward-path is the argument of + the RCPT command, and the mail data is the argument of the DATA + command. These arguments or data objects must be transmitted and + held pending the confirmation communicated by the end of mail data + indication which finalizes the transaction. The model for this is + that distinct buffers are provided to hold the types of data objects, + that is, there is a reverse-path buffer, a forward-path buffer, and a + mail data buffer. Specific commands cause information to be appended + to a specific buffer, or cause one or more buffers to be cleared. + + Several commands (RSET, DATA, QUIT) are specified as not permitting + parameters. In the absence of specific extensions offered by the + server and accepted by the client, clients MUST NOT send such + parameters and servers SHOULD reject commands containing them as + having invalid syntax. + +4.1.1.1 Extended HELLO (EHLO) or HELLO (HELO) + + These commands are used to identify the SMTP client to the SMTP + server. The argument field contains the fully-qualified domain name + of the SMTP client if one is available. In situations in which the + SMTP client system does not have a meaningful domain name (e.g., when + its address is dynamically allocated and no reverse mapping record is + + + +Klensin Standards Track [Page 29] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + available), the client SHOULD send an address literal (see section + 4.1.3), optionally followed by information that will help to identify + the client system. y The SMTP server identifies itself to the SMTP + client in the connection greeting reply and in the response to this + command. + + A client SMTP SHOULD start an SMTP session by issuing the EHLO + command. If the SMTP server supports the SMTP service extensions it + will give a successful response, a failure response, or an error + response. If the SMTP server, in violation of this specification, + does not support any SMTP service extensions it will generate an + error response. Older client SMTP systems MAY, as discussed above, + use HELO (as specified in RFC 821) instead of EHLO, and servers MUST + support the HELO command and reply properly to it. In any event, a + client MUST issue HELO or EHLO before starting a mail transaction. + + These commands, and a "250 OK" reply to one of them, confirm that + both the SMTP client and the SMTP server are in the initial state, + that is, there is no transaction in progress and all state tables and + buffers are cleared. + + Syntax: + + ehlo = "EHLO" SP Domain CRLF + helo = "HELO" SP Domain CRLF + + Normally, the response to EHLO will be a multiline reply. Each line + of the response contains a keyword and, optionally, one or more + parameters. Following the normal syntax for multiline replies, these + keyworks follow the code (250) and a hyphen for all but the last + line, and the code and a space for the last line. The syntax for a + positive response, using the ABNF notation and terminal symbols of + [8], is: + + ehlo-ok-rsp = ( "250" domain [ SP ehlo-greet ] CRLF ) + / ( "250-" domain [ SP ehlo-greet ] CRLF + *( "250-" ehlo-line CRLF ) + "250" SP ehlo-line CRLF ) + + ehlo-greet = 1*(%d0-9 / %d11-12 / %d14-127) + ; string of any characters other than CR or LF + + ehlo-line = ehlo-keyword *( SP ehlo-param ) + + ehlo-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") + ; additional syntax of ehlo-params depends on + ; ehlo-keyword + + + + +Klensin Standards Track [Page 30] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + ehlo-param = 1*(%d33-127) + ; any CHAR excluding and all + ; control characters (US-ASCII 0-31 inclusive) + + Although EHLO keywords may be specified in upper, lower, or mixed + case, they MUST always be recognized and processed in a case- + insensitive manner. This is simply an extension of practices + specified in RFC 821 and section 2.4.1. + +4.1.1.2 MAIL (MAIL) + + This command is used to initiate a mail transaction in which the mail + data is delivered to an SMTP server which may, in turn, deliver it to + one or more mailboxes or pass it on to another system (possibly using + SMTP). The argument field contains a reverse-path and may contain + optional parameters. In general, the MAIL command may be sent only + when no mail transaction is in progress, see section 4.1.4. + + The reverse-path consists of the sender mailbox. Historically, that + mailbox might optionally have been preceded by a list of hosts, but + that behavior is now deprecated (see appendix C). In some types of + reporting messages for which a reply is likely to cause a mail loop + (for example, mail delivery and nondelivery notifications), the + reverse-path may be null (see section 3.7). + + This command clears the reverse-path buffer, the forward-path buffer, + and the mail data buffer; and inserts the reverse-path information + from this command into the reverse-path buffer. + + If service extensions were negotiated, the MAIL command may also + carry parameters associated with a particular service extension. + + Syntax: + + "MAIL FROM:" ("<>" / Reverse-Path) + [SP Mail-parameters] CRLF + +4.1.1.3 RECIPIENT (RCPT) + + This command is used to identify an individual recipient of the mail + data; multiple recipients are specified by multiple use of this + command. The argument field contains a forward-path and may contain + optional parameters. + + The forward-path normally consists of the required destination + mailbox. Sending systems SHOULD not generate the optional list of + hosts known as a source route. Receiving systems MUST recognize + + + + +Klensin Standards Track [Page 31] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + source route syntax but SHOULD strip off the source route + specification and utilize the domain name associated with the mailbox + as if the source route had not been provided. + + Similarly, relay hosts SHOULD strip or ignore source routes, and + names MUST NOT be copied into the reverse-path. When mail reaches + its ultimate destination (the forward-path contains only a + destination mailbox), the SMTP server inserts it into the destination + mailbox in accordance with its host mail conventions. + + For example, mail received at relay host xyz.com with envelope + commands + + MAIL FROM: + RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> + + will normally be sent directly on to host d.bar.org with envelope + commands + + MAIL FROM: + RCPT TO: + + As provided in appendix C, xyz.com MAY also choose to relay the + message to hosta.int, using the envelope commands + + MAIL FROM: + RCPT TO:<@hosta.int,@jkl.org:userc@d.bar.org> + + or to jkl.org, using the envelope commands + + MAIL FROM: + RCPT TO:<@jkl.org:userc@d.bar.org> + + Of course, since hosts are not required to relay mail at all, xyz.com + may also reject the message entirely when the RCPT command is + received, using a 550 code (since this is a "policy reason"). + + If service extensions were negotiated, the RCPT command may also + carry parameters associated with a particular service extension + offered by the server. The client MUST NOT transmit parameters other + than those associated with a service extension offered by the server + in its EHLO response. + +Syntax: + "RCPT TO:" ("" / "" / Forward-Path) + [SP Rcpt-parameters] CRLF + + + + + +Klensin Standards Track [Page 32] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +4.1.1.4 DATA (DATA) + + The receiver normally sends a 354 response to DATA, and then treats + the lines (strings ending in sequences, as described in + section 2.3.7) following the command as mail data from the sender. + This command causes the mail data to be appended to the mail data + buffer. The mail data may contain any of the 128 ASCII character + codes, although experience has indicated that use of control + characters other than SP, HT, CR, and LF may cause problems and + SHOULD be avoided when possible. + + The mail data is terminated by a line containing only a period, that + is, the character sequence "." (see section 4.5.2). This + is the end of mail data indication. Note that the first of + this terminating sequence is also the that ends the final line + of the data (message text) or, if there was no data, ends the DATA + command itself. An extra MUST NOT be added, as that would + cause an empty line to be added to the message. The only exception + to this rule would arise if the message body were passed to the + originating SMTP-sender with a final "line" that did not end in + ; in that case, the originating SMTP system MUST either reject + the message as invalid or add in order to have the receiving + SMTP server recognize the "end of data" condition. + + The custom of accepting lines ending only in , as a concession to + non-conforming behavior on the part of some UNIX systems, has proven + to cause more interoperability problems than it solves, and SMTP + server systems MUST NOT do this, even in the name of improved + robustness. In particular, the sequence "." (bare line + feeds, without carriage returns) MUST NOT be treated as equivalent to + . as the end of mail data indication. + + Receipt of the end of mail data indication requires the server to + process the stored mail transaction information. This processing + consumes the information in the reverse-path buffer, the forward-path + buffer, and the mail data buffer, and on the completion of this + command these buffers are cleared. If the processing is successful, + the receiver MUST send an OK reply. If the processing fails the + receiver MUST send a failure reply. The SMTP model does not allow + for partial failures at this point: either the message is accepted by + the server for delivery and a positive response is returned or it is + not accepted and a failure reply is returned. In sending a positive + completion reply to the end of data indication, the receiver takes + full responsibility for the message (see section 6.1). Errors that + are diagnosed subsequently MUST be reported in a mail message, as + discussed in section 4.4. + + + + + +Klensin Standards Track [Page 33] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + When the SMTP server accepts a message either for relaying or for + final delivery, it inserts a trace record (also referred to + interchangeably as a "time stamp line" or "Received" line) at the top + of the mail data. This trace record indicates the identity of the + host that sent the message, the identity of the host that received + the message (and is inserting this time stamp), and the date and time + the message was received. Relayed messages will have multiple time + stamp lines. Details for formation of these lines, including their + syntax, is specified in section 4.4. + + Additional discussion about the operation of the DATA command appears + in section 3.3. + + Syntax: + "DATA" CRLF + +4.1.1.5 RESET (RSET) + + This command specifies that the current mail transaction will be + aborted. Any stored sender, recipients, and mail data MUST be + discarded, and all buffers and state tables cleared. The receiver + MUST send a "250 OK" reply to a RSET command with no arguments. A + reset command may be issued by the client at any time. It is + effectively equivalent to a NOOP (i.e., if has no effect) if issued + immediately after EHLO, before EHLO is issued in the session, after + an end-of-data indicator has been sent and acknowledged, or + immediately before a QUIT. An SMTP server MUST NOT close the + connection as the result of receiving a RSET; that action is reserved + for QUIT (see section 4.1.1.10). + + Since EHLO implies some additional processing and response by the + server, RSET will normally be more efficient than reissuing that + command, even though the formal semantics are the same. + + There are circumstances, contrary to the intent of this + specification, in which an SMTP server may receive an indication that + the underlying TCP connection has been closed or reset. To preserve + the robustness of the mail system, SMTP servers SHOULD be prepared + for this condition and SHOULD treat it as if a QUIT had been received + before the connection disappeared. + + Syntax: + "RSET" CRLF + + + + + + + + +Klensin Standards Track [Page 34] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +4.1.1.6 VERIFY (VRFY) + + This command asks the receiver to confirm that the argument + identifies a user or mailbox. If it is a user name, information is + returned as specified in section 3.5. + + This command has no effect on the reverse-path buffer, the forward- + path buffer, or the mail data buffer. + + Syntax: + "VRFY" SP String CRLF + +4.1.1.7 EXPAND (EXPN) + + This command asks the receiver to confirm that the argument + identifies a mailing list, and if so, to return the membership of + that list. If the command is successful, a reply is returned + containing information as described in section 3.5. This reply will + have multiple lines except in the trivial case of a one-member list. + + This command has no effect on the reverse-path buffer, the forward- + path buffer, or the mail data buffer and may be issued at any time. + + Syntax: + "EXPN" SP String CRLF + +4.1.1.8 HELP (HELP) + + This command causes the server to send helpful information to the + client. The command MAY take an argument (e.g., any command name) + and return more specific information as a response. + + This command has no effect on the reverse-path buffer, the forward- + path buffer, or the mail data buffer and may be issued at any time. + + SMTP servers SHOULD support HELP without arguments and MAY support it + with arguments. + + Syntax: + "HELP" [ SP String ] CRLF + +4.1.1.9 NOOP (NOOP) + + This command does not affect any parameters or previously entered + commands. It specifies no action other than that the receiver send + an OK reply. + + + + + +Klensin Standards Track [Page 35] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + This command has no effect on the reverse-path buffer, the forward- + path buffer, or the mail data buffer and may be issued at any time. + If a parameter string is specified, servers SHOULD ignore it. + + Syntax: + "NOOP" [ SP String ] CRLF + +4.1.1.10 QUIT (QUIT) + + This command specifies that the receiver MUST send an OK reply, and + then close the transmission channel. + + The receiver MUST NOT intentionally close the transmission channel + until it receives and replies to a QUIT command (even if there was an + error). The sender MUST NOT intentionally close the transmission + channel until it sends a QUIT command and SHOULD wait until it + receives the reply (even if there was an error response to a previous + command). If the connection is closed prematurely due to violations + of the above or system or network failure, the server MUST cancel any + pending transaction, but not undo any previously completed + transaction, and generally MUST act as if the command or transaction + in progress had received a temporary error (i.e., a 4yz response). + + The QUIT command may be issued at any time. + + Syntax: + "QUIT" CRLF + +4.1.2 Command Argument Syntax + + The syntax of the argument fields of the above commands (using the + syntax specified in [8] where applicable) is given below. Some of + the productions given below are used only in conjunction with source + routes as described in appendix C. Terminals not defined in this + document, such as ALPHA, DIGIT, SP, CR, LF, CRLF, are as defined in + the "core" syntax [8 (section 6)] or in the message format syntax + [32]. + + Reverse-path = Path + Forward-path = Path + Path = "<" [ A-d-l ":" ] Mailbox ">" + A-d-l = At-domain *( "," A-d-l ) + ; Note that this form, the so-called "source route", + ; MUST BE accepted, SHOULD NOT be generated, and SHOULD be + ; ignored. + At-domain = "@" domain + Mail-parameters = esmtp-param *(SP esmtp-param) + Rcpt-parameters = esmtp-param *(SP esmtp-param) + + + +Klensin Standards Track [Page 36] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + esmtp-param = esmtp-keyword ["=" esmtp-value] + esmtp-keyword = (ALPHA / DIGIT) *(ALPHA / DIGIT / "-") + esmtp-value = 1*(%d33-60 / %d62-127) + ; any CHAR excluding "=", SP, and control characters + Keyword = Ldh-str + Argument = Atom + Domain = (sub-domain 1*("." sub-domain)) / address-literal + sub-domain = Let-dig [Ldh-str] + + address-literal = "[" IPv4-address-literal / + IPv6-address-literal / + General-address-literal "]" + ; See section 4.1.3 + + Mailbox = Local-part "@" Domain + + Local-part = Dot-string / Quoted-string + ; MAY be case-sensitive + + Dot-string = Atom *("." Atom) + + Atom = 1*atext + + Quoted-string = DQUOTE *qcontent DQUOTE + + String = Atom / Quoted-string + + While the above definition for Local-part is relatively permissive, + for maximum interoperability, a host that expects to receive mail + SHOULD avoid defining mailboxes where the Local-part requires (or + uses) the Quoted-string form or where the Local-part is case- + sensitive. For any purposes that require generating or comparing + Local-parts (e.g., to specific mailbox names), all quoted forms MUST + be treated as equivalent and the sending system SHOULD transmit the + form that uses the minimum quoting possible. + + Systems MUST NOT define mailboxes in such a way as to require the use + in SMTP of non-ASCII characters (octets with the high order bit set + to one) or ASCII "control characters" (decimal value 0-31 and 127). + These characters MUST NOT be used in MAIL or RCPT commands or other + commands that require mailbox names. + + Note that the backslash, "\", is a quote character, which is used to + indicate that the next character is to be used literally (instead of + its normal interpretation). For example, "Joe\,Smith" indicates a + single nine character user field with the comma being the fourth + character of the field. + + + + +Klensin Standards Track [Page 37] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + To promote interoperability and consistent with long-standing + guidance about conservative use of the DNS in naming and applications + (e.g., see section 2.3.1 of the base DNS document, RFC1035 [22]), + characters outside the set of alphas, digits, and hyphen MUST NOT + appear in domain name labels for SMTP clients or servers. In + particular, the underscore character is not permitted. SMTP servers + that receive a command in which invalid character codes have been + employed, and for which there are no other reasons for rejection, + MUST reject that command with a 501 response. + +4.1.3 Address Literals + + Sometimes a host is not known to the domain name system and + communication (and, in particular, communication to report and repair + the error) is blocked. To bypass this barrier a special literal form + of the address is allowed as an alternative to a domain name. For + IPv4 addresses, this form uses four small decimal integers separated + by dots and enclosed by brackets such as [123.255.37.2], which + indicates an (IPv4) Internet Address in sequence-of-octets form. For + IPv6 and other forms of addressing that might eventually be + standardized, the form consists of a standardized "tag" that + identifies the address syntax, a colon, and the address itself, in a + format specified as part of the IPv6 standards [17]. + + Specifically: + + IPv4-address-literal = Snum 3("." Snum) + IPv6-address-literal = "IPv6:" IPv6-addr + General-address-literal = Standardized-tag ":" 1*dcontent + Standardized-tag = Ldh-str + ; MUST be specified in a standards-track RFC + ; and registered with IANA + + Snum = 1*3DIGIT ; representing a decimal integer + ; value in the range 0 through 255 + Let-dig = ALPHA / DIGIT + Ldh-str = *( ALPHA / DIGIT / "-" ) Let-dig + + IPv6-addr = IPv6-full / IPv6-comp / IPv6v4-full / IPv6v4-comp + IPv6-hex = 1*4HEXDIG + IPv6-full = IPv6-hex 7(":" IPv6-hex) + IPv6-comp = [IPv6-hex *5(":" IPv6-hex)] "::" [IPv6-hex *5(":" + IPv6-hex)] + ; The "::" represents at least 2 16-bit groups of zeros + ; No more than 6 groups in addition to the "::" may be + ; present + IPv6v4-full = IPv6-hex 5(":" IPv6-hex) ":" IPv4-address-literal + IPv6v4-comp = [IPv6-hex *3(":" IPv6-hex)] "::" + + + +Klensin Standards Track [Page 38] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + [IPv6-hex *3(":" IPv6-hex) ":"] IPv4-address-literal + ; The "::" represents at least 2 16-bit groups of zeros + ; No more than 4 groups in addition to the "::" and + ; IPv4-address-literal may be present + +4.1.4 Order of Commands + + There are restrictions on the order in which these commands may be + used. + + A session that will contain mail transactions MUST first be + initialized by the use of the EHLO command. An SMTP server SHOULD + accept commands for non-mail transactions (e.g., VRFY or EXPN) + without this initialization. + + An EHLO command MAY be issued by a client later in the session. If + it is issued after the session begins, the SMTP server MUST clear all + buffers and reset the state exactly as if a RSET command had been + issued. In other words, the sequence of RSET followed immediately by + EHLO is redundant, but not harmful other than in the performance cost + of executing unnecessary commands. + + If the EHLO command is not acceptable to the SMTP server, 501, 500, + or 502 failure replies MUST be returned as appropriate. The SMTP + server MUST stay in the same state after transmitting these replies + that it was in before the EHLO was received. + + The SMTP client MUST, if possible, ensure that the domain parameter + to the EHLO command is a valid principal host name (not a CNAME or MX + name) for its host. If this is not possible (e.g., when the client's + address is dynamically assigned and the client does not have an + obvious name), an address literal SHOULD be substituted for the + domain name and supplemental information provided that will assist in + identifying the client. + + An SMTP server MAY verify that the domain name parameter in the EHLO + command actually corresponds to the IP address of the client. + However, the server MUST NOT refuse to accept a message for this + reason if the verification fails: the information about verification + failure is for logging and tracing only. + + The NOOP, HELP, EXPN, VRFY, and RSET commands can be used at any time + during a session, or without previously initializing a session. SMTP + servers SHOULD process these normally (that is, not return a 503 + code) even if no EHLO command has yet been received; clients SHOULD + open a session with EHLO before sending these commands. + + + + + +Klensin Standards Track [Page 39] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + If these rules are followed, the example in RFC 821 that shows "550 + access denied to you" in response to an EXPN command is incorrect + unless an EHLO command precedes the EXPN or the denial of access is + based on the client's IP address or other authentication or + authorization-determining mechanisms. + + The MAIL command (or the obsolete SEND, SOML, or SAML commands) + begins a mail transaction. Once started, a mail transaction consists + of a transaction beginning command, one or more RCPT commands, and a + DATA command, in that order. A mail transaction may be aborted by + the RSET (or a new EHLO) command. There may be zero or more + transactions in a session. MAIL (or SEND, SOML, or SAML) MUST NOT be + sent if a mail transaction is already open, i.e., it should be sent + only if no mail transaction had been started in the session, or it + the previous one successfully concluded with a successful DATA + command, or if the previous one was aborted with a RSET. + + If the transaction beginning command argument is not acceptable, a + 501 failure reply MUST be returned and the SMTP server MUST stay in + the same state. If the commands in a transaction are out of order to + the degree that they cannot be processed by the server, a 503 failure + reply MUST be returned and the SMTP server MUST stay in the same + state. + + The last command in a session MUST be the QUIT command. The QUIT + command cannot be used at any other time in a session, but SHOULD be + used by the client SMTP to request connection closure, even when no + session opening command was sent and accepted. + +4.1.5 Private-use Commands + + As specified in section 2.2.2, commands starting in "X" may be used + by bilateral agreement between the client (sending) and server + (receiving) SMTP agents. An SMTP server that does not recognize such + a command is expected to reply with "500 Command not recognized". An + extended SMTP server MAY list the feature names associated with these + private commands in the response to the EHLO command. + + Commands sent or accepted by SMTP systems that do not start with "X" + MUST conform to the requirements of section 2.2.2. + +4.2 SMTP Replies + + Replies to SMTP commands serve to ensure the synchronization of + requests and actions in the process of mail transfer and to guarantee + that the SMTP client always knows the state of the SMTP server. + Every command MUST generate exactly one reply. + + + + +Klensin Standards Track [Page 40] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + The details of the command-reply sequence are described in section + 4.3. + + An SMTP reply consists of a three digit number (transmitted as three + numeric characters) followed by some text unless specified otherwise + in this document. The number is for use by automata to determine + what state to enter next; the text is for the human user. The three + digits contain enough encoded information that the SMTP client need + not examine the text and may either discard it or pass it on to the + user, as appropriate. Exceptions are as noted elsewhere in this + document. In particular, the 220, 221, 251, 421, and 551 reply codes + are associated with message text that must be parsed and interpreted + by machines. In the general case, the text may be receiver dependent + and context dependent, so there are likely to be varying texts for + each reply code. A discussion of the theory of reply codes is given + in section 4.2.1. Formally, a reply is defined to be the sequence: a + three-digit code, , one line of text, and , or a multiline + reply (as defined in section 4.2.1). Since, in violation of this + specification, the text is sometimes not sent, clients which do not + receive it SHOULD be prepared to process the code alone (with or + without a trailing space character). Only the EHLO, EXPN, and HELP + commands are expected to result in multiline replies in normal + circumstances, however, multiline replies are allowed for any + command. + + In ABNF, server responses are: + + Greeting = "220 " Domain [ SP text ] CRLF + Reply-line = Reply-code [ SP text ] CRLF + + where "Greeting" appears only in the 220 response that announces that + the server is opening its part of the connection. + + An SMTP server SHOULD send only the reply codes listed in this + document. An SMTP server SHOULD use the text shown in the examples + whenever appropriate. + + An SMTP client MUST determine its actions only by the reply code, not + by the text (except for the "change of address" 251 and 551 and, if + necessary, 220, 221, and 421 replies); in the general case, any text, + including no text at all (although senders SHOULD NOT send bare + codes), MUST be acceptable. The space (blank) following the reply + code is considered part of the text. Whenever possible, a receiver- + SMTP SHOULD test the first digit (severity indication) of the reply + code. + + + + + + +Klensin Standards Track [Page 41] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + The list of codes that appears below MUST NOT be construed as + permanent. While the addition of new codes should be a rare and + significant activity, with supplemental information in the textual + part of the response being preferred, new codes may be added as the + result of new Standards or Standards-track specifications. + Consequently, a sender-SMTP MUST be prepared to handle codes not + specified in this document and MUST do so by interpreting the first + digit only. + +4.2.1 Reply Code Severities and Theory + + The three digits of the reply each have a special significance. The + first digit denotes whether the response is good, bad or incomplete. + An unsophisticated SMTP client, or one that receives an unexpected + code, will be able to determine its next action (proceed as planned, + redo, retrench, etc.) by examining this first digit. An SMTP client + that wants to know approximately what kind of error occurred (e.g., + mail system error, command syntax error) may examine the second + digit. The third digit and any supplemental information that may be + present is reserved for the finest gradation of information. + + There are five values for the first digit of the reply code: + + 1yz Positive Preliminary reply + The command has been accepted, but the requested action is being + held in abeyance, pending confirmation of the information in this + reply. The SMTP client should send another command specifying + whether to continue or abort the action. Note: unextended SMTP + does not have any commands that allow this type of reply, and so + does not have continue or abort commands. + + 2yz Positive Completion reply + The requested action has been successfully completed. A new + request may be initiated. + + 3yz Positive Intermediate reply + The command has been accepted, but the requested action is being + held in abeyance, pending receipt of further information. The + SMTP client should send another command specifying this + information. This reply is used in command sequence groups (i.e., + in DATA). + + 4yz Transient Negative Completion reply + The command was not accepted, and the requested action did not + occur. However, the error condition is temporary and the action + may be requested again. The sender should return to the beginning + of the command sequence (if any). It is difficult to assign a + meaning to "transient" when two different sites (receiver- and + + + +Klensin Standards Track [Page 42] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + sender-SMTP agents) must agree on the interpretation. Each reply + in this category might have a different time value, but the SMTP + client is encouraged to try again. A rule of thumb to determine + whether a reply fits into the 4yz or the 5yz category (see below) + is that replies are 4yz if they can be successful if repeated + without any change in command form or in properties of the sender + or receiver (that is, the command is repeated identically and the + receiver does not put up a new implementation.) + + 5yz Permanent Negative Completion reply + The command was not accepted and the requested action did not + occur. The SMTP client is discouraged from repeating the exact + request (in the same sequence). Even some "permanent" error + conditions can be corrected, so the human user may want to direct + the SMTP client to reinitiate the command sequence by direct + action at some point in the future (e.g., after the spelling has + been changed, or the user has altered the account status). + + The second digit encodes responses in specific categories: + + x0z Syntax: These replies refer to syntax errors, syntactically + correct commands that do not fit any functional category, and + unimplemented or superfluous commands. + + x1z Information: These are replies to requests for information, + such as status or help. + + x2z Connections: These are replies referring to the transmission + channel. + + x3z Unspecified. + + x4z Unspecified. + + x5z Mail system: These replies indicate the status of the receiver + mail system vis-a-vis the requested transfer or other mail system + action. + + The third digit gives a finer gradation of meaning in each category + specified by the second digit. The list of replies illustrates this. + Each reply text is recommended rather than mandatory, and may even + change according to the command with which it is associated. On the + other hand, the reply codes must strictly follow the specifications + in this section. Receiver implementations should not invent new + codes for slightly different situations from the ones described here, + but rather adapt codes already defined. + + + + + +Klensin Standards Track [Page 43] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + For example, a command such as NOOP, whose successful execution does + not offer the SMTP client any new information, will return a 250 + reply. The reply is 502 when the command requests an unimplemented + non-site-specific action. A refinement of that is the 504 reply for + a command that is implemented, but that requests an unimplemented + parameter. + + The reply text may be longer than a single line; in these cases the + complete text must be marked so the SMTP client knows when it can + stop reading the reply. This requires a special format to indicate a + multiple line reply. + + The format for multiline replies requires that every line, except the + last, begin with the reply code, followed immediately by a hyphen, + "-" (also known as minus), followed by text. The last line will + begin with the reply code, followed immediately by , optionally + some text, and . As noted above, servers SHOULD send the + if subsequent text is not sent, but clients MUST be prepared for it + to be omitted. + + For example: + + 123-First line + 123-Second line + 123-234 text beginning with numbers + 123 The last line + + In many cases the SMTP client then simply needs to search for a line + beginning with the reply code followed by or and ignore + all preceding lines. In a few cases, there is important data for the + client in the reply "text". The client will be able to identify + these cases from the current context. + +4.2.2 Reply Codes by Function Groups + + 500 Syntax error, command unrecognized + (This may include errors such as command line too long) + 501 Syntax error in parameters or arguments + 502 Command not implemented (see section 4.2.4) + 503 Bad sequence of commands + 504 Command parameter not implemented + + 211 System status, or system help reply + 214 Help message + (Information on how to use the receiver or the meaning of a + particular non-standard command; this reply is useful only + to the human user) + + + + +Klensin Standards Track [Page 44] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + 220 Service ready + 221 Service closing transmission channel + 421 Service not available, closing transmission channel + (This may be a reply to any command if the service knows it + must shut down) + + 250 Requested mail action okay, completed + 251 User not local; will forward to + (See section 3.4) + 252 Cannot VRFY user, but will accept message and attempt + delivery + (See section 3.5.3) + 450 Requested mail action not taken: mailbox unavailable + (e.g., mailbox busy) + 550 Requested action not taken: mailbox unavailable + (e.g., mailbox not found, no access, or command rejected + for policy reasons) + 451 Requested action aborted: error in processing + 551 User not local; please try + (See section 3.4) + 452 Requested action not taken: insufficient system storage + 552 Requested mail action aborted: exceeded storage allocation + 553 Requested action not taken: mailbox name not allowed + (e.g., mailbox syntax incorrect) + 354 Start mail input; end with . + 554 Transaction failed (Or, in the case of a connection-opening + response, "No SMTP service here") + +4.2.3 Reply Codes in Numeric Order + + 211 System status, or system help reply + 214 Help message + (Information on how to use the receiver or the meaning of a + particular non-standard command; this reply is useful only + to the human user) + 220 Service ready + 221 Service closing transmission channel + 250 Requested mail action okay, completed + 251 User not local; will forward to + (See section 3.4) + 252 Cannot VRFY user, but will accept message and attempt + delivery + (See section 3.5.3) + + 354 Start mail input; end with . + + + + + + +Klensin Standards Track [Page 45] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + 421 Service not available, closing transmission channel + (This may be a reply to any command if the service knows it + must shut down) + 450 Requested mail action not taken: mailbox unavailable + (e.g., mailbox busy) + 451 Requested action aborted: local error in processing + 452 Requested action not taken: insufficient system storage + 500 Syntax error, command unrecognized + (This may include errors such as command line too long) + 501 Syntax error in parameters or arguments + 502 Command not implemented (see section 4.2.4) + 503 Bad sequence of commands + 504 Command parameter not implemented + 550 Requested action not taken: mailbox unavailable + (e.g., mailbox not found, no access, or command rejected + for policy reasons) + 551 User not local; please try + (See section 3.4) + 552 Requested mail action aborted: exceeded storage allocation + 553 Requested action not taken: mailbox name not allowed + (e.g., mailbox syntax incorrect) + 554 Transaction failed (Or, in the case of a connection-opening + response, "No SMTP service here") + +4.2.4 Reply Code 502 + + Questions have been raised as to when reply code 502 (Command not + implemented) SHOULD be returned in preference to other codes. 502 + SHOULD be used when the command is actually recognized by the SMTP + server, but not implemented. If the command is not recognized, code + 500 SHOULD be returned. Extended SMTP systems MUST NOT list + capabilities in response to EHLO for which they will return 502 (or + 500) replies. + +4.2.5 Reply Codes After DATA and the Subsequent . + + When an SMTP server returns a positive completion status (2yz code) + after the DATA command is completed with ., it accepts + responsibility for: + + - delivering the message (if the recipient mailbox exists), or + + - if attempts to deliver the message fail due to transient + conditions, retrying delivery some reasonable number of times at + intervals as specified in section 4.5.4. + + + + + + +Klensin Standards Track [Page 46] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + - if attempts to deliver the message fail due to permanent + conditions, or if repeated attempts to deliver the message fail + due to transient conditions, returning appropriate notification to + the sender of the original message (using the address in the SMTP + MAIL command). + + When an SMTP server returns a permanent error status (5yz) code after + the DATA command is completed with ., it MUST NOT make + any subsequent attempt to deliver that message. The SMTP client + retains responsibility for delivery of that message and may either + return it to the user or requeue it for a subsequent attempt (see + section 4.5.4.1). + + The user who originated the message SHOULD be able to interpret the + return of a transient failure status (by mail message or otherwise) + as a non-delivery indication, just as a permanent failure would be + interpreted. I.e., if the client SMTP successfully handles these + conditions, the user will not receive such a reply. + + When an SMTP server returns a permanent error status (5yz) code after + the DATA command is completely with ., it MUST NOT make + any subsequent attempt to deliver the message. As with temporary + error status codes, the SMTP client retains responsibility for the + message, but SHOULD not again attempt delivery to the same server + without user review and intervention of the message. + +4.3 Sequencing of Commands and Replies + +4.3.1 Sequencing Overview + + The communication between the sender and receiver is an alternating + dialogue, controlled by the sender. As such, the sender issues a + command and the receiver responds with a reply. Unless other + arrangements are negotiated through service extensions, the sender + MUST wait for this response before sending further commands. + + One important reply is the connection greeting. Normally, a receiver + will send a 220 "Service ready" reply when the connection is + completed. The sender SHOULD wait for this greeting message before + sending any commands. + + Note: all the greeting-type replies have the official name (the + fully-qualified primary domain name) of the server host as the first + word following the reply code. Sometimes the host will have no + meaningful name. See 4.1.3 for a discussion of alternatives in these + situations. + + + + + +Klensin Standards Track [Page 47] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + For example, + + 220 ISIF.USC.EDU Service ready + or + 220 mail.foo.com SuperSMTP v 6.1.2 Service ready + or + 220 [10.0.0.1] Clueless host service ready + + The table below lists alternative success and failure replies for + each command. These SHOULD be strictly adhered to: a receiver may + substitute text in the replies, but the meaning and action implied by + the code numbers and by the specific command reply sequence cannot be + altered. + +4.3.2 Command-Reply Sequences + + Each command is listed with its usual possible replies. The prefixes + used before the possible replies are "I" for intermediate, "S" for + success, and "E" for error. Since some servers may generate other + replies under special circumstances, and to allow for future + extension, SMTP clients SHOULD, when possible, interpret only the + first digit of the reply and MUST be prepared to deal with + unrecognized reply codes by interpreting the first digit only. + Unless extended using the mechanisms described in section 2.2, SMTP + servers MUST NOT transmit reply codes to an SMTP client that are + other than three digits or that do not start in a digit between 2 and + 5 inclusive. + + These sequencing rules and, in principle, the codes themselves, can + be extended or modified by SMTP extensions offered by the server and + accepted (requested) by the client. + + In addition to the codes listed below, any SMTP command can return + any of the following codes if the corresponding unusual circumstances + are encountered: + + 500 For the "command line too long" case or if the command name was + not recognized. Note that producing a "command not recognized" + error in response to the required subset of these commands is a + violation of this specification. + + 501 Syntax error in command or arguments. In order to provide for + future extensions, commands that are specified in this document as + not accepting arguments (DATA, RSET, QUIT) SHOULD return a 501 + message if arguments are supplied in the absence of EHLO- + advertised extensions. + + 421 Service shutting down and closing transmission channel + + + +Klensin Standards Track [Page 48] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + Specific sequences are: + + CONNECTION ESTABLISHMENT + S: 220 + E: 554 + EHLO or HELO + S: 250 + E: 504, 550 + MAIL + S: 250 + E: 552, 451, 452, 550, 553, 503 + RCPT + S: 250, 251 (but see section 3.4 for discussion of 251 and 551) + E: 550, 551, 552, 553, 450, 451, 452, 503, 550 + DATA + I: 354 -> data -> S: 250 + E: 552, 554, 451, 452 + E: 451, 554, 503 + RSET + S: 250 + VRFY + S: 250, 251, 252 + E: 550, 551, 553, 502, 504 + EXPN + S: 250, 252 + E: 550, 500, 502, 504 + HELP + S: 211, 214 + E: 502, 504 + NOOP + S: 250 + QUIT + S: 221 + +4.4 Trace Information + + When an SMTP server receives a message for delivery or further + processing, it MUST insert trace ("time stamp" or "Received") + information at the beginning of the message content, as discussed in + section 4.1.1.4. + + This line MUST be structured as follows: + + - The FROM field, which MUST be supplied in an SMTP environment, + SHOULD contain both (1) the name of the source host as presented + in the EHLO command and (2) an address literal containing the IP + address of the source, determined from the TCP connection. + + + + +Klensin Standards Track [Page 49] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + - The ID field MAY contain an "@" as suggested in RFC 822, but this + is not required. + + - The FOR field MAY contain a list of entries when multiple + RCPT commands have been given. This may raise some security + issues and is usually not desirable; see section 7.2. + + An Internet mail program MUST NOT change a Received: line that was + previously added to the message header. SMTP servers MUST prepend + Received lines to messages; they MUST NOT change the order of + existing lines or insert Received lines in any other location. + + As the Internet grows, comparability of Received fields is important + for detecting problems, especially slow relays. SMTP servers that + create Received fields SHOULD use explicit offsets in the dates + (e.g., -0800), rather than time zone names of any type. Local time + (with an offset) is preferred to UT when feasible. This formulation + allows slightly more information about local circumstances to be + specified. If UT is needed, the receiver need merely do some simple + arithmetic to convert the values. Use of UT loses information about + the time zone-location of the server. If it is desired to supply a + time zone name, it SHOULD be included in a comment. + + When the delivery SMTP server makes the "final delivery" of a + message, it inserts a return-path line at the beginning of the mail + data. This use of return-path is required; mail systems MUST support + it. The return-path line preserves the information in the from the MAIL command. Here, final delivery means the message + has left the SMTP environment. Normally, this would mean it had been + delivered to the destination user or an associated mail drop, but in + some cases it may be further processed and transmitted by another + mail system. + + It is possible for the mailbox in the return path to be different + from the actual sender's mailbox, for example, if error responses are + to be delivered to a special error handling mailbox rather than to + the message sender. When mailing lists are involved, this + arrangement is common and useful as a means of directing errors to + the list maintainer rather than the message originator. + + The text above implies that the final mail data will begin with a + return path line, followed by one or more time stamp lines. These + lines will be followed by the mail data headers and body [32]. + + It is sometimes difficult for an SMTP server to determine whether or + not it is making final delivery since forwarding or other operations + may occur after the message is accepted for delivery. Consequently, + + + + +Klensin Standards Track [Page 50] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + any further (forwarding, gateway, or relay) systems MAY remove the + return path and rebuild the MAIL command as needed to ensure that + exactly one such line appears in a delivered message. + + A message-originating SMTP system SHOULD NOT send a message that + already contains a Return-path header. SMTP servers performing a + relay function MUST NOT inspect the message data, and especially not + to the extent needed to determine if Return-path headers are present. + SMTP servers making final delivery MAY remove Return-path headers + before adding their own. + + The primary purpose of the Return-path is to designate the address to + which messages indicating non-delivery or other mail system failures + are to be sent. For this to be unambiguous, exactly one return path + SHOULD be present when the message is delivered. Systems using RFC + 822 syntax with non-SMTP transports SHOULD designate an unambiguous + address, associated with the transport envelope, to which error + reports (e.g., non-delivery messages) should be sent. + + Historical note: Text in RFC 822 that appears to contradict the use + of the Return-path header (or the envelope reverse path address from + the MAIL command) as the destination for error messages is not + applicable on the Internet. The reverse path address (as copied into + the Return-path) MUST be used as the target of any mail containing + delivery error messages. + + In particular: + + - a gateway from SMTP->elsewhere SHOULD insert a return-path header, + unless it is known that the "elsewhere" transport also uses + Internet domain addresses and maintains the envelope sender + address separately. + + - a gateway from elsewhere->SMTP SHOULD delete any return-path + header present in the message, and either copy that information to + the SMTP envelope or combine it with information present in the + envelope of the other transport system to construct the reverse + path argument to the MAIL command in the SMTP envelope. + + The server must give special treatment to cases in which the + processing following the end of mail data indication is only + partially successful. This could happen if, after accepting several + recipients and the mail data, the SMTP server finds that the mail + data could be successfully delivered to some, but not all, of the + recipients. In such cases, the response to the DATA command MUST be + an OK reply. However, the SMTP server MUST compose and send an + "undeliverable mail" notification message to the originator of the + message. + + + +Klensin Standards Track [Page 51] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + A single notification listing all of the failed recipients or + separate notification messages MUST be sent for each failed + recipient. For economy of processing by the sender, the former is + preferred when possible. All undeliverable mail notification + messages are sent using the MAIL command (even if they result from + processing the obsolete SEND, SOML, or SAML commands) and use a null + return path as discussed in section 3.7. + + The time stamp line and the return path line are formally defined as + follows: + +Return-path-line = "Return-Path:" FWS Reverse-path + +Time-stamp-line = "Received:" FWS Stamp + +Stamp = From-domain By-domain Opt-info ";" FWS date-time + + ; where "date-time" is as defined in [32] + ; but the "obs-" forms, especially two-digit + ; years, are prohibited in SMTP and MUST NOT be used. + +From-domain = "FROM" FWS Extended-Domain CFWS + +By-domain = "BY" FWS Extended-Domain CFWS + +Extended-Domain = Domain / + ( Domain FWS "(" TCP-info ")" ) / + ( Address-literal FWS "(" TCP-info ")" ) + +TCP-info = Address-literal / ( Domain FWS Address-literal ) + ; Information derived by server from TCP connection + ; not client EHLO. + +Opt-info = [Via] [With] [ID] [For] + +Via = "VIA" FWS Link CFWS + +With = "WITH" FWS Protocol CFWS + +ID = "ID" FWS String / msg-id CFWS + +For = "FOR" FWS 1*( Path / Mailbox ) CFWS + +Link = "TCP" / Addtl-Link +Addtl-Link = Atom + ; Additional standard names for links are registered with the + ; Internet Assigned Numbers Authority (IANA). "Via" is + ; primarily of value with non-Internet transports. SMTP + + + +Klensin Standards Track [Page 52] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + ; servers SHOULD NOT use unregistered names. +Protocol = "ESMTP" / "SMTP" / Attdl-Protocol +Attdl-Protocol = Atom + ; Additional standard names for protocols are registered with the + ; Internet Assigned Numbers Authority (IANA). SMTP servers + ; SHOULD NOT use unregistered names. + +4.5 Additional Implementation Issues + +4.5.1 Minimum Implementation + + In order to make SMTP workable, the following minimum implementation + is required for all receivers. The following commands MUST be + supported to conform to this specification: + + EHLO + HELO + MAIL + RCPT + DATA + RSET + NOOP + QUIT + VRFY + + Any system that includes an SMTP server supporting mail relaying or + delivery MUST support the reserved mailbox "postmaster" as a case- + insensitive local name. This postmaster address is not strictly + necessary if the server always returns 554 on connection opening (as + described in section 3.1). The requirement to accept mail for + postmaster implies that RCPT commands which specify a mailbox for + postmaster at any of the domains for which the SMTP server provides + mail service, as well as the special case of "RCPT TO:" + (with no domain specification), MUST be supported. + + SMTP systems are expected to make every reasonable effort to accept + mail directed to Postmaster from any other system on the Internet. + In extreme cases --such as to contain a denial of service attack or + other breach of security-- an SMTP server may block mail directed to + Postmaster. However, such arrangements SHOULD be narrowly tailored + so as to avoid blocking messages which are not part of such attacks. + +4.5.2 Transparency + + Without some provision for data transparency, the character sequence + "." ends the mail text and cannot be sent by the user. + In general, users are not aware of such "forbidden" sequences. To + + + + +Klensin Standards Track [Page 53] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + allow all user composed text to be transmitted transparently, the + following procedures are used: + + - Before sending a line of mail text, the SMTP client checks the + first character of the line. If it is a period, one additional + period is inserted at the beginning of the line. + + - When a line of mail text is received by the SMTP server, it checks + the line. If the line is composed of a single period, it is + treated as the end of mail indicator. If the first character is a + period and there are other characters on the line, the first + character is deleted. + + The mail data may contain any of the 128 ASCII characters. All + characters are to be delivered to the recipient's mailbox, including + spaces, vertical and horizontal tabs, and other control characters. + If the transmission channel provides an 8-bit byte (octet) data + stream, the 7-bit ASCII codes are transmitted right justified in the + octets, with the high order bits cleared to zero. See 3.7 for + special treatment of these conditions in SMTP systems serving a relay + function. + + In some systems it may be necessary to transform the data as it is + received and stored. This may be necessary for hosts that use a + different character set than ASCII as their local character set, that + store data in records rather than strings, or which use special + character sequences as delimiters inside mailboxes. If such + transformations are necessary, they MUST be reversible, especially if + they are applied to mail being relayed. + +4.5.3 Sizes and Timeouts + +4.5.3.1 Size limits and minimums + + There are several objects that have required minimum/maximum sizes. + Every implementation MUST be able to receive objects of at least + these sizes. Objects larger than these sizes SHOULD be avoided when + possible. However, some Internet mail constructs such as encoded + X.400 addresses [16] will often require larger objects: clients MAY + attempt to transmit these, but MUST be prepared for a server to + reject them if they cannot be handled by it. To the maximum extent + possible, implementation techniques which impose no limits on the + length of these objects should be used. + + local-part + The maximum total length of a user name or other local-part is 64 + characters. + + + + +Klensin Standards Track [Page 54] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + domain + The maximum total length of a domain name or number is 255 + characters. + + path + The maximum total length of a reverse-path or forward-path is 256 + characters (including the punctuation and element separators). + + command line + The maximum total length of a command line including the command + word and the is 512 characters. SMTP extensions may be + used to increase this limit. + + reply line + The maximum total length of a reply line including the reply code + and the is 512 characters. More information may be + conveyed through multiple-line replies. + + text line + The maximum total length of a text line including the is + 1000 characters (not counting the leading dot duplicated for + transparency). This number may be increased by the use of SMTP + Service Extensions. + + message content + The maximum total length of a message content (including any + message headers as well as the message body) MUST BE at least 64K + octets. Since the introduction of Internet standards for + multimedia mail [12], message lengths on the Internet have grown + dramatically, and message size restrictions should be avoided if + at all possible. SMTP server systems that must impose + restrictions SHOULD implement the "SIZE" service extension [18], + and SMTP client systems that will send large messages SHOULD + utilize it when possible. + + recipients buffer + The minimum total number of recipients that must be buffered is + 100 recipients. Rejection of messages (for excessive recipients) + with fewer than 100 RCPT commands is a violation of this + specification. The general principle that relaying SMTP servers + MUST NOT, and delivery SMTP servers SHOULD NOT, perform validation + tests on message headers suggests that rejecting a message based + on the total number of recipients shown in header fields is to be + discouraged. A server which imposes a limit on the number of + recipients MUST behave in an orderly fashion, such as to reject + additional addresses over its limit rather than silently + discarding addresses previously accepted. A client that needs to + + + + +Klensin Standards Track [Page 55] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + deliver a message containing over 100 RCPT commands SHOULD be + prepared to transmit in 100-recipient "chunks" if the server + declines to accept more than 100 recipients in a single message. + + Errors due to exceeding these limits may be reported by using the + reply codes. Some examples of reply codes are: + + 500 Line too long. + or + 501 Path too long + or + 452 Too many recipients (see below) + or + 552 Too much mail data. + + RFC 821 [30] incorrectly listed the error where an SMTP server + exhausts its implementation limit on the number of RCPT commands + ("too many recipients") as having reply code 552. The correct reply + code for this condition is 452. Clients SHOULD treat a 552 code in + this case as a temporary, rather than permanent, failure so the logic + below works. + + When a conforming SMTP server encounters this condition, it has at + least 100 successful RCPT commands in its recipients buffer. If the + server is able to accept the message, then at least these 100 + addresses will be removed from the SMTP client's queue. When the + client attempts retransmission of those addresses which received 452 + responses, at least 100 of these will be able to fit in the SMTP + server's recipients buffer. Each retransmission attempt which is + able to deliver anything will be able to dispose of at least 100 of + these recipients. + + If an SMTP server has an implementation limit on the number of RCPT + commands and this limit is exhausted, it MUST use a response code of + 452 (but the client SHOULD also be prepared for a 552, as noted + above). If the server has a configured site-policy limitation on the + number of RCPT commands, it MAY instead use a 5XX response code. + This would be most appropriate if the policy limitation was intended + to apply if the total recipient count for a particular message body + were enforced even if that message body was sent in multiple mail + transactions. + +4.5.3.2 Timeouts + + An SMTP client MUST provide a timeout mechanism. It MUST use per- + command timeouts rather than somehow trying to time the entire mail + transaction. Timeouts SHOULD be easily reconfigurable, preferably + without recompiling the SMTP code. To implement this, a timer is set + + + +Klensin Standards Track [Page 56] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + for each SMTP command and for each buffer of the data transfer. The + latter means that the overall timeout is inherently proportional to + the size of the message. + + Based on extensive experience with busy mail-relay hosts, the minimum + per-command timeout values SHOULD be as follows: + + Initial 220 Message: 5 minutes + An SMTP client process needs to distinguish between a failed TCP + connection and a delay in receiving the initial 220 greeting + message. Many SMTP servers accept a TCP connection but delay + delivery of the 220 message until their system load permits more + mail to be processed. + + MAIL Command: 5 minutes + + RCPT Command: 5 minutes + A longer timeout is required if processing of mailing lists and + aliases is not deferred until after the message was accepted. + + DATA Initiation: 2 minutes + This is while awaiting the "354 Start Input" reply to a DATA + command. + + Data Block: 3 minutes + This is while awaiting the completion of each TCP SEND call + transmitting a chunk of data. + + DATA Termination: 10 minutes. + This is while awaiting the "250 OK" reply. When the receiver gets + the final period terminating the message data, it typically + performs processing to deliver the message to a user mailbox. A + spurious timeout at this point would be very wasteful and would + typically result in delivery of multiple copies of the message, + since it has been successfully sent and the server has accepted + responsibility for delivery. See section 6.1 for additional + discussion. + + An SMTP server SHOULD have a timeout of at least 5 minutes while it + is awaiting the next command from the sender. + +4.5.4 Retry Strategies + + The common structure of a host SMTP implementation includes user + mailboxes, one or more areas for queuing messages in transit, and one + or more daemon processes for sending and receiving mail. The exact + structure will vary depending on the needs of the users on the host + + + + +Klensin Standards Track [Page 57] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + and the number and size of mailing lists supported by the host. We + describe several optimizations that have proved helpful, particularly + for mailers supporting high traffic levels. + + Any queuing strategy MUST include timeouts on all activities on a + per-command basis. A queuing strategy MUST NOT send error messages + in response to error messages under any circumstances. + +4.5.4.1 Sending Strategy + + The general model for an SMTP client is one or more processes that + periodically attempt to transmit outgoing mail. In a typical system, + the program that composes a message has some method for requesting + immediate attention for a new piece of outgoing mail, while mail that + cannot be transmitted immediately MUST be queued and periodically + retried by the sender. A mail queue entry will include not only the + message itself but also the envelope information. + + The sender MUST delay retrying a particular destination after one + attempt has failed. In general, the retry interval SHOULD be at + least 30 minutes; however, more sophisticated and variable strategies + will be beneficial when the SMTP client can determine the reason for + non-delivery. + + Retries continue until the message is transmitted or the sender gives + up; the give-up time generally needs to be at least 4-5 days. The + parameters to the retry algorithm MUST be configurable. + + A client SHOULD keep a list of hosts it cannot reach and + corresponding connection timeouts, rather than just retrying queued + mail items. + + Experience suggests that failures are typically transient (the target + system or its connection has crashed), favoring a policy of two + connection attempts in the first hour the message is in the queue, + and then backing off to one every two or three hours. + + The SMTP client can shorten the queuing delay in cooperation with the + SMTP server. For example, if mail is received from a particular + address, it is likely that mail queued for that host can now be sent. + Application of this principle may, in many cases, eliminate the + requirement for an explicit "send queues now" function such as ETRN + [9]. + + The strategy may be further modified as a result of multiple + addresses per host (see below) to optimize delivery time vs. resource + usage. + + + + +Klensin Standards Track [Page 58] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + An SMTP client may have a large queue of messages for each + unavailable destination host. If all of these messages were retried + in every retry cycle, there would be excessive Internet overhead and + the sending system would be blocked for a long period. Note that an + SMTP client can generally determine that a delivery attempt has + failed only after a timeout of several minutes and even a one-minute + timeout per connection will result in a very large delay if retries + are repeated for dozens, or even hundreds, of queued messages to the + same host. + + At the same time, SMTP clients SHOULD use great care in caching + negative responses from servers. In an extreme case, if EHLO is + issued multiple times during the same SMTP connection, different + answers may be returned by the server. More significantly, 5yz + responses to the MAIL command MUST NOT be cached. + + When a mail message is to be delivered to multiple recipients, and + the SMTP server to which a copy of the message is to be sent is the + same for multiple recipients, then only one copy of the message + SHOULD be transmitted. That is, the SMTP client SHOULD use the + command sequence: MAIL, RCPT, RCPT,... RCPT, DATA instead of the + sequence: MAIL, RCPT, DATA, ..., MAIL, RCPT, DATA. However, if there + are very many addresses, a limit on the number of RCPT commands per + MAIL command MAY be imposed. Implementation of this efficiency + feature is strongly encouraged. + + Similarly, to achieve timely delivery, the SMTP client MAY support + multiple concurrent outgoing mail transactions. However, some limit + may be appropriate to protect the host from devoting all its + resources to mail. + +4.5.4.2 Receiving Strategy + + The SMTP server SHOULD attempt to keep a pending listen on the SMTP + port at all times. This requires the support of multiple incoming + TCP connections for SMTP. Some limit MAY be imposed but servers that + cannot handle more than one SMTP transaction at a time are not in + conformance with the intent of this specification. + + As discussed above, when the SMTP server receives mail from a + particular host address, it could activate its own SMTP queuing + mechanisms to retry any mail pending for that host address. + +4.5.5 Messages with a null reverse-path + + There are several types of notification messages which are required + by existing and proposed standards to be sent with a null reverse + path, namely non-delivery notifications as discussed in section 3.7, + + + +Klensin Standards Track [Page 59] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + other kinds of Delivery Status Notifications (DSNs) [24], and also + Message Disposition Notifications (MDNs) [10]. All of these kinds of + messages are notifications about a previous message, and they are + sent to the reverse-path of the previous mail message. (If the + delivery of such a notification message fails, that usually indicates + a problem with the mail system of the host to which the notification + message is addressed. For this reason, at some hosts the MTA is set + up to forward such failed notification messages to someone who is + able to fix problems with the mail system, e.g., via the postmaster + alias.) + + All other types of messages (i.e., any message which is not required + by a standards-track RFC to have a null reverse-path) SHOULD be sent + with with a valid, non-null reverse-path. + + Implementors of automated email processors should be careful to make + sure that the various kinds of messages with null reverse-path are + handled correctly, in particular such systems SHOULD NOT reply to + messages with null reverse-path. + +5. Address Resolution and Mail Handling + + Once an SMTP client lexically identifies a domain to which mail will + be delivered for processing (as described in sections 3.6 and 3.7), a + DNS lookup MUST be performed to resolve the domain name [22]. The + names are expected to be fully-qualified domain names (FQDNs): + mechanisms for inferring FQDNs from partial names or local aliases + are outside of this specification and, due to a history of problems, + are generally discouraged. The lookup first attempts to locate an MX + record associated with the name. If a CNAME record is found instead, + the resulting name is processed as if it were the initial name. If + no MX records are found, but an A RR is found, the A RR is treated as + if it was associated with an implicit MX RR, with a preference of 0, + pointing to that host. If one or more MX RRs are found for a given + name, SMTP systems MUST NOT utilize any A RRs associated with that + name unless they are located using the MX RRs; the "implicit MX" rule + above applies only if there are no MX records present. If MX records + are present, but none of them are usable, this situation MUST be + reported as an error. + + When the lookup succeeds, the mapping can result in a list of + alternative delivery addresses rather than a single address, because + of multiple MX records, multihoming, or both. To provide reliable + mail transmission, the SMTP client MUST be able to try (and retry) + each of the relevant addresses in this list in order, until a + delivery attempt succeeds. However, there MAY also be a configurable + limit on the number of alternate addresses that can be tried. In any + case, the SMTP client SHOULD try at least two addresses. + + + +Klensin Standards Track [Page 60] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + Two types of information is used to rank the host addresses: multiple + MX records, and multihomed hosts. + + Multiple MX records contain a preference indication that MUST be used + in sorting (see below). Lower numbers are more preferred than higher + ones. If there are multiple destinations with the same preference + and there is no clear reason to favor one (e.g., by recognition of an + easily-reached address), then the sender-SMTP MUST randomize them to + spread the load across multiple mail exchangers for a specific + organization. + + The destination host (perhaps taken from the preferred MX record) may + be multihomed, in which case the domain name resolver will return a + list of alternative IP addresses. It is the responsibility of the + domain name resolver interface to have ordered this list by + decreasing preference if necessary, and SMTP MUST try them in the + order presented. + + Although the capability to try multiple alternative addresses is + required, specific installations may want to limit or disable the use + of alternative addresses. The question of whether a sender should + attempt retries using the different addresses of a multihomed host + has been controversial. The main argument for using the multiple + addresses is that it maximizes the probability of timely delivery, + and indeed sometimes the probability of any delivery; the counter- + argument is that it may result in unnecessary resource use. Note + that resource use is also strongly determined by the sending strategy + discussed in section 4.5.4.1. + + If an SMTP server receives a message with a destination for which it + is a designated Mail eXchanger, it MAY relay the message (potentially + after having rewritten the MAIL FROM and/or RCPT TO addresses), make + final delivery of the message, or hand it off using some mechanism + outside the SMTP-provided transport environment. Of course, neither + of the latter require that the list of MX records be examined + further. + + If it determines that it should relay the message without rewriting + the address, it MUST sort the MX records to determine candidates for + delivery. The records are first ordered by preference, with the + lowest-numbered records being most preferred. The relay host MUST + then inspect the list for any of the names or addresses by which it + might be known in mail transactions. If a matching record is found, + all records at that preference level and higher-numbered ones MUST be + discarded from consideration. If there are no records left at that + point, it is an error condition, and the message MUST be returned as + undeliverable. If records do remain, they SHOULD be tried, best + preference first, as described above. + + + +Klensin Standards Track [Page 61] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +6. Problem Detection and Handling + +6.1 Reliable Delivery and Replies by Email + + When the receiver-SMTP accepts a piece of mail (by sending a "250 OK" + message in response to DATA), it is accepting responsibility for + delivering or relaying the message. It must take this responsibility + seriously. It MUST NOT lose the message for frivolous reasons, such + as because the host later crashes or because of a predictable + resource shortage. + + If there is a delivery failure after acceptance of a message, the + receiver-SMTP MUST formulate and mail a notification message. This + notification MUST be sent using a null ("<>") reverse path in the + envelope. The recipient of this notification MUST be the address + from the envelope return path (or the Return-Path: line). However, + if this address is null ("<>"), the receiver-SMTP MUST NOT send a + notification. Obviously, nothing in this section can or should + prohibit local decisions (i.e., as part of the same system + environment as the receiver-SMTP) to log or otherwise transmit + information about null address events locally if that is desired. If + the address is an explicit source route, it MUST be stripped down to + its final hop. + + For example, suppose that an error notification must be sent for a + message that arrived with: + + MAIL FROM:<@a,@b:user@d> + + The notification message MUST be sent using: + + RCPT TO: + + Some delivery failures after the message is accepted by SMTP will be + unavoidable. For example, it may be impossible for the receiving + SMTP server to validate all the delivery addresses in RCPT command(s) + due to a "soft" domain system error, because the target is a mailing + list (see earlier discussion of RCPT), or because the server is + acting as a relay and has no immediate access to the delivering + system. + + To avoid receiving duplicate messages as the result of timeouts, a + receiver-SMTP MUST seek to minimize the time required to respond to + the final . end of data indicator. See RFC 1047 [28] for + a discussion of this problem. + + + + + + +Klensin Standards Track [Page 62] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +6.2 Loop Detection + + Simple counting of the number of "Received:" headers in a message has + proven to be an effective, although rarely optimal, method of + detecting loops in mail systems. SMTP servers using this technique + SHOULD use a large rejection threshold, normally at least 100 + Received entries. Whatever mechanisms are used, servers MUST contain + provisions for detecting and stopping trivial loops. + +6.3 Compensating for Irregularities + + Unfortunately, variations, creative interpretations, and outright + violations of Internet mail protocols do occur; some would suggest + that they occur quite frequently. The debate as to whether a well- + behaved SMTP receiver or relay should reject a malformed message, + attempt to pass it on unchanged, or attempt to repair it to increase + the odds of successful delivery (or subsequent reply) began almost + with the dawn of structured network mail and shows no signs of + abating. Advocates of rejection claim that attempted repairs are + rarely completely adequate and that rejection of bad messages is the + only way to get the offending software repaired. Advocates of + "repair" or "deliver no matter what" argue that users prefer that + mail go through it if at all possible and that there are significant + market pressures in that direction. In practice, these market + pressures may be more important to particular vendors than strict + conformance to the standards, regardless of the preference of the + actual developers. + + The problems associated with ill-formed messages were exacerbated by + the introduction of the split-UA mail reading protocols [3, 26, 5, + 21]. These protocols have encouraged the use of SMTP as a posting + protocol, and SMTP servers as relay systems for these client hosts + (which are often only intermittently connected to the Internet). + Historically, many of those client machines lacked some of the + mechanisms and information assumed by SMTP (and indeed, by the mail + format protocol [7]). Some could not keep adequate track of time; + others had no concept of time zones; still others could not identify + their own names or addresses; and, of course, none could satisfy the + assumptions that underlay RFC 822's conception of authenticated + addresses. + + In response to these weak SMTP clients, many SMTP systems now + complete messages that are delivered to them in incomplete or + incorrect form. This strategy is generally considered appropriate + when the server can identify or authenticate the client, and there + are prior agreements between them. By contrast, there is at best + great concern about fixes applied by a relay or delivery SMTP server + that has little or no knowledge of the user or client machine. + + + +Klensin Standards Track [Page 63] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + The following changes to a message being processed MAY be applied + when necessary by an originating SMTP server, or one used as the + target of SMTP as an initial posting protocol: + + - Addition of a message-id field when none appears + + - Addition of a date, time or time zone when none appears + + - Correction of addresses to proper FQDN format + + The less information the server has about the client, the less likely + these changes are to be correct and the more caution and conservatism + should be applied when considering whether or not to perform fixes + and how. These changes MUST NOT be applied by an SMTP server that + provides an intermediate relay function. + + In all cases, properly-operating clients supplying correct + information are preferred to corrections by the SMTP server. In all + cases, documentation of actions performed by the servers (in trace + fields and/or header comments) is strongly encouraged. + +7. Security Considerations + +7.1 Mail Security and Spoofing + + SMTP mail is inherently insecure in that it is feasible for even + fairly casual users to negotiate directly with receiving and relaying + SMTP servers and create messages that will trick a naive recipient + into believing that they came from somewhere else. Constructing such + a message so that the "spoofed" behavior cannot be detected by an + expert is somewhat more difficult, but not sufficiently so as to be a + deterrent to someone who is determined and knowledgeable. + Consequently, as knowledge of Internet mail increases, so does the + knowledge that SMTP mail inherently cannot be authenticated, or + integrity checks provided, at the transport level. Real mail + security lies only in end-to-end methods involving the message + bodies, such as those which use digital signatures (see [14] and, + e.g., PGP [4] or S/MIME [31]). + + Various protocol extensions and configuration options that provide + authentication at the transport level (e.g., from an SMTP client to + an SMTP server) improve somewhat on the traditional situation + described above. However, unless they are accompanied by careful + handoffs of responsibility in a carefully-designed trust environment, + they remain inherently weaker than end-to-end mechanisms which use + digitally signed messages rather than depending on the integrity of + the transport system. + + + + +Klensin Standards Track [Page 64] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + Efforts to make it more difficult for users to set envelope return + path and header "From" fields to point to valid addresses other than + their own are largely misguided: they frustrate legitimate + applications in which mail is sent by one user on behalf of another + or in which error (or normal) replies should be directed to a special + address. (Systems that provide convenient ways for users to alter + these fields on a per-message basis should attempt to establish a + primary and permanent mailbox address for the user so that Sender + fields within the message data can be generated sensibly.) + + This specification does not further address the authentication issues + associated with SMTP other than to advocate that useful functionality + not be disabled in the hope of providing some small margin of + protection against an ignorant user who is trying to fake mail. + +7.2 "Blind" Copies + + Addresses that do not appear in the message headers may appear in the + RCPT commands to an SMTP server for a number of reasons. The two + most common involve the use of a mailing address as a "list exploder" + (a single address that resolves into multiple addresses) and the + appearance of "blind copies". Especially when more than one RCPT + command is present, and in order to avoid defeating some of the + purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy + the full set of RCPT command arguments into the headers, either as + part of trace headers or as informational or private-extension + headers. Since this rule is often violated in practice, and cannot + be enforced, sending SMTP systems that are aware of "bcc" use MAY + find it helpful to send each blind copy as a separate message + transaction containing only a single RCPT command. + + There is no inherent relationship between either "reverse" (from + MAIL, SAML, etc., commands) or "forward" (RCPT) addresses in the SMTP + transaction ("envelope") and the addresses in the headers. Receiving + systems SHOULD NOT attempt to deduce such relationships and use them + to alter the headers of the message for delivery. The popular + "Apparently-to" header is a violation of this principle as well as a + common source of unintended information disclosure and SHOULD NOT be + used. + +7.3 VRFY, EXPN, and Security + + As discussed in section 3.5, individual sites may want to disable + either or both of VRFY or EXPN for security reasons. As a corollary + to the above, implementations that permit this MUST NOT appear to + have verified addresses that are not, in fact, verified. If a site + + + + + +Klensin Standards Track [Page 65] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + disables these commands for security reasons, the SMTP server MUST + return a 252 response, rather than a code that could be confused with + successful or unsuccessful verification. + + Returning a 250 reply code with the address listed in the VRFY + command after having checked it only for syntax violates this rule. + Of course, an implementation that "supports" VRFY by always returning + 550 whether or not the address is valid is equally not in + conformance. + + Within the last few years, the contents of mailing lists have become + popular as an address information source for so-called "spammers." + The use of EXPN to "harvest" addresses has increased as list + administrators have installed protections against inappropriate uses + of the lists themselves. Implementations SHOULD still provide + support for EXPN, but sites SHOULD carefully evaluate the tradeoffs. + As authentication mechanisms are introduced into SMTP, some sites may + choose to make EXPN available only to authenticated requestors. + +7.4 Information Disclosure in Announcements + + There has been an ongoing debate about the tradeoffs between the + debugging advantages of announcing server type and version (and, + sometimes, even server domain name) in the greeting response or in + response to the HELP command and the disadvantages of exposing + information that might be useful in a potential hostile attack. The + utility of the debugging information is beyond doubt. Those who + argue for making it available point out that it is far better to + actually secure an SMTP server rather than hope that trying to + conceal known vulnerabilities by hiding the server's precise identity + will provide more protection. Sites are encouraged to evaluate the + tradeoff with that issue in mind; implementations are strongly + encouraged to minimally provide for making type and version + information available in some way to other network hosts. + +7.5 Information Disclosure in Trace Fields + + In some circumstances, such as when mail originates from within a LAN + whose hosts are not directly on the public Internet, trace + ("Received") fields produced in conformance with this specification + may disclose host names and similar information that would not + normally be available. This ordinarily does not pose a problem, but + sites with special concerns about name disclosure should be aware of + it. Also, the optional FOR clause should be supplied with caution or + not at all when multiple recipients are involved lest it + inadvertently disclose the identities of "blind copy" recipients to + others. + + + + +Klensin Standards Track [Page 66] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +7.6 Information Disclosure in Message Forwarding + + As discussed in section 3.4, use of the 251 or 551 reply codes to + identify the replacement address associated with a mailbox may + inadvertently disclose sensitive information. Sites that are + concerned about those issues should ensure that they select and + configure servers appropriately. + +7.7 Scope of Operation of SMTP Servers + + It is a well-established principle that an SMTP server may refuse to + accept mail for any operational or technical reason that makes sense + to the site providing the server. However, cooperation among sites + and installations makes the Internet possible. If sites take + excessive advantage of the right to reject traffic, the ubiquity of + email availability (one of the strengths of the Internet) will be + threatened; considerable care should be taken and balance maintained + if a site decides to be selective about the traffic it will accept + and process. + + In recent years, use of the relay function through arbitrary sites + has been used as part of hostile efforts to hide the actual origins + of mail. Some sites have decided to limit the use of the relay + function to known or identifiable sources, and implementations SHOULD + provide the capability to perform this type of filtering. When mail + is rejected for these or other policy reasons, a 550 code SHOULD be + used in response to EHLO, MAIL, or RCPT as appropriate. + +8. IANA Considerations + + IANA will maintain three registries in support of this specification. + The first consists of SMTP service extensions with the associated + keywords, and, as needed, parameters and verbs. As specified in + section 2.2.2, no entry may be made in this registry that starts in + an "X". Entries may be made only for service extensions (and + associated keywords, parameters, or verbs) that are defined in + standards-track or experimental RFCs specifically approved by the + IESG for this purpose. + + The second registry consists of "tags" that identify forms of domain + literals other than those for IPv4 addresses (specified in RFC 821 + and in this document) and IPv6 addresses (specified in this + document). Additional literal types require standardization before + being used; none are anticipated at this time. + + The third, established by RFC 821 and renewed by this specification, + is a registry of link and protocol identifiers to be used with the + "via" and "with" subclauses of the time stamp ("Received: header") + + + +Klensin Standards Track [Page 67] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + described in section 4.4. Link and protocol identifiers in addition + to those specified in this document may be registered only by + standardization or by way of an RFC-documented, IESG-approved, + Experimental protocol extension. + +9. References + + [1] American National Standards Institute (formerly United States of + America Standards Institute), X3.4, 1968, "USA Code for + Information Interchange". ANSI X3.4-1968 has been replaced by + newer versions with slight modifications, but the 1968 version + remains definitive for the Internet. + + [2] Braden, R., "Requirements for Internet hosts - application and + support", STD 3, RFC 1123, October 1989. + + [3] Butler, M., Chase, D., Goldberger, J., Postel, J. and J. + Reynolds, "Post Office Protocol - version 2", RFC 937, February + 1985. + + [4] Callas, J., Donnerhacke, L., Finney, H. and R. Thayer, "OpenPGP + Message Format", RFC 2440, November 1998. + + [5] Crispin, M., "Interactive Mail Access Protocol - Version 2", RFC + 1176, August 1990. + + [6] Crispin, M., "Internet Message Access Protocol - Version 4", RFC + 2060, December 1996. + + [7] Crocker, D., "Standard for the Format of ARPA Internet Text + Messages", RFC 822, August 1982. + + [8] Crocker, D. and P. Overell, Eds., "Augmented BNF for Syntax + Specifications: ABNF", RFC 2234, November 1997. + + [9] De Winter, J., "SMTP Service Extension for Remote Message Queue + Starting", RFC 1985, August 1996. + + [10] Fajman, R., "An Extensible Message Format for Message + Disposition Notifications", RFC 2298, March 1998. + + [11] Freed, N, "Behavior of and Requirements for Internet Firewalls", + RFC 2979, October 2000. + + [12] Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part One: Format of Internet Message Bodies", + RFC 2045, December 1996. + + + + +Klensin Standards Track [Page 68] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + [13] Freed, N., "SMTP Service Extension for Command Pipelining", RFC + 2920, September 2000. + + [14] Galvin, J., Murphy, S., Crocker, S. and N. Freed, "Security + Multiparts for MIME: Multipart/Signed and Multipart/Encrypted", + RFC 1847, October 1995. + + [15] Gellens, R. and J. Klensin, "Message Submission", RFC 2476, + December 1998. + + [16] Kille, S., "Mapping between X.400 and RFC822/MIME", RFC 2156, + January 1998. + + [17] Hinden, R and S. Deering, Eds. "IP Version 6 Addressing + Architecture", RFC 2373, July 1998. + + [18] Klensin, J., Freed, N. and K. Moore, "SMTP Service Extension for + Message Size Declaration", STD 10, RFC 1870, November 1995. + + [19] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker, + "SMTP Service Extensions", STD 10, RFC 1869, November 1995. + + [20] Klensin, J., Freed, N., Rose, M., Stefferud, E. and D. Crocker, + "SMTP Service Extension for 8bit-MIMEtransport", RFC 1652, July + 1994. + + [21] Lambert, M., "PCMAIL: A distributed mail system for personal + computers", RFC 1056, July 1988. + + [22] Mockapetris, P., "Domain names - implementation and + specification", STD 13, RFC 1035, November 1987. + + Mockapetris, P., "Domain names - concepts and facilities", STD + 13, RFC 1034, November 1987. + + [23] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part + Three: Message Header Extensions for Non-ASCII Text", RFC 2047, + December 1996. + + [24] Moore, K., "SMTP Service Extension for Delivery Status + Notifications", RFC 1891, January 1996. + + [25] Moore, K., and G. Vaudreuil, "An Extensible Message Format for + Delivery Status Notifications", RFC 1894, January 1996. + + [26] Myers, J. and M. Rose, "Post Office Protocol - Version 3", STD + 53, RFC 1939, May 1996. + + + + +Klensin Standards Track [Page 69] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + [27] Partridge, C., "Mail routing and the domain system", RFC 974, + January 1986. + + [28] Partridge, C., "Duplicate messages and SMTP", RFC 1047, February + 1988. + + [29] Postel, J., ed., "Transmission Control Protocol - DARPA Internet + Program Protocol Specification", STD 7, RFC 793, September 1981. + + [30] Postel, J., "Simple Mail Transfer Protocol", RFC 821, August + 1982. + + [31] Ramsdell, B., Ed., "S/MIME Version 3 Message Specification", RFC + 2633, June 1999. + + [32] Resnick, P., Ed., "Internet Message Format", RFC 2822, April + 2001. + + [33] Vaudreuil, G., "SMTP Service Extensions for Transmission of + Large and Binary MIME Messages", RFC 1830, August 1995. + + [34] Vaudreuil, G., "Enhanced Mail System Status Codes", RFC 1893, + January 1996. + +10. Editor's Address + + John C. Klensin + AT&T Laboratories + 99 Bedford St + Boston, MA 02111 USA + + Phone: 617-574-3076 + EMail: klensin@research.att.com + +11. Acknowledgments + + Many people worked long and hard on the many iterations of this + document. There was wide-ranging debate in the IETF DRUMS Working + Group, both on its mailing list and in face to face discussions, + about many technical issues and the role of a revised standard for + Internet mail transport, and many contributors helped form the + wording in this specification. The hundreds of participants in the + many discussions since RFC 821 was produced are too numerous to + mention, but they all helped this document become what it is. + + + + + + + +Klensin Standards Track [Page 70] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +APPENDICES + +A. TCP Transport Service + + The TCP connection supports the transmission of 8-bit bytes. The + SMTP data is 7-bit ASCII characters. Each character is transmitted + as an 8-bit byte with the high-order bit cleared to zero. Service + extensions may modify this rule to permit transmission of full 8-bit + data bytes as part of the message body, but not in SMTP commands or + responses. + +B. Generating SMTP Commands from RFC 822 Headers + + Some systems use RFC 822 headers (only) in a mail submission + protocol, or otherwise generate SMTP commands from RFC 822 headers + when such a message is handed to an MTA from a UA. While the MTA-UA + protocol is a private matter, not covered by any Internet Standard, + there are problems with this approach. For example, there have been + repeated problems with proper handling of "bcc" copies and + redistribution lists when information that conceptually belongs to a + mail envelopes is not separated early in processing from header + information (and kept separate). + + It is recommended that the UA provide its initial ("submission + client") MTA with an envelope separate from the message itself. + However, if the envelope is not supplied, SMTP commands SHOULD be + generated as follows: + + 1. Each recipient address from a TO, CC, or BCC header field SHOULD + be copied to a RCPT command (generating multiple message copies if + that is required for queuing or delivery). This includes any + addresses listed in a RFC 822 "group". Any BCC fields SHOULD then + be removed from the headers. Once this process is completed, the + remaining headers SHOULD be checked to verify that at least one + To:, Cc:, or Bcc: header remains. If none do, then a bcc: header + with no additional information SHOULD be inserted as specified in + [32]. + + 2. The return address in the MAIL command SHOULD, if possible, be + derived from the system's identity for the submitting (local) + user, and the "From:" header field otherwise. If there is a + system identity available, it SHOULD also be copied to the Sender + header field if it is different from the address in the From + header field. (Any Sender field that was already there SHOULD be + removed.) Systems may provide a way for submitters to override + the envelope return address, but may want to restrict its use to + privileged users. This will not prevent mail forgery, but may + lessen its incidence; see section 7.1. + + + +Klensin Standards Track [Page 71] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + When an MTA is being used in this way, it bears responsibility for + ensuring that the message being transmitted is valid. The mechanisms + for checking that validity, and for handling (or returning) messages + that are not valid at the time of arrival, are part of the MUA-MTA + interface and not covered by this specification. + + A submission protocol based on Standard RFC 822 information alone + MUST NOT be used to gateway a message from a foreign (non-SMTP) mail + system into an SMTP environment. Additional information to construct + an envelope must come from some source in the other environment, + whether supplemental headers or the foreign system's envelope. + + Attempts to gateway messages using only their header "to" and "cc" + fields have repeatedly caused mail loops and other behavior adverse + to the proper functioning of the Internet mail environment. These + problems have been especially common when the message originates from + an Internet mailing list and is distributed into the foreign + environment using envelope information. When these messages are then + processed by a header-only remailer, loops back to the Internet + environment (and the mailing list) are almost inevitable. + +C. Source Routes + + Historically, the was a reverse source routing list of + hosts and a source mailbox. The first host in the + SHOULD be the host sending the MAIL command. Similarly, the + may be a source routing lists of hosts and a + destination mailbox. However, in general, the SHOULD + contain only a mailbox and domain name, relying on the domain name + system to supply routing information if required. The use of source + routes is deprecated; while servers MUST be prepared to receive and + handle them as discussed in section 3.3 and F.2, clients SHOULD NOT + transmit them and this section was included only to provide context. + + For relay purposes, the forward-path may be a source route of the + form "@ONE,@TWO:JOE@THREE", where ONE, TWO, and THREE MUST BE fully- + qualified domain names. This form is used to emphasize the + distinction between an address and a route. The mailbox is an + absolute address, and the route is information about how to get + there. The two concepts should not be confused. + + If source routes are used, RFC 821 and the text below should be + consulted for the mechanisms for constructing and updating the + forward- and reverse-paths. + + + + + + + +Klensin Standards Track [Page 72] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + The SMTP server transforms the command arguments by moving its own + identifier (its domain name or that of any domain for which it is + acting as a mail exchanger), if it appears, from the forward-path to + the beginning of the reverse-path. + + Notice that the forward-path and reverse-path appear in the SMTP + commands and replies, but not necessarily in the message. That is, + there is no need for these paths and especially this syntax to appear + in the "To:" , "From:", "CC:", etc. fields of the message header. + Conversely, SMTP servers MUST NOT derive final message delivery + information from message header fields. + + When the list of hosts is present, it is a "reverse" source route and + indicates that the mail was relayed through each host on the list + (the first host in the list was the most recent relay). This list is + used as a source route to return non-delivery notices to the sender. + As each relay host adds itself to the beginning of the list, it MUST + use its name as known in the transport environment to which it is + relaying the mail rather than that of the transport environment from + which the mail came (if they are different). + +D. Scenarios + + This section presents complete scenarios of several types of SMTP + sessions. In the examples, "C:" indicates what is said by the SMTP + client, and "S:" indicates what is said by the SMTP server. + +D.1 A Typical SMTP Transaction Scenario + + This SMTP example shows mail sent by Smith at host bar.com, to Jones, + Green, and Brown at host foo.com. Here we assume that host bar.com + contacts host foo.com directly. The mail is accepted for Jones and + Brown. Green does not have a mailbox at host foo.com. + + S: 220 foo.com Simple Mail Transfer Service Ready + C: EHLO bar.com + S: 250-foo.com greets bar.com + S: 250-8BITMIME + S: 250-SIZE + S: 250-DSN + S: 250 HELP + C: MAIL FROM: + S: 250 OK + C: RCPT TO: + S: 250 OK + C: RCPT TO: + S: 550 No such user here + C: RCPT TO: + + + +Klensin Standards Track [Page 73] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + S: 250 OK + C: DATA + S: 354 Start mail input; end with . + C: Blah blah blah... + C: ...etc. etc. etc. + C: . + S: 250 OK + C: QUIT + S: 221 foo.com Service closing transmission channel + +D.2 Aborted SMTP Transaction Scenario + + S: 220 foo.com Simple Mail Transfer Service Ready + C: EHLO bar.com + S: 250-foo.com greets bar.com + S: 250-8BITMIME + S: 250-SIZE + S: 250-DSN + S: 250 HELP + C: MAIL FROM: + S: 250 OK + C: RCPT TO: + S: 250 OK + C: RCPT TO: + S: 550 No such user here + C: RSET + S: 250 OK + C: QUIT + S: 221 foo.com Service closing transmission channel + +D.3 Relayed Mail Scenario + + Step 1 -- Source Host to Relay Host + + S: 220 foo.com Simple Mail Transfer Service Ready + C: EHLO bar.com + S: 250-foo.com greets bar.com + S: 250-8BITMIME + S: 250-SIZE + S: 250-DSN + S: 250 HELP + C: MAIL FROM: + S: 250 OK + C: RCPT TO:<@foo.com:Jones@XYZ.COM> + S: 250 OK + C: DATA + S: 354 Start mail input; end with . + C: Date: Thu, 21 May 1998 05:33:29 -0700 + + + +Klensin Standards Track [Page 74] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + C: From: John Q. Public + C: Subject: The Next Meeting of the Board + C: To: Jones@xyz.com + C: + C: Bill: + C: The next meeting of the board of directors will be + C: on Tuesday. + C: John. + C: . + S: 250 OK + C: QUIT + S: 221 foo.com Service closing transmission channel + + Step 2 -- Relay Host to Destination Host + + S: 220 xyz.com Simple Mail Transfer Service Ready + C: EHLO foo.com + S: 250 xyz.com is on the air + C: MAIL FROM:<@foo.com:JQP@bar.com> + S: 250 OK + C: RCPT TO: + S: 250 OK + C: DATA + S: 354 Start mail input; end with . + C: Received: from bar.com by foo.com ; Thu, 21 May 1998 + C: 05:33:29 -0700 + C: Date: Thu, 21 May 1998 05:33:22 -0700 + C: From: John Q. Public + C: Subject: The Next Meeting of the Board + C: To: Jones@xyz.com + C: + C: Bill: + C: The next meeting of the board of directors will be + C: on Tuesday. + C: John. + C: . + S: 250 OK + C: QUIT + S: 221 foo.com Service closing transmission channel + +D.4 Verifying and Sending Scenario + + S: 220 foo.com Simple Mail Transfer Service Ready + C: EHLO bar.com + S: 250-foo.com greets bar.com + S: 250-8BITMIME + S: 250-SIZE + S: 250-DSN + + + +Klensin Standards Track [Page 75] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + + S: 250-VRFY + S: 250 HELP + C: VRFY Crispin + S: 250 Mark Crispin + C: SEND FROM: + S: 250 OK + C: RCPT TO: + S: 250 OK + C: DATA + S: 354 Start mail input; end with . + C: Blah blah blah... + C: ...etc. etc. etc. + C: . + S: 250 OK + C: QUIT + S: 221 foo.com Service closing transmission channel + +E. Other Gateway Issues + + In general, gateways between the Internet and other mail systems + SHOULD attempt to preserve any layering semantics across the + boundaries between the two mail systems involved. Gateway- + translation approaches that attempt to take shortcuts by mapping, + (such as envelope information from one system to the message headers + or body of another) have generally proven to be inadequate in + important ways. Systems translating between environments that do not + support both envelopes and headers and Internet mail must be written + with the understanding that some information loss is almost + inevitable. + +F. Deprecated Features of RFC 821 + + A few features of RFC 821 have proven to be problematic and SHOULD + NOT be used in Internet mail. + +F.1 TURN + + This command, described in RFC 821, raises important security issues + since, in the absence of strong authentication of the host requesting + that the client and server switch roles, it can easily be used to + divert mail from its correct destination. Its use is deprecated; + SMTP systems SHOULD NOT use it unless the server can authenticate the + client. + + + + + + + + +Klensin Standards Track [Page 76] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +F.2 Source Routing + + RFC 821 utilized the concept of explicit source routing to get mail + from one host to another via a series of relays. The requirement to + utilize source routes in regular mail traffic was eliminated by the + introduction of the domain name system "MX" record and the last + significant justification for them was eliminated by the + introduction, in RFC 1123, of a clear requirement that addresses + following an "@" must all be fully-qualified domain names. + Consequently, the only remaining justifications for the use of source + routes are support for very old SMTP clients or MUAs and in mail + system debugging. They can, however, still be useful in the latter + circumstance and for routing mail around serious, but temporary, + problems such as problems with the relevant DNS records. + + SMTP servers MUST continue to accept source route syntax as specified + in the main body of this document and in RFC 1123. They MAY, if + necessary, ignore the routes and utilize only the target domain in + the address. If they do utilize the source route, the message MUST + be sent to the first domain shown in the address. In particular, a + server MUST NOT guess at shortcuts within the source route. + + Clients SHOULD NOT utilize explicit source routing except under + unusual circumstances, such as debugging or potentially relaying + around firewall or mail system configuration errors. + +F.3 HELO + + As discussed in sections 3.1 and 4.1.1, EHLO is strongly preferred to + HELO when the server will accept the former. Servers must continue + to accept and process HELO in order to support older clients. + +F.4 #-literals + + RFC 821 provided for specifying an Internet address as a decimal + integer host number prefixed by a pound sign, "#". In practice, that + form has been obsolete since the introduction of TCP/IP. It is + deprecated and MUST NOT be used. + +F.5 Dates and Years + + When dates are inserted into messages by SMTP clients or servers + (e.g., in trace fields), four-digit years MUST BE used. Two-digit + years are deprecated; three-digit years were never permitted in the + Internet mail system. + + + + + + +Klensin Standards Track [Page 77] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +F.6 Sending versus Mailing + + In addition to specifying a mechanism for delivering messages to + user's mailboxes, RFC 821 provided additional, optional, commands to + deliver messages directly to the user's terminal screen. These + commands (SEND, SAML, SOML) were rarely implemented, and changes in + workstation technology and the introduction of other protocols may + have rendered them obsolete even where they are implemented. + + Clients SHOULD NOT provide SEND, SAML, or SOML as services. Servers + MAY implement them. If they are implemented by servers, the + implementation model specified in RFC 821 MUST be used and the + command names MUST be published in the response to the EHLO command. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Klensin Standards Track [Page 78] + +RFC 2821 Simple Mail Transfer Protocol April 2001 + + +Full Copyright Statement + + Copyright (C) The Internet Society (2001). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Acknowledgement + + Funding for the RFC Editor function is currently provided by the + Internet Society. + + + + + + + + + + + + + + + + + + + +Klensin Standards Track [Page 79] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2822.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2822.txt new file mode 100644 index 0000000..9f698f7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc2822.txt @@ -0,0 +1,2859 @@ + + + + + + +Network Working Group P. Resnick, Editor +Request for Comments: 2822 QUALCOMM Incorporated +Obsoletes: 822 April 2001 +Category: Standards Track + + + Internet Message Format + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2001). All Rights Reserved. + +Abstract + + This standard specifies a syntax for text messages that are sent + between computer users, within the framework of "electronic mail" + messages. This standard supersedes the one specified in Request For + Comments (RFC) 822, "Standard for the Format of ARPA Internet Text + Messages", updating it to reflect current practice and incorporating + incremental changes that were specified in other RFCs. + +Table of Contents + + 1. Introduction ............................................... 3 + 1.1. Scope .................................................... 3 + 1.2. Notational conventions ................................... 4 + 1.2.1. Requirements notation .................................. 4 + 1.2.2. Syntactic notation ..................................... 4 + 1.3. Structure of this document ............................... 4 + 2. Lexical Analysis of Messages ............................... 5 + 2.1. General Description ...................................... 5 + 2.1.1. Line Length Limits ..................................... 6 + 2.2. Header Fields ............................................ 7 + 2.2.1. Unstructured Header Field Bodies ....................... 7 + 2.2.2. Structured Header Field Bodies ......................... 7 + 2.2.3. Long Header Fields ..................................... 7 + 2.3. Body ..................................................... 8 + 3. Syntax ..................................................... 9 + 3.1. Introduction ............................................. 9 + 3.2. Lexical Tokens ........................................... 9 + + + +Resnick Standards Track [Page 1] + +RFC 2822 Internet Message Format April 2001 + + + 3.2.1. Primitive Tokens ....................................... 9 + 3.2.2. Quoted characters ......................................10 + 3.2.3. Folding white space and comments .......................11 + 3.2.4. Atom ...................................................12 + 3.2.5. Quoted strings .........................................13 + 3.2.6. Miscellaneous tokens ...................................13 + 3.3. Date and Time Specification ..............................14 + 3.4. Address Specification ....................................15 + 3.4.1. Addr-spec specification ................................16 + 3.5 Overall message syntax ....................................17 + 3.6. Field definitions ........................................18 + 3.6.1. The origination date field .............................20 + 3.6.2. Originator fields ......................................21 + 3.6.3. Destination address fields .............................22 + 3.6.4. Identification fields ..................................23 + 3.6.5. Informational fields ...................................26 + 3.6.6. Resent fields ..........................................26 + 3.6.7. Trace fields ...........................................28 + 3.6.8. Optional fields ........................................29 + 4. Obsolete Syntax ............................................29 + 4.1. Miscellaneous obsolete tokens ............................30 + 4.2. Obsolete folding white space .............................31 + 4.3. Obsolete Date and Time ...................................31 + 4.4. Obsolete Addressing ......................................33 + 4.5. Obsolete header fields ...................................33 + 4.5.1. Obsolete origination date field ........................34 + 4.5.2. Obsolete originator fields .............................34 + 4.5.3. Obsolete destination address fields ....................34 + 4.5.4. Obsolete identification fields .........................35 + 4.5.5. Obsolete informational fields ..........................35 + 4.5.6. Obsolete resent fields .................................35 + 4.5.7. Obsolete trace fields ..................................36 + 4.5.8. Obsolete optional fields ...............................36 + 5. Security Considerations ....................................36 + 6. Bibliography ...............................................37 + 7. Editor's Address ...........................................38 + 8. Acknowledgements ...........................................39 + Appendix A. Example messages ..................................41 + A.1. Addressing examples ......................................41 + A.1.1. A message from one person to another with simple + addressing .............................................41 + A.1.2. Different types of mailboxes ...........................42 + A.1.3. Group addresses ........................................43 + A.2. Reply messages ...........................................43 + A.3. Resent messages ..........................................44 + A.4. Messages with trace fields ...............................46 + A.5. White space, comments, and other oddities ................47 + A.6. Obsoleted forms ..........................................47 + + + +Resnick Standards Track [Page 2] + +RFC 2822 Internet Message Format April 2001 + + + A.6.1. Obsolete addressing ....................................48 + A.6.2. Obsolete dates .........................................48 + A.6.3. Obsolete white space and comments ......................48 + Appendix B. Differences from earlier standards ................49 + Appendix C. Notices ...........................................50 + Full Copyright Statement ......................................51 + +1. Introduction + +1.1. Scope + + This standard specifies a syntax for text messages that are sent + between computer users, within the framework of "electronic mail" + messages. This standard supersedes the one specified in Request For + Comments (RFC) 822, "Standard for the Format of ARPA Internet Text + Messages" [RFC822], updating it to reflect current practice and + incorporating incremental changes that were specified in other RFCs + [STD3]. + + This standard specifies a syntax only for text messages. In + particular, it makes no provision for the transmission of images, + audio, or other sorts of structured data in electronic mail messages. + There are several extensions published, such as the MIME document + series [RFC2045, RFC2046, RFC2049], which describe mechanisms for the + transmission of such data through electronic mail, either by + extending the syntax provided here or by structuring such messages to + conform to this syntax. Those mechanisms are outside of the scope of + this standard. + + In the context of electronic mail, messages are viewed as having an + envelope and contents. The envelope contains whatever information is + needed to accomplish transmission and delivery. (See [RFC2821] for a + discussion of the envelope.) The contents comprise the object to be + delivered to the recipient. This standard applies only to the format + and some of the semantics of message contents. It contains no + specification of the information in the envelope. + + However, some message systems may use information from the contents + to create the envelope. It is intended that this standard facilitate + the acquisition of such information by programs. + + This specification is intended as a definition of what message + content format is to be passed between systems. Though some message + systems locally store messages in this format (which eliminates the + need for translation between formats) and others use formats that + differ from the one specified in this standard, local storage is + outside of the scope of this standard. + + + + +Resnick Standards Track [Page 3] + +RFC 2822 Internet Message Format April 2001 + + + Note: This standard is not intended to dictate the internal formats + used by sites, the specific message system features that they are + expected to support, or any of the characteristics of user interface + programs that create or read messages. In addition, this standard + does not specify an encoding of the characters for either transport + or storage; that is, it does not specify the number of bits used or + how those bits are specifically transferred over the wire or stored + on disk. + +1.2. Notational conventions + +1.2.1. Requirements notation + + This document occasionally uses terms that appear in capital letters. + When the terms "MUST", "SHOULD", "RECOMMENDED", "MUST NOT", "SHOULD + NOT", and "MAY" appear capitalized, they are being used to indicate + particular requirements of this specification. A discussion of the + meanings of these terms appears in [RFC2119]. + +1.2.2. Syntactic notation + + This standard uses the Augmented Backus-Naur Form (ABNF) notation + specified in [RFC2234] for the formal definitions of the syntax of + messages. Characters will be specified either by a decimal value + (e.g., the value %d65 for uppercase A and %d97 for lowercase A) or by + a case-insensitive literal value enclosed in quotation marks (e.g., + "A" for either uppercase or lowercase A). See [RFC2234] for the full + description of the notation. + +1.3. Structure of this document + + This document is divided into several sections. + + This section, section 1, is a short introduction to the document. + + Section 2 lays out the general description of a message and its + constituent parts. This is an overview to help the reader understand + some of the general principles used in the later portions of this + document. Any examples in this section MUST NOT be taken as + specification of the formal syntax of any part of a message. + + Section 3 specifies formal ABNF rules for the structure of each part + of a message (the syntax) and describes the relationship between + those parts and their meaning in the context of a message (the + semantics). That is, it describes the actual rules for the structure + of each part of a message (the syntax) as well as a description of + the parts and instructions on how they ought to be interpreted (the + semantics). This includes analysis of the syntax and semantics of + + + +Resnick Standards Track [Page 4] + +RFC 2822 Internet Message Format April 2001 + + + subparts of messages that have specific structure. The syntax + included in section 3 represents messages as they MUST be created. + There are also notes in section 3 to indicate if any of the options + specified in the syntax SHOULD be used over any of the others. + + Both sections 2 and 3 describe messages that are legal to generate + for purposes of this standard. + + Section 4 of this document specifies an "obsolete" syntax. There are + references in section 3 to these obsolete syntactic elements. The + rules of the obsolete syntax are elements that have appeared in + earlier revisions of this standard or have previously been widely + used in Internet messages. As such, these elements MUST be + interpreted by parsers of messages in order to be conformant to this + standard. However, since items in this syntax have been determined + to be non-interoperable or to cause significant problems for + recipients of messages, they MUST NOT be generated by creators of + conformant messages. + + Section 5 details security considerations to take into account when + implementing this standard. + + Section 6 is a bibliography of references in this document. + + Section 7 contains the editor's address. + + Section 8 contains acknowledgements. + + Appendix A lists examples of different sorts of messages. These + examples are not exhaustive of the types of messages that appear on + the Internet, but give a broad overview of certain syntactic forms. + + Appendix B lists the differences between this standard and earlier + standards for Internet messages. + + Appendix C has copyright and intellectual property notices. + +2. Lexical Analysis of Messages + +2.1. General Description + + At the most basic level, a message is a series of characters. A + message that is conformant with this standard is comprised of + characters with values in the range 1 through 127 and interpreted as + US-ASCII characters [ASCII]. For brevity, this document sometimes + refers to this range of characters as simply "US-ASCII characters". + + + + + +Resnick Standards Track [Page 5] + +RFC 2822 Internet Message Format April 2001 + + + Note: This standard specifies that messages are made up of characters + in the US-ASCII range of 1 through 127. There are other documents, + specifically the MIME document series [RFC2045, RFC2046, RFC2047, + RFC2048, RFC2049], that extend this standard to allow for values + outside of that range. Discussion of those mechanisms is not within + the scope of this standard. + + Messages are divided into lines of characters. A line is a series of + characters that is delimited with the two characters carriage-return + and line-feed; that is, the carriage return (CR) character (ASCII + value 13) followed immediately by the line feed (LF) character (ASCII + value 10). (The carriage-return/line-feed pair is usually written in + this document as "CRLF".) + + A message consists of header fields (collectively called "the header + of the message") followed, optionally, by a body. The header is a + sequence of lines of characters with special syntax as defined in + this standard. The body is simply a sequence of characters that + follows the header and is separated from the header by an empty line + (i.e., a line with nothing preceding the CRLF). + +2.1.1. Line Length Limits + + There are two limits that this standard places on the number of + characters in a line. Each line of characters MUST be no more than + 998 characters, and SHOULD be no more than 78 characters, excluding + the CRLF. + + The 998 character limit is due to limitations in many implementations + which send, receive, or store Internet Message Format messages that + simply cannot handle more than 998 characters on a line. Receiving + implementations would do well to handle an arbitrarily large number + of characters in a line for robustness sake. However, there are so + many implementations which (in compliance with the transport + requirements of [RFC2821]) do not accept messages containing more + than 1000 character including the CR and LF per line, it is important + for implementations not to create such messages. + + The more conservative 78 character recommendation is to accommodate + the many implementations of user interfaces that display these + messages which may truncate, or disastrously wrap, the display of + more than 78 characters per line, in spite of the fact that such + implementations are non-conformant to the intent of this + specification (and that of [RFC2821] if they actually cause + information to be lost). Again, even though this limitation is put on + messages, it is encumbant upon implementations which display messages + + + + + +Resnick Standards Track [Page 6] + +RFC 2822 Internet Message Format April 2001 + + + to handle an arbitrarily large number of characters in a line + (certainly at least up to the 998 character limit) for the sake of + robustness. + +2.2. Header Fields + + Header fields are lines composed of a field name, followed by a colon + (":"), followed by a field body, and terminated by CRLF. A field + name MUST be composed of printable US-ASCII characters (i.e., + characters that have values between 33 and 126, inclusive), except + colon. A field body may be composed of any US-ASCII characters, + except for CR and LF. However, a field body may contain CRLF when + used in header "folding" and "unfolding" as described in section + 2.2.3. All field bodies MUST conform to the syntax described in + sections 3 and 4 of this standard. + +2.2.1. Unstructured Header Field Bodies + + Some field bodies in this standard are defined simply as + "unstructured" (which is specified below as any US-ASCII characters, + except for CR and LF) with no further restrictions. These are + referred to as unstructured field bodies. Semantically, unstructured + field bodies are simply to be treated as a single line of characters + with no further processing (except for header "folding" and + "unfolding" as described in section 2.2.3). + +2.2.2. Structured Header Field Bodies + + Some field bodies in this standard have specific syntactical + structure more restrictive than the unstructured field bodies + described above. These are referred to as "structured" field bodies. + Structured field bodies are sequences of specific lexical tokens as + described in sections 3 and 4 of this standard. Many of these tokens + are allowed (according to their syntax) to be introduced or end with + comments (as described in section 3.2.3) as well as the space (SP, + ASCII value 32) and horizontal tab (HTAB, ASCII value 9) characters + (together known as the white space characters, WSP), and those WSP + characters are subject to header "folding" and "unfolding" as + described in section 2.2.3. Semantic analysis of structured field + bodies is given along with their syntax. + +2.2.3. Long Header Fields + + Each header field is logically a single line of characters comprising + the field name, the colon, and the field body. For convenience + however, and to deal with the 998/78 character limitations per line, + the field body portion of a header field can be split into a multiple + line representation; this is called "folding". The general rule is + + + +Resnick Standards Track [Page 7] + +RFC 2822 Internet Message Format April 2001 + + + that wherever this standard allows for folding white space (not + simply WSP characters), a CRLF may be inserted before any WSP. For + example, the header field: + + Subject: This is a test + + can be represented as: + + Subject: This + is a test + + Note: Though structured field bodies are defined in such a way that + folding can take place between many of the lexical tokens (and even + within some of the lexical tokens), folding SHOULD be limited to + placing the CRLF at higher-level syntactic breaks. For instance, if + a field body is defined as comma-separated values, it is recommended + that folding occur after the comma separating the structured items in + preference to other places where the field could be folded, even if + it is allowed elsewhere. + + The process of moving from this folded multiple-line representation + of a header field to its single line representation is called + "unfolding". Unfolding is accomplished by simply removing any CRLF + that is immediately followed by WSP. Each header field should be + treated in its unfolded form for further syntactic and semantic + evaluation. + +2.3. Body + + The body of a message is simply lines of US-ASCII characters. The + only two limitations on the body are as follows: + + - CR and LF MUST only occur together as CRLF; they MUST NOT appear + independently in the body. + + - Lines of characters in the body MUST be limited to 998 characters, + and SHOULD be limited to 78 characters, excluding the CRLF. + + Note: As was stated earlier, there are other standards documents, + specifically the MIME documents [RFC2045, RFC2046, RFC2048, RFC2049] + that extend this standard to allow for different sorts of message + bodies. Again, these mechanisms are beyond the scope of this + document. + + + + + + + + +Resnick Standards Track [Page 8] + +RFC 2822 Internet Message Format April 2001 + + +3. Syntax + +3.1. Introduction + + The syntax as given in this section defines the legal syntax of + Internet messages. Messages that are conformant to this standard + MUST conform to the syntax in this section. If there are options in + this section where one option SHOULD be generated, that is indicated + either in the prose or in a comment next to the syntax. + + For the defined expressions, a short description of the syntax and + use is given, followed by the syntax in ABNF, followed by a semantic + analysis. Primitive tokens that are used but otherwise unspecified + come from [RFC2234]. + + In some of the definitions, there will be nonterminals whose names + start with "obs-". These "obs-" elements refer to tokens defined in + the obsolete syntax in section 4. In all cases, these productions + are to be ignored for the purposes of generating legal Internet + messages and MUST NOT be used as part of such a message. However, + when interpreting messages, these tokens MUST be honored as part of + the legal syntax. In this sense, section 3 defines a grammar for + generation of messages, with "obs-" elements that are to be ignored, + while section 4 adds grammar for interpretation of messages. + +3.2. Lexical Tokens + + The following rules are used to define an underlying lexical + analyzer, which feeds tokens to the higher-level parsers. This + section defines the tokens used in structured header field bodies. + + Note: Readers of this standard need to pay special attention to how + these lexical tokens are used in both the lower-level and + higher-level syntax later in the document. Particularly, the white + space tokens and the comment tokens defined in section 3.2.3 get used + in the lower-level tokens defined here, and those lower-level tokens + are in turn used as parts of the higher-level tokens defined later. + Therefore, the white space and comments may be allowed in the + higher-level tokens even though they may not explicitly appear in a + particular definition. + +3.2.1. Primitive Tokens + + The following are primitive tokens referred to elsewhere in this + standard, but not otherwise defined in [RFC2234]. Some of them will + not appear anywhere else in the syntax, but they are convenient to + refer to in other parts of this document. + + + + +Resnick Standards Track [Page 9] + +RFC 2822 Internet Message Format April 2001 + + + Note: The "specials" below are just such an example. Though the + specials token does not appear anywhere else in this standard, it is + useful for implementers who use tools that lexically analyze + messages. Each of the characters in specials can be used to indicate + a tokenization point in lexical analysis. + +NO-WS-CTL = %d1-8 / ; US-ASCII control characters + %d11 / ; that do not include the + %d12 / ; carriage return, line feed, + %d14-31 / ; and white space characters + %d127 + +text = %d1-9 / ; Characters excluding CR and LF + %d11 / + %d12 / + %d14-127 / + obs-text + +specials = "(" / ")" / ; Special characters used in + "<" / ">" / ; other parts of the syntax + "[" / "]" / + ":" / ";" / + "@" / "\" / + "," / "." / + DQUOTE + + No special semantics are attached to these tokens. They are simply + single characters. + +3.2.2. Quoted characters + + Some characters are reserved for special interpretation, such as + delimiting lexical tokens. To permit use of these characters as + uninterpreted data, a quoting mechanism is provided. + +quoted-pair = ("\" text) / obs-qp + + Where any quoted-pair appears, it is to be interpreted as the text + character alone. That is to say, the "\" character that appears as + part of a quoted-pair is semantically "invisible". + + Note: The "\" character may appear in a message where it is not part + of a quoted-pair. A "\" character that does not appear in a + quoted-pair is not semantically invisible. The only places in this + standard where quoted-pair currently appears are ccontent, qcontent, + dcontent, no-fold-quote, and no-fold-literal. + + + + + +Resnick Standards Track [Page 10] + +RFC 2822 Internet Message Format April 2001 + + +3.2.3. Folding white space and comments + + White space characters, including white space used in folding + (described in section 2.2.3), may appear between many elements in + header field bodies. Also, strings of characters that are treated as + comments may be included in structured field bodies as characters + enclosed in parentheses. The following defines the folding white + space (FWS) and comment constructs. + + Strings of characters enclosed in parentheses are considered comments + so long as they do not appear within a "quoted-string", as defined in + section 3.2.5. Comments may nest. + + There are several places in this standard where comments and FWS may + be freely inserted. To accommodate that syntax, an additional token + for "CFWS" is defined for places where comments and/or FWS can occur. + However, where CFWS occurs in this standard, it MUST NOT be inserted + in such a way that any line of a folded header field is made up + entirely of WSP characters and nothing else. + +FWS = ([*WSP CRLF] 1*WSP) / ; Folding white space + obs-FWS + +ctext = NO-WS-CTL / ; Non white space controls + + %d33-39 / ; The rest of the US-ASCII + %d42-91 / ; characters not including "(", + %d93-126 ; ")", or "\" + +ccontent = ctext / quoted-pair / comment + +comment = "(" *([FWS] ccontent) [FWS] ")" + +CFWS = *([FWS] comment) (([FWS] comment) / FWS) + + Throughout this standard, where FWS (the folding white space token) + appears, it indicates a place where header folding, as discussed in + section 2.2.3, may take place. Wherever header folding appears in a + message (that is, a header field body containing a CRLF followed by + any WSP), header unfolding (removal of the CRLF) is performed before + any further lexical analysis is performed on that header field + according to this standard. That is to say, any CRLF that appears in + FWS is semantically "invisible." + + A comment is normally used in a structured field body to provide some + human readable informational text. Since a comment is allowed to + contain FWS, folding is permitted within the comment. Also note that + since quoted-pair is allowed in a comment, the parentheses and + + + +Resnick Standards Track [Page 11] + +RFC 2822 Internet Message Format April 2001 + + + backslash characters may appear in a comment so long as they appear + as a quoted-pair. Semantically, the enclosing parentheses are not + part of the comment; the comment is what is contained between the two + parentheses. As stated earlier, the "\" in any quoted-pair and the + CRLF in any FWS that appears within the comment are semantically + "invisible" and therefore not part of the comment either. + + Runs of FWS, comment or CFWS that occur between lexical tokens in a + structured field header are semantically interpreted as a single + space character. + +3.2.4. Atom + + Several productions in structured header field bodies are simply + strings of certain basic characters. Such productions are called + atoms. + + Some of the structured header field bodies also allow the period + character (".", ASCII value 46) within runs of atext. An additional + "dot-atom" token is defined for those purposes. + +atext = ALPHA / DIGIT / ; Any character except controls, + "!" / "#" / ; SP, and specials. + "$" / "%" / ; Used for atoms + "&" / "'" / + "*" / "+" / + "-" / "/" / + "=" / "?" / + "^" / "_" / + "`" / "{" / + "|" / "}" / + "~" + +atom = [CFWS] 1*atext [CFWS] + +dot-atom = [CFWS] dot-atom-text [CFWS] + +dot-atom-text = 1*atext *("." 1*atext) + + Both atom and dot-atom are interpreted as a single unit, comprised of + the string of characters that make it up. Semantically, the optional + comments and FWS surrounding the rest of the characters are not part + of the atom; the atom is only the run of atext characters in an atom, + or the atext and "." characters in a dot-atom. + + + + + + + +Resnick Standards Track [Page 12] + +RFC 2822 Internet Message Format April 2001 + + +3.2.5. Quoted strings + + Strings of characters that include characters other than those + allowed in atoms may be represented in a quoted string format, where + the characters are surrounded by quote (DQUOTE, ASCII value 34) + characters. + +qtext = NO-WS-CTL / ; Non white space controls + + %d33 / ; The rest of the US-ASCII + %d35-91 / ; characters not including "\" + %d93-126 ; or the quote character + +qcontent = qtext / quoted-pair + +quoted-string = [CFWS] + DQUOTE *([FWS] qcontent) [FWS] DQUOTE + [CFWS] + + A quoted-string is treated as a unit. That is, quoted-string is + identical to atom, semantically. Since a quoted-string is allowed to + contain FWS, folding is permitted. Also note that since quoted-pair + is allowed in a quoted-string, the quote and backslash characters may + appear in a quoted-string so long as they appear as a quoted-pair. + + Semantically, neither the optional CFWS outside of the quote + characters nor the quote characters themselves are part of the + quoted-string; the quoted-string is what is contained between the two + quote characters. As stated earlier, the "\" in any quoted-pair and + the CRLF in any FWS/CFWS that appears within the quoted-string are + semantically "invisible" and therefore not part of the quoted-string + either. + +3.2.6. Miscellaneous tokens + + Three additional tokens are defined, word and phrase for combinations + of atoms and/or quoted-strings, and unstructured for use in + unstructured header fields and in some places within structured + header fields. + +word = atom / quoted-string + +phrase = 1*word / obs-phrase + + + + + + + + +Resnick Standards Track [Page 13] + +RFC 2822 Internet Message Format April 2001 + + +utext = NO-WS-CTL / ; Non white space controls + %d33-126 / ; The rest of US-ASCII + obs-utext + +unstructured = *([FWS] utext) [FWS] + +3.3. Date and Time Specification + + Date and time occur in several header fields. This section specifies + the syntax for a full date and time specification. Though folding + white space is permitted throughout the date-time specification, it + is RECOMMENDED that a single space be used in each place that FWS + appears (whether it is required or optional); some older + implementations may not interpret other occurrences of folding white + space correctly. + +date-time = [ day-of-week "," ] date FWS time [CFWS] + +day-of-week = ([FWS] day-name) / obs-day-of-week + +day-name = "Mon" / "Tue" / "Wed" / "Thu" / + "Fri" / "Sat" / "Sun" + +date = day month year + +year = 4*DIGIT / obs-year + +month = (FWS month-name FWS) / obs-month + +month-name = "Jan" / "Feb" / "Mar" / "Apr" / + "May" / "Jun" / "Jul" / "Aug" / + "Sep" / "Oct" / "Nov" / "Dec" + +day = ([FWS] 1*2DIGIT) / obs-day + +time = time-of-day FWS zone + +time-of-day = hour ":" minute [ ":" second ] + +hour = 2DIGIT / obs-hour + +minute = 2DIGIT / obs-minute + +second = 2DIGIT / obs-second + +zone = (( "+" / "-" ) 4DIGIT) / obs-zone + + + + + +Resnick Standards Track [Page 14] + +RFC 2822 Internet Message Format April 2001 + + + The day is the numeric day of the month. The year is any numeric + year 1900 or later. + + The time-of-day specifies the number of hours, minutes, and + optionally seconds since midnight of the date indicated. + + The date and time-of-day SHOULD express local time. + + The zone specifies the offset from Coordinated Universal Time (UTC, + formerly referred to as "Greenwich Mean Time") that the date and + time-of-day represent. The "+" or "-" indicates whether the + time-of-day is ahead of (i.e., east of) or behind (i.e., west of) + Universal Time. The first two digits indicate the number of hours + difference from Universal Time, and the last two digits indicate the + number of minutes difference from Universal Time. (Hence, +hhmm + means +(hh * 60 + mm) minutes, and -hhmm means -(hh * 60 + mm) + minutes). The form "+0000" SHOULD be used to indicate a time zone at + Universal Time. Though "-0000" also indicates Universal Time, it is + used to indicate that the time was generated on a system that may be + in a local time zone other than Universal Time and therefore + indicates that the date-time contains no information about the local + time zone. + + A date-time specification MUST be semantically valid. That is, the + day-of-the-week (if included) MUST be the day implied by the date, + the numeric day-of-month MUST be between 1 and the number of days + allowed for the specified month (in the specified year), the + time-of-day MUST be in the range 00:00:00 through 23:59:60 (the + number of seconds allowing for a leap second; see [STD12]), and the + zone MUST be within the range -9959 through +9959. + +3.4. Address Specification + + Addresses occur in several message header fields to indicate senders + and recipients of messages. An address may either be an individual + mailbox, or a group of mailboxes. + +address = mailbox / group + +mailbox = name-addr / addr-spec + +name-addr = [display-name] angle-addr + +angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr + +group = display-name ":" [mailbox-list / CFWS] ";" + [CFWS] + + + + +Resnick Standards Track [Page 15] + +RFC 2822 Internet Message Format April 2001 + + +display-name = phrase + +mailbox-list = (mailbox *("," mailbox)) / obs-mbox-list + +address-list = (address *("," address)) / obs-addr-list + + A mailbox receives mail. It is a conceptual entity which does not + necessarily pertain to file storage. For example, some sites may + choose to print mail on a printer and deliver the output to the + addressee's desk. Normally, a mailbox is comprised of two parts: (1) + an optional display name that indicates the name of the recipient + (which could be a person or a system) that could be displayed to the + user of a mail application, and (2) an addr-spec address enclosed in + angle brackets ("<" and ">"). There is also an alternate simple form + of a mailbox where the addr-spec address appears alone, without the + recipient's name or the angle brackets. The Internet addr-spec + address is described in section 3.4.1. + + Note: Some legacy implementations used the simple form where the + addr-spec appears without the angle brackets, but included the name + of the recipient in parentheses as a comment following the addr-spec. + Since the meaning of the information in a comment is unspecified, + implementations SHOULD use the full name-addr form of the mailbox, + instead of the legacy form, to specify the display name associated + with a mailbox. Also, because some legacy implementations interpret + the comment, comments generally SHOULD NOT be used in address fields + to avoid confusing such implementations. + + When it is desirable to treat several mailboxes as a single unit + (i.e., in a distribution list), the group construct can be used. The + group construct allows the sender to indicate a named group of + recipients. This is done by giving a display name for the group, + followed by a colon, followed by a comma separated list of any number + of mailboxes (including zero and one), and ending with a semicolon. + Because the list of mailboxes can be empty, using the group construct + is also a simple way to communicate to recipients that the message + was sent to one or more named sets of recipients, without actually + providing the individual mailbox address for each of those + recipients. + +3.4.1. Addr-spec specification + + An addr-spec is a specific Internet identifier that contains a + locally interpreted string followed by the at-sign character ("@", + ASCII value 64) followed by an Internet domain. The locally + interpreted string is either a quoted-string or a dot-atom. If the + string can be represented as a dot-atom (that is, it contains no + characters other than atext characters or "." surrounded by atext + + + +Resnick Standards Track [Page 16] + +RFC 2822 Internet Message Format April 2001 + + + characters), then the dot-atom form SHOULD be used and the + quoted-string form SHOULD NOT be used. Comments and folding white + space SHOULD NOT be used around the "@" in the addr-spec. + +addr-spec = local-part "@" domain + +local-part = dot-atom / quoted-string / obs-local-part + +domain = dot-atom / domain-literal / obs-domain + +domain-literal = [CFWS] "[" *([FWS] dcontent) [FWS] "]" [CFWS] + +dcontent = dtext / quoted-pair + +dtext = NO-WS-CTL / ; Non white space controls + + %d33-90 / ; The rest of the US-ASCII + %d94-126 ; characters not including "[", + ; "]", or "\" + + The domain portion identifies the point to which the mail is + delivered. In the dot-atom form, this is interpreted as an Internet + domain name (either a host name or a mail exchanger name) as + described in [STD3, STD13, STD14]. In the domain-literal form, the + domain is interpreted as the literal Internet address of the + particular host. In both cases, how addressing is used and how + messages are transported to a particular host is covered in the mail + transport document [RFC2821]. These mechanisms are outside of the + scope of this document. + + The local-part portion is a domain dependent string. In addresses, + it is simply interpreted on the particular host as a name of a + particular mailbox. + +3.5 Overall message syntax + + A message consists of header fields, optionally followed by a message + body. Lines in a message MUST be a maximum of 998 characters + excluding the CRLF, but it is RECOMMENDED that lines be limited to 78 + characters excluding the CRLF. (See section 2.1.1 for explanation.) + In a message body, though all of the characters listed in the text + rule MAY be used, the use of US-ASCII control characters (values 1 + through 8, 11, 12, and 14 through 31) is discouraged since their + interpretation by receivers for display is not guaranteed. + + + + + + + +Resnick Standards Track [Page 17] + +RFC 2822 Internet Message Format April 2001 + + +message = (fields / obs-fields) + [CRLF body] + +body = *(*998text CRLF) *998text + + The header fields carry most of the semantic information and are + defined in section 3.6. The body is simply a series of lines of text + which are uninterpreted for the purposes of this standard. + +3.6. Field definitions + + The header fields of a message are defined here. All header fields + have the same general syntactic structure: A field name, followed by + a colon, followed by the field body. The specific syntax for each + header field is defined in the subsequent sections. + + Note: In the ABNF syntax for each field in subsequent sections, each + field name is followed by the required colon. However, for brevity + sometimes the colon is not referred to in the textual description of + the syntax. It is, nonetheless, required. + + It is important to note that the header fields are not guaranteed to + be in a particular order. They may appear in any order, and they + have been known to be reordered occasionally when transported over + the Internet. However, for the purposes of this standard, header + fields SHOULD NOT be reordered when a message is transported or + transformed. More importantly, the trace header fields and resent + header fields MUST NOT be reordered, and SHOULD be kept in blocks + prepended to the message. See sections 3.6.6 and 3.6.7 for more + information. + + The only required header fields are the origination date field and + the originator address field(s). All other header fields are + syntactically optional. More information is contained in the table + following this definition. + +fields = *(trace + *(resent-date / + resent-from / + resent-sender / + resent-to / + resent-cc / + resent-bcc / + resent-msg-id)) + *(orig-date / + from / + sender / + reply-to / + + + +Resnick Standards Track [Page 18] + +RFC 2822 Internet Message Format April 2001 + + + to / + cc / + bcc / + message-id / + in-reply-to / + references / + subject / + comments / + keywords / + optional-field) + + The following table indicates limits on the number of times each + field may occur in a message header as well as any special + limitations on the use of those fields. An asterisk next to a value + in the minimum or maximum column indicates that a special restriction + appears in the Notes column. + +Field Min number Max number Notes + +trace 0 unlimited Block prepended - see + 3.6.7 + +resent-date 0* unlimited* One per block, required + if other resent fields + present - see 3.6.6 + +resent-from 0 unlimited* One per block - see + 3.6.6 + +resent-sender 0* unlimited* One per block, MUST + occur with multi-address + resent-from - see 3.6.6 + +resent-to 0 unlimited* One per block - see + 3.6.6 + +resent-cc 0 unlimited* One per block - see + 3.6.6 + +resent-bcc 0 unlimited* One per block - see + 3.6.6 + +resent-msg-id 0 unlimited* One per block - see + 3.6.6 + +orig-date 1 1 + +from 1 1 See sender and 3.6.2 + + + +Resnick Standards Track [Page 19] + +RFC 2822 Internet Message Format April 2001 + + +sender 0* 1 MUST occur with multi- + address from - see 3.6.2 + +reply-to 0 1 + +to 0 1 + +cc 0 1 + +bcc 0 1 + +message-id 0* 1 SHOULD be present - see + 3.6.4 + +in-reply-to 0* 1 SHOULD occur in some + replies - see 3.6.4 + +references 0* 1 SHOULD occur in some + replies - see 3.6.4 + +subject 0 1 + +comments 0 unlimited + +keywords 0 unlimited + +optional-field 0 unlimited + + The exact interpretation of each field is described in subsequent + sections. + +3.6.1. The origination date field + + The origination date field consists of the field name "Date" followed + by a date-time specification. + +orig-date = "Date:" date-time CRLF + + The origination date specifies the date and time at which the creator + of the message indicated that the message was complete and ready to + enter the mail delivery system. For instance, this might be the time + that a user pushes the "send" or "submit" button in an application + program. In any case, it is specifically not intended to convey the + time that the message is actually transported, but rather the time at + which the human or other creator of the message has put the message + into its final form, ready for transport. (For example, a portable + computer user who is not connected to a network might queue a message + + + + +Resnick Standards Track [Page 20] + +RFC 2822 Internet Message Format April 2001 + + + for delivery. The origination date is intended to contain the date + and time that the user queued the message, not the time when the user + connected to the network to send the message.) + +3.6.2. Originator fields + + The originator fields of a message consist of the from field, the + sender field (when applicable), and optionally the reply-to field. + The from field consists of the field name "From" and a + comma-separated list of one or more mailbox specifications. If the + from field contains more than one mailbox specification in the + mailbox-list, then the sender field, containing the field name + "Sender" and a single mailbox specification, MUST appear in the + message. In either case, an optional reply-to field MAY also be + included, which contains the field name "Reply-To" and a + comma-separated list of one or more addresses. + +from = "From:" mailbox-list CRLF + +sender = "Sender:" mailbox CRLF + +reply-to = "Reply-To:" address-list CRLF + + The originator fields indicate the mailbox(es) of the source of the + message. The "From:" field specifies the author(s) of the message, + that is, the mailbox(es) of the person(s) or system(s) responsible + for the writing of the message. The "Sender:" field specifies the + mailbox of the agent responsible for the actual transmission of the + message. For example, if a secretary were to send a message for + another person, the mailbox of the secretary would appear in the + "Sender:" field and the mailbox of the actual author would appear in + the "From:" field. If the originator of the message can be indicated + by a single mailbox and the author and transmitter are identical, the + "Sender:" field SHOULD NOT be used. Otherwise, both fields SHOULD + appear. + + The originator fields also provide the information required when + replying to a message. When the "Reply-To:" field is present, it + indicates the mailbox(es) to which the author of the message suggests + that replies be sent. In the absence of the "Reply-To:" field, + replies SHOULD by default be sent to the mailbox(es) specified in the + "From:" field unless otherwise specified by the person composing the + reply. + + In all cases, the "From:" field SHOULD NOT contain any mailbox that + does not belong to the author(s) of the message. See also section + 3.6.3 for more information on forming the destination addresses for a + reply. + + + +Resnick Standards Track [Page 21] + +RFC 2822 Internet Message Format April 2001 + + +3.6.3. Destination address fields + + The destination fields of a message consist of three possible fields, + each of the same form: The field name, which is either "To", "Cc", or + "Bcc", followed by a comma-separated list of one or more addresses + (either mailbox or group syntax). + +to = "To:" address-list CRLF + +cc = "Cc:" address-list CRLF + +bcc = "Bcc:" (address-list / [CFWS]) CRLF + + The destination fields specify the recipients of the message. Each + destination field may have one or more addresses, and each of the + addresses indicate the intended recipients of the message. The only + difference between the three fields is how each is used. + + The "To:" field contains the address(es) of the primary recipient(s) + of the message. + + The "Cc:" field (where the "Cc" means "Carbon Copy" in the sense of + making a copy on a typewriter using carbon paper) contains the + addresses of others who are to receive the message, though the + content of the message may not be directed at them. + + The "Bcc:" field (where the "Bcc" means "Blind Carbon Copy") contains + addresses of recipients of the message whose addresses are not to be + revealed to other recipients of the message. There are three ways in + which the "Bcc:" field is used. In the first case, when a message + containing a "Bcc:" field is prepared to be sent, the "Bcc:" line is + removed even though all of the recipients (including those specified + in the "Bcc:" field) are sent a copy of the message. In the second + case, recipients specified in the "To:" and "Cc:" lines each are sent + a copy of the message with the "Bcc:" line removed as above, but the + recipients on the "Bcc:" line get a separate copy of the message + containing a "Bcc:" line. (When there are multiple recipient + addresses in the "Bcc:" field, some implementations actually send a + separate copy of the message to each recipient with a "Bcc:" + containing only the address of that particular recipient.) Finally, + since a "Bcc:" field may contain no addresses, a "Bcc:" field can be + sent without any addresses indicating to the recipients that blind + copies were sent to someone. Which method to use with "Bcc:" fields + is implementation dependent, but refer to the "Security + Considerations" section of this document for a discussion of each. + + + + + + +Resnick Standards Track [Page 22] + +RFC 2822 Internet Message Format April 2001 + + + When a message is a reply to another message, the mailboxes of the + authors of the original message (the mailboxes in the "From:" field) + or mailboxes specified in the "Reply-To:" field (if it exists) MAY + appear in the "To:" field of the reply since these would normally be + the primary recipients of the reply. If a reply is sent to a message + that has destination fields, it is often desirable to send a copy of + the reply to all of the recipients of the message, in addition to the + author. When such a reply is formed, addresses in the "To:" and + "Cc:" fields of the original message MAY appear in the "Cc:" field of + the reply, since these are normally secondary recipients of the + reply. If a "Bcc:" field is present in the original message, + addresses in that field MAY appear in the "Bcc:" field of the reply, + but SHOULD NOT appear in the "To:" or "Cc:" fields. + + Note: Some mail applications have automatic reply commands that + include the destination addresses of the original message in the + destination addresses of the reply. How those reply commands behave + is implementation dependent and is beyond the scope of this document. + In particular, whether or not to include the original destination + addresses when the original message had a "Reply-To:" field is not + addressed here. + +3.6.4. Identification fields + + Though optional, every message SHOULD have a "Message-ID:" field. + Furthermore, reply messages SHOULD have "In-Reply-To:" and + "References:" fields as appropriate, as described below. + + The "Message-ID:" field contains a single unique message identifier. + The "References:" and "In-Reply-To:" field each contain one or more + unique message identifiers, optionally separated by CFWS. + + The message identifier (msg-id) is similar in syntax to an angle-addr + construct without the internal CFWS. + +message-id = "Message-ID:" msg-id CRLF + +in-reply-to = "In-Reply-To:" 1*msg-id CRLF + +references = "References:" 1*msg-id CRLF + +msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS] + +id-left = dot-atom-text / no-fold-quote / obs-id-left + +id-right = dot-atom-text / no-fold-literal / obs-id-right + +no-fold-quote = DQUOTE *(qtext / quoted-pair) DQUOTE + + + +Resnick Standards Track [Page 23] + +RFC 2822 Internet Message Format April 2001 + + +no-fold-literal = "[" *(dtext / quoted-pair) "]" + + The "Message-ID:" field provides a unique message identifier that + refers to a particular version of a particular message. The + uniqueness of the message identifier is guaranteed by the host that + generates it (see below). This message identifier is intended to be + machine readable and not necessarily meaningful to humans. A message + identifier pertains to exactly one instantiation of a particular + message; subsequent revisions to the message each receive new message + identifiers. + + Note: There are many instances when messages are "changed", but those + changes do not constitute a new instantiation of that message, and + therefore the message would not get a new message identifier. For + example, when messages are introduced into the transport system, they + are often prepended with additional header fields such as trace + fields (described in section 3.6.7) and resent fields (described in + section 3.6.6). The addition of such header fields does not change + the identity of the message and therefore the original "Message-ID:" + field is retained. In all cases, it is the meaning that the sender + of the message wishes to convey (i.e., whether this is the same + message or a different message) that determines whether or not the + "Message-ID:" field changes, not any particular syntactic difference + that appears (or does not appear) in the message. + + The "In-Reply-To:" and "References:" fields are used when creating a + reply to a message. They hold the message identifier of the original + message and the message identifiers of other messages (for example, + in the case of a reply to a message which was itself a reply). The + "In-Reply-To:" field may be used to identify the message (or + messages) to which the new message is a reply, while the + "References:" field may be used to identify a "thread" of + conversation. + + When creating a reply to a message, the "In-Reply-To:" and + "References:" fields of the resultant message are constructed as + follows: + + The "In-Reply-To:" field will contain the contents of the "Message- + ID:" field of the message to which this one is a reply (the "parent + message"). If there is more than one parent message, then the "In- + Reply-To:" field will contain the contents of all of the parents' + "Message-ID:" fields. If there is no "Message-ID:" field in any of + the parent messages, then the new message will have no "In-Reply-To:" + field. + + + + + + +Resnick Standards Track [Page 24] + +RFC 2822 Internet Message Format April 2001 + + + The "References:" field will contain the contents of the parent's + "References:" field (if any) followed by the contents of the parent's + "Message-ID:" field (if any). If the parent message does not contain + a "References:" field but does have an "In-Reply-To:" field + containing a single message identifier, then the "References:" field + will contain the contents of the parent's "In-Reply-To:" field + followed by the contents of the parent's "Message-ID:" field (if + any). If the parent has none of the "References:", "In-Reply-To:", + or "Message-ID:" fields, then the new message will have no + "References:" field. + + Note: Some implementations parse the "References:" field to display + the "thread of the discussion". These implementations assume that + each new message is a reply to a single parent and hence that they + can walk backwards through the "References:" field to find the parent + of each message listed there. Therefore, trying to form a + "References:" field for a reply that has multiple parents is + discouraged and how to do so is not defined in this document. + + The message identifier (msg-id) itself MUST be a globally unique + identifier for a message. The generator of the message identifier + MUST guarantee that the msg-id is unique. There are several + algorithms that can be used to accomplish this. Since the msg-id has + a similar syntax to angle-addr (identical except that comments and + folding white space are not allowed), a good method is to put the + domain name (or a domain literal IP address) of the host on which the + message identifier was created on the right hand side of the "@", and + put a combination of the current absolute date and time along with + some other currently unique (perhaps sequential) identifier available + on the system (for example, a process id number) on the left hand + side. Using a date on the left hand side and a domain name or domain + literal on the right hand side makes it possible to guarantee + uniqueness since no two hosts use the same domain name or IP address + at the same time. Though other algorithms will work, it is + RECOMMENDED that the right hand side contain some domain identifier + (either of the host itself or otherwise) such that the generator of + the message identifier can guarantee the uniqueness of the left hand + side within the scope of that domain. + + Semantically, the angle bracket characters are not part of the + msg-id; the msg-id is what is contained between the two angle bracket + characters. + + + + + + + + + +Resnick Standards Track [Page 25] + +RFC 2822 Internet Message Format April 2001 + + +3.6.5. Informational fields + + The informational fields are all optional. The "Keywords:" field + contains a comma-separated list of one or more words or + quoted-strings. The "Subject:" and "Comments:" fields are + unstructured fields as defined in section 2.2.1, and therefore may + contain text or folding white space. + +subject = "Subject:" unstructured CRLF + +comments = "Comments:" unstructured CRLF + +keywords = "Keywords:" phrase *("," phrase) CRLF + + These three fields are intended to have only human-readable content + with information about the message. The "Subject:" field is the most + common and contains a short string identifying the topic of the + message. When used in a reply, the field body MAY start with the + string "Re: " (from the Latin "res", in the matter of) followed by + the contents of the "Subject:" field body of the original message. + If this is done, only one instance of the literal string "Re: " ought + to be used since use of other strings or more than one instance can + lead to undesirable consequences. The "Comments:" field contains any + additional comments on the text of the body of the message. The + "Keywords:" field contains a comma-separated list of important words + and phrases that might be useful for the recipient. + +3.6.6. Resent fields + + Resent fields SHOULD be added to any message that is reintroduced by + a user into the transport system. A separate set of resent fields + SHOULD be added each time this is done. All of the resent fields + corresponding to a particular resending of the message SHOULD be + together. Each new set of resent fields is prepended to the message; + that is, the most recent set of resent fields appear earlier in the + message. No other fields in the message are changed when resent + fields are added. + + Each of the resent fields corresponds to a particular field elsewhere + in the syntax. For instance, the "Resent-Date:" field corresponds to + the "Date:" field and the "Resent-To:" field corresponds to the "To:" + field. In each case, the syntax for the field body is identical to + the syntax given previously for the corresponding field. + + When resent fields are used, the "Resent-From:" and "Resent-Date:" + fields MUST be sent. The "Resent-Message-ID:" field SHOULD be sent. + "Resent-Sender:" SHOULD NOT be used if "Resent-Sender:" would be + identical to "Resent-From:". + + + +Resnick Standards Track [Page 26] + +RFC 2822 Internet Message Format April 2001 + + +resent-date = "Resent-Date:" date-time CRLF + +resent-from = "Resent-From:" mailbox-list CRLF + +resent-sender = "Resent-Sender:" mailbox CRLF + +resent-to = "Resent-To:" address-list CRLF + +resent-cc = "Resent-Cc:" address-list CRLF + +resent-bcc = "Resent-Bcc:" (address-list / [CFWS]) CRLF + +resent-msg-id = "Resent-Message-ID:" msg-id CRLF + + Resent fields are used to identify a message as having been + reintroduced into the transport system by a user. The purpose of + using resent fields is to have the message appear to the final + recipient as if it were sent directly by the original sender, with + all of the original fields remaining the same. Each set of resent + fields correspond to a particular resending event. That is, if a + message is resent multiple times, each set of resent fields gives + identifying information for each individual time. Resent fields are + strictly informational. They MUST NOT be used in the normal + processing of replies or other such automatic actions on messages. + + Note: Reintroducing a message into the transport system and using + resent fields is a different operation from "forwarding". + "Forwarding" has two meanings: One sense of forwarding is that a mail + reading program can be told by a user to forward a copy of a message + to another person, making the forwarded message the body of the new + message. A forwarded message in this sense does not appear to have + come from the original sender, but is an entirely new message from + the forwarder of the message. On the other hand, forwarding is also + used to mean when a mail transport program gets a message and + forwards it on to a different destination for final delivery. Resent + header fields are not intended for use with either type of + forwarding. + + The resent originator fields indicate the mailbox of the person(s) or + system(s) that resent the message. As with the regular originator + fields, there are two forms: a simple "Resent-From:" form which + contains the mailbox of the individual doing the resending, and the + more complex form, when one individual (identified in the + "Resent-Sender:" field) resends a message on behalf of one or more + others (identified in the "Resent-From:" field). + + Note: When replying to a resent message, replies behave just as they + would with any other message, using the original "From:", + + + +Resnick Standards Track [Page 27] + +RFC 2822 Internet Message Format April 2001 + + + "Reply-To:", "Message-ID:", and other fields. The resent fields are + only informational and MUST NOT be used in the normal processing of + replies. + + The "Resent-Date:" indicates the date and time at which the resent + message is dispatched by the resender of the message. Like the + "Date:" field, it is not the date and time that the message was + actually transported. + + The "Resent-To:", "Resent-Cc:", and "Resent-Bcc:" fields function + identically to the "To:", "Cc:", and "Bcc:" fields respectively, + except that they indicate the recipients of the resent message, not + the recipients of the original message. + + The "Resent-Message-ID:" field provides a unique identifier for the + resent message. + +3.6.7. Trace fields + + The trace fields are a group of header fields consisting of an + optional "Return-Path:" field, and one or more "Received:" fields. + The "Return-Path:" header field contains a pair of angle brackets + that enclose an optional addr-spec. The "Received:" field contains a + (possibly empty) list of name/value pairs followed by a semicolon and + a date-time specification. The first item of the name/value pair is + defined by item-name, and the second item is either an addr-spec, an + atom, a domain, or a msg-id. Further restrictions may be applied to + the syntax of the trace fields by standards that provide for their + use, such as [RFC2821]. + +trace = [return] + 1*received + +return = "Return-Path:" path CRLF + +path = ([CFWS] "<" ([CFWS] / addr-spec) ">" [CFWS]) / + obs-path + +received = "Received:" name-val-list ";" date-time CRLF + +name-val-list = [CFWS] [name-val-pair *(CFWS name-val-pair)] + +name-val-pair = item-name CFWS item-value + +item-name = ALPHA *(["-"] (ALPHA / DIGIT)) + +item-value = 1*angle-addr / addr-spec / + atom / domain / msg-id + + + +Resnick Standards Track [Page 28] + +RFC 2822 Internet Message Format April 2001 + + + A full discussion of the Internet mail use of trace fields is + contained in [RFC2821]. For the purposes of this standard, the trace + fields are strictly informational, and any formal interpretation of + them is outside of the scope of this document. + +3.6.8. Optional fields + + Fields may appear in messages that are otherwise unspecified in this + standard. They MUST conform to the syntax of an optional-field. + This is a field name, made up of the printable US-ASCII characters + except SP and colon, followed by a colon, followed by any text which + conforms to unstructured. + + The field names of any optional-field MUST NOT be identical to any + field name specified elsewhere in this standard. + +optional-field = field-name ":" unstructured CRLF + +field-name = 1*ftext + +ftext = %d33-57 / ; Any character except + %d59-126 ; controls, SP, and + ; ":". + + For the purposes of this standard, any optional field is + uninterpreted. + +4. Obsolete Syntax + + Earlier versions of this standard allowed for different (usually more + liberal) syntax than is allowed in this version. Also, there have + been syntactic elements used in messages on the Internet whose + interpretation have never been documented. Though some of these + syntactic forms MUST NOT be generated according to the grammar in + section 3, they MUST be accepted and parsed by a conformant receiver. + This section documents many of these syntactic elements. Taking the + grammar in section 3 and adding the definitions presented in this + section will result in the grammar to use for interpretation of + messages. + + Note: This section identifies syntactic forms that any implementation + MUST reasonably interpret. However, there are certainly Internet + messages which do not conform to even the additional syntax given in + this section. The fact that a particular form does not appear in any + section of this document is not justification for computer programs + to crash or for malformed data to be irretrievably lost by any + implementation. To repeat an example, though this document requires + lines in messages to be no longer than 998 characters, silently + + + +Resnick Standards Track [Page 29] + +RFC 2822 Internet Message Format April 2001 + + + discarding the 999th and subsequent characters in a line without + warning would still be bad behavior for an implementation. It is up + to the implementation to deal with messages robustly. + + One important difference between the obsolete (interpreting) and the + current (generating) syntax is that in structured header field bodies + (i.e., between the colon and the CRLF of any structured header + field), white space characters, including folding white space, and + comments can be freely inserted between any syntactic tokens. This + allows many complex forms that have proven difficult for some + implementations to parse. + + Another key difference between the obsolete and the current syntax is + that the rule in section 3.2.3 regarding lines composed entirely of + white space in comments and folding white space does not apply. See + the discussion of folding white space in section 4.2 below. + + Finally, certain characters that were formerly allowed in messages + appear in this section. The NUL character (ASCII value 0) was once + allowed, but is no longer for compatibility reasons. CR and LF were + allowed to appear in messages other than as CRLF; this use is also + shown here. + + Other differences in syntax and semantics are noted in the following + sections. + +4.1. Miscellaneous obsolete tokens + + These syntactic elements are used elsewhere in the obsolete syntax or + in the main syntax. The obs-char and obs-qp elements each add ASCII + value 0. Bare CR and bare LF are added to obs-text and obs-utext. + The period character is added to obs-phrase. The obs-phrase-list + provides for "empty" elements in a comma-separated list of phrases. + + Note: The "period" (or "full stop") character (".") in obs-phrase is + not a form that was allowed in earlier versions of this or any other + standard. Period (nor any other character from specials) was not + allowed in phrase because it introduced a parsing difficulty + distinguishing between phrases and portions of an addr-spec (see + section 4.4). It appears here because the period character is + currently used in many messages in the display-name portion of + addresses, especially for initials in names, and therefore must be + interpreted properly. In the future, period may appear in the + regular syntax of phrase. + +obs-qp = "\" (%d0-127) + +obs-text = *LF *CR *(obs-char *LF *CR) + + + +Resnick Standards Track [Page 30] + +RFC 2822 Internet Message Format April 2001 + + +obs-char = %d0-9 / %d11 / ; %d0-127 except CR and + %d12 / %d14-127 ; LF + +obs-utext = obs-text + +obs-phrase = word *(word / "." / CFWS) + +obs-phrase-list = phrase / 1*([phrase] [CFWS] "," [CFWS]) [phrase] + + Bare CR and bare LF appear in messages with two different meanings. + In many cases, bare CR or bare LF are used improperly instead of CRLF + to indicate line separators. In other cases, bare CR and bare LF are + used simply as ASCII control characters with their traditional ASCII + meanings. + +4.2. Obsolete folding white space + + In the obsolete syntax, any amount of folding white space MAY be + inserted where the obs-FWS rule is allowed. This creates the + possibility of having two consecutive "folds" in a line, and + therefore the possibility that a line which makes up a folded header + field could be composed entirely of white space. + + obs-FWS = 1*WSP *(CRLF 1*WSP) + +4.3. Obsolete Date and Time + + The syntax for the obsolete date format allows a 2 digit year in the + date field and allows for a list of alphabetic time zone + specifications that were used in earlier versions of this standard. + It also permits comments and folding white space between many of the + tokens. + +obs-day-of-week = [CFWS] day-name [CFWS] + +obs-year = [CFWS] 2*DIGIT [CFWS] + +obs-month = CFWS month-name CFWS + +obs-day = [CFWS] 1*2DIGIT [CFWS] + +obs-hour = [CFWS] 2DIGIT [CFWS] + +obs-minute = [CFWS] 2DIGIT [CFWS] + +obs-second = [CFWS] 2DIGIT [CFWS] + +obs-zone = "UT" / "GMT" / ; Universal Time + + + +Resnick Standards Track [Page 31] + +RFC 2822 Internet Message Format April 2001 + + + ; North American UT + ; offsets + "EST" / "EDT" / ; Eastern: - 5/ - 4 + "CST" / "CDT" / ; Central: - 6/ - 5 + "MST" / "MDT" / ; Mountain: - 7/ - 6 + "PST" / "PDT" / ; Pacific: - 8/ - 7 + + %d65-73 / ; Military zones - "A" + %d75-90 / ; through "I" and "K" + %d97-105 / ; through "Z", both + %d107-122 ; upper and lower case + + Where a two or three digit year occurs in a date, the year is to be + interpreted as follows: If a two digit year is encountered whose + value is between 00 and 49, the year is interpreted by adding 2000, + ending up with a value between 2000 and 2049. If a two digit year is + encountered with a value between 50 and 99, or any three digit year + is encountered, the year is interpreted by adding 1900. + + In the obsolete time zone, "UT" and "GMT" are indications of + "Universal Time" and "Greenwich Mean Time" respectively and are both + semantically identical to "+0000". + + The remaining three character zones are the US time zones. The first + letter, "E", "C", "M", or "P" stands for "Eastern", "Central", + "Mountain" and "Pacific". The second letter is either "S" for + "Standard" time, or "D" for "Daylight" (or summer) time. Their + interpretations are as follows: + + EDT is semantically equivalent to -0400 + EST is semantically equivalent to -0500 + CDT is semantically equivalent to -0500 + CST is semantically equivalent to -0600 + MDT is semantically equivalent to -0600 + MST is semantically equivalent to -0700 + PDT is semantically equivalent to -0700 + PST is semantically equivalent to -0800 + + The 1 character military time zones were defined in a non-standard + way in [RFC822] and are therefore unpredictable in their meaning. + The original definitions of the military zones "A" through "I" are + equivalent to "+0100" through "+0900" respectively; "K", "L", and "M" + are equivalent to "+1000", "+1100", and "+1200" respectively; "N" + through "Y" are equivalent to "-0100" through "-1200" respectively; + and "Z" is equivalent to "+0000". However, because of the error in + [RFC822], they SHOULD all be considered equivalent to "-0000" unless + there is out-of-band information confirming their meaning. + + + + +Resnick Standards Track [Page 32] + +RFC 2822 Internet Message Format April 2001 + + + Other multi-character (usually between 3 and 5) alphabetic time zones + have been used in Internet messages. Any such time zone whose + meaning is not known SHOULD be considered equivalent to "-0000" + unless there is out-of-band information confirming their meaning. + +4.4. Obsolete Addressing + + There are three primary differences in addressing. First, mailbox + addresses were allowed to have a route portion before the addr-spec + when enclosed in "<" and ">". The route is simply a comma-separated + list of domain names, each preceded by "@", and the list terminated + by a colon. Second, CFWS were allowed between the period-separated + elements of local-part and domain (i.e., dot-atom was not used). In + addition, local-part is allowed to contain quoted-string in addition + to just atom. Finally, mailbox-list and address-list were allowed to + have "null" members. That is, there could be two or more commas in + such a list with nothing in between them. + +obs-angle-addr = [CFWS] "<" [obs-route] addr-spec ">" [CFWS] + +obs-route = [CFWS] obs-domain-list ":" [CFWS] + +obs-domain-list = "@" domain *(*(CFWS / "," ) [CFWS] "@" domain) + +obs-local-part = word *("." word) + +obs-domain = atom *("." atom) + +obs-mbox-list = 1*([mailbox] [CFWS] "," [CFWS]) [mailbox] + +obs-addr-list = 1*([address] [CFWS] "," [CFWS]) [address] + + When interpreting addresses, the route portion SHOULD be ignored. + +4.5. Obsolete header fields + + Syntactically, the primary difference in the obsolete field syntax is + that it allows multiple occurrences of any of the fields and they may + occur in any order. Also, any amount of white space is allowed + before the ":" at the end of the field name. + +obs-fields = *(obs-return / + obs-received / + obs-orig-date / + obs-from / + obs-sender / + obs-reply-to / + obs-to / + + + +Resnick Standards Track [Page 33] + +RFC 2822 Internet Message Format April 2001 + + + obs-cc / + obs-bcc / + obs-message-id / + obs-in-reply-to / + obs-references / + obs-subject / + obs-comments / + obs-keywords / + obs-resent-date / + obs-resent-from / + obs-resent-send / + obs-resent-rply / + obs-resent-to / + obs-resent-cc / + obs-resent-bcc / + obs-resent-mid / + obs-optional) + + Except for destination address fields (described in section 4.5.3), + the interpretation of multiple occurrences of fields is unspecified. + Also, the interpretation of trace fields and resent fields which do + not occur in blocks prepended to the message is unspecified as well. + Unless otherwise noted in the following sections, interpretation of + other fields is identical to the interpretation of their non-obsolete + counterparts in section 3. + +4.5.1. Obsolete origination date field + +obs-orig-date = "Date" *WSP ":" date-time CRLF + +4.5.2. Obsolete originator fields + +obs-from = "From" *WSP ":" mailbox-list CRLF + +obs-sender = "Sender" *WSP ":" mailbox CRLF + +obs-reply-to = "Reply-To" *WSP ":" mailbox-list CRLF + +4.5.3. Obsolete destination address fields + +obs-to = "To" *WSP ":" address-list CRLF + +obs-cc = "Cc" *WSP ":" address-list CRLF + +obs-bcc = "Bcc" *WSP ":" (address-list / [CFWS]) CRLF + + + + + + +Resnick Standards Track [Page 34] + +RFC 2822 Internet Message Format April 2001 + + + When multiple occurrences of destination address fields occur in a + message, they SHOULD be treated as if the address-list in the first + occurrence of the field is combined with the address lists of the + subsequent occurrences by adding a comma and concatenating. + +4.5.4. Obsolete identification fields + + The obsolete "In-Reply-To:" and "References:" fields differ from the + current syntax in that they allow phrase (words or quoted strings) to + appear. The obsolete forms of the left and right sides of msg-id + allow interspersed CFWS, making them syntactically identical to + local-part and domain respectively. + +obs-message-id = "Message-ID" *WSP ":" msg-id CRLF + +obs-in-reply-to = "In-Reply-To" *WSP ":" *(phrase / msg-id) CRLF + +obs-references = "References" *WSP ":" *(phrase / msg-id) CRLF + +obs-id-left = local-part + +obs-id-right = domain + + For purposes of interpretation, the phrases in the "In-Reply-To:" and + "References:" fields are ignored. + + Semantically, none of the optional CFWS surrounding the local-part + and the domain are part of the obs-id-left and obs-id-right + respectively. + +4.5.5. Obsolete informational fields + +obs-subject = "Subject" *WSP ":" unstructured CRLF + +obs-comments = "Comments" *WSP ":" unstructured CRLF + +obs-keywords = "Keywords" *WSP ":" obs-phrase-list CRLF + +4.5.6. Obsolete resent fields + + The obsolete syntax adds a "Resent-Reply-To:" field, which consists + of the field name, the optional comments and folding white space, the + colon, and a comma separated list of addresses. + +obs-resent-from = "Resent-From" *WSP ":" mailbox-list CRLF + +obs-resent-send = "Resent-Sender" *WSP ":" mailbox CRLF + + + + +Resnick Standards Track [Page 35] + +RFC 2822 Internet Message Format April 2001 + + +obs-resent-date = "Resent-Date" *WSP ":" date-time CRLF + +obs-resent-to = "Resent-To" *WSP ":" address-list CRLF + +obs-resent-cc = "Resent-Cc" *WSP ":" address-list CRLF + +obs-resent-bcc = "Resent-Bcc" *WSP ":" + (address-list / [CFWS]) CRLF + +obs-resent-mid = "Resent-Message-ID" *WSP ":" msg-id CRLF + +obs-resent-rply = "Resent-Reply-To" *WSP ":" address-list CRLF + + As with other resent fields, the "Resent-Reply-To:" field is to be + treated as trace information only. + +4.5.7. Obsolete trace fields + + The obs-return and obs-received are again given here as template + definitions, just as return and received are in section 3. Their + full syntax is given in [RFC2821]. + +obs-return = "Return-Path" *WSP ":" path CRLF + +obs-received = "Received" *WSP ":" name-val-list CRLF + +obs-path = obs-angle-addr + +4.5.8. Obsolete optional fields + +obs-optional = field-name *WSP ":" unstructured CRLF + +5. Security Considerations + + Care needs to be taken when displaying messages on a terminal or + terminal emulator. Powerful terminals may act on escape sequences + and other combinations of ASCII control characters with a variety of + consequences. They can remap the keyboard or permit other + modifications to the terminal which could lead to denial of service + or even damaged data. They can trigger (sometimes programmable) + answerback messages which can allow a message to cause commands to be + issued on the recipient's behalf. They can also effect the operation + of terminal attached devices such as printers. Message viewers may + wish to strip potentially dangerous terminal escape sequences from + the message prior to display. However, other escape sequences appear + in messages for useful purposes (cf. [RFC2045, RFC2046, RFC2047, + RFC2048, RFC2049, ISO2022]) and therefore should not be stripped + indiscriminately. + + + +Resnick Standards Track [Page 36] + +RFC 2822 Internet Message Format April 2001 + + + Transmission of non-text objects in messages raises additional + security issues. These issues are discussed in [RFC2045, RFC2046, + RFC2047, RFC2048, RFC2049]. + + Many implementations use the "Bcc:" (blind carbon copy) field + described in section 3.6.3 to facilitate sending messages to + recipients without revealing the addresses of one or more of the + addressees to the other recipients. Mishandling this use of "Bcc:" + has implications for confidential information that might be revealed, + which could eventually lead to security problems through knowledge of + even the existence of a particular mail address. For example, if + using the first method described in section 3.6.3, where the "Bcc:" + line is removed from the message, blind recipients have no explicit + indication that they have been sent a blind copy, except insofar as + their address does not appear in the message header. Because of + this, one of the blind addressees could potentially send a reply to + all of the shown recipients and accidentally reveal that the message + went to the blind recipient. When the second method from section + 3.6.3 is used, the blind recipient's address appears in the "Bcc:" + field of a separate copy of the message. If the "Bcc:" field sent + contains all of the blind addressees, all of the "Bcc:" recipients + will be seen by each "Bcc:" recipient. Even if a separate message is + sent to each "Bcc:" recipient with only the individual's address, + implementations still need to be careful to process replies to the + message as per section 3.6.3 so as not to accidentally reveal the + blind recipient to other recipients. + +6. Bibliography + + [ASCII] American National Standards Institute (ANSI), Coded + Character Set - 7-Bit American National Standard Code for + Information Interchange, ANSI X3.4, 1986. + + [ISO2022] International Organization for Standardization (ISO), + Information processing - ISO 7-bit and 8-bit coded + character sets - Code extension techniques, Third edition + - 1986-05-01, ISO 2022, 1986. + + [RFC822] Crocker, D., "Standard for the Format of ARPA Internet + Text Messages", RFC 822, August 1982. + + [RFC2045] Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part One: Format of Internet Message + Bodies", RFC 2045, November 1996. + + [RFC2046] Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part Two: Media Types", RFC 2046, + November 1996. + + + +Resnick Standards Track [Page 37] + +RFC 2822 Internet Message Format April 2001 + + + [RFC2047] Moore, K., "Multipurpose Internet Mail Extensions (MIME) + Part Three: Message Header Extensions for Non-ASCII Text", + RFC 2047, November 1996. + + [RFC2048] Freed, N., Klensin, J. and J. Postel, "Multipurpose + Internet Mail Extensions (MIME) Part Four: Format of + Internet Message Bodies", RFC 2048, November 1996. + + [RFC2049] Freed, N. and N. Borenstein, "Multipurpose Internet Mail + Extensions (MIME) Part Five: Conformance Criteria and + Examples", RFC 2049, November 1996. + + [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119, March 1997. + + [RFC2234] Crocker, D., Editor, and P. Overell, "Augmented BNF for + Syntax Specifications: ABNF", RFC 2234, November 1997. + + [RFC2821] Klensin, J., Editor, "Simple Mail Transfer Protocol", RFC + 2821, March 2001. + + [STD3] Braden, R., "Host Requirements", STD 3, RFC 1122 and RFC + 1123, October 1989. + + [STD12] Mills, D., "Network Time Protocol", STD 12, RFC 1119, + September 1989. + + [STD13] Mockapetris, P., "Domain Name System", STD 13, RFC 1034 + and RFC 1035, November 1987. + + [STD14] Partridge, C., "Mail Routing and the Domain System", STD + 14, RFC 974, January 1986. + +7. Editor's Address + + Peter W. Resnick + QUALCOMM Incorporated + 5775 Morehouse Drive + San Diego, CA 92121-1714 + USA + + Phone: +1 858 651 4478 + Fax: +1 858 651 1102 + EMail: presnick@qualcomm.com + + + + + + + +Resnick Standards Track [Page 38] + +RFC 2822 Internet Message Format April 2001 + + +8. Acknowledgements + + Many people contributed to this document. They included folks who + participated in the Detailed Revision and Update of Messaging + Standards (DRUMS) Working Group of the Internet Engineering Task + Force (IETF), the chair of DRUMS, the Area Directors of the IETF, and + people who simply sent their comments in via e-mail. The editor is + deeply indebted to them all and thanks them sincerely. The below + list includes everyone who sent e-mail concerning this document. + Hopefully, everyone who contributed is named here: + + Matti Aarnio Barry Finkel Larry Masinter + Tanaka Akira Erik Forsberg Denis McKeon + Russ Allbery Chuck Foster William P McQuillan + Eric Allman Paul Fox Alexey Melnikov + Harald Tveit Alvestrand Klaus M. Frank Perry E. Metzger + Ran Atkinson Ned Freed Steven Miller + Jos Backus Jochen Friedrich Keith Moore + Bruce Balden Randall C. Gellens John Gardiner Myers + Dave Barr Sukvinder Singh Gill Chris Newman + Alan Barrett Tim Goodwin John W. Noerenberg + John Beck Philip Guenther Eric Norman + J. Robert von Behren Tony Hansen Mike O'Dell + Jos den Bekker John Hawkinson Larry Osterman + D. J. Bernstein Philip Hazel Paul Overell + James Berriman Kai Henningsen Jacob Palme + Norbert Bollow Robert Herriot Michael A. Patton + Raj Bose Paul Hethmon Uzi Paz + Antony Bowesman Jim Hill Michael A. Quinlan + Scott Bradner Paul E. Hoffman Eric S. Raymond + Randy Bush Steve Hole Sam Roberts + Tom Byrer Kari Hurtta Hugh Sasse + Bruce Campbell Marco S. Hyman Bart Schaefer + Larry Campbell Ofer Inbar Tom Scola + W. J. Carpenter Olle Jarnefors Wolfgang Segmuller + Michael Chapman Kevin Johnson Nick Shelness + Richard Clayton Sudish Joseph John Stanley + Maurizio Codogno Maynard Kang Einar Stefferud + Jim Conklin Prabhat Keni Jeff Stephenson + R. Kelley Cook John C. Klensin Bernard Stern + Steve Coya Graham Klyne Peter Sylvester + Mark Crispin Brad Knowles Mark Symons + Dave Crocker Shuhei Kobayashi Eric Thomas + Matt Curtin Peter Koch Lee Thompson + Michael D'Errico Dan Kohn Karel De Vriendt + Cyrus Daboo Christian Kuhtz Matthew Wall + Jutta Degener Anand Kumria Rolf Weber + Mark Delany Steen Larsen Brent B. Welch + + + +Resnick Standards Track [Page 39] + +RFC 2822 Internet Message Format April 2001 + + + Steve Dorner Eliot Lear Dan Wing + Harold A. Driscoll Barry Leiba Jack De Winter + Michael Elkins Jay Levitt Gregory J. Woodhouse + Robert Elz Lars-Johan Liman Greg A. Woods + Johnny Eriksson Charles Lindsey Kazu Yamamoto + Erik E. Fair Pete Loshin Alain Zahm + Roger Fajman Simon Lyall Jamie Zawinski + Patrik Faltstrom Bill Manning Timothy S. Zurcher + Claus Andre Farber John Martin + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Resnick Standards Track [Page 40] + +RFC 2822 Internet Message Format April 2001 + + +Appendix A. Example messages + + This section presents a selection of messages. These are intended to + assist in the implementation of this standard, but should not be + taken as normative; that is to say, although the examples in this + section were carefully reviewed, if there happens to be a conflict + between these examples and the syntax described in sections 3 and 4 + of this document, the syntax in those sections is to be taken as + correct. + + Messages are delimited in this section between lines of "----". The + "----" lines are not part of the message itself. + +A.1. Addressing examples + + The following are examples of messages that might be sent between two + individuals. + +A.1.1. A message from one person to another with simple addressing + + This could be called a canonical message. It has a single author, + John Doe, a single recipient, Mary Smith, a subject, the date, a + message identifier, and a textual message in the body. + +---- +From: John Doe +To: Mary Smith +Subject: Saying Hello +Date: Fri, 21 Nov 1997 09:55:06 -0600 +Message-ID: <1234@local.machine.example> + +This is a message just to say hello. +So, "Hello". +---- + + + + + + + + + + + + + + + + + +Resnick Standards Track [Page 41] + +RFC 2822 Internet Message Format April 2001 + + + If John's secretary Michael actually sent the message, though John + was the author and replies to this message should go back to him, the + sender field would be used: + +---- +From: John Doe +Sender: Michael Jones +To: Mary Smith +Subject: Saying Hello +Date: Fri, 21 Nov 1997 09:55:06 -0600 +Message-ID: <1234@local.machine.example> + +This is a message just to say hello. +So, "Hello". +---- + +A.1.2. Different types of mailboxes + + This message includes multiple addresses in the destination fields + and also uses several different forms of addresses. + +---- +From: "Joe Q. Public" +To: Mary Smith , jdoe@example.org, Who? +Cc: , "Giant; \"Big\" Box" +Date: Tue, 1 Jul 2003 10:52:37 +0200 +Message-ID: <5678.21-Nov-1997@example.com> + +Hi everyone. +---- + + Note that the display names for Joe Q. Public and Giant; "Big" Box + needed to be enclosed in double-quotes because the former contains + the period and the latter contains both semicolon and double-quote + characters (the double-quote characters appearing as quoted-pair + construct). Conversely, the display name for Who? could appear + without them because the question mark is legal in an atom. Notice + also that jdoe@example.org and boss@nil.test have no display names + associated with them at all, and jdoe@example.org uses the simpler + address form without the angle brackets. + + + + + + + + + + + +Resnick Standards Track [Page 42] + +RFC 2822 Internet Message Format April 2001 + + +A.1.3. Group addresses + +---- +From: Pete +To: A Group:Chris Jones ,joe@where.test,John ; +Cc: Undisclosed recipients:; +Date: Thu, 13 Feb 1969 23:32:54 -0330 +Message-ID: + +Testing. +---- + + In this message, the "To:" field has a single group recipient named A + Group which contains 3 addresses, and a "Cc:" field with an empty + group recipient named Undisclosed recipients. + +A.2. Reply messages + + The following is a series of three messages that make up a + conversation thread between John and Mary. John firsts sends a + message to Mary, Mary then replies to John's message, and then John + replies to Mary's reply message. + + Note especially the "Message-ID:", "References:", and "In-Reply-To:" + fields in each message. + +---- +From: John Doe +To: Mary Smith +Subject: Saying Hello +Date: Fri, 21 Nov 1997 09:55:06 -0600 +Message-ID: <1234@local.machine.example> + +This is a message just to say hello. +So, "Hello". +---- + + + + + + + + + + + + + + + +Resnick Standards Track [Page 43] + +RFC 2822 Internet Message Format April 2001 + + + When sending replies, the Subject field is often retained, though + prepended with "Re: " as described in section 3.6.5. + +---- +From: Mary Smith +To: John Doe +Reply-To: "Mary Smith: Personal Account" +Subject: Re: Saying Hello +Date: Fri, 21 Nov 1997 10:01:10 -0600 +Message-ID: <3456@example.net> +In-Reply-To: <1234@local.machine.example> +References: <1234@local.machine.example> + +This is a reply to your hello. +---- + + Note the "Reply-To:" field in the above message. When John replies + to Mary's message above, the reply should go to the address in the + "Reply-To:" field instead of the address in the "From:" field. + +---- +To: "Mary Smith: Personal Account" +From: John Doe +Subject: Re: Saying Hello +Date: Fri, 21 Nov 1997 11:00:00 -0600 +Message-ID: +In-Reply-To: <3456@example.net> +References: <1234@local.machine.example> <3456@example.net> + +This is a reply to your reply. +---- + +A.3. Resent messages + + Start with the message that has been used as an example several + times: + +---- +From: John Doe +To: Mary Smith +Subject: Saying Hello +Date: Fri, 21 Nov 1997 09:55:06 -0600 +Message-ID: <1234@local.machine.example> + +This is a message just to say hello. +So, "Hello". +---- + + + + +Resnick Standards Track [Page 44] + +RFC 2822 Internet Message Format April 2001 + + + Say that Mary, upon receiving this message, wishes to send a copy of + the message to Jane such that (a) the message would appear to have + come straight from John; (b) if Jane replies to the message, the + reply should go back to John; and (c) all of the original + information, like the date the message was originally sent to Mary, + the message identifier, and the original addressee, is preserved. In + this case, resent fields are prepended to the message: + +---- +Resent-From: Mary Smith +Resent-To: Jane Brown +Resent-Date: Mon, 24 Nov 1997 14:22:01 -0800 +Resent-Message-ID: <78910@example.net> +From: John Doe +To: Mary Smith +Subject: Saying Hello +Date: Fri, 21 Nov 1997 09:55:06 -0600 +Message-ID: <1234@local.machine.example> + +This is a message just to say hello. +So, "Hello". +---- + + If Jane, in turn, wished to resend this message to another person, + she would prepend her own set of resent header fields to the above + and send that. + + + + + + + + + + + + + + + + + + + + + + + + + +Resnick Standards Track [Page 45] + +RFC 2822 Internet Message Format April 2001 + + +A.4. Messages with trace fields + + As messages are sent through the transport system as described in + [RFC2821], trace fields are prepended to the message. The following + is an example of what those trace fields might look like. Note that + there is some folding white space in the first one since these lines + can be long. + +---- +Received: from x.y.test + by example.net + via TCP + with ESMTP + id ABC12345 + for ; 21 Nov 1997 10:05:43 -0600 +Received: from machine.example by x.y.test; 21 Nov 1997 10:01:22 -0600 +From: John Doe +To: Mary Smith +Subject: Saying Hello +Date: Fri, 21 Nov 1997 09:55:06 -0600 +Message-ID: <1234@local.machine.example> + +This is a message just to say hello. +So, "Hello". +---- + + + + + + + + + + + + + + + + + + + + + + + + + + +Resnick Standards Track [Page 46] + +RFC 2822 Internet Message Format April 2001 + + +A.5. White space, comments, and other oddities + + White space, including folding white space, and comments can be + inserted between many of the tokens of fields. Taking the example + from A.1.3, white space and comments can be inserted into all of the + fields. + +---- +From: Pete(A wonderful \) chap) +To:A Group(Some people) + :Chris Jones , + joe@example.org, + John (my dear friend); (the end of the group) +Cc:(Empty list)(start)Undisclosed recipients :(nobody(that I know)) ; +Date: Thu, + 13 + Feb + 1969 + 23:32 + -0330 (Newfoundland Time) +Message-ID: + +Testing. +---- + + The above example is aesthetically displeasing, but perfectly legal. + Note particularly (1) the comments in the "From:" field (including + one that has a ")" character appearing as part of a quoted-pair); (2) + the white space absent after the ":" in the "To:" field as well as + the comment and folding white space after the group name, the special + character (".") in the comment in Chris Jones's address, and the + folding white space before and after "joe@example.org,"; (3) the + multiple and nested comments in the "Cc:" field as well as the + comment immediately following the ":" after "Cc"; (4) the folding + white space (but no comments except at the end) and the missing + seconds in the time of the date field; and (5) the white space before + (but not within) the identifier in the "Message-ID:" field. + +A.6. Obsoleted forms + + The following are examples of obsolete (that is, the "MUST NOT + generate") syntactic elements described in section 4 of this + document. + + + + + + + + +Resnick Standards Track [Page 47] + +RFC 2822 Internet Message Format April 2001 + + +A.6.1. Obsolete addressing + + Note in the below example the lack of quotes around Joe Q. Public, + the route that appears in the address for Mary Smith, the two commas + that appear in the "To:" field, and the spaces that appear around the + "." in the jdoe address. + +---- +From: Joe Q. Public +To: Mary Smith <@machine.tld:mary@example.net>, , jdoe@test . example +Date: Tue, 1 Jul 2003 10:52:37 +0200 +Message-ID: <5678.21-Nov-1997@example.com> + +Hi everyone. +---- + +A.6.2. Obsolete dates + + The following message uses an obsolete date format, including a non- + numeric time zone and a two digit year. Note that although the + day-of-week is missing, that is not specific to the obsolete syntax; + it is optional in the current syntax as well. + +---- +From: John Doe +To: Mary Smith +Subject: Saying Hello +Date: 21 Nov 97 09:55:06 GMT +Message-ID: <1234@local.machine.example> + +This is a message just to say hello. +So, "Hello". +---- + +A.6.3. Obsolete white space and comments + + White space and comments can appear between many more elements than + in the current syntax. Also, folding lines that are made up entirely + of white space are legal. + + + + + + + + + + + + +Resnick Standards Track [Page 48] + +RFC 2822 Internet Message Format April 2001 + + +---- +From : John Doe +To : Mary Smith +__ + +Subject : Saying Hello +Date : Fri, 21 Nov 1997 09(comment): 55 : 06 -0600 +Message-ID : <1234 @ local(blah) .machine .example> + +This is a message just to say hello. +So, "Hello". +---- + + Note especially the second line of the "To:" field. It starts with + two space characters. (Note that "__" represent blank spaces.) + Therefore, it is considered part of the folding as described in + section 4.2. Also, the comments and white space throughout + addresses, dates, and message identifiers are all part of the + obsolete syntax. + +Appendix B. Differences from earlier standards + + This appendix contains a list of changes that have been made in the + Internet Message Format from earlier standards, specifically [RFC822] + and [STD3]. Items marked with an asterisk (*) below are items which + appear in section 4 of this document and therefore can no longer be + generated. + + 1. Period allowed in obsolete form of phrase. + 2. ABNF moved out of document to [RFC2234]. + 3. Four or more digits allowed for year. + 4. Header field ordering (and lack thereof) made explicit. + 5. Encrypted header field removed. + 6. Received syntax loosened to allow any token/value pair. + 7. Specifically allow and give meaning to "-0000" time zone. + 8. Folding white space is not allowed between every token. + 9. Requirement for destinations removed. + 10. Forwarding and resending redefined. + 11. Extension header fields no longer specifically called out. + 12. ASCII 0 (null) removed.* + 13. Folding continuation lines cannot contain only white space.* + 14. Free insertion of comments not allowed in date.* + 15. Non-numeric time zones not allowed.* + 16. Two digit years not allowed.* + 17. Three digit years interpreted, but not allowed for generation. + 18. Routes in addresses not allowed.* + 19. CFWS within local-parts and domains not allowed.* + 20. Empty members of address lists not allowed.* + + + +Resnick Standards Track [Page 49] + +RFC 2822 Internet Message Format April 2001 + + + 21. Folding white space between field name and colon not allowed.* + 22. Comments between field name and colon not allowed. + 23. Tightened syntax of in-reply-to and references.* + 24. CFWS within msg-id not allowed.* + 25. Tightened semantics of resent fields as informational only. + 26. Resent-Reply-To not allowed.* + 27. No multiple occurrences of fields (except resent and received).* + 28. Free CR and LF not allowed.* + 29. Routes in return path not allowed.* + 30. Line length limits specified. + 31. Bcc more clearly specified. + +Appendix C. Notices + + Intellectual Property + + The IETF takes no position regarding the validity or scope of any + intellectual property or other rights that might be claimed to + pertain to the implementation or use of the technology described in + this document or the extent to which any license under such rights + might or might not be available; neither does it represent that it + has made any effort to identify any such rights. Information on the + IETF's procedures with respect to rights in standards-track and + standards-related documentation can be found in BCP-11. Copies of + claims of rights made available for publication and any assurances of + licenses to be made available, or the result of an attempt made to + obtain a general license or permission for the use of such + proprietary rights by implementors or users of this specification can + be obtained from the IETF Secretariat. + + + + + + + + + + + + + + + + + + + + + + +Resnick Standards Track [Page 50] + +RFC 2822 Internet Message Format April 2001 + + +Full Copyright Statement + + Copyright (C) The Internet Society (2001). All Rights Reserved. + + This document and translations of it may be copied and furnished to + others, and derivative works that comment on or otherwise explain it + or assist in its implementation may be prepared, copied, published + and distributed, in whole or in part, without restriction of any + kind, provided that the above copyright notice and this paragraph are + included on all such copies and derivative works. However, this + document itself may not be modified in any way, such as by removing + the copyright notice or references to the Internet Society or other + Internet organizations, except as needed for the purpose of + developing Internet standards in which case the procedures for + copyrights defined in the Internet Standards process must be + followed, or as required to translate it into languages other than + English. + + The limited permissions granted above are perpetual and will not be + revoked by the Internet Society or its successors or assigns. + + This document and the information contained herein is provided on an + "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING + TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION + HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF + MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Acknowledgement + + Funding for the RFC Editor function is currently provided by the + Internet Society. + + + + + + + + + + + + + + + + + + + +Resnick Standards Track [Page 51] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc3676.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc3676.txt new file mode 100644 index 0000000..bc08fba --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc3676.txt @@ -0,0 +1,1123 @@ + + + + + + +Network Working Group R. Gellens +Request for Comments: 3676 Qualcomm +Obsoletes: 2646 February 2004 +Category: Standards Track + + + The Text/Plain Format and DelSp Parameters + +Status of this Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2004). All Rights Reserved. + +Abstract + + This specification establishes two parameters (Format and DelSP) to + be used with the Text/Plain media type. In the presence of these + parameters, trailing whitespace is used to indicate flowed lines and + a canonical quote indicator is used to indicate quoted lines. This + results in an encoding which appears as normal Text/Plain in older + implementations, since it is in fact normal Text/Plain, yet provides + for superior wrapping/flowing, and quoting. + + This document supersedes the one specified in RFC 2646, "The + Text/Plain Format Parameter", and adds the DelSp parameter to + accommodate languages/coded character sets in which ASCII spaces are + not used or appear rarely. + +Table of Contents + + 1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . 2 + 2. Conventions Used in this Document . . . . . . . . . . . . . . 2 + 3. The Problem . . . . . . . . . . . . . . . . . . . . . . . . . 3 + 3.1. Paragraph Text. . . . . . . . . . . . . . . . . . . . . 3 + 3.2. Embarrassing Line Wrap . . . . . . . . . . . . . . . . 3 + 3.3. New Media Types . . . . . . . . . . . . . . . . . . . . 4 + 4. The Format and DelSp Parameters . . . . . . . . . . . . . . . 5 + 4.1. Interpreting Format=Flowed. . . . . . . . . . . . . . . 6 + 4.2. Generating Format=Flowed . . . . . . . . . . . . . . . 7 + 4.3. Usenet Signature Convention . . . . . . . . . . . . . . 9 + 4.4. Space-Stuffing . . . . . . . . . . . . . . . . . . . . 9 + + + +Gellens Standards Track [Page 1] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + 4.5. Quoting . . . . . . . . . . . . . . . . . . . . . . . . 9 + 4.6. Digital Signatures and Encryption . . . . . . . . . . . 11 + 4.7. Examples. . . . . . . . . . . . . . . . . . . . . . . . 12 + 5. Interoperability. . . . . . . . . . . . . . . . . . . . . . . 12 + 6. ABNF. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 + 7. Failure Modes . . . . . . . . . . . . . . . . . . . . . . . . 14 + 7.1. Trailing White Space Corruption . . . . . . . . . . . . 14 + 8. Security Considerations . . . . . . . . . . . . . . . . . . . 15 + 9. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 15 + 10. Internationalization Considerations . . . . . . . . . . . . . 15 + 11. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 15 + 12. Normative References. . . . . . . . . . . . . . . . . . . . . 16 + 13. Informative References. . . . . . . . . . . . . . . . . . . . 16 + Appendix A: Changes from RFC 2646 . . . . . . . . . . . . . . . . 18 + Author's Address. . . . . . . . . . . . . . . . . . . . . . . . . 19 + Full Copyright Statement. . . . . . . . . . . . . . . . . . . . . 20 + +1. Introduction + + Interoperability problems have been observed with erroneous labelling + of paragraph text as Text/Plain, and with various forms of + "embarrassing line wrap". (See Section 3.) + + Attempts to deploy new media types, such as Text/Enriched [Rich] and + Text/HTML [HTML] have suffered from a lack of backwards compatibility + and an often hostile user reaction at the receiving end. + + What is required is a format which is in all significant ways + Text/Plain, and therefore is quite suitable for display as + Text/Plain, and yet allows the sender to express to the receiver + which lines are quoted and which lines are considered a logical + paragraph, and thus eligible to be flowed (wrapped and joined) as + appropriate. + +2. Conventions Used in this Document + + The key words "REQUIRED", "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", + and "MAY" in this document are to be interpreted as described in "Key + words for use in RFCs to Indicate Requirement Levels" [KEYWORDS]. + + The term "paragraph" is used here to mean a series of lines which are + logically to be treated as a unit for display purposes and eligible + to be flowed (wrapped and joined) as appropriate to fit in the + display window and when creating text for replies, forwarding, etc. + + + + + + + +Gellens Standards Track [Page 2] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + +3. The Problem + + The Text/Plain media type is the lowest common denominator of + Internet email, with lines of no more than 998 characters (by + convention usually no more than 78), and where the carriage-return + and line-feed (CRLF) sequence represents a line break (see [MIME-IMT] + and [MSG-FMT]). + + Text/Plain is usually displayed as preformatted text, often in a + fixed font. That is, the characters start at the left margin of the + display window, and advance to the right until a CRLF sequence is + seen, at which point a new line is started, again at the left margin. + When a line length exceeds the display window, some clients will wrap + the line, while others invoke a horizontal scroll bar. + + Text which meets this description is defined by this memo as "fixed". + + Some interoperability problems have been observed with this format: + +3.1. Paragraph Text + + Many modern programs use a proportional-spaced font, and use CRLF to + represent paragraph breaks. Line breaks are "soft", occurring as + needed on display. That is, characters are grouped into a paragraph + until a CRLF sequence is seen, at which point a new paragraph is + started. Each paragraph is displayed, starting at the left margin + (or paragraph indent), and continuing to the right until a word is + encountered which does not fit in the remaining display width. This + word is displayed at the left margin of the next line. This + continues until the paragraph ends (a CRLF is seen). Extra vertical + space is left between paragraphs. + + Text which meets this description is defined by this memo as + "flowed". + + Numerous software products erroneously label this format as + Text/Plain, resulting in much user discomfort. + +3.2. Embarrassing Line Wrap + + As Text/Plain messages are quoted in replies or forwarded messages, + each line gradually increases in length, eventually being arbitrarily + hard wrapped, resulting in "embarrassing line wrap". This produces + text which is, at best, hard to read, and often confuses + attributions. + + + + + + +Gellens Standards Track [Page 3] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + Example: + + >>>>>>This is a comment from the first message to show a + >quoting example. + >>>>>This is a comment from the second message to show a + >quoting example. + >>>>This is a comment from the third message. + >>>This is a comment from the fourth message. + + It can be confusing to assign attribution to lines 2 and 4 above. + + In addition, as devices with display widths smaller than 79 or 80 + characters become more popular, embarrassing line wrap has become + even more prevalent, even with unquoted text. + + Example: + + This is paragraph text that is + meant to be flowed across + several lines. + However, the sending mailer is + converting it to fixed text at + a width of 72 + characters, which causes it to + look like this when shown on a + PDA with only + 30 character lines. + +3.3. New Media Types + + Attempts to deploy new media types, such as Text/Enriched [Rich] and + Text/HTML [HTML] have suffered from a lack of backwards compatibility + and an often hostile user reaction at the receiving end. + + In particular, Text/Enriched requires that open angle brackets ("<") + and hard line breaks be doubled, with resulting user unhappiness when + viewed as Text/Plain. Text/HTML requires even more alteration of + text, with a corresponding increase in user complaints. + + A proposal to define a new media type to explicitly represent the + paragraph form suffered from a lack of interoperability with + currently deployed software. Some programs treat unknown subtypes of + TEXT as an attachment. + + + + + + + + +Gellens Standards Track [Page 4] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + What is desired is a format which is in all significant ways + Text/Plain, and therefore is quite suitable for display as + Text/Plain, and yet allows the sender to express to the receiver + which lines can be considered a logical paragraph, and thus flowed + (wrapped and joined) as appropriate. + +4. The Format and DelSp Parameters + + This specification defines two MIME parameters for use with + Text/Plain: + + Name: Format + Value: Fixed, Flowed + + Name: DelSp + Value: Yes, No + + (Neither the parameter names nor values are case sensitive.) + + If Format is not specified, or if the value is not recognized, a + value of Fixed is assumed. The semantics of the Fixed value are the + usual associated with Text/Plain [MIME-IMT]. + + A Format value of Flowed indicates that the definition of flowed text + (as specified in this memo) was used on generation, and MAY be used + on reception. + + Note that because Format is a parameter of the Text/Plain content- + type, any content-transfer-encoding used is irrelevant to the + processing of flowed text. + + If DelSp is not specified, or if its value is not recognized, a value + of No is assumed. The use of DelSp without a Format value of Flowed + is undefined. When creating messages, DelSp SHOULD NOT be specified + in Text content types other than Text/Plain with Format = Flowed. + When receiving messages, DelSp SHOULD be ignored if used in a Text + content type other than Text/Plain with Format = Flowed. + + This section discusses flowed text; section 6 provides a formal + definition. + + Section 5 discusses interoperability. + + Note that this memo describes an on-the-wire format. It does not + address formats for local file storage. + + + + + + +Gellens Standards Track [Page 5] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + +4.1. Interpreting Format=Flowed + + If the first character of a line is a quote mark (">"), the line is + considered to be quoted (see Section 4.5). Logically, all quote + marks are counted and deleted, resulting in a line with a non-zero + quote depth, and content. (The agent is of course free to display + the content with quote marks or excerpt bars or anything else.) + Logically, this test for quoted lines is done before any other tests + (that is, before checking for space-stuffed and flowed). + + If the first character of a line is a space, the line has been + space-stuffed (see Section 4.4). Logically, this leading space is + deleted before examining the line further (that is, before checking + for flowed). + + If the line ends in a space, the line is flowed. Otherwise it is + fixed. The exception to this rule is a signature separator line, + described in Section 4.3. Such lines end in a space but are neither + flowed nor fixed. + + If the line is flowed and DelSp is "yes", the trailing space + immediately prior to the line's CRLF is logically deleted. If the + DelSp parameter is "no" (or not specified, or set to an unrecognized + value), the trailing space is not deleted. + + Any remaining trailing spaces are part of the line's content, but the + CRLF of a soft line break is not. + + A series of one or more flowed lines followed by one fixed line is + considered a paragraph, and MAY be flowed (wrapped and unwrapped) as + appropriate on display and in the construction of new messages (see + Section 4.5). + + An interpreting agent SHOULD allow for three exceptions to the rule + that paragraphs end with a fixed line. These exceptions are + improperly constructed messages: a flowed line SHOULD be considered + to end the paragraph if it is followed by a line of a different quote + depth (see 4.5) or by a signature separator (see 4.3); the end of the + body also ends the paragraph. + + A line consisting of one or more spaces (after deleting a space + acting as stuffing) is considered a flowed line. + + An empty line (just a CRLF) is a fixed line. + + Note that, for Unicode text, [Annex-14] provides guidance for + choosing at which characters to wrap a line. + + + + +Gellens Standards Track [Page 6] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + +4.2. Generating Format=Flowed + + When generating Format=Flowed text, lines SHOULD be 78 characters or + shorter, including any trailing white space and also including any + space added as part of stuffing (see Section 4.4). As suggested + values, any paragraph longer than 78 characters in total length could + be wrapped using lines of 72 or fewer characters. While the specific + line length used is a matter of aesthetics and preference, longer + lines are more likely to require rewrapping and to encounter + difficulties with older mailers. (It has been suggested that 66 + character lines are the most readable.) + + The restriction to 78 or fewer characters between CRLFs on the wire + is to conform to [MSG-FMT]. + + (In addition to conformance to [MSG-FMT], there is a historical need + that all lines, even when displayed by a non-flowed-aware program, + will fit in a standard 79- or 80-column screen without having to be + wrapped. The limit is 78, not 79 or 80, because while 79 or 80 fit + on a line, the last column is often reserved for a line-wrap + indicator.) + + When creating flowed text, the generating agent wraps, that is, + inserts 'soft' line breaks as needed. Soft line breaks are added at + natural wrapping points, such as between words. A soft line break is + a SP CRLF sequence. + + There are two techniques for inserting soft line breaks. The older + technique, established by RFC 2646, creates a soft line break by + inserting a CRLF after the occurrence of a space. With this + technique, soft line breaks are only possible where spaces already + occur. When this technique is used, the DelSp parameter SHOULD be + used; if used it MUST be set to "no". + + The newer technique, suitable for use even with languages/coded + character sets in which the ASCII space character is rare or not + used, creates a soft line break by inserting a SP CRLF sequence. + When this technique is used, the DelSp parameter MUST be used and + MUST be set to "yes". Note that because of space-stuffing (see + Section 4.4), when this technique is used and a soft line break is + inserted at a point where a SP already exists (such as between + words), if the SP CRLF sequence is added immediately before the SP, + the pre-existing SP becomes leading and thus requires stuffing. It + is RECOMMENDED that agents avoid this by inserting the SP CRLF + sequence following the existing SP. + + Generating agents MAY use either method within each Text/Plain body + part. + + + +Gellens Standards Track [Page 7] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + Regardless of which technique is used, a generating agent SHOULD NOT + insert a space in an unnatural location, such as into a word (a + sequence of printable characters, not containing spaces, in a + language/coded character set in which spaces are common). If faced + with such a word which exceeds 78 characters (but less than 998 + characters, the [SMTP] limit on line length), the agent SHOULD send + the word as is and exceed the 78-character limit on line length. + + A generating agent SHOULD: + + o Ensure all lines (fixed and flowed) are 78 characters or fewer in + length, counting any trailing space as well as a space added as + stuffing, but not counting the CRLF, unless a word by itself + exceeds 78 characters. + + o Trim spaces before user-inserted hard line breaks. + + A generating agent MUST: + + o Space-stuff lines which start with a space, "From ", or ">". + + In order to create messages which do not require space-stuffing, and + are thus more aesthetically pleasing when viewed as Format=Fixed, a + generating agent MAY avoid wrapping immediately before ">", "From ", + or space. + + (See Sections 4.4 and 4.5 for more information on space-stuffing and + quoting, respectively.) + + A Format=Flowed message consists of zero or more paragraphs, each + containing one or more flowed lines followed by one fixed line. The + usual case is a series of flowed text lines with blank (empty) fixed + lines between them. + + Any number of fixed lines can appear between paragraphs. + + When placing soft line breaks in a paragraph, generating agents MUST + NOT place them in a way that causes any line of the paragraph to be a + signature separator line, because paragraphs cannot contain signature + separator lines (see Sections 4.3 and 6). + + [Quoted-Printable] encoding SHOULD NOT be used with Format=Flowed + unless absolutely necessary (for example, non-US-ASCII (8-bit) + characters over a strictly 7-bit transport such as unextended + [SMTP]). In particular, a message SHOULD NOT be encoded in Quoted- + Printable for the sole purpose of protecting the trailing space on + flowed lines unless the body part is cryptographically signed or + encrypted (see Section 4.6). + + + +Gellens Standards Track [Page 8] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + The intent of Format=Flowed is to allow user agents to generate + flowed text which is non-obnoxious when viewed as pure, raw + Text/Plain (without any decoding); use of Quoted-Printable hinders + this and may cause Format=Flowed to be rejected by end users. + +4.3. Usenet Signature Convention + + There is a long-standing convention in Usenet news which also + commonly appears in Internet mail of using "-- " as the separator + line between the body and the signature of a message. When + generating a Format=Flowed message containing a Usenet-style + separator before the signature, the separator line is sent as-is. + This is a special case; an (optionally quoted or quoted and stuffed) + line consisting of DASH DASH SP is neither fixed nor flowed. + + Generating agents MUST NOT end a paragraph with such a signature + line. + + A receiving agent needs to test for a signature line both before the + test for a quoted line (see Section 4.5) and also after logically + counting and deleting quote marks and stuffing (see Section 4.4) from + a quoted line. + +4.4. Space-Stuffing + + In order to allow for unquoted lines which start with ">", and to + protect against systems which "From-munge" in-transit messages + (modifying any line which starts with "From " to ">From "), + Format=Flowed provides for space-stuffing. + + Space-stuffing adds a single space to the start of any line which + needs protection when the message is generated. On reception, if the + first character of a line is a space, it is logically deleted. This + occurs after the test for a quoted line (which logically counts and + deletes any quote marks), and before the test for a flowed line. + + On generation, any unquoted lines which start with ">", and any lines + which start with a space or "From " MUST be space-stuffed. Other + lines MAY be space-stuffed as desired. + + (Note that space-stuffing is conceptually similar to dot-stuffing as + specified in [SMTP].) + +4.5. Quoting + + In Format=Flowed, the canonical quote indicator (or quote mark) is + one or more close angle bracket (">") characters. Lines which start + with the quote indicator are considered quoted. The number of ">" + + + +Gellens Standards Track [Page 9] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + characters at the start of the line specifies the quote depth. + Flowed lines which are also quoted may require special handling on + display and when copied to new messages. + + When creating quoted flowed lines, each such line starts with the + quote indicator. + + Note that because of space-stuffing, the lines + >> Exit, Stage Left + and + >>Exit, Stage Left + are semantically identical; both have a quote-depth of two, and a + content of "Exit, Stage Left". + + However, the line + > > Exit, Stage Left + is different. It has a quote-depth of one, and a content of + "> Exit, Stage Left". + + When generating quoted flowed lines, an agent needs to pay attention + to changes in quote depth. All lines of a paragraph MUST be + unquoted, or else they MUST all be quoted and have the same quote + depth. Therefore, whenever there is a change in quote depth, or a + change from quoted to unquoted, or change from unquoted to quoted, + the line immediately preceding the change MUST NOT be a flowed line. + + If a receiving agent wishes to reformat flowed quoted lines (joining + and/or wrapping them) on display or when generating new messages, the + lines SHOULD be de-quoted, reformatted, and then re-quoted. To de- + quote, the number of close angle brackets in the quote indicator at + the start of each line is counted. To re-quote after reformatting, a + quote indicator containing the same number of close angle brackets + originally present are prefixed to each line. + + On reception, if a change in quote depth occurs on a flowed line, + this is an improperly formatted message. The receiver SHOULD handle + this error by using the 'quote-depth-wins' rule, which is to consider + the paragraph to end with the flowed line immediately preceding the + change in quote depth. + + In other words, whenever two adjacent lines have different quote + depths, senders MUST ensure that the earlier line is not flowed (does + not end in a space), and receivers finding a flowed line there SHOULD + treat it as the last line of a paragraph. + + For example, consider the following sequence of lines (using '*' to + indicate a soft line break, i.e., SP CRLF, and '#' to indicate a hard + line break, i.e., CRLF): + + + +Gellens Standards Track [Page 10] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + > Thou villainous ill-breeding spongy dizzy-eyed* + > reeky elf-skinned pigeon-egg!* <--- problem ---< + >> Thou artless swag-bellied milk-livered* + >> dismal-dreaming idle-headed scut!# + >>> Thou errant folly-fallen spleeny reeling-ripe* + >>> unmuzzled ratsbane!# + >>>> Henceforth, the coding style is to be strictly* + >>>> enforced, including the use of only upper case.# + >>>>> I've noticed a lack of adherence to the coding* + >>>>> styles, of late.# + >>>>>> Any complaints?# + + The second line ends in a soft line break, even though it is the last + line of the one-deep quote block. The question then arises as to how + this line is to be interpreted, considering that the next line is the + first line of the two-deep quote block. + + The example text above, when processed according to quote-depth wins, + results in the first two lines being considered as one quoted, flowed + section, with a quote depth of 1; the third and fourth lines become a + quoted, flowed section, with a quote depth of 2. + + A generating agent MUST NOT create this situation; a receiving agent + SHOULD handle it by giving preference to the quote depth. + +4.6. Digital Signatures and Encryption + + If a message is digitally signed or encrypted it is important that + cryptographic processing use the same text for signature verification + and/or decryption as was used for signature generation and/or + encryption. Since the use of format=flowed allows text to be altered + (by adding or removing line breaks and trailing spaces) between + composition and transmission, and between reception and display, + interoperability problems or security vulnerabilities may arise if + originator and recipient do not both use the on-the-wire format for + cryptographic processing. + + The implications of the interaction between format=flowed and any + specific cryptographic process depend on the details of the + cryptographic processing and should be understood before using + format=flowed in conjunction with signed and/or encrypted messages. + + Note that [OpenPGP] specifies (in Section 7.1) that "any trailing + whitespace (spaces, and tabs, 0x09) at the end of any line is ignored + when the cleartext signature is calculated." + + + + + + +Gellens Standards Track [Page 11] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + Thus it would be possible to add, in transit, a format=flowed header + to a regular, format=fixed vanilla PGP (not [OpenPGP-MIME]) signed + message and add arbitrary trailing space characters without this + addition being detected. This would change the rendering of the + article by a client which supported format=flowed. + + Therefore, the use of [OpenPGP] with format=flowed messages is + strongly discouraged. [OpenPGP-MIME] is recommended instead. + +4.7. Examples + + The following example contains three paragraphs: + + `Take some more tea,' the March Hare said to Alice, very + earnestly. + + `I've had nothing yet,' Alice replied in an offended tone, `so I + can't take more.' + + `You mean you can't take LESS,' said the Hatter: `it's very easy + to take MORE than nothing.' + + This could be encoded as follows (using '*' to indicate a soft line + break, that is, SP CRLF sequence, and '#' to indicate a hard line + break, that is, CRLF): + + `Take some more tea,' the March Hare said to Alice, very* + earnestly.# + # + `I've had nothing yet,' Alice replied in an offended tone, `so* + I can't take more.'# + # + `You mean you can't take LESS,' said the Hatter: `it's very* + easy to take MORE than nothing.'# + + To show an example of quoting, here we have the same exchange, + presented as a series of direct quotes: + + >>>Take some more tea.# + >>I've had nothing yet, so I can't take more.# + >You mean you can't take LESS, it's very easy to take* + >MORE than nothing.# + +5. Interoperability + + Because flowed lines are all-but-indistinguishable from fixed lines, + software which does not recognize Format=Flowed treats flowed lines + as normal Text/Plain (which is what they are). Thus, Format=Flowed + + + +Gellens Standards Track [Page 12] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + interoperates with older clients, although flowed lines will have + trailing white space inserted. + + If a space-stuffed message is received by an agent which handles + Format=Flowed, the space-stuffing is reversed and thus the message + appears unchanged. An agent which is not aware of Format=Flowed will + of course not undo any space-stuffing; thus Format=Flowed messages + may appear with a leading space on some lines (those which start with + a space, ">" which is not a quote indicator, or "From "). Since + lines which require space-stuffing rarely occur, and the aesthetic + consequences of unreversed space-stuffing are minimal, this is not + expected to be a significant problem. + + If some lines begin with one or more spaces, the generating agent MAY + space-stuff all lines, to maintain the relative indentation of the + lines when viewed by clients which are not aware of Format=Flowed. + + Messages generated with DelSp=yes and received by clients which are + aware of Format=Flowed but are not aware of the DelSp parameter will + have an extra space remaining after removal of soft line breaks. + Thus, when generating text in languages/coded character sets in which + spaces are common, the generating agent MAY always use the DelSp=no + method. + + Hand-aligned text, such as ASCII tables or art, source code, etc., + SHOULD be sent as fixed, not flowed lines. + +6. ABNF + + The constructs used in Text/Plain; Format=Flowed body parts are + described using Augmented Backus-Naur Form [ABNF], including the core + rules defined in Appendix A. + + Note that the SP (space) and ">" characters are encoded according to + the charset parameter. + +flowed-body = *( paragraph / fixed-line / sig-sep ) +paragraph = 1*flowed-line fixed-line + ; all lines in paragraph MUST be unquoted or + ; have same quote depth +flowed-line = ( flowed-line-qt / flowed-line-unqt ) flow CRLF +flowed-line-qt = quote ( ( stuffing stuffed-flowed ) / + unstuffed-flowed ) +flowed-line-unqt = ( stuffing stuffed-flowed ) / unstuffed-flowed +stuffed-flowed = *text-char +unstuffed-flowed = non-sp-quote *text-char +fixed-line = fixed-line-qt / fixed-line-unqt +fixed-line-qt = quote ( ( stuffing stuffed-fixed ) / + + + +Gellens Standards Track [Page 13] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + unstuffed-fixed ) CRLF +fixed-line-unqt = ( stuffed-fixed / unstuffed-fixed ) CRLF +stuffed-fixed = *text-char non-sp +unstuffed-fixed = non-sp-quote [ *text-char non-sp ] +sig-sep = [ quote [stuffing] ] "--" SP CRLF +quote-mark = ">" +quote = 1*quote-mark +stuffing = SP ; space-stuffed, added on generation if + ; needed, deleted on reception +flow = SP ; space before CRLF indicates flowed line, + ; if DelSp=yes, space was added on generation + ; and is deleted on reception +non-sp-quote = < any character except NUL, CR, LF, SP, quote-mark > +non-sp = non-sp-quote / quote-mark +text-char = non-sp / SP + + That is, a Format=Flowed message body consists of any number of + paragraphs and/or fixed lines and/or signature separator lines; + paragraphs need at least one flowed line and are terminated by a + fixed line; the fixed line terminating the paragraph is part of the + paragraph. (There are some exceptions to this described in the + text.) + + Without at least one flowed line, there is a series of fixed lines, + each independent. There is no paragraph. + + With at least one flowed line, there is a paragraph, and the received + lines can be reformed and flowed to fit the display window size. + This can only be done if the lines are part of a logical grouping, + the paragraph. + + Note that the definitions of flowed-line and sig-sep are potentially + ambiguous: a signature separator line matches both, but is treated as + a signature separator line and not a flowed line. + +7. Failure Modes + +7.1. Trailing White Space Corruption + + There are systems in existence which alter trailing whitespace on + messages which pass through them. Such systems may strip, or in + rarer cases, add trailing whitespace, in violation of RFC 2821 [SMTP] + Section 4.5.2. + + Stripping trailing whitespace has the effect of converting flowed + lines to fixed lines, which results in a message no worse than if + Format=Flowed had not been used. + + + + +Gellens Standards Track [Page 14] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + Adding trailing whitespace to a Format=Flowed message may result in a + malformed display or reply. + + Since most systems which add trailing white space do so to create a + line which fills an internal record format, the result is almost + always a line which contains an even number of characters (counting + the added trailing white space). + + One possible avoidance, therefore, would be to define Format=Flowed + lines to use either one or two trailing space characters to indicate + a flowed line, such that the total line length is odd. However, + considering the scarcity of such systems today, it is not worth the + added complexity. + +8. Security Considerations + + Any security considerations which apply to Text/Plain also apply to + Text/Plain with Format=Flowed. + + Section 4.6 discusses the interaction between Format=Flowed and + digital signatures or encryption. + +9. IANA Considerations + + IANA has added a reference to this specification in the Text/Plain + Media Type registration. + +10. Internationalization Considerations + + The line wrap and quoting specifications of Format=Flowed may not be + suitable for certain charsets, such as for Arabic and Hebrew + characters that read from right to left. Care needs to be taken in + applying format=flowed in these cases, as format=fixed combined with + [quoted-printable] encoding may be more suitable. + + The DelSp parameter was added specifically to permit Format=Flowed to + be used with languages/coded character sets in which the ASCII space + character is rarely used, or not used at all. + +11. Acknowledgments + + The DelSp parameter was developed during a series of discussions + among a number of people, including Harald Alvestrand, Grant Baillie, + Ian Bell, Steve Dorner, Patrik Faltstrom, Eric Fischer, Ned Freed, + Alexey Melnikov, John Myers, and Pete Resnick. + + + + + + +Gellens Standards Track [Page 15] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + Corrections and clarifications to RFC 2646 and early versions of this + document were pointed out by several people, including Adam Costello, + Jutta Degener, Tony Hansen, Simon Josefsson, Dan Kohn, Ragho + Mahalingam, Keith Moore, Greg Troxel, and Dan Wing. + + I'm told that NeXT's mail application used a very similar mechanism + (without support for non-Western languages) in 1992. + +12. Normative References + + [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF + for Syntax Specifications: ABNF", RFC 2234, + November 1997. + + [KEYWORDS] Bradner, S., "Key words for use in RFCs to + Indicate Requirement Levels", BCP 14, RFC 2119, + March 1997. + + [MIME-IMT] Freed, N. and N. Borenstein, "Multipurpose + Internet Mail Extensions (MIME) Part Two: Media + Types", RFC 2046, November 1996. + + [Quoted-Printable] Freed, N. and N. Borenstein, "Multipurpose + Internet Mail Extensions (MIME) Part One: Format + of Internet Message Bodies", RFC 2045, November + 1996. + +13. Informative References + + [Annex-14] Unicode Standard Annex #14, "Line Breaking + Properties" + + + [MSG-FMT] Resnick, P., Ed., "Internet Message Format", RFC + 2822, April 2001. + + [OpenPGP] Callas, J., Donnerhacke, L., Finney, H. and R. + Thayer, "OpenPGP Message Format", RFC 2440, + November 1998. + + [OpenPGP-MIME] Elkins, M., "MIME Security with Pretty Good + Privacy (PGP)", RFC 2015, October 1996. + + Elkins, M., Del Torto, D., Levien, R. and J. + Roessler, "MIME Security with OpenPGP", RFC 3156, + August 2001. + + + + + +Gellens Standards Track [Page 16] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + [Rich] Resnick, P. and A. Walker, "The text/enriched MIME + Content-type", RFC 1896, February 1996. + + [SMTP] Klensin, J., Ed., "Simple Mail Transfer Protocol", + RFC 2821, April 2001. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Gellens Standards Track [Page 17] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + +Appendix A: Changes from RFC 2646 + + Substantive: + + o Added DelSp parameter to handle languages and coded character sets + in which space is less common or not used. + o Updated text on generating and interpreting to accommodate the + DelSp parameter. + o Changed the limits of 79 or 80 to be 78 in conformance with RFC + 2822. + o Added text on generating to clarify that the 78-character limit + includes trailing white space and stuffing. + o Changed sig-sep in ABNF to allow stuffing. + o Changed fixed-line to allow empty lines in ABNF. + o Added explanatory text following ABNF. + o Moved text from Abstract to new Introduction; rewrote Abstract. + o Moved interoperability text to new section, and updated. + o Clarified Security Considerations. + o Text on digital signatures now discusses that OpenPGP ignores + trailing white space. + o Mention Unicode Annex 14. + o Added mention of quoting to Abstract and Introduction. + o Deleted line analysis table. + o Added recommendations for OpenPGP and OpenPGP-MIME. + o Rewrote ABNF rules to remove most ambiguity and note remaining + case. + o Added note that c-t-e is irrelevant to flowed text processing. + o Added text indicating that end of data terminates a paragraph. + o Moved sig-sep out of fixed-line ABNF. + o Changed some SHOULDs to MUSTs (space-stuffing, quoted paragraphs). + o Added note to ABNF that space and ">" are encoded according to + charset. + o Mentioned exceptions in section on interpreting. + o Clarified and made consistent treatment of signature separator + lines. + + Editorial: + + o Added mention of NeXT's mail application to Acknowledgments. + o Updated Acknowledgments. + o Updated [SMTP] reference to 2821. + o Added Notices. + o Split References into Normative and Informative. + o Improved text wording in some areas. + o Standardize on "quote depth", not "quoting depth". + o Moved section on interpreting before section on generating. + o Reworded non-normative "should"s. + o Noted meaning of "paragraph". + + + +Gellens Standards Track [Page 18] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + + The DelSp parameter was added specifically to permit Format=Flowed to + be used with languages/coded character sets in which the ASCII space + character is rarely used, or not used at all. The DelSp mechanism + was selected despite having been initially rejected as too much of a + kludge, because among the many different techniques proposed, it + allows for maximum interoperability among clients which support + neither this specification nor RFC 2646, those which do support RFC + 2646 but not this specification, and those that do support this + specification; this set is multiplied by those that handle + languages/coded character sets in which spaces are common, and in + which they are uncommon or not used. + +Author's Address + + Randall Gellens + QUALCOMM Incorporated + 5775 Morehouse Drive + San Diego, CA 92121 + USA + + Phone: +1 858 651 5115 + EMail: randy@qualcomm.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Gellens Standards Track [Page 19] + +RFC 3676 Text/Plain Format and DelSp Parameters February 2004 + + +Full Copyright Statement + + Copyright (C) The Internet Society (2004). This document is subject + to the rights, licenses and restrictions contained in BCP 78 and + except as set forth therein, the authors retain all their rights. + + This document and the information contained herein are provided on an + "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE + REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE + INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF + THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Intellectual Property + + The IETF takes no position regarding the validity or scope of any + Intellectual Property Rights or other rights that might be claimed + to pertain to the implementation or use of the technology + described in this document or the extent to which any license + under such rights might or might not be available; nor does it + represent that it has made any independent effort to identify any + such rights. Information on the procedures with respect to + rights in RFC documents can be found in BCP 78 and BCP 79. + + Copies of IPR disclosures made to the IETF Secretariat and any + assurances of licenses to be made available, or the result of an + attempt made to obtain a general license or permission for the use + of such proprietary rights by implementers or users of this + specification can be obtained from the IETF on-line IPR repository + at http://www.ietf.org/ipr. + + The IETF invites any interested party to bring to its attention + any copyrights, patents or patent applications, or other + proprietary rights that may cover technology that may be required + to implement this standard. Please address the information to the + IETF at ietf-ipr@ietf.org. + +Acknowledgement + + Funding for the RFC Editor function is currently provided by the + Internet Society. + + + + + + + + + +Gellens Standards Track [Page 20] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4505.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4505.txt new file mode 100644 index 0000000..6b8a4a1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4505.txt @@ -0,0 +1,507 @@ + + + + + + +Network Working Group K. Zeilenga, Ed. +Request for Comments: 4505 OpenLDAP Foundation +Obsoletes: 2245 June 2006 +Category: Standards Track + + + Anonymous Simple Authentication and Security Layer (SASL) Mechanism + +Status of This Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2006). + +Abstract + + On the Internet, it is common practice to permit anonymous access to + various services. Traditionally, this has been done with a plain- + text password mechanism using "anonymous" as the user name and using + optional trace information, such as an email address, as the + password. As plain-text login commands are not permitted in new IETF + protocols, a new way to provide anonymous login is needed within the + context of the Simple Authentication and Security Layer (SASL) + framework. + +1. Introduction + + This document defines an anonymous mechanism for the Simple + Authentication and Security Layer ([SASL]) framework. The name + associated with this mechanism is "ANONYMOUS". + + Unlike many other SASL mechanisms, whose purpose is to authenticate + and identify the user to a server, the purpose of this SASL mechanism + is to allow the user to gain access to services or resources without + requiring the user to establish or otherwise disclose their identity + to the server. That is, this mechanism provides an anonymous login + method. + + This mechanism does not provide a security layer. + + This document replaces RFC 2245. Changes since RFC 2245 are detailed + in Appendix A. + + + +Zeilenga Standards Track [Page 1] + +RFC 4505 Anonymous SASL Mechanism June 2006 + + +2. The Anonymous Mechanism + + The mechanism consists of a single message from the client to the + server. The client may include in this message trace information in + the form of a string of [UTF-8]-encoded [Unicode] characters prepared + in accordance with [StringPrep] and the "trace" stringprep profile + defined in Section 3 of this document. The trace information, which + has no semantical value, should take one of two forms: an Internet + email address, or an opaque string that does not contain the '@' + (U+0040) character and that can be interpreted by the system + administrator of the client's domain. For privacy reasons, an + Internet email address or other information identifying the user + should only be used with permission from the user. + + A server that permits anonymous access will announce support for the + ANONYMOUS mechanism and allow anyone to log in using that mechanism, + usually with restricted access. + + A formal grammar for the client message using Augmented BNF [ABNF] is + provided below as a tool for understanding this technical + specification. + + message = [ email / token ] + ;; to be prepared in accordance with Section 3 + + UTF1 = %x00-3F / %x41-7F ;; less '@' (U+0040) + UTF2 = %xC2-DF UTF0 + UTF3 = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) / + %xED %x80-9F UTF0 / %xEE-EF 2(UTF0) + UTF4 = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) / + %xF4 %x80-8F 2(UTF0) + UTF0 = %x80-BF + + TCHAR = UTF1 / UTF2 / UTF3 / UTF4 + ;; any UTF-8 encoded Unicode character + ;; except '@' (U+0040) + + email = addr-spec + ;; as defined in [IMAIL] + + token = 1*255TCHAR + + Note to implementors: + The production is restricted to 255 UTF-8-encoded Unicode + characters. As the encoding of a characters uses a sequence of 1 + to 4 octets, a token may be as long as 1020 octets. + + + + + +Zeilenga Standards Track [Page 2] + +RFC 4505 Anonymous SASL Mechanism June 2006 + + +3. The "trace" Profile of "Stringprep" + + This section defines the "trace" profile of [StringPrep]. This + profile is designed for use with the SASL ANONYMOUS Mechanism. + Specifically, the client is to prepare the production in + accordance with this profile. + + The character repertoire of this profile is Unicode 3.2 [Unicode]. + + No mapping is required by this profile. + + No Unicode normalization is required by this profile. + + The list of unassigned code points for this profile is that provided + in Appendix A of [StringPrep]. Unassigned code points are not + prohibited. + + Characters from the following tables of [StringPrep] are prohibited: + + - C.2.1 (ASCII control characters) + - C.2.2 (Non-ASCII control characters) + - C.3 (Private use characters) + - C.4 (Non-character code points) + - C.5 (Surrogate codes) + - C.6 (Inappropriate for plain text) + - C.8 (Change display properties are deprecated) + - C.9 (Tagging characters) + + No additional characters are prohibited. + + This profile requires bidirectional character checking per Section 6 + of [StringPrep]. + +4. Example + + Here is a sample ANONYMOUS login between an IMAP client and server. + In this example, "C:" and "S:" indicate lines sent by the client and + server, respectively. If such lines are wrapped without a new "C:" + or "S:" label, then the wrapping is for editorial clarity and is not + part of the command. + + Note that this example uses the IMAP profile [IMAP4] of SASL. The + base64 encoding of challenges and responses as well as the "+ " + preceding the responses are part of the IMAP4 profile, not part of + SASL itself. Additionally, protocols with SASL profiles permitting + an initial client response will be able to avoid the extra round trip + below (the server response with an empty "+ "). + + + + +Zeilenga Standards Track [Page 3] + +RFC 4505 Anonymous SASL Mechanism June 2006 + + + In this example, the trace information is "sirhc". + + S: * OK IMAP4 server ready + C: A001 CAPABILITY + S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=DIGEST-MD5 AUTH=ANONYMOUS + S: A001 OK done + C: A002 AUTHENTICATE ANONYMOUS + S: + + C: c2lyaGM= + S: A003 OK Welcome, trace information has been logged. + +5. Security Considerations + + The ANONYMOUS mechanism grants access to services and/or resources by + anyone. For this reason, it should be disabled by default so that + the administrator can make an explicit decision to enable it. + + If the anonymous user has any write privileges, a denial-of-service + attack is possible by filling up all available space. This can be + prevented by disabling all write access by anonymous users. + + If anonymous users have read and write access to the same area, the + server can be used as a communication mechanism to exchange + information anonymously. Servers that accept anonymous submissions + should implement the common "drop box" model, which forbids anonymous + read access to the area where anonymous submissions are accepted. + + If the anonymous user can run many expensive operations (e.g., an + IMAP SEARCH BODY command), this could enable a denial-of-service + attack. Servers are encouraged to reduce the priority of anonymous + users or limit their resource usage. + + While servers may impose a limit on the number of anonymous users, + note that such limits enable denial-of-service attacks and should be + used with caution. + + The trace information is not authenticated, so it can be falsified. + This can be used as an attempt to get someone else in trouble for + access to questionable information. Administrators investigating + abuse need to realize that this trace information may be falsified. + + A client that uses the user's correct email address as trace + information without explicit permission may violate that user's + privacy. Anyone who accesses an anonymous archive on a sensitive + subject (e.g., sexual abuse) likely has strong privacy needs. + Clients should not send the email address without the explicit + permission of the user and should offer the option of supplying no + trace information, thus only exposing the source IP address and time. + + + +Zeilenga Standards Track [Page 4] + +RFC 4505 Anonymous SASL Mechanism June 2006 + + + Anonymous proxy servers could enhance this privacy but would have to + consider the resulting potential denial-of-service attacks. + + Anonymous connections are susceptible to man-in-the-middle attacks + that view or alter the data transferred. Clients and servers are + encouraged to support external data security services. + + Protocols that fail to require an explicit anonymous login are more + susceptible to break-ins given certain common implementation + techniques. Specifically, Unix servers that offer user login may + initially start up as root and switch to the appropriate user id + after an explicit login command. Normally, such servers refuse all + data access commands prior to explicit login and may enter a + restricted security environment (e.g., the Unix chroot(2) function) + for anonymous users. If anonymous access is not explicitly + requested, the entire data access machinery is exposed to external + security attacks without the chance for explicit protective measures. + Protocols that offer restricted data access should not allow + anonymous data access without an explicit login step. + + General [SASL] security considerations apply to this mechanism. + + [StringPrep] security considerations and [Unicode] security + considerations discussed in [StringPrep] apply to this mechanism. + [UTF-8] security considerations also apply. + +6. IANA Considerations + + The SASL Mechanism registry [IANA-SASL] entry for the ANONYMOUS + mechanism has been updated by the IANA to reflect that this document + now provides its technical specification. + + To: iana@iana.org + Subject: Updated Registration of SASL mechanism ANONYMOUS + + SASL mechanism name: ANONYMOUS + Security considerations: See RFC 4505. + Published specification (optional, recommended): RFC 4505 + Person & email address to contact for further information: + Kurt Zeilenga + Chris Newman + Intended usage: COMMON + Author/Change controller: IESG + Note: Updates existing entry for ANONYMOUS + + + + + + + +Zeilenga Standards Track [Page 5] + +RFC 4505 Anonymous SASL Mechanism June 2006 + + + The [StringPrep] profile "trace", first defined in this RFC, has been + registered: + + To: iana@iana.org + Subject: Initial Registration of Stringprep "trace" profile + + Stringprep profile: trace + Published specification: RFC 4505 + Person & email address to contact for further information: + Kurt Zeilenga + +7. Acknowledgement + + This document is a revision of RFC 2245 by Chris Newman. Portions of + the grammar defined in Section 1 were borrowed from RFC 3629 by + Francois Yergeau. + + This document is a product of the IETF SASL WG. + +8. Normative References + + [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax + Specifications: ABNF", RFC 4234, October 2005. + + [IMAIL] Resnick, P., "Internet Message Format", RFC 2822, April + 2001. + + [SASL] Melnikov, A., Ed. and K. Zeilenga, Ed., "Simple + Authentication and Security Layer (SASL)", RFC 4422, + June 2006. + + [StringPrep] Hoffman, P. and M. Blanchet, "Preparation of + Internationalized Strings ('stringprep')", RFC 3454, + December 2002. + + [Unicode] The Unicode Consortium, "The Unicode Standard, Version + 3.2.0" is defined by "The Unicode Standard, Version 3.0" + (Reading, MA, Addison-Wesley, 2000. ISBN 0-201-61633-5), + as amended by the "Unicode Standard Annex #27: Unicode + 3.1" (http://www.unicode.org/reports/tr27/) and by the + "Unicode Standard Annex #28: Unicode 3.2" + (http://www.unicode.org/reports/tr28/). + + [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO + 10646", RFC 3629 (also STD 63), November 2003. + + + + + + +Zeilenga Standards Track [Page 6] + +RFC 4505 Anonymous SASL Mechanism June 2006 + + +9. Informative References + + [IMAP4] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION + 4rev1", RFC 3501, March 2003. + + [IANA-SASL] IANA, "SIMPLE AUTHENTICATION AND SECURITY LAYER (SASL) + MECHANISMS", . + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Zeilenga Standards Track [Page 7] + +RFC 4505 Anonymous SASL Mechanism June 2006 + + +Appendix A. Changes since RFC 2245 + + This appendix is non-normative. + + RFC 2245 allows the client to include optional trace information in + the form of a human readable string. RFC 2245 restricted this string + to US-ASCII. As the Internet is international, this document uses a + string restricted to UTF-8 encoded Unicode characters. A + "stringprep" profile is defined to precisely define which Unicode + characters are allowed in this string. While the string remains + restricted to 255 characters, the encoded length of each character + may now range from 1 to 4 octets. + + Additionally, a number of editorial changes were made. + +Editor's Address + + Kurt D. Zeilenga + OpenLDAP Foundation + + EMail: Kurt@OpenLDAP.org + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Zeilenga Standards Track [Page 8] + +RFC 4505 Anonymous SASL Mechanism June 2006 + + +Full Copyright Statement + + Copyright (C) The Internet Society (2006). + + This document is subject to the rights, licenses and restrictions + contained in BCP 78, and except as set forth therein, the authors + retain all their rights. + + This document and the information contained herein are provided on an + "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS + OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET + ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE + INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Intellectual Property + + The IETF takes no position regarding the validity or scope of any + Intellectual Property Rights or other rights that might be claimed to + pertain to the implementation or use of the technology described in + this document or the extent to which any license under such rights + might or might not be available; nor does it represent that it has + made any independent effort to identify any such rights. Information + on the procedures with respect to rights in RFC documents can be + found in BCP 78 and BCP 79. + + Copies of IPR disclosures made to the IETF Secretariat and any + assurances of licenses to be made available, or the result of an + attempt made to obtain a general license or permission for the use of + such proprietary rights by implementers or users of this + specification can be obtained from the IETF on-line IPR repository at + http://www.ietf.org/ipr. + + The IETF invites any interested party to bring to its attention any + copyrights, patents or patent applications, or other proprietary + rights that may cover technology that may be required to implement + this standard. Please address the information to the IETF at + ietf-ipr@ietf.org. + +Acknowledgement + + Funding for the RFC Editor function is provided by the IETF + Administrative Support Activity (IASA). + + + + + + + +Zeilenga Standards Track [Page 9] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4616.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4616.txt new file mode 100644 index 0000000..991189d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4616.txt @@ -0,0 +1,619 @@ + + + + + + +Network Working Group K. Zeilenga, Ed. +Request for Comments: 4616 OpenLDAP Foundation +Updates: 2595 August 2006 +Category: Standards Track + + + The PLAIN Simple Authentication and Security Layer (SASL) Mechanism + +Status of This Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The Internet Society (2006). + +Abstract + + This document defines a simple clear-text user/password Simple + Authentication and Security Layer (SASL) mechanism called the PLAIN + mechanism. The PLAIN mechanism is intended to be used, in + combination with data confidentiality services provided by a lower + layer, in protocols that lack a simple password authentication + command. + + + + + + + + + + + + + + + + + + + + + + + +Zeilenga Standards Track [Page 1] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + +1. Introduction + + Clear-text, multiple-use passwords are simple, interoperate with + almost all existing operating system authentication databases, and + are useful for a smooth transition to a more secure password-based + authentication mechanism. The drawback is that they are unacceptable + for use over network connections where data confidentiality is not + ensured. + + This document defines the PLAIN Simple Authentication and Security + Layer ([SASL]) mechanism for use in protocols with no clear-text + login command (e.g., [ACAP] or [SMTP-AUTH]). This document updates + RFC 2595, replacing Section 6. Changes since RFC 2595 are detailed + in Appendix A. + + The name associated with this mechanism is "PLAIN". + + The PLAIN SASL mechanism does not provide a security layer. + + The PLAIN mechanism should not be used without adequate data security + protection as this mechanism affords no integrity or confidentiality + protections itself. The mechanism is intended to be used with data + security protections provided by application-layer protocol, + generally through its use of Transport Layer Security ([TLS]) + services. + + By default, implementations SHOULD advertise and make use of the + PLAIN mechanism only when adequate data security services are in + place. Specifications for IETF protocols that indicate that this + mechanism is an applicable authentication mechanism MUST mandate that + implementations support an strong data security service, such as TLS. + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in [Keywords]. + +2. PLAIN SASL Mechanism + + The mechanism consists of a single message, a string of [UTF-8] + encoded [Unicode] characters, from the client to the server. The + client presents the authorization identity (identity to act as), + followed by a NUL (U+0000) character, followed by the authentication + identity (identity whose password will be used), followed by a NUL + (U+0000) character, followed by the clear-text password. As with + other SASL mechanisms, the client does not provide an authorization + identity when it wishes the server to derive an identity from the + credentials and use that as the authorization identity. + + + + +Zeilenga Standards Track [Page 2] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + + The formal grammar for the client message using Augmented BNF [ABNF] + follows. + + message = [authzid] UTF8NUL authcid UTF8NUL passwd + authcid = 1*SAFE ; MUST accept up to 255 octets + authzid = 1*SAFE ; MUST accept up to 255 octets + passwd = 1*SAFE ; MUST accept up to 255 octets + UTF8NUL = %x00 ; UTF-8 encoded NUL character + + SAFE = UTF1 / UTF2 / UTF3 / UTF4 + ;; any UTF-8 encoded Unicode character except NUL + + UTF1 = %x01-7F ;; except NUL + UTF2 = %xC2-DF UTF0 + UTF3 = %xE0 %xA0-BF UTF0 / %xE1-EC 2(UTF0) / + %xED %x80-9F UTF0 / %xEE-EF 2(UTF0) + UTF4 = %xF0 %x90-BF 2(UTF0) / %xF1-F3 3(UTF0) / + %xF4 %x80-8F 2(UTF0) + UTF0 = %x80-BF + + The authorization identity (authzid), authentication identity + (authcid), password (passwd), and NUL character deliminators SHALL be + transferred as [UTF-8] encoded strings of [Unicode] characters. As + the NUL (U+0000) character is used as a deliminator, the NUL (U+0000) + character MUST NOT appear in authzid, authcid, or passwd productions. + + The form of the authzid production is specific to the application- + level protocol's SASL profile [SASL]. The authcid and passwd + productions are form-free. Use of non-visible characters or + characters that a user may be unable to enter on some keyboards is + discouraged. + + Servers MUST be capable of accepting authzid, authcid, and passwd + productions up to and including 255 octets. It is noted that the + UTF-8 encoding of a Unicode character may be as long as 4 octets. + + Upon receipt of the message, the server will verify the presented (in + the message) authentication identity (authcid) and password (passwd) + with the system authentication database, and it will verify that the + authentication credentials permit the client to act as the (presented + or derived) authorization identity (authzid). If both steps succeed, + the user is authenticated. + + The presented authentication identity and password strings, as well + as the database authentication identity and password strings, are to + be prepared before being used in the verification process. The + [SASLPrep] profile of the [StringPrep] algorithm is the RECOMMENDED + preparation algorithm. The SASLprep preparation algorithm is + + + +Zeilenga Standards Track [Page 3] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + + recommended to improve the likelihood that comparisons behave in an + expected manner. The SASLprep preparation algorithm is not mandatory + so as to allow the server to employ other preparation algorithms + (including none) when appropriate. For instance, use of a different + preparation algorithm may be necessary for the server to interoperate + with an external system. + + When preparing the presented strings using [SASLPrep], the presented + strings are to be treated as "query" strings (Section 7 of + [StringPrep]) and hence unassigned code points are allowed to appear + in their prepared output. When preparing the database strings using + [SASLPrep], the database strings are to be treated as "stored" + strings (Section 7 of [StringPrep]) and hence unassigned code points + are prohibited from appearing in their prepared output. + + Regardless of the preparation algorithm used, if the output of a + non-invertible function (e.g., hash) of the expected string is + stored, the string MUST be prepared before input to that function. + + Regardless of the preparation algorithm used, if preparation fails or + results in an empty string, verification SHALL fail. + + When no authorization identity is provided, the server derives an + authorization identity from the prepared representation of the + provided authentication identity string. This ensures that the + derivation of different representations of the authentication + identity produces the same authorization identity. + + The server MAY use the credentials to initialize any new + authentication database, such as one suitable for [CRAM-MD5] or + [DIGEST-MD5]. + +3. Pseudo-Code + + This section provides pseudo-code illustrating the verification + process (using hashed passwords and the SASLprep preparation + function) discussed above. This section is not definitive. + + boolean Verify(string authzid, string authcid, string passwd) { + string pAuthcid = SASLprep(authcid, true); # prepare authcid + string pPasswd = SASLprep(passwd, true); # prepare passwd + if (pAuthcid == NULL || pPasswd == NULL) { + return false; # preparation failed + } + if (pAuthcid == "" || pPasswd == "") { + return false; # empty prepared string + } + + + + +Zeilenga Standards Track [Page 4] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + + storedHash = FetchPasswordHash(pAuthcid); + if (storedHash == NULL || storedHash == "") { + return false; # error or unknown authcid + } + + if (!Compare(storedHash, Hash(pPasswd))) { + return false; # incorrect password + } + + if (authzid == NULL ) { + authzid = DeriveAuthzid(pAuthcid); + if (authzid == NULL || authzid == "") { + return false; # could not derive authzid + } + } + + if (!Authorize(pAuthcid, authzid)) { + return false; # not authorized + } + + return true; + } + + The second parameter of the SASLprep function, when true, indicates + that unassigned code points are allowed in the input. When the + SASLprep function is called to prepare the password prior to + computing the stored hash, the second parameter would be false. + + The second parameter provided to the Authorize function is not + prepared by this code. The application-level SASL profile should be + consulted to determine what, if any, preparation is necessary. + + Note that the DeriveAuthzid and Authorize functions (whether + implemented as one function or two, whether designed in a manner in + which these functions or whether the mechanism implementation can be + reused elsewhere) require knowledge and understanding of mechanism + and the application-level protocol specification and/or + implementation details to implement. + + Note that the Authorize function outcome is clearly dependent on + details of the local authorization model and policy. Both functions + may be dependent on other factors as well. + + + + + + + + + +Zeilenga Standards Track [Page 5] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + +4. Examples + + This section provides examples of PLAIN authentication exchanges. + The examples are intended to help the readers understand the above + text. The examples are not definitive. + + "C:" and "S:" indicate lines sent by the client and server, + respectively. "" represents a single NUL (U+0000) character. + The Application Configuration Access Protocol ([ACAP]) is used in the + examples. + + The first example shows how the PLAIN mechanism might be used for + user authentication. + + S: * ACAP (SASL "CRAM-MD5") (STARTTLS) + C: a001 STARTTLS + S: a001 OK "Begin TLS negotiation now" + + S: * ACAP (SASL "CRAM-MD5" "PLAIN") + C: a002 AUTHENTICATE "PLAIN" + S: + "" + C: {21} + C: timtanstaaftanstaaf + S: a002 OK "Authenticated" + + The second example shows how the PLAIN mechanism might be used to + attempt to assume the identity of another user. In this example, the + server rejects the request. Also, this example makes use of the + protocol optional initial response capability to eliminate a round- + trip. + + S: * ACAP (SASL "CRAM-MD5") (STARTTLS) + C: a001 STARTTLS + S: a001 OK "Begin TLS negotiation now" + + S: * ACAP (SASL "CRAM-MD5" "PLAIN") + C: a002 AUTHENTICATE "PLAIN" {20+} + C: UrselKurtxipj3plmq + S: a002 NO "Not authorized to requested authorization identity" + +5. Security Considerations + + As the PLAIN mechanism itself provided no integrity or + confidentiality protections, it should not be used without adequate + external data security protection, such as TLS services provided by + many application-layer protocols. By default, implementations SHOULD + NOT advertise and SHOULD NOT make use of the PLAIN mechanism unless + adequate data security services are in place. + + + +Zeilenga Standards Track [Page 6] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + + When the PLAIN mechanism is used, the server gains the ability to + impersonate the user to all services with the same password + regardless of any encryption provided by TLS or other confidentiality + protection mechanisms. Whereas many other authentication mechanisms + have similar weaknesses, stronger SASL mechanisms address this issue. + Clients are encouraged to have an operational mode where all + mechanisms that are likely to reveal the user's password to the + server are disabled. + + General [SASL] security considerations apply to this mechanism. + + Unicode, [UTF-8], and [StringPrep] security considerations also + apply. + +6. IANA Considerations + + The SASL Mechanism registry [IANA-SASL] entry for the PLAIN mechanism + has been updated by the IANA to reflect that this document now + provides its technical specification. + + To: iana@iana.org + Subject: Updated Registration of SASL mechanism PLAIN + + SASL mechanism name: PLAIN + Security considerations: See RFC 4616. + Published specification (optional, recommended): RFC 4616 + Person & email address to contact for further information: + Kurt Zeilenga + IETF SASL WG + Intended usage: COMMON + Author/Change controller: IESG + Note: Updates existing entry for PLAIN + +7. Acknowledgements + + This document is a revision of RFC 2595 by Chris Newman. Portions of + the grammar defined in Section 2 were borrowed from [UTF-8] by + Francois Yergeau. + + This document is a product of the IETF Simple Authentication and + Security Layer (SASL) Working Group. + + + + + + + + + + +Zeilenga Standards Track [Page 7] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + +8. Normative References + + [ABNF] Crocker, D., Ed. and P. Overell, "Augmented BNF for + Syntax Specifications: ABNF", RFC 4234, October 2005. + + [Keywords] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119, March 1997. + + [SASL] Melnikov, A., Ed., and K. Zeilenga, Ed., "Simple + Authentication and Security Layer (SASL)", RFC 4422, + June 2006. + + [SASLPrep] Zeilenga, K., "SASLprep: Stringprep Profile for User + Names and Passwords", RFC 4013, February 2005. + + [StringPrep] Hoffman, P. and M. Blanchet, "Preparation of + Internationalized Strings ("stringprep")", RFC 3454, + December 2002. + + [Unicode] The Unicode Consortium, "The Unicode Standard, Version + 3.2.0" is defined by "The Unicode Standard, Version + 3.0" (Reading, MA, Addison-Wesley, 2000. ISBN 0-201- + 61633-5), as amended by the "Unicode Standard Annex + #27: Unicode 3.1" + (http://www.unicode.org/reports/tr27/) and by the + "Unicode Standard Annex #28: Unicode 3.2" + (http://www.unicode.org/reports/tr28/). + + [UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO + 10646", STD 63, RFC 3629, November 2003. + + [TLS] Dierks, T. and E. Rescorla, "The Transport Layer + Security (TLS) Protocol Version 1.1", RFC 4346, April + 2006. + +9. Informative References + + [ACAP] Newman, C. and J. Myers, "ACAP -- Application + Configuration Access Protocol", RFC 2244, November + 1997. + + [CRAM-MD5] Nerenberg, L., Ed., "The CRAM-MD5 SASL Mechanism", Work + in Progress, June 2006. + + [DIGEST-MD5] Melnikov, A., Ed., "Using Digest Authentication as a + SASL Mechanism", Work in Progress, June 2006. + + + + + +Zeilenga Standards Track [Page 8] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + + [IANA-SASL] IANA, "SIMPLE AUTHENTICATION AND SECURITY LAYER (SASL) + MECHANISMS", + . + + [SMTP-AUTH] Myers, J., "SMTP Service Extension for Authentication", + RFC 2554, March 1999. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Zeilenga Standards Track [Page 9] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + +Appendix A. Changes since RFC 2595 + + This appendix is non-normative. + + This document replaces Section 6 of RFC 2595. + + The specification details how the server is to compare client- + provided character strings with stored character strings. + + The ABNF grammar was updated. In particular, the grammar now allows + LINE FEED (U+000A) and CARRIAGE RETURN (U+000D) characters in the + authzid, authcid, passwd productions. However, whether these control + characters may be used depends on the string preparation rules + applicable to the production. For passwd and authcid productions, + control characters are prohibited. For authzid, one must consult the + application-level SASL profile. This change allows PLAIN to carry + all possible authorization identity strings allowed in SASL. + + Pseudo-code was added. + + The example section was expanded to illustrate more features of the + PLAIN mechanism. + +Editor's Address + + Kurt D. Zeilenga + OpenLDAP Foundation + + EMail: Kurt@OpenLDAP.org + + + + + + + + + + + + + + + + + + + + + + +Zeilenga Standards Track [Page 10] + +RFC 4616 The PLAIN SASL Mechanism August 2006 + + +Full Copyright Statement + + Copyright (C) The Internet Society (2006). + + This document is subject to the rights, licenses and restrictions + contained in BCP 78, and except as set forth therein, the authors + retain all their rights. + + This document and the information contained herein are provided on an + "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS + OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET + ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, + INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE + INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Intellectual Property + + The IETF takes no position regarding the validity or scope of any + Intellectual Property Rights or other rights that might be claimed to + pertain to the implementation or use of the technology described in + this document or the extent to which any license under such rights + might or might not be available; nor does it represent that it has + made any independent effort to identify any such rights. Information + on the procedures with respect to rights in RFC documents can be + found in BCP 78 and BCP 79. + + Copies of IPR disclosures made to the IETF Secretariat and any + assurances of licenses to be made available, or the result of an + attempt made to obtain a general license or permission for the use of + such proprietary rights by implementers or users of this + specification can be obtained from the IETF on-line IPR repository at + http://www.ietf.org/ipr. + + The IETF invites any interested party to bring to its attention any + copyrights, patents or patent applications, or other proprietary + rights that may cover technology that may be required to implement + this standard. Please address the information to the IETF at + ietf-ipr@ietf.org. + +Acknowledgement + + Funding for the RFC Editor function is provided by the IETF + Administrative Support Activity (IASA). + + + + + + + +Zeilenga Standards Track [Page 11] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4954.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4954.txt new file mode 100644 index 0000000..668d738 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/rfc4954.txt @@ -0,0 +1,1123 @@ + + + + + + +Network Working Group R. Siemborski, Ed. +Request for Comments: 4954 Google, Inc. +Obsoletes: 2554 A. Melnikov, Ed. +Updates: 3463 Isode Limited +Category: Standards Track July 2007 + + + SMTP Service Extension for Authentication + +Status of This Memo + + This document specifies an Internet standards track protocol for the + Internet community, and requests discussion and suggestions for + improvements. Please refer to the current edition of the "Internet + Official Protocol Standards" (STD 1) for the standardization state + and status of this protocol. Distribution of this memo is unlimited. + +Copyright Notice + + Copyright (C) The IETF Trust (2007). + +Abstract + + This document defines a Simple Mail Transport Protocol (SMTP) + extension whereby an SMTP client may indicate an authentication + mechanism to the server, perform an authentication protocol exchange, + and optionally negotiate a security layer for subsequent protocol + interactions during this session. This extension includes a profile + of the Simple Authentication and Security Layer (SASL) for SMTP. + + This document obsoletes RFC 2554. + + + + + + + + + + + + + + + + + + + + +Siemborski & Melnikov Standards Track [Page 1] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + +Table of Contents + + 1. Introduction ....................................................2 + 2. How to Read This Document .......................................2 + 3. The Authentication Service Extension ............................3 + 4. The AUTH Command ................................................3 + 4.1. Examples ...................................................7 + 5. The AUTH Parameter to the MAIL FROM command .....................9 + 5.1. Examples ..................................................10 + 6. Status Codes ...................................................11 + 7. Additional requirements on servers .............................12 + 8. Formal Syntax ..................................................13 + 9. Security Considerations ........................................14 + 10. IANA Considerations ...........................................15 + 11. Normative References ..........................................15 + 12. Informative References ........................................16 + 13. Acknowledgments ...............................................17 + 14. Additional Requirements When Using SASL PLAIN over TLS ........17 + 15. Changes since RFC 2554 ........................................18 + +1. Introduction + + This document defines a Simple Mail Transport Protocol (SMTP) + extension whereby an SMTP client may indicate an authentication + mechanism to the server, perform an authentication protocol exchange, + optionally negotiate a security layer for subsequent protocol + interactions during this session and, during a mail transaction, + optionally specify a mailbox associated with the identity that + submitted the message to the mail delivery system. + + This extension includes a profile of the Simple Authentication and + Security Layer (SASL) for SMTP. + + When compared to RFC 2554, this document deprecates use of the 538 + response code, adds a new Enhanced Status Code, adds a requirement to + support SASLprep profile for preparing authorization identities, + recommends use of RFC 3848 transmission types in the Received trace + header field, and clarifies interaction with SMTP PIPELINING + [PIPELINING] extension. + +2. How to Read This Document + + The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", + "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this + document are to be interpreted as described in [KEYWORDS]. + + In examples, "C:" and "S:" indicate lines sent by the client and + server, respectively. + + + +Siemborski & Melnikov Standards Track [Page 2] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + +3. The Authentication Service Extension + + 1. The name of this [SMTP] service extension is "Authentication". + + 2. The EHLO keyword value associated with this extension is "AUTH". + + 3. The AUTH EHLO keyword contains as a parameter a space-separated + list of the names of available [SASL] mechanisms. The list of + available mechanisms MAY change after a successful STARTTLS + command [SMTP-TLS]. + + 4. A new [SMTP] verb "AUTH" is defined. + + 5. An optional parameter using the keyword "AUTH" is added to the + MAIL FROM command, and extends the maximum line length of the + MAIL FROM command by 500 characters. + + 6. This extension is appropriate for the submission protocol + [SUBMIT]. + +4. The AUTH Command + + AUTH mechanism [initial-response] + + Arguments: + mechanism: A string identifying a [SASL] authentication + mechanism. + + initial-response: An optional initial client response. If + present, this response MUST be encoded as described in Section + 4 of [BASE64] or contain a single character "=". + + Restrictions: + After an AUTH command has been successfully completed, no more + AUTH commands may be issued in the same session. After a + successful AUTH command completes, a server MUST reject any + further AUTH commands with a 503 reply. + + The AUTH command is not permitted during a mail transaction. + An AUTH command issued during a mail transaction MUST be + rejected with a 503 reply. + + Discussion: + The AUTH command initiates a [SASL] authentication exchange + between the client and the server. The client identifies the + SASL mechanism to use with the first parameter of the AUTH + command. If the server supports the requested authentication + mechanism, it performs the SASL exchange to authenticate the + + + +Siemborski & Melnikov Standards Track [Page 3] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + user. Optionally, it also negotiates a security layer for + subsequent protocol interactions during this session. If the + requested authentication mechanism is invalid (e.g., is not + supported or requires an encryption layer), the server rejects + the AUTH command with a 504 reply. If the server supports the + [ESMTP-CODES] extension, it SHOULD return a 5.5.4 enhanced + response code. + + The SASL authentication exchange consists of a series of + server challenges and client responses that are specific to + the chosen [SASL] mechanism. + + A server challenge is sent as a 334 reply with the text part + containing the [BASE64] encoded string supplied by the SASL + mechanism. This challenge MUST NOT contain any text other + than the BASE64 encoded challenge. + + A client response consists of a line containing a [BASE64] + encoded string. If the client wishes to cancel the + authentication exchange, it issues a line with a single "*". + If the server receives such a response, it MUST reject the + AUTH command by sending a 501 reply. + + The optional initial response argument to the AUTH command is + used to save a round-trip when using authentication mechanisms + that support an initial client response. If the initial + response argument is omitted and the chosen mechanism requires + an initial client response, the server MUST proceed as defined + in Section 5.1 of [SASL]. In SMTP, a server challenge that + contains no data is defined as a 334 reply with no text part. + Note that there is still a space following the reply code, so + the complete response line is "334 ". + + Note that the AUTH command is still subject to the line length + limitations defined in [SMTP]. If use of the initial response + argument would cause the AUTH command to exceed this length, + the client MUST NOT use the initial response parameter (and + instead proceed as defined in Section 5.1 of [SASL]). + + If the client is transmitting an initial response of zero + length, it MUST instead transmit the response as a single + equals sign ("="). This indicates that the response is + present, but contains no data. + + If the client uses an initial-response argument to the AUTH + command with a SASL mechanism in which the client does not + begin the authentication exchange, the server MUST reject the + + + + +Siemborski & Melnikov Standards Track [Page 4] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + AUTH command with a 501 reply. Servers using the enhanced + status codes extension [ESMTP-CODES] SHOULD return an enhanced + status code of 5.7.0 in this case. + + If the server cannot [BASE64] decode any client response, it + MUST reject the AUTH command with a 501 reply (and an enhanced + status code of 5.5.2). If the client cannot BASE64 decode any + of the server's challenges, it MUST cancel the authentication + using the "*" response. In particular, servers and clients + MUST reject (and not ignore) any character not explicitly + allowed by the BASE64 alphabet, and MUST reject any sequence + of BASE64 characters that contains the pad character ('=') + anywhere other than the end of the string (e.g., "=AAA" and + "AAA=BBB" are not allowed). + + Note that these [BASE64] strings can be much longer than + normal SMTP commands. Clients and servers MUST be able to + handle the maximum encoded size of challenges and responses + generated by their supported authentication mechanisms. This + requirement is independent of any line length limitations the + client or server may have in other parts of its protocol + implementation. (At the time of writing of this document, + 12288 octets is considered to be a sufficient line length + limit for handling of deployed authentication mechanisms.) + If, during an authentication exchange, the server receives a + line that is longer than the server's authentication buffer, + the server fails the AUTH command with the 500 reply. Servers + using the enhanced status codes extension [ESMTP-CODES] SHOULD + return an enhanced status code of 5.5.6 in this case. + + The authorization identity generated by this [SASL] exchange + is a "simple username" (in the sense defined in [SASLprep]), + and both client and server SHOULD (*) use the [SASLprep] + profile of the [StringPrep] algorithm to prepare these names + for transmission or comparison. If preparation of the + authorization identity fails or results in an empty string + (unless it was transmitted as the empty string), the server + MUST fail the authentication. + + (*) Note: Future revision of this specification may change this + requirement to MUST. Currently, the SHOULD is used in order to + avoid breaking the majority of existing implementations. + + If the server is unable to authenticate the client, it SHOULD reject + the AUTH command with a 535 reply unless a more specific error code + is appropriate. Should the client successfully complete the + exchange, the SMTP server issues a 235 reply. (Note that the SMTP + protocol doesn't support the SASL feature of returning additional + + + +Siemborski & Melnikov Standards Track [Page 5] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + data with a successful outcome.) These status codes, along with + others defined by this extension, are discussed in Section 6 of this + document. + + If a security layer is negotiated during the SASL exchange, it takes + effect for the client on the octet immediately following the CRLF + that concludes the last response generated by the client. For the + server, it takes effect immediately following the CRLF of its success + reply. + + When a security layer takes effect, the SMTP protocol is reset to the + initial state (the state in SMTP after a server issues a 220 service + ready greeting). The server MUST discard any knowledge obtained from + the client, such as the EHLO argument, which was not obtained from + the SASL negotiation itself. Likewise, the client MUST discard any + knowledge obtained from the server, such as the list of SMTP service + extensions, which was not obtained from the SASL negotiation itself. + (Note that a client MAY compare the advertised SASL mechanisms before + and after authentication in order to detect an active down- + negotiation attack). + + The client SHOULD send an EHLO command as the first command after a + successful SASL negotiation that results in the enabling of a + security layer. + + When an entity (whether it is the client or the server end) is + sending data, and both [TLS] and SASL security layers are in effect, + the TLS encoding MUST be applied after the SASL encoding, regardless + of the order in which the layers were negotiated. + + The service name specified by this protocol's profile of SASL is + "smtp". This service name is also to be used for the [SUBMIT] + protocol. + + If an AUTH command fails, the client MAY proceed without + authentication. Alternatively, the client MAY try another + authentication mechanism or present different credentials by issuing + another AUTH + + Note: A server implementation MUST implement a configuration in which + it does NOT permit any plaintext password mechanisms, unless either + the STARTTLS [SMTP-TLS] command has been negotiated or some other + mechanism that protects the session from password snooping has been + provided. Server sites SHOULD NOT use any configuration which + permits a plaintext password mechanism without such a protection + mechanism against password snooping. + + + + + +Siemborski & Melnikov Standards Track [Page 6] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + To ensure interoperability, client and server implementations of this + extension MUST implement the [PLAIN] SASL mechanism running over TLS + [TLS] [SMTP-TLS]. See also Section 15 for additional requirements on + implementations of [PLAIN] over [TLS]. + + Note that many existing client and server implementations implement + CRAM-MD5 [CRAM-MD5] SASL mechanism. In order to ensure + interoperability with deployed software, new implementations MAY + implement it; however, implementations should be aware that this SASL + mechanism doesn't provide any server authentication. Note that at + the time of writing of this document the SASL Working Group is + working on several replacement SASL mechanisms that provide server + authentication and other features. + + When the AUTH command is used together with the [PIPELINING] + extension, it MUST be the last command in a pipelined group of + commands. The only exception to this rule is when the AUTH command + contains an initial response for a SASL mechanism that allows the + client to send data first, the SASL mechanism is known to complete in + one round-trip, and a security layer is not negotiated by the client. + Two examples of such SASL mechanisms are PLAIN [PLAIN] and EXTERNAL + [SASL]. + +4.1. Examples + + Here is an example of a client attempting AUTH using the [PLAIN] SASL + mechanism under a TLS layer, and making use of the initial client + response: + + S: 220-smtp.example.com ESMTP Server + C: EHLO client.example.com + S: 250-smtp.example.com Hello client.example.com + S: 250-AUTH GSSAPI DIGEST-MD5 + S: 250-ENHANCEDSTATUSCODES + S: 250 STARTTLS + C: STARTTLS + S: 220 Ready to start TLS + ... TLS negotiation proceeds, further commands + protected by TLS layer ... + C: EHLO client.example.com + S: 250-smtp.example.com Hello client.example.com + S: 250 AUTH GSSAPI DIGEST-MD5 PLAIN + C: AUTH PLAIN dGVzdAB0ZXN0ADEyMzQ= + S: 235 2.7.0 Authentication successful + + Here is another client that is attempting AUTH PLAIN under a TLS + layer, this time without the initial response. Parts of the + negotiation before the TLS layer was established have been omitted: + + + +Siemborski & Melnikov Standards Track [Page 7] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + ... TLS negotiation proceeds, further commands + protected by TLS layer ... + C: EHLO client.example.com + S: 250-smtp.example.com Hello client.example.com + S: 250 AUTH GSSAPI DIGEST-MD5 PLAIN + C: AUTH PLAIN + (note: there is a single space following the 334 + on the following line) + S: 334 + C: dGVzdAB0ZXN0ADEyMzQ= + S: 235 2.7.0 Authentication successful + + Here is an example using CRAM-MD5 [CRAM-MD5], a mechanism in which + the client does not begin the authentication exchange, and includes a + server challenge: + + S: 220-smtp.example.com ESMTP Server + C: EHLO client.example.com + S: 250-smtp.example.com Hello client.example.com + S: 250-AUTH DIGEST-MD5 CRAM-MD5 + S: 250-ENHANCEDSTATUSCODES + S: 250 STARTTLS + C: AUTH CRAM-MD5 + S: 334 PDQxOTI5NDIzNDEuMTI4Mjg0NzJAc291cmNlZm91ci5hbmRyZXcuY211LmVk + dT4= + C: cmpzMyBlYzNhNTlmZWQzOTVhYmExZWM2MzY3YzRmNGI0MWFjMA== + S: 235 2.7.0 Authentication successful + + Here is an example of a client attempting AUTH EXTERNAL under TLS, + using the derived authorization ID (and thus a zero-length initial + client response). + + S: 220-smtp.example.com ESMTP Server + C: EHLO client.example.com + S: 250-smtp.example.com Hello client.example.com + S: 250-AUTH GSSAPI DIGEST-MD5 + S: 250-ENHANCEDSTATUSCODES + S: 250 STARTTLS + C: STARTTLS + S: 220 Ready to start TLS + ... TLS negotiation proceeds, further commands + protected by TLS layer ... + C: EHLO client.example.com + S: 250-smtp.example.com Hello client.example.com + S: 250 AUTH EXTERNAL GSSAPI DIGEST-MD5 PLAIN + C: AUTH EXTERNAL = + S: 235 2.7.0 Authentication successful + + + + +Siemborski & Melnikov Standards Track [Page 8] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + +5. The AUTH Parameter to the MAIL FROM command + + AUTH=mailbox + + Arguments: + A (see Section 4.1.2 of [SMTP]) that is associated + with the identity that submitted the message to the delivery + system, or the two character sequence "<>" indicating such an + identity is unknown or insufficiently authenticated. To comply + with restrictions imposed on ESMTP parameters, the is + encoded inside an xtext. The syntax of an xtext is described in + Section 4 of [ESMTP-DSN]. + + Note: + For the purposes of this discussion, "authenticated identity" + refers to the identity (if any) derived from the authorization + identity of previous AUTH command, while the terms "authorized + identity" and "supplied " refer to the sender identity + that is being associated with a particular message. Note that + one authenticated identity may be able to identify messages as + being sent by any number of authorized identities within a + single session. For example, this may be the case when an SMTP + server (one authenticated identity) is processing its queue + (many messages with distinct authorized identities). + + Discussion: + The optional AUTH parameter to the MAIL FROM command allows + cooperating agents in a trusted environment to communicate the + authorization identity associated with individual messages. + + If the server trusts the authenticated identity of the client to + assert that the message was originally submitted by the supplied + , then the server SHOULD supply the same in + an AUTH parameter when relaying the message to any other server + which supports the AUTH extension. + + For this reason, servers that advertise support for this + extension MUST support the AUTH parameter to the MAIL FROM + command even when the client has not authenticated itself to the + server. + + A MAIL FROM parameter of AUTH=<> indicates that the original + submitter of the message is not known. The server MUST NOT + treat the message as having been originally submitted by the + authenticated identity that resulted from the AUTH command. + + + + + + +Siemborski & Melnikov Standards Track [Page 9] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + If the AUTH parameter to the MAIL FROM command is not supplied, + the client has authenticated, and the server believes the + message is an original submission, the server MAY generate a + from the user's authenticated identity for use in an + AUTH parameter when relaying the message to any server which + supports the AUTH extension. The generated is + implementation specific, but it MUST conform to the syntax of + [SMTP]. If the implementation cannot generate a valid + , it MUST transmit AUTH=<> when relaying this message. + + If the server does not sufficiently trust the authenticated + identity of the client, or if the client is not authenticated, + then the server MUST behave as if the AUTH=<> parameter was + supplied. The server MAY, however, write the value of any + supplied AUTH parameter to a log file. + + If an AUTH=<> parameter was supplied, either explicitly or due + to the requirement in the previous paragraph, then the server + MUST supply the AUTH=<> parameter when relaying the message to + any server which it has authenticated to using the AUTH + extension. + + A server MAY treat expansion of a mailing list as a new + submission, setting the AUTH parameter to the mailing list + address or mailing list administration address when relaying the + message to list subscribers. + + Note that an implementation which is hard-coded to treat all + clients as being insufficiently trusted is compliant with this + specification. In that case, the implementation does nothing + more than parse and discard syntactically valid AUTH parameters + to the MAIL FROM command, and supply AUTH=<> parameters to any + servers that it authenticates to. + +5.1. Examples + + An example where the original identity of the sender is trusted and + known: + + C: MAIL FROM: AUTH=e+3Dmc2@example.com + S: 250 OK + + One example where the identity of the sender is not trusted or is + otherwise being suppressed by the client: + + C: MAIL FROM: AUTH=<> + S: 250 OK + + + + +Siemborski & Melnikov Standards Track [Page 10] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + +6. Status Codes + + The following error codes may be used to indicate various success or + failure conditions. Servers that return enhanced status codes + [ESMTP-CODES] SHOULD use the enhanced codes suggested here. + + 235 2.7.0 Authentication Succeeded + + This response to the AUTH command indicates that the authentication + was successful. + + 432 4.7.12 A password transition is needed + + This response to the AUTH command indicates that the user needs to + transition to the selected authentication mechanism. This is + typically done by authenticating once using the [PLAIN] + authentication mechanism. The selected mechanism SHOULD then work + for authentications in subsequent sessions. + + 454 4.7.0 Temporary authentication failure + + This response to the AUTH command indicates that the authentication + failed due to a temporary server failure. The client SHOULD NOT + prompt the user for another password in this case, and should instead + notify the user of server failure. + + 534 5.7.9 Authentication mechanism is too weak + + This response to the AUTH command indicates that the selected + authentication mechanism is weaker than server policy permits for + that user. The client SHOULD retry with a new authentication + mechanism. + + 535 5.7.8 Authentication credentials invalid + + This response to the AUTH command indicates that the authentication + failed due to invalid or insufficient authentication credentials. In + this case, the client SHOULD ask the user to supply new credentials + (such as by presenting a password dialog box). + + 500 5.5.6 Authentication Exchange line is too long + + This response to the AUTH command indicates that the authentication + failed due to the client sending a [BASE64] response that is longer + than the maximum buffer size available for the currently selected + SASL mechanism. + + + + + +Siemborski & Melnikov Standards Track [Page 11] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + 530 5.7.0 Authentication required + + This response SHOULD be returned by any command other than AUTH, + EHLO, HELO, NOOP, RSET, or QUIT when server policy requires + authentication in order to perform the requested action and + authentication is not currently in force. + + 538 5.7.11 Encryption required for requested authentication + mechanism + + This response to the AUTH command indicates that the selected + authentication mechanism may only be used when the underlying SMTP + connection is encrypted. Note that this response code is documented + here for historical purposes only. Modern implementations SHOULD NOT + advertise mechanisms that are not permitted due to lack of + encryption, unless an encryption layer of sufficient strength is + currently being employed. + + This document adds several new enhanced status codes to the list + defined in [ENHANCED]: + + The following 3 Enhanced Status Codes were defined above: + + 5.7.8 Authentication credentials invalid + 5.7.9 Authentication mechanism is too weak + 5.7.11 Encryption required for requested authentication mechanism + + X.5.6 Authentication Exchange line is too long + + This enhanced status code SHOULD be returned when the server fails + the AUTH command due to the client sending a [BASE64] response which + is longer than the maximum buffer size available for the currently + selected SASL mechanism. This is useful for both permanent and + persistent transient errors. + +7. Additional Requirements on Servers + + As described in Section 4.4 of [SMTP], an SMTP server that receives a + message for delivery or further processing MUST insert the + "Received:" header field at the beginning of the message content. + This document places additional requirements on the content of a + generated "Received:" header field. Upon successful authentication, + a server SHOULD use the "ESMTPA" or the "ESMTPSA" [SMTP-TT] (when + appropriate) keyword in the "with" clause of the Received header + field. + + + + + + +Siemborski & Melnikov Standards Track [Page 12] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + +8. Formal Syntax + + The following syntax specification uses the Augmented Backus-Naur + Form notation as specified in [ABNF]. Non-terminals referenced but + not defined below are as defined by [ABNF] or [SASL]. The non- + terminal is defined in [SMTP]. + + Except as noted otherwise, all alphabetic characters are case- + insensitive. The use of upper or lower case characters to define + token strings is for editorial clarity only. Implementations MUST + accept these strings in a case-insensitive fashion. + + hexchar = "+" HEXDIG HEXDIG + + xchar = %x21-2A / %x2C-3C / %x3E-7E + ;; US-ASCII except for "+", "=", SP, and CTL + + xtext = *(xchar / hexchar) + ;; non-US-ASCII is only allowed as hexchar + + auth-command = "AUTH" SP sasl-mech [SP initial-response] + *(CRLF [base64]) [CRLF cancel-response] + CRLF + ;; is defined in [SASL] + + auth-param = "AUTH=" xtext + ;; Parameter to the MAIL FROM command. + ;; This non-terminal complies with + ;; syntax defined by esmtp-param [SMTP]. + ;; + ;; The decoded form of the xtext MUST be + ;; either a or the two + ;; characters "<>" + + base64 = base64-terminal / + ( 1*(4base64-char) [base64-terminal] ) + + base64-char = ALPHA / DIGIT / "+" / "/" + ;; Case-sensitive + + base64-terminal = (2base64-char "==") / (3base64-char "=") + + continue-req = "334" SP [base64] CRLF + ;; Intermediate response to the AUTH + ;; command. + ;; This non-terminal complies with + ;; syntax defined by Reply-line [SMTP]. + + + + +Siemborski & Melnikov Standards Track [Page 13] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + initial-response= base64 / "=" + + cancel-response = "*" + +9. Security Considerations + + Security issues are discussed throughout this memo. + + If a client uses this extension to get an encrypted tunnel through an + insecure network to a cooperating server, it needs to be configured + to never send mail to that server when the connection is not mutually + authenticated and encrypted. Otherwise, an attacker could steal the + client's mail by hijacking the [SMTP] connection and either + pretending the server does not support the Authentication extension + or causing all AUTH commands to fail. + + Before the [SASL] negotiation has begun, any protocol interactions + are performed in the clear and may be modified by an active attacker. + For this reason, clients and servers MUST discard any knowledge + obtained prior to the start of the SASL negotiation upon the + establishment of a security layer. + + This mechanism does not protect the TCP port, so an active attacker + may redirect a relay connection attempt (i.e., a connection between + two Mail Transfer Agents (MTAs)) to the submission port [SUBMIT]. + The AUTH=<> parameter prevents such an attack from causing a relayed + message and, in the absence of other envelope authentication, from + picking up the authentication of the relay client. + + A message submission client may require the user to authenticate + whenever a suitable [SASL] mechanism is advertised. Therefore, it + may not be desirable for a submission server [SUBMIT] to advertise a + SASL mechanism when use of that mechanism grants the clients no + benefits over anonymous submission. + + Servers MAY implement a policy whereby the connection is dropped + after a number of failed authentication attempts. If they do so, + they SHOULD NOT drop the connection until at least 3 attempts to + authenticate have failed. + + If an implementation supports SASL mechanisms that are vulnerable to + passive eavesdropping attacks (such as [PLAIN]), then the + implementation MUST support at least one configuration where these + SASL mechanisms are not advertised or used without the presence of an + external security layer such as [TLS]. + + + + + + +Siemborski & Melnikov Standards Track [Page 14] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + This extension is not intended to replace or be used instead of end- + to-end message signature and encryption systems such as [S/MIME] or + [PGP]. This extension addresses a different problem than end-to-end + systems; it has the following key differences: + + 1. It is generally useful only within a trusted enclave. + + 2. It protects the entire envelope of a message, not just the + message's body. + + 3. It authenticates the message submission, not authorship of the + message content. + + 4. When mutual authentication is used along with a security layer, + it can give the sender some assurance that the message was + successfully delivered to the next hop. + + Additional security considerations are mentioned in the [SASL] + specification. Additional security considerations specific to a + particular SASL mechanism are described in the relevant + specification. Additional security considerations for [PLAIN] over + [TLS] are mentioned in Section 15 of this document. + +10. IANA Considerations + + IANA updated the entry for the "smtp" SASL protocol name to point at + this document. + + IANA updated the registration of the Authentication SMTP service + extension as defined in Section 3 of this document. This registry is + currently located at . + +11. Normative References + + [ABNF] Crocker, D. and P. Overell, "Augmented BNF for Syntax + Specifications: ABNF", RFC 4234, October 2005. + + [BASE64] Josefsson, S., "The Base16, Base32, and Base64 Data + Encodings", RFC 4648, October 2006. + + [ESMTP-CODES] Freed, N., "SMTP Service Extension for Returning + Enhanced Error Codes", RFC 2034, October 1996. + + [ENHANCED] Vaudreuil, G., "Enhanced Mail System Status Codes", RFC + 3463, January 2003. + + + + + +Siemborski & Melnikov Standards Track [Page 15] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + [ESMTP-DSN] Moore, K., "Simple Mail Transfer Protocol (SMTP) + Service Extension Delivery Status Notifications + (DSNs)", RFC 3461, January 2003. + + [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate + Requirement Levels", BCP 14, RFC 2119, March 1997. + + [SASL] Melnikov, A. and K. Zeilenga, "Simple Authentication + and Security Layer (SASL)", RFC 4422, June 2006. + + [SASLprep] Zeilenga, K., "SASLprep: Stringprep Profile for User + Names and Passwords", RFC 4013, February 2005. + + [SMTP] Klensin, J., "Simple Mail Transfer Protocol", RFC 2821, + April 2001. + + [SMTP-TLS] Hoffman, P., "SMTP Service Extension for Secure SMTP + over Transport Layer Security", RFC 3207, February + 2002. + + [StringPrep] Hoffman, P. and M. Blanchet, "Preparation of + Internationalized Strings ("stringprep")", RFC 3454, + December 2002. + + [SUBMIT] Gellens, R. and J. Klensin, "Message Submission for + Mail", RFC 4409, April 2006. + + [SMTP-TT] Newman, C., "ESMTP and LMTP Transmission Types + Registration", RFC 3848, July 2004. + + [PLAIN] Zeilenga, K., Ed., "The PLAIN Simple Authentication and + Security Layer (SASL) Mechanism", RFC 4616, August + 2006. + + [X509] Housley, R., Polk, W., Ford, W., and D. Solo, "Internet + X.509 Public Key Infrastructure Certificate and + Certificate Revocation List (CRL) Profile", RFC 3280, + April 2002. + +12. Informative References + + [PGP] Elkins, M., "MIME Security with Pretty Good Privacy + (PGP)", RFC 2015, October 1996. + + [S/MIME] Ramsdell, B., Ed., "Secure/Multipurpose Internet Mail + Extensions (S/MIME) Version 3.1 Message Specification", + RFC 3851, July 2004. + + + + +Siemborski & Melnikov Standards Track [Page 16] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + [TLS] Dierks, T. and E. Rescorla, "The Transport Layer + Security (TLS) Protocol Version 1.1", RFC 4346, April + 2006. + + [PIPELINING] Freed, N., "SMTP Service Extension for Command + Pipelining", STD 60, RFC 2920, September 2000. + + [CRAM-MD5] Klensin, J., Catoe, R., and P. Krumviede, "IMAP/POP + AUTHorize Extension for Simple Challenge/Response", RFC + 2195, September 1997. + +13. Acknowledgments + + The editors would like to acknowledge the contributions of John Myers + and other contributors to RFC 2554, on which this document draws from + heavily. + + The editors would also like to thank Ken Murchison, Mark Crispin, + Chris Newman, David Wilson, Dave Cridland, Frank Ellermann, Ned + Freed, John Klensin, Tony Finch, Abhijit Menon-Sen, Philip Guenther, + Sam Hartman, Russ Housley, Cullen Jennings, and Lisa Dusseault for + the time they devoted to reviewing of this document and/or for the + comments received. + +14. Additional Requirements When Using SASL PLAIN over TLS + + This section is normative for SMTP implementations that support SASL + [PLAIN] over [TLS]. + + If an SMTP client is willing to use SASL PLAIN over TLS to + authenticate to the SMTP server, the client verifies the server + certificate according to the rules of [X509]. If the server has not + provided any certificate, or if the certificate verification fails, + the client MUST NOT attempt to authenticate using the SASL PLAIN + mechanism. + + After a successful [TLS] negotiation, the client MUST check its + understanding of the server hostname against the server's identity as + presented in the server Certificate message, in order to prevent + man-in-the-middle attacks. If the match fails, the client MUST NOT + attempt to authenticate using the SASL PLAIN mechanism. Matching is + performed according to the following rules: + + The client MUST use the server hostname it used to open the + connection as the value to compare against the server name as + expressed in the server certificate. The client MUST NOT use + + + + + +Siemborski & Melnikov Standards Track [Page 17] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + any form of the server hostname derived from an insecure remote + source (e.g., insecure DNS lookup). CNAME canonicalization is + not done. + + If a subjectAltName extension of type dNSName is present in the + certificate, it SHOULD be used as the source of the server's + identity. + + Matching is case-insensitive. + + A "*" wildcard character MAY be used as the leftmost name + component in the certificate. For example, *.example.com would + match a.example.com, foo.example.com, etc., but would not match + example.com. + + If the certificate contains multiple names (e.g., more than one + dNSName field), then a match with any one of the fields is + considered acceptable. + +15. Changes since RFC 2554 + + 1. Clarified that servers MUST support the use of the AUTH=mailbox + parameter to MAIL FROM, even when the client is not + authenticated. + + 2. Clarified the initial-client-send requirements, and give + additional examples. + + 3. Updated references to newer versions of various specifications. + + 4. Required SASL PLAIN (over TLS) as mandatory-to-implement. + + 5. Clarified that the mechanism list can change. + + 6. Deprecated the use of the 538 response code. + + 7. Added the use of the SASLprep profile for preparing authorization + identities. + + 8. Substantial cleanup of response codes and indicated suggested + enhanced response codes. Also indicated what response codes + should result in a client prompting the user for new credentials. + + 9. Updated ABNF section to use RFC 4234. + + 10. Clarified interaction with SMTP PIPELINING extension. + + 11. Added a reference to RFC 3848. + + + +Siemborski & Melnikov Standards Track [Page 18] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + + 12. Added a new Enhanced Status Code for "authentication line too + long" case. + + 13. Other general editorial clarifications. + +Editors' Addresses + + Robert Siemborski + Google, Inc. + 1600 Ampitheatre Parkway + Mountain View, CA 94043, USA + + Phone: +1 650 623 6925 + EMail: robsiemb@google.com + + + Alexey Melnikov + Isode Limited + 5 Castle Business Village, 36 Station Road, + Hampton, Middlesex, TW12 2BX, UK + + EMail: Alexey.Melnikov@isode.com + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Siemborski & Melnikov Standards Track [Page 19] + +RFC 4954 SMTP Service Extension for Authentication July 2007 + + +Full Copyright Statement + + Copyright (C) The IETF Trust (2007). + + This document is subject to the rights, licenses and restrictions + contained in BCP 78, and except as set forth therein, the authors + retain all their rights. + + This document and the information contained herein are provided on an + "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS + OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND + THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF + THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED + WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +Intellectual Property + + The IETF takes no position regarding the validity or scope of any + Intellectual Property Rights or other rights that might be claimed to + pertain to the implementation or use of the technology described in + this document or the extent to which any license under such rights + might or might not be available; nor does it represent that it has + made any independent effort to identify any such rights. Information + on the procedures with respect to rights in RFC documents can be + found in BCP 78 and BCP 79. + + Copies of IPR disclosures made to the IETF Secretariat and any + assurances of licenses to be made available, or the result of an + attempt made to obtain a general license or permission for the use of + such proprietary rights by implementers or users of this + specification can be obtained from the IETF on-line IPR repository at + http://www.ietf.org/ipr. + + The IETF invites any interested party to bring to its attention any + copyrights, patents or patent applications, or other proprietary + rights that may cover technology that may be required to implement + this standard. Please address the information to the IETF at + ietf-ipr@ietf.org. + +Acknowledgement + + Funding for the RFC Editor function is currently provided by the + Internet Society. + + + + + + + +Siemborski & Melnikov Standards Track [Page 20] + diff --git a/vendor/swiftmailer/swiftmailer/notes/rfc/whats_where.txt b/vendor/swiftmailer/swiftmailer/notes/rfc/whats_where.txt new file mode 100644 index 0000000..1470874 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/rfc/whats_where.txt @@ -0,0 +1,61 @@ +RFC 1854: +--------- +PIPELINING extension + +RFC 2222: +--------- +SASL + +RFC 4505: +--------- +ANYNONYMOUS SASL + +RFC 4616: +--------- +PLAIN SASL + +RFC 2487: +--------- +STARTTLS extension + +RFC 2554 & 4954: +---------------- +AUTH extension + +RFC 2821: +--------- +SMTP protocol + +RFC 2822: +--------- +General message structure (focusing on important headers) + +RFC 2045: +--------- +Quoted Printable Encoding +Base 64 Encoding +Detailed message structure + +RFC 2046: +--------- +Media types (for subparts) + +RFC 2047: +--------- +Header Encoding + +RFC 2183: +--------- +The Content-Disposition header + +RFC 2231: +--------- +Encoded Text header/attribute extensions + +RFC 2234: +--------- +ABNF definitions + +RFC 3676: +--------- +Flowed formatting/delsp parameters diff --git a/vendor/swiftmailer/swiftmailer/notes/smtp.txt b/vendor/swiftmailer/swiftmailer/notes/smtp.txt new file mode 100644 index 0000000..db73744 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/notes/smtp.txt @@ -0,0 +1,48 @@ +General Notes +-------------- + * MX is NOT required, but an A record, or CNAME to a MX MUST be present at the least. + * EHLO should be tried, then fall back to HELO + * The 250 return code from RCPT TO is not actually clear-cut. A 251 may be + returned if the message was forwarded to another address. This could be a + useful indicator to end-users that an address should be updated. + * RCPT TO can accpet just "postmaster" without a domain name + * Server MUST not close connection before: + - QUIT and returning 221 response + - Forced requirement, and only after returning a 421 response + - Clients expriencing a forced connection closure, without prior warning should + just treat it like a 451 closure regardless + * ALWAYS use blocking sockets for the initial connection (this should prevent + Exim4's whining about sync). + +Response codes +-------------- + * From RFC2821, 4.2. + - In particular, the 220, 221, 251, 421, and 551 reply codes + are associated with message text that must be parsed and interpreted + by machines. + +Error Codes +------------ + * Numeric 5yz = Error + - 550/RCPT TO = Relay denied + - 500 = Unknown command + * Numeric 2yz = Normal + * Numeric 4yz = Temporary failure?? + + + + Swift + pear.swiftmailer.org + Free Feature-rich PHP Mailer. + + Swift Mailer integrates into any web app written in PHP 5, offering a flexible and elegant object-oriented approach to sending emails with a multitude of features. + + + Fabien Potencier + fabpot + fabien.potencier@symfony-project.org + yes + + + Chris Corbyn + d11wtq + + no + + {{ date }} + + + {{ version }} + {{ api_version }} + + + {{ stability }} + {{ stability }} + + LGPL + - + + + + + + + + + + + + + + + + + + + + +{{ files }} + + + + + + + + + 5.2.4 + + + 1.4.0 + + + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/CHANGES b/vendor/swiftmailer/swiftmailer/test-suite/CHANGES new file mode 100644 index 0000000..6229a4c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/CHANGES @@ -0,0 +1,7 @@ +Sweety SimpleTest Front-end, Version 0.1 - beta +----------------------------------------------- + +17th November 2007, 0.1b: + Finished initial draft, giving up on dealing with invalid XML for now since + $test->dump() should be used for output where needed. Will address this again + later. diff --git a/vendor/swiftmailer/swiftmailer/test-suite/LICENSE b/vendor/swiftmailer/swiftmailer/test-suite/LICENSE new file mode 100644 index 0000000..fc8a5de --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/vendor/swiftmailer/swiftmailer/test-suite/README b/vendor/swiftmailer/swiftmailer/test-suite/README new file mode 100644 index 0000000..6348255 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/README @@ -0,0 +1,159 @@ +Sweety SimpleTest Suite +----------------------- + +Sweety is a wrapper around SimpleTest's XML reporting capabilities which +makes unit tests easier to manage and friendlier to run. + +Tests are run in a grouped fashion, but each individual test runs in its own +environment and own memory space either via forking new PHP processes, or by +making new HTTP requests. + +Sweety works with any vanilla version of SimpleTest since the XmlReporter was +added. + +Tests can be run on command line, in an AJAX equipped web browser*, or in a +web browser with javascript turned off. + + * Sweety has been tested with success in the following browsers: + + - Mozilla Firefox 2.0 + - Safari 3-beta + - Internet Explorer 7 + - Opera 9 + + +Configuring Sweety: +-------------------- + +All Sweety configuration is contained inside the config.php file, defined as +constants for the mostpart. + +Make sure you at least indicate a path to a directory containing SimpleTest, +and also change the SWEETY_INCLUDE_PATH and SWEETY_TEST_PATH to fit your needs. + +Paths are provided using the directory separator for your OS. Use the PHP +constant PATH_SEPARATOR if you need to run in different environments. + +If you have test cases in directories /webdev/tests/unit and +/webdev/tests/integration your SWEETY_TEST_PATH should look like: + +define('SWEETY_TEST_PATH', '/webdev/tests/unit' . PATH_SEPARATOR . + '/webdev/tests/integration'); + +If you want to run Sweety on the command line you'll need to specify the path +to your PHP executable (typically /usr/bin/php). Sweety needs to be able to +fork new processes using this executable. + + +What to do if your naming scheme doesn't use PEAR conventions: +-------------------------------------------------------------- + +By default Sweety looks for classes using PEAR naming conventions. If you use +some other naming convention you need to tell Sweety how to find your test cases. + +This is a two step process: + +1) Write a new Sweety_TestLocator -- don't worry, it's easy! + + Refer to the interface in lib/Sweety/TestLocator.php for guidance on what + your TestLocator needs to include (just two methods for searching and including). + +2) Add it to your config.php. + + Once you've written a new TestLocator which works for your naming scheme, + change the config value SWEETY_TEST_LOCATOR to the name of your new class, then + include the class file somewhere inside the config.php. If you use multiple class + naming conventions, list your TestLocators as a comma separated string. + + +Making tests appear in Sweety's interface: +------------------------------------------- + +No really, you just edit the configuration and they'll show up if a TestLocator +can find them ;) + + +Running sweety on the command line: +----------------------------------- + +Interacting with Sweety on the command line you'll get almost as much detail +as you do in a web browser, although the formatting obviously isn't so pretty! + +All operations are handled by the file named run.php in the sweety installation +directory. + + -bash$ php run.php #runs all tests + -bash$ php run.php Name_Of_TestClass #runs a single test case + -bash$ php run.php Name_Of_TestClass xml #runs a single test case in XML + + + +Runing Sweety with AJAX: +------------------------- + +Open up an AJAX equipped web browsers (preferably supporting DOM 3 XPath, but at +least support basic DOM). Navigate to the index.php file at the installation +directory of Sweety. You'll see the screen is divided into two sections, left +and right. On the left there's a list of test cases which you can click to run. +On the right you get all the verbose output from running the tests. + +Clicking the "Run Tests" button will run all tests you can currently see in +the list. As each test runs, a request is sent to the web server to get +SimpleTest to run your test case. If the test passes the test case will turn +green, if it fails it will turn red. Tests go yellow until a final conclusion +is drawn. + +If you need to stop the tests at any time just click the button again (it +should say "Stop Tests" whilst the tests run). + +Whilst the tests run, the large bar to the right of the screen will tally +up aggregated results and will eventually go either green or red indicating +a pass or failure. Failed assertion messages will appear in the page just like +they do with the HtmlReporter of SimpleTest. + +Clicking a single test case will run just that test in isolation. If you want +(or need?) to run the test with SimpleTest's HtmlReporter just click the +HTML Icon (little world image) next to the test case. Tests can also be run in +XML if needed. + +Above the list of tests there's a filter box which can be directly typed into. +Typing in here narrows down the list of testcases to show only the ones which +match the search query. + +Refreshing the page with your browser's refresh button will reset the test suite. + +When you change your code, you DO NOT need to refesh your browser window. Just +click the "Run Tests" button, or click the individual test to refresh the results. + +If you add a new test case you will need to refresh your browser window however. + + +Running Sweety without JavaScript: +---------------------------------- + +If your web browser has JavaScript disabled you can still use the HTML version +of the test suite. Open up the index.php file in your web browser. + +You'll see the screen is divided into two sections, left +and right. On the left there's a list of test cases with checkboxes next to them +which you can check to run. On the right you get all the verbose output from +running the tests. + +Clicking the "Run Tests" button will run all the currently selected test cases. +This could take a long time depending upon how many tests you have to run, +but once complete you'll see the page again where the tests you selected will +either be red or green indicating a pass or failure. The bar at the right of +the screen will contain aggregate results for all the tests and will be either +red or green to indicate an overall pass or failure. + +Assertion messages appear in the page just like with SimpleTest's HtmlReporter. + +If you want to run just a single test case, click the "Run" icon at the right +of the test (little running man image). + +You can run tests with SimpleTest's HtmlReporter by clicking the HTML icon +(little world image) next to the test case. Tests can be run in XML if needed +too. + +Enjoy! + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/config.php b/vendor/swiftmailer/swiftmailer/test-suite/config.php new file mode 100644 index 0000000..c363b03 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/config.php @@ -0,0 +1,68 @@ +setReporter(new Sweety_Reporter_HtmlReporter()); + +$runner->setIgnoredClassRegex(SWEETY_IGNORED_CLASSES); + +$locators = preg_split('/\s*,\s*/', SWEETY_TEST_LOCATOR); +foreach ($locators as $locator) +{ + $runner->registerTestLocator(new $locator()); +} + +if (isset($_GET['test'])) +{ + $testName = $_GET['test']; + $format = isset($_GET['format']) ? $_GET['format'] : Sweety_Runner::REPORT_HTML; + + $runner->runTestCase($testName, $format); +} +else +{ + $runner->runAllTests(); +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter.php new file mode 100644 index 0000000..345bdc0 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter.php @@ -0,0 +1,69 @@ +_name = $name; + $this->_aggregates = array( + 'cases' => 0, + 'run' => 0, + 'passes' => 0, + 'fails' => 0, + 'exceptions' => 0 + ); + } + + /** + * Used so test case reporters can notify this reporter when they've completed. + * @param string $testCase + */ + public function notifyEnded($testCase) + { + $this->_aggregates['run']++; + } + + /** + * Get the reporter used to report on this specific test case. + * @param string $testCase + * @return Sweety_Reporter + */ + public function getReporterFor($testCase) + { + $this->_aggregates['cases']++; + + $reporter = new Sweety_Reporter_CliTestCaseReporter($testCase, $this); + return $reporter; + } + + /** + * Returns true if start() has been invoked. + * @return boolean + */ + public function isStarted() + { + return $this->_started; + } + + /** + * Start reporting. + */ + public function start() + { + $this->_started = true; + echo $this->_name . PHP_EOL; + } + + /** + * Report a skipped test case. + * @param string $message + * @param string $path + */ + public function reportSkip($message, $path) + { + echo " \033[34m\033[1m\033[4mSkip\033[0m:"; + $messageLines = explode(PHP_EOL, wordwrap($message, 74, PHP_EOL)); + foreach ($messageLines as $line) + { + echo ' ' . $line . PHP_EOL; + } + echo ' in: ' . $path . PHP_EOL; + } + + /** + * Report a passing assertion. + * @param string $message + * @param string $path + */ + public function reportPass($message, $path) + { + $this->_aggregates['passes']++; + } + + /** + * Report a failing assertion. + * @param string $message + * @param string $path + */ + public function reportFail($message, $path) + { + $this->_aggregates['fails']++; + + echo "\033[31m" . $this->_aggregates['fails'] . ') '; + echo $message . "\033[0m" . PHP_EOL; + echo ' in: ' . $path . PHP_EOL; + } + + /** + * Report an unexpected exception. + * @param string $message + * @param string $path + */ + public function reportException($message, $path) + { + $this->_aggregates['exceptions']++; + + echo "\033[31m\033[1mException" . $this->_aggregates['exceptions'] . "\033[0m!" . PHP_EOL; + echo "\033[1m" . $message . "\033[0m" . PHP_EOL; + echo ' in ' . $path . PHP_EOL; + } + + /** + * Report output from something like a dump(). + * @param string $output + * @param string $path + */ + public function reportOutput($output, $path) + { + if (preg_match('/^\{image @ (.*?)\}$/D', $output, $matches)) + { + echo " \033[33mSmoke Test\033[0m" . PHP_EOL; + echo ' Compare email sent with image @ ' . $matches[1] . PHP_EOL; + } + else + { + echo '--------------------' . PHP_EOL; + echo $output . PHP_EOL; + echo '--------------------' . PHP_EOL; + } + } + + /** + * End reporting. + */ + public function finish() + { + $this->_started = false; + + $incomplete = $this->_aggregates['cases'] - $this->_aggregates['run']; + + if ($incomplete) + { + echo '**********************' . PHP_EOL; + echo $incomplete . ' test case(s) did not complete.' . PHP_EOL . + 'This may be because invalid XML was output during the test run' . PHP_EOL . + 'and/or because an error occured.' . PHP_EOL . + 'Try running the tests separately for more detail.' . PHP_EOL; + echo '**********************' . PHP_EOL; + } + + $success = (!$this->_aggregates['fails'] && !$this->_aggregates['exceptions'] + && $this->_aggregates['cases'] == $this->_aggregates['run']); + + if ($success) + { + echo "\033[32m\033[1mOK\033[0m" . PHP_EOL; + } + else + { + echo "\033[31m\033[1mFAILURES!!!\033[0m" . PHP_EOL; + } + + echo 'Test cases run: '; + echo $this->_aggregates['run'] . '/' . $this->_aggregates['cases'] . ', '; + echo 'Passes: ' . $this->_aggregates['passes'] . ', '; + echo 'Failures: ' . $this->_aggregates['fails'] . ', '; + echo 'Exceptions: '. $this->_aggregates['exceptions'] . PHP_EOL; + + exit((int) !$success); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/CliTestCaseReporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/CliTestCaseReporter.php new file mode 100644 index 0000000..ba23834 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/CliTestCaseReporter.php @@ -0,0 +1,160 @@ +_parent = $parent; + $this->_testCase = $testCase; + $this->_aggregates = array( + 'passes' => 0, + 'fails' => 0, + 'exceptions' => 0 + ); + } + + /** + * Get the reporter used to report on this specific test case. + * This method is stubbed only to return itself. + * @param string $testCase + * @return Sweety_Reporter + */ + public function getReporterFor($testCase) + { + return $this; + } + + /** + * Returns true if start() has been invoked. + * @return boolean + */ + public function isStarted() + { + return $this->_started; + } + + /** + * Start reporting. + */ + public function start() + { + $this->_started = true; + } + + /** + * Report a skipped test case. + * @param string $message + * @param string $path + */ + public function reportSkip($message, $path) + { + $this->_parent->reportSkip($message, $path); + } + + /** + * Report a passing assertion. + * @param string $message + * @param string $path + */ + public function reportPass($message, $path) + { + $this->_aggregates['passes']++; + $this->_parent->reportPass($message, $path); + } + + /** + * Report a failing assertion. + * @param string $message + * @param string $path + */ + public function reportFail($message, $path) + { + $this->_aggregates['fails']++; + $this->_parent->reportFail($message, $path); + } + + /** + * Report an unexpected exception. + * @param string $message + * @param string $path + */ + public function reportException($message, $path) + { + $this->_aggregates['exceptions']++; + $this->_parent->reportException($message, $path); + } + + /** + * Report output from something like a dump(). + * @param string $output + * @param string $path + */ + public function reportOutput($output, $path) + { + $this->_parent->reportOutput($output, $path); + } + + /** + * End reporting. + */ + public function finish() + { + $this->_started = false; + + if (!$this->_aggregates['fails'] && !$this->_aggregates['exceptions']) + { + echo ' >> ' . $this->_testCase . ' '; + echo "\033[32mOK\033[0m" . PHP_EOL; + } + else + { + echo ' !! ' . $this->_testCase . ' '; + echo "\033[31mFAILED\033[0m" . PHP_EOL; + } + + $this->_parent->notifyEnded($this->_testCase); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/HtmlReporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/HtmlReporter.php new file mode 100644 index 0000000..6a15339 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/HtmlReporter.php @@ -0,0 +1,174 @@ +_tplVars =& $vars; + } + + /** + * Used so test case reporters can notify this reporter when they've completed. + * @param string $testCase + */ + public function notifyEnded($testCase) + { + $this->_tplVars['runTests'][] = $testCase; + $this->_tplVars['runCount']++; + } + + /** + * Get the reporter used to report on this specific test case. + * @param string $testCase + * @return Sweety_Reporter + */ + public function getReporterFor($testCase) + { + $this->_tplVars['caseCount']++; + + $reporter = new Sweety_Reporter_HtmlTestCaseReporter($testCase, $this); + $reporter->setTemplateVars($this->_tplVars); + return $reporter; + } + + /** + * Returns true if start() has been invoked. + * @return boolean + */ + public function isStarted() + { + return $this->_started; + } + + /** + * Start reporting. + */ + public function start() + { + $this->_started = true; + } + + /** + * Report a skipped test case. + * @param string $message + * @param string $path + */ + public function reportSkip($message, $path) + { + $this->_tplVars['messages'][] = array( + 'type' => 'skip', + 'path' => $path, + 'text' => $message); + } + + /** + * Report a passing assertion. + * @param string $message + * @param string $path + */ + public function reportPass($message, $path) + { + $this->_tplVars['passCount']++; + } + + /** + * Report a failing assertion. + * @param string $message + * @param string $path + */ + public function reportFail($message, $path) + { + $this->_tplVars['failCount']++; + $this->_tplVars['messages'][] = array( + 'type' => 'fail', + 'path' => $path, + 'text' => $message); + } + + /** + * Report an unexpected exception. + * @param string $message + * @param string $path + */ + public function reportException($message, $path) + { + $this->_tplVars['exceptionCount']++; + $this->_tplVars['messages'][] = array( + 'type' => 'exception', + 'path' => $path, + 'text' => $message); + } + + /** + * Report output from something like a dump(). + * @param string $output + * @param string $path + */ + public function reportOutput($output, $path) + { + $this->_tplVars['messages'][] = array( + 'type' => 'output', + 'path' => $path, + 'text' => $output); + } + + /** + * End reporting. + */ + public function finish() + { + $this->_started = false; + + if (!$this->_tplVars['failCount'] && !$this->_tplVars['exceptionCount'] + && $this->_tplVars['caseCount'] == $this->_tplVars['runCount']) + { + $this->_tplVars['result'] = 'pass'; + } + else + { + $this->_tplVars['result'] = 'fail'; + } + + $incomplete = $this->_tplVars['caseCount'] - $this->_tplVars['runCount']; + + if (0 < $incomplete) + { + $this->_tplVars['messages'][] = array( + 'type' => 'internal', + 'path' => '', + 'text' => $incomplete . ' test case(s) did not complete.' . + ' This may be because invalid XML was output during the test run' . + ' and/or because an error occured.' . + ' Incomplete test cases are shown in yellow. Click the HTML link ' . + 'next to the test for more detail.' + ); + } + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/HtmlTestCaseReporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/HtmlTestCaseReporter.php new file mode 100644 index 0000000..8d4474d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Reporter/HtmlTestCaseReporter.php @@ -0,0 +1,174 @@ +_parent = $parent; + $this->_testCase = $testCase; + $this->_aggregates = array( + 'passes' => 0, + 'fails' => 0, + 'exceptions' => 0 + ); + } + + /** + * Set template data. + * @param mixed[] + */ + public function setTemplateVars(&$vars) + { + $this->_tplVars =& $vars; + } + + /** + * Get the reporter used to report on this specific test case. + * This method is stubbed only to return itself. + * @param string $testCase + * @return Sweety_Reporter + */ + public function getReporterFor($testCase) + { + return $this; + } + + /** + * Returns true if start() has been invoked. + * @return boolean + */ + public function isStarted() + { + return $this->_started; + } + + /** + * Start reporting. + */ + public function start() + { + $this->_started = true; + $this->_tplVars['runTests'][$this->_testCase] = 'running'; + } + + /** + * Report a skipped test case. + * @param string $message + * @param string $path + */ + public function reportSkip($message, $path) + { + $this->_parent->reportSkip($message, $path); + } + + /** + * Report a passing assertion. + * @param string $message + * @param string $path + */ + public function reportPass($message, $path) + { + $this->_aggregates['passes']++; + $this->_parent->reportPass($message, $path); + } + + /** + * Report a failing assertion. + * @param string $message + * @param string $path + */ + public function reportFail($message, $path) + { + $this->_aggregates['fails']++; + $this->_parent->reportFail($message, $path); + } + + /** + * Report an unexpected exception. + * @param string $message + * @param string $path + */ + public function reportException($message, $path) + { + $this->_aggregates['exceptions']++; + $this->_parent->reportException($message, $path); + } + + /** + * Report output from something like a dump(). + * @param string $output + * @param string $path + */ + public function reportOutput($output, $path) + { + $this->_parent->reportOutput($output, $path); + } + + /** + * End reporting. + */ + public function finish() + { + $this->_started = false; + + if (!$this->_aggregates['fails'] && !$this->_aggregates['exceptions']) + { + $this->_tplVars['runTests'][$this->_testCase] = 'pass'; + } + else + { + $this->_tplVars['runTests'][$this->_testCase] = 'fail'; + } + + $this->_parent->notifyEnded($this->_testCase); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner.php new file mode 100644 index 0000000..b07ddb4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner.php @@ -0,0 +1,56 @@ +_reporter = $reporter; + } + + /** + * Get the reporter used for showing results. + * @return Sweety_Reporter + */ + public function getReporter() + { + return $this->_reporter; + } + + /** + * Register a test locator instance. + * @param Sweety_TestLocator $locator + */ + public function registerTestLocator(Sweety_TestLocator $locator) + { + $this->_testLocators[] = $locator; + } + + /** + * Set the regular expression used to filter out certain class names. + * @param string $ignoredClassRegex + */ + public function setIgnoredClassRegex($ignoredClassRegex) + { + $this->_ignoredClassRegex = $ignoredClassRegex; + } + + /** + * Get the filtering regular expression for ignoring certain classes. + * @return string + */ + public function getIgnoredClassRegex() + { + return $this->_ignoredClassRegex; + } + + /** + * Run a single test case with the given name, using the provided output format. + * @param string $testName + * @param string $format (xml, text or html) + * @return int + */ + public function runTestCase($testName, $format = Sweety_Runner::REPORT_TEXT) + { + foreach ($this->_testLocators as $locator) + { + if ($locator->includeTest($testName)) + { + break; + } + } + + $testClass = new ReflectionClass($testName); + if ($testClass->getConstructor()) + { + //We don't want test output to be cached + if (!SimpleReporter::inCli()) + { + header("Cache-Control: no-cache, must-revalidate"); + header("Pragma: no-cache"); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + } + + switch ($format) + { + case Sweety_Runner::REPORT_HTML: + $reporter = new HtmlReporter(); + break; + case Sweety_Runner::REPORT_XML: + if (!SimpleReporter::inCli()) + { + header("Content-Type: text/xml"); //Sigh! SimpleTest (skip() issues). + } + $reporter = new XmlReporter(); + break; + case Sweety_Runner::REPORT_TEXT: + default: + $reporter = new TextReporter(); + break; + } + $test = $testClass->newInstance(); + return $test->run($reporter) ? 0 : 1; + } + + return 1; + } + + /** + * Use strategies to find tests which are runnable. + * @param string[] $dirs + * @return string[] + */ + protected function findTests($dirs = array()) + { + $tests = array(); + foreach ($this->_testLocators as $locator) + { + $tests += $locator->getTests($dirs); + } + return $tests; + } + + /** + * Parse an XML response from a test case an report to the reporter. + * @param string $xml + * @param string $testCase + */ + protected function parseXml($xml, $testCase) + { + $reporter = $this->_reporter->getReporterFor($testCase); + if (!$reporter->isStarted()) + { + $reporter->start(); + } + + $xml = str_replace("\0", '?', trim($xml)); + $xml = preg_replace('/[^\x01-\x7F]/e', 'sprintf("&#%d;", ord("$0"));', $xml); //Do something better? + if (!empty($xml)) + { + $document = @simplexml_load_string($xml); + if ($document) + { + $this->_parseDocument($document, $testCase, $reporter); + $reporter->finish(); + return; + } + } + + $reporter->reportException( + 'Invalid XML response: ' . + trim(strip_tags( + preg_replace('/^\s*<\?xml.+<\/(?:name|pass|fail|exception)>/s', '', $xml) + )), + $testCase + ); + } + + /** + * Parse formatted test output. + * @param SimpleXMLElement The node containing the output + * @param string $path to this test method + * @access private + */ + private function _parseFormatted(SimpleXMLElement $formatted, $path = '', + Sweety_Reporter $reporter) + { + $reporter->reportOutput((string)$formatted, $path); + } + + /** + * Parse test output. + * @param SimpleXMLElement The node containing the output + * @param string $path to this test method + * @access private + */ + private function _parseMessage(SimpleXMLElement $message, $path = '', + Sweety_Reporter $reporter) + { + $reporter->reportOutput((string)$message, $path); + } + + /** + * Parse a test failure. + * @param SimpleXMLElement The node containing the fail + * @param string $path to this test method + * @access private + */ + private function _parseFailure(SimpleXMLElement $failure, $path = '', + Sweety_Reporter $reporter) + { + $reporter->reportFail((string)$failure, $path); + } + + /** + * Parse an exception. + * @param SimpleXMLElement The node containing the exception + * @param string $path to this test method + * @access private + */ + private function _parseException(SimpleXMLElement $exception, $path = '', + Sweety_Reporter $reporter) + { + $reporter->reportException((string)$exception, $path); + } + + /** + * Parse a pass. + * @param SimpleXMLElement The node containing this pass. + * @param string $path to this test method + * @access private + */ + private function _parsePass(SimpleXMLElement $pass, $path = '', + Sweety_Reporter $reporter) + { + $reporter->reportPass((string)$pass, $path); + } + + /** + * Parse a single test case. + * @param SimpleXMLElement The node containing the test case + * @param string $path to this test case + * @access private + */ + private function _parseTestCase(SimpleXMLElement $testCase, $path = '', + Sweety_Reporter $reporter) + { + foreach ($testCase->xpath('./test') as $testMethod) + { + $testMethodName = (string) $this->_firstNodeValue($testMethod->xpath('./name')); + + foreach ($testMethod->xpath('./formatted') as $formatted) + { + $this->_parseFormatted( + $formatted, $path . ' -> ' . $testMethodName, $reporter); + } + + foreach ($testMethod->xpath('./message') as $message) + { + $this->_parseMessage( + $message, $path . ' -> ' . $testMethodName, $reporter); + } + + foreach ($testMethod->xpath('./fail') as $failure) + { + $this->_parseFailure( + $failure, $path . ' -> ' . $testMethodName, $reporter); + } + + foreach ($testMethod->xpath('./exception') as $exception) + { + $this->_parseException( + $exception, $path . ' -> ' . $testMethodName, $reporter); + } + + foreach ($testMethod->xpath('./pass') as $pass) + { + $this->_parsePass($pass, $path . ' -> ' . $testMethodName, $reporter); + } + + $stdout = trim((string) $testMethod); + if ($stdout) + { + $reporter->reportOutput($stdout, $path . ' -> ' . $testMethodName); + } + } + } + + /** + * Parse the results of all tests. + * @param SimpleXMLElement The node containing the tests + * @param string $path to the tests + * @access private + */ + private function _parseResults(SimpleXMLElement $document, $path = '', + Sweety_Reporter $reporter) + { + $groups = $document->xpath('./group'); + if (!empty($groups)) + { + foreach ($groups as $group) + { + $groupName = (string) $this->_firstNodeValue($group->xpath('./name')); + $this->_parseResults($group, $path . ' -> ' . $groupName, $reporter); + } + } + else + { + foreach ($document->xpath('./case') as $testCase) + { + $this->_parseTestCase($testCase, $path, $reporter); + } + } + } + + /** + * Parse the entire SimpleTest XML document from a test case. + * @param SimpleXMLElement $document to parse + * @param string $path to the test + * @access private + */ + private function _parseDocument(SimpleXMLElement $document, $path = '', + Sweety_Reporter $reporter) + { + if ($everything = $this->_firstNodeValue($document->xpath('/run'))) + { + $this->_parseResults($everything, $path, $reporter); + } + elseif ($skip = $this->_firstNodeValue($document->xpath('/skip'))) + { + $reporter->reportSkip((string) $skip, $path); + } + } + + protected function _sort($a, $b) + { + $apkg = preg_replace('/_[^_]+$/D', '', $a); + $bpkg = preg_replace('/_[^_]+$/D', '', $b); + if ($apkg == $bpkg) + { + if ($a == $b) + { + return 0; + } + else + { + return ($a > $b) ? 1 : -1; + } + } + else + { + return ($apkg > $bpkg) ? 1 : -1; + } + } + + private function _firstNodeValue($nodeSet) + { + $first = array_shift($nodeSet); + return $first; + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/CliRunner.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/CliRunner.php new file mode 100644 index 0000000..c3e4026 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/CliRunner.php @@ -0,0 +1,128 @@ +_dirs = $dirs; + $this->_command = $command; + } + + /** + * Runs all test cases found under the given directories. + * @param string[] $directories to scan for test cases + * @param string To be prepended to class names + * @return int + */ + public function runAllTests($dirs = array()) + { + if (empty($dirs)) + { + $dirs = $this->_dirs; + } + + $reporter = $this->getReporter(); + + if (!$reporter->isStarted()) + { + $reporter->start(); + } + + $tests = $this->findTests($dirs); + usort($tests, array($this, '_sort')); + + global $argv; + + if (!empty($argv[1])) + { + if (substr($argv[1], 0, 1) == '!') + { + $argv[1] = substr($argv[1], 1); + foreach ($tests as $index => $name) + { + if (@preg_match($argv[1] . 'i', $name)) + { + unset($tests[$index]); + } + } + } + else + { + foreach ($tests as $index => $name) + { + if (!@preg_match($argv[1] . 'i', $name)) + { + unset($tests[$index]); + } + } + } + } + + $ret = $this->_runTestList($tests); + + $reporter->finish(); + + return $ret; + } + + /** + * Run all possible tests from the given list. + * @param string[] $tests + * @return int + */ + protected function _runTestList(array $tests) + { + foreach ($tests as $testCase) + { + if (preg_match($this->getIgnoredClassRegex(), $testCase)) + { + continue; + } + + $command = $this->_command; + $command .= ' ' . $testCase; + $command .= ' ' . Sweety_Runner::REPORT_XML; + + exec($command, $output, $status); + + $xml = implode(PHP_EOL, $output); + + $this->parseXml($xml, $testCase); + + unset($status); + unset($output); + } + + return 0; + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/HtmlRunner.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/HtmlRunner.php new file mode 100644 index 0000000..e115692 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/Runner/HtmlRunner.php @@ -0,0 +1,160 @@ +_dirs = $dirs; + $this->_template = $template; + $this->_name = $name; + } + + /** + * Runs all test cases found under the given directories. + * @param string[] $directories to scan for test cases + * @param string To be prepended to class names + * @return int + */ + public function runAllTests($dirs = array()) + { + //We don't want test output to be cached + header("Cache-Control: no-cache, must-revalidate"); + header("Pragma: no-cache"); + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + + if (empty($dirs)) + { + $dirs = $this->_dirs; + } + + $testCases = $this->findTests($dirs); + foreach ($testCases as $k => $testCase) + { + if (preg_match($this->getIgnoredClassRegex(), $testCase)) + { + unset($testCases[$k]); + } + } + + usort($testCases, array($this, '_sort')); + + $vars = array( + //String + 'testCases' => $testCases, + //String + 'suiteName' => $this->_name, + // testCase => pass | fail | running + 'runTests' => array(), + //Integer + 'caseCount' => 0, + //Integer + 'runCount' => 0, + //Integer + 'passCount' => 0, + //Integer + 'failCount' => 0, + //Integer + 'exceptionCount' => 0, + // type => pass | fail | exception | output | internal, path => testCase, text => ... + 'messages' => array(), + // pass | fail + 'result' => 'idle' + ); + + if (isset($_REQUEST['runtests'])) + { + $reporter = $this->getReporter(); + $reporter->setTemplateVars($vars); + + if (!$reporter->isStarted()) + { + $reporter->start(); + } + + $this->_runTestList((array)$_REQUEST['runtests'], $reporter); + + $reporter->finish(); + } + else + { + foreach ($testCases as $testCase) + { + $vars['runTests'][$testCase] = 'idle'; //Show all checked by default + } + } + + $this->_render($vars); + } + + /** + * Run tests in the given array using the REST API (kind of). + * @param string[] $tests + * @param Sweety_Reporter $reporter + * @return int + */ + protected function _runTestList(array $tests, Sweety_Reporter $reporter) + { + $protocol = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://'; + + //Most likely a HTTP/1.0 server not supporting HOST header + $server = !empty($_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : '127.0.0.1'; + + $path = '/'; + if (!empty($_SERVER['REQUEST_URI'])) + { + $path = preg_replace('/\?.*$/sD', '', $_SERVER['REQUEST_URI']); + } + + $baseUrl = $protocol . $server . $path; + + foreach ($tests as $testCase) + { + $url = $baseUrl . '?test=' . $testCase . '&format=xml'; + $xml = file_get_contents($url); + $this->parseXml($xml, $testCase); + } + + return 0; + } + + /** + * Renders the view for the suite. + * @param string[] $templateVars + */ + protected function _render($vars = array()) + { + foreach ($vars as $k => $v) + { + $$k = $v; + } + + require_once $this->_template; + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/TestLocator.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/TestLocator.php new file mode 100644 index 0000000..96e4649 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/Sweety/TestLocator.php @@ -0,0 +1,25 @@ +_findTestCases($dirs); + } + + public function includeTest($testCase) + { + $file = str_replace('_', '/', $testCase) . '.php'; + foreach (explode(PATH_SEPARATOR, get_include_path()) as $dir) + { + if (is_file($dir . '/' . $file)) + { + require_once $dir . '/' . $file; + return true; + } + } + + return false; + } + + protected function _findTestCases($dirs = array(), $prepend = '') + { + $ret = array(); + + foreach ($dirs as $dir) + { + if (array_key_exists($dir, $this->_testCache)) + { + $ret += $this->_testCache[$dir]; + continue; + } + + $this->_testCache[$dir] = array(); + + $handle = opendir($dir); + while (false !== $file = readdir($handle)) + { + if (substr($file, 0, 1) != '.' && is_dir($dir . '/' . $file)) + { + foreach ($this->_findTestCases( + array($dir . '/' . $file), $prepend . $file . '_') as $add) + { + $this->_testCache[$dir][] = $add; + $ret[] = $add; + } + } + elseif (substr($file, -4) == '.php') + { + $className = $prepend . basename($file, '.php'); + $this->_testCache[$dir][] = $className; + $ret[] = $className; + } + } + closedir($handle); + } + + sort($ret); + + return $ret; + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE new file mode 100644 index 0000000..d99acd8 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE @@ -0,0 +1,383 @@ +Simple Test interface changes +============================= +Because the SimpleTest tool set is still evolving it is likely that tests +written with earlier versions will fail with the newest ones. The most +dramatic changes are in the alpha releases. Here is a list of possible +problems and their fixes... + +Fatal error: Call to undefined method Classname::classname() +------------------------------------------------------------ +SimpleTest renamed all of its constructors from +Classname to __construct; derived classes invoking +their parent constructors should replace parent::Classname() +with parent::__construct(). + +Custom CSS in HtmlReporter not being applied +-------------------------------------------- +Batch rename of protected and private methods +means that _getCss() was renamed to getCss(); +replace your function definition accordingly. + +setReturnReference() throws errors in E_STRICT +---------------------------------------------- +Happens when an object is passed by reference. +This also happens with setReturnReferenceAt(). +If you want to return objects then replace these +with calls to returns() and returnsAt() with the +same arguments. This change was forced in the 1.1 +version for E_STRICT compatibility. + +assertReference() throws errors in E_STRICT +------------------------------------------- +Due to language restrictions you cannot compare +both variables and objects in E_STRICT mode. Use +assertSame() in this mode with objects. This change +was forced the 1.1 version. + +Cannot create GroupTest +----------------------- +The GroupTest has been renamed TestSuite (see below). +It was removed completely in 1.1 in favour of this +name. + +No method getRelativeUrls() or getAbsoluteUrls() +------------------------------------------------ +These methods were always a bit weird anyway, and +the new parsing of the base tag makes them more so. +They have been replaced with getUrls() instead. If +you want the old functionality then simply chop +off the current domain from getUrl(). + +Method setWildcard() removed in mocks +------------------------------------- +Even setWildcard() has been removed in 1.0.1beta now. +If you want to test explicitely for a '*' string, then +simply pass in new IdenticalExpectation('*') instead. + +No method _getTest() on mocks +----------------------------- +This has finally been removed. It was a pretty esoteric +flex point anyway. It was there to allow the mocks to +work with other test tools, but no one does this. + +No method assertError(), assertNoErrors(), swallowErrors() +---------------------------------------------------------- +These have been deprecated in 1.0.1beta in favour of +expectError() and expectException(). assertNoErrors() is +redundant if you use expectError() as failures are now reported +immediately. + +No method TestCase::signal() +---------------------------- +This has been deprecated in favour of triggering an error or +throwing an exception. Deprecated as of 1.0.1beta. + +No method TestCase::sendMessage() +--------------------------------- +This has been deprecated as of 1.0.1beta. + +Failure to connect now emits failures +------------------------------------- +It used to be that you would have to use the +getTransferError() call on the web tester to see if +there was a socket level error in a fetch. This check +is now always carried out by the WebTestCase unless +the fetch is prefaced with WebTestCase::ignoreErrors(). +The ignore directive only lasts for test case fetching +action such as get() and click(). + +No method SimpleTestOptions::ignore() +------------------------------------- +This is deprecated in version 1.0.1beta and has been moved +to SimpleTest::ignore() as that is more readable. In +addition, parent classes are also ignored automatically. +If you are using PHP5 you can skip this directive simply +by marking your test case as abstract. + +No method assertCopy() +---------------------- +This is deprecated in 1.0.1 in favour of assertClone(). +The assertClone() method is slightly different in that +the objects must be identical, but without being a +reference. It is thus not a strict inversion of +assertReference(). + +Constructor wildcard override has no effect in mocks +---------------------------------------------------- +As of 1.0.1beta this is now set with setWildcard() instead +of in the constructor. + +No methods setStubBaseClass()/getStubBaseClass() +------------------------------------------------ +As mocks are now used instead of stubs, these methods +stopped working and are now removed as of the 1.0.1beta +release. The mock objects may be freely used instead. + +No method addPartialMockCode() +------------------------------ +The ability to insert arbitrary partial mock code +has been removed. This was a low value feature +causing needless complications. It was removed +in the 1.0.1beta release. + +No method setMockBaseClass() +---------------------------- +The ability to change the mock base class has been +scheduled for removal and is deprecated since the +1.0.1beta version. This was a rarely used feature +except as a workaround for PHP5 limitations. As +these limitations are being resolved it's hoped +that the bundled mocks can be used directly. + +No class Stub +------------- +Server stubs are deprecated from 1.0.1 as the mocks now +have exactly the same interface. Just use mock objects +instead. + +No class SimpleTestOptions +-------------------------- +This was replced by the shorter SimpleTest in 1.0.1beta1 +and is since deprecated. + +No file simple_test.php +----------------------- +This was renamed test_case.php in 1.0.1beta to more accurately +reflect it's purpose. This file should never be directly +included in test suites though, as it's part of the +underlying mechanics and has a tendency to be refactored. + +No class WantedPatternExpectation +--------------------------------- +This was deprecated in 1.0.1alpha in favour of the simpler +name PatternExpectation. + +No class NoUnwantedPatternExpectation +------------------------------------- +This was deprecated in 1.0.1alpha in favour of the simpler +name NoPatternExpectation. + +No method assertNoUnwantedPattern() +----------------------------------- +This has been renamed to assertNoPattern() in 1.0.1alpha and +the old form is deprecated. + +No method assertWantedPattern() +------------------------------- +This has been renamed to assertPattern() in 1.0.1alpha and +the old form is deprecated. + +No method assertExpectation() +----------------------------- +This was renamed as assert() in 1.0.1alpha and the old form +has been deprecated. + +No class WildcardExpectation +---------------------------- +This was a mostly internal class for the mock objects. It was +renamed AnythingExpectation to bring it closer to JMock and +NMock in version 1.0.1alpha. + +Missing UnitTestCase::assertErrorPattern() +------------------------------------------ +This method is deprecated for version 1.0.1 onwards. +This method has been subsumed by assertError() that can now +take an expectation. Simply pass a PatternExpectation +into assertError() to simulate the old behaviour. + +No HTML when matching page elements +----------------------------------- +This behaviour has been switched to using plain text as if it +were seen by the user of the browser. This means that HTML tags +are suppressed, entities are converted and whitespace is +normalised. This should make it easier to match items in forms. +Also images are replaced with their "alt" text so that they +can be matched as well. + +No method SimpleRunner::_getTestCase() +-------------------------------------- +This was made public as getTestCase() in 1.0RC2. + +No method restartSession() +-------------------------- +This was renamed to restart() in the WebTestCase, SimpleBrowser +and the underlying SimpleUserAgent in 1.0RC2. Because it was +undocumented anyway, no attempt was made at backward +compatibility. + +My custom test case ignored by tally() +-------------------------------------- +The _assertTrue method has had it's signature changed due to a bug +in the PHP 5.0.1 release. You must now use getTest() from within +that method to get the test case. Mock compatibility with other +unit testers is now deprecated as of 1.0.1alpha as PEAR::PHPUnit2 +should soon have mock support of it's own. + +Broken code extending SimpleRunner +---------------------------------- +This was replaced with SimpleScorer so that I could use the runner +name in another class. This happened in RC1 development and there +is no easy backward compatibility fix. The solution is simply to +extend SimpleScorer instead. + +Missing method getBaseCookieValue() +----------------------------------- +This was renamed getCurrentCookieValue() in RC1. + +Missing files from the SimpleTest suite +--------------------------------------- +Versions of SimpleTest prior to Beta6 required a SIMPLE_TEST constant +to point at the SimpleTest folder location before any of the toolset +was loaded. This is no longer documented as it is now unnecessary +for later versions. If you are using an earlier version you may +need this constant. Consult the documentation that was bundled with +the release that you are using or upgrade to Beta6 or later. + +No method SimpleBrowser::getCurrentUrl() +-------------------------------------- +This is replaced with the more versatile showRequest() for +debugging. It only existed in this context for version Beta5. +Later versions will have SimpleBrowser::getHistory() for tracking +paths through pages. It is renamed as getUrl() since 1.0RC1. + +No method Stub::setStubBaseClass() +---------------------------------- +This method has finally been removed in 1.0RC1. Use +SimpleTestOptions::setStubBaseClass() instead. + +No class CommandLineReporter +---------------------------- +This was renamed to TextReporter in Beta3 and the deprecated version +was removed in 1.0RC1. + +No method requireReturn() +------------------------- +This was deprecated in Beta3 and is now removed. + +No method expectCookie() +------------------------ +This method was abruptly removed in Beta4 so as to simplify the internals +until another mechanism can replace it. As a workaround it is necessary +to assert that the cookie has changed by setting it before the page +fetch and then assert the desired value. + +No method clickSubmitByFormId() +------------------------------- +This method had an incorrect name as no button was involved. It was +renamed to submitByFormId() in Beta4 and the old version deprecated. +Now removed. + +No method paintStart() or paintEnd() +------------------------------------ +You should only get this error if you have subclassed the lower level +reporting and test runner machinery. These methods have been broken +down into events for test methods, events for test cases and events +for group tests. The new methods are... + +paintStart() --> paintMethodStart(), paintCaseStart(), paintGroupStart() +paintEnd() --> paintMethodEnd(), paintCaseEnd(), paintGroupEnd() + +This change was made in Beta3, ironically to make it easier to subclass +the inner machinery. Simply duplicating the code you had in the previous +methods should provide a temporary fix. + +No class TestDisplay +-------------------- +This has been folded into SimpleReporter in Beta3 and is now deprecated. +It was removed in RC1. + +No method WebTestCase::fetch() +------------------------------ +This was renamed get() in Alpha8. It is removed in Beta3. + +No method submit() +------------------ +This has been renamed clickSubmit() in Beta1. The old method was +removed in Beta2. + +No method clearHistory() +------------------------ +This method is deprecated in Beta2 and removed in RC1. + +No method getCallCount() +------------------------ +This method has been deprecated since Beta1 and has now been +removed. There are now more ways to set expectations on counts +and so this method should be unecessery. Removed in RC1. + +Cannot find file * +------------------ +The following public name changes have occoured... + +simple_html_test.php --> reporter.php +simple_mock.php --> mock_objects.php +simple_unit.php --> unit_tester.php +simple_web.php --> web_tester.php + +The old names were deprecated in Alpha8 and removed in Beta1. + +No method attachObserver() +-------------------------- +Prior to the Alpha8 release the old internal observer pattern was +gutted and replaced with a visitor. This is to trade flexibility of +test case expansion against the ease of writing user interfaces. + +Code such as... + +$test = &new MyTestCase(); +$test->attachObserver(new TestHtmlDisplay()); +$test->run(); + +...should be rewritten as... + +$test = &new MyTestCase(); +$test->run(new HtmlReporter()); + +If you previously attached multiple observers then the workaround +is to run the tests twice, once with each, until they can be combined. +For one observer the old method is simulated in Alpha 8, but is +removed in Beta1. + +No class TestHtmlDisplay +------------------------ +This class has been renamed to HtmlReporter in Alpha8. It is supported, +but deprecated in Beta1 and removed in Beta2. If you have subclassed +the display for your own design, then you will have to extend this +class (HtmlReporter) instead. + +If you have accessed the event queue by overriding the notify() method +then I am afraid you are in big trouble :(. The reporter is now +carried around the test suite by the runner classes and the methods +called directly. In the unlikely event that this is a problem and +you don't want to upgrade the test tool then simplest is to write your +own runner class and invoke the tests with... + +$test->accept(new MyRunner(new MyReporter())); + +...rather than the run method. This should be easier to extend +anyway and gives much more control. Even this method is overhauled +in Beta3 where the runner class can be set within the test case. Really +the best thing to do is to upgrade to this version as whatever you were +trying to achieve before should now be very much easier. + +Missing set options method +-------------------------- +All test suite options are now in one class called SimpleTestOptions. +This means that options are set differently... + +GroupTest::ignore() --> SimpleTestOptions::ignore() +Mock::setMockBaseClass() --> SimpleTestOptions::setMockBaseClass() + +These changed in Alpha8 and the old versions are now removed in RC1. + +No method setExpected*() +------------------------ +The mock expectations changed their names in Alpha4 and the old names +ceased to be supported in Alpha8. The changes are... + +setExpectedArguments() --> expectArguments() +setExpectedArgumentsSequence() --> expectArgumentsAt() +setExpectedCallCount() --> expectCallCount() +setMaximumCallCount() --> expectMaximumCallCount() + +The parameters remained the same. diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/LICENSE b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/LICENSE new file mode 100644 index 0000000..09f465a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/LICENSE @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/README b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/README new file mode 100644 index 0000000..f0912b2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/README @@ -0,0 +1,108 @@ +SimpleTest +========== +You probably got this package from... +http://simpletest.sourceforge.net/projects/simpletest/ + +If there is no licence agreement with this package please download +a version from the location above. You must read and accept that +licence to use this software. The file is titled simply LICENSE. + +What is it? It's a framework for unit testing, web site testing and +mock objects for PHP 5.0.5+. + +If you have used JUnit, you will find this PHP unit testing version very +similar. Also included is a mock objects and server stubs generator. +The stubs can have return values set for different arguments, can have +sequences set also by arguments and can return items by reference. +The mocks inherit all of this functionality and can also have +expectations set, again in sequences and for different arguments. + +A web tester similar in concept to JWebUnit is also included. There is no +JavaScript or tables support, but forms, authentication, cookies and +frames are handled. + +You can see a release schedule at http://simpletest.org/en/overview.html +which is also copied to the documentation folder with this release. +A full PHPDocumenter API documentation exists at +http://simpletest.org/api/. + +The user interface is minimal +in the extreme, but a lot of information flows from the test suite. +After version 1.0 we will release a better web UI, but we are leaving XUL +and GTk versions to volunteers as everybody has their own opinion +on a good GUI, and we don't want to discourage development by shipping +one with the toolkit. You can download an Eclipse plug-in separately. + +You are looking at a second full release. The unit tests for SimpleTest +itself can be run here... + +simpletest/test/unit_tests.php + +And tests involving live network connections as well are here... + +simpletest/test/all_tests.php + +The full tests will typically overrun the 8Mb limit often allowed +to a PHP process. A workaround is to run the tests on the command +with a custom php.ini file if you do not have access to your server +version. + +You will have to edit the all_tests.php file if you are accesssing +the internet through a proxy server. See the comments in all_tests.php +for instructions. + +The full tests read some test data from the LastCraft site. If the site +is down or has been modified for a later version then you will get +spurious errors. A unit_tests.php failure on the other hand would be +very serious. As far as we know we haven't yet managed to check in any +unit test failures, so please correct us if you find one. + +Even if all of the tests run please verify that your existing test suites +also function as expected. If they don't see the file... + +HELP_MY_TESTS_DONT_WORK_ANYMORE + +This contains information on interface changes. It also points out +deprecated interfaces, so you should read this even if all of +your current tests appear to run. + +There is a documentation folder which contains the core reference information +in English and French, although this information is fairly basic. +You can find a tutorial on... + +http://simpletest.org/en/first_test_tutorial.html + +...to get you started and this material will eventually become included +with the project documentation. A French translation exists at... + +http://simpletest.org/fr/first_test_tutorial.html + +If you download and use, and possibly even extend this tool, please let us +know. Any feedback, even bad, is always welcome and we will work to get +your suggestions into the next release. Ideally please send your +comments to... + +simpletest-support@lists.sourceforge.net + +...so that others can read them too. We usually try to respond within 48 +hours. + +There is no change log except at Sourceforge. You can visit the +release notes to see the completed TODO list after each cycle and also the +status of any bugs, but if the bug is recent then it will be fixed in SVN only. +The SVN check-ins always have all the tests passing and so SVN snapshots should +be pretty usable, although the code may not look so good internally. + +Oh, yes. It is called "Simple" because it should be simple to +use. We intend to add a complete set of tools for a test first +and "test as you code" type of development. "Simple" does not +mean "Lite" in this context. + +Thanks to everyone who has sent comments and offered suggestions. They +really are invaluable, but sadly you are too many to mention in full. +Thanks to all on the advanced PHP forum on SitePoint, especially Harry +Fuecks. Early adopters are always an inspiration. + +Marcus Baker, Jason Sweat, Travis Swicegood, Perrick Penet and Edward Z. Yang. +-- +marcus@lastcraft.com diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/TODO.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/TODO.xml new file mode 100644 index 0000000..3fa84e9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/TODO.xml @@ -0,0 +1,176 @@ + + + TODO tasks for the current iteration + +
+

+ The following is the approximate plan for the next full point release. +

+

+ Before each release we hope to have the following done. + More may get done, depending on the interest of the volunteers, + but this is the current minimum. +

+

+ The aim of this release cycle is to produce a functionally + identical version to the 1.0.1 release, but bug-fixed and + fully compatible with PHP 5.0.5+ under E_STRICT. + We are also hoping to flush out issues and use cases + caused by people hacking against unpublished flex points + in SimpleTest. + We want to break people's code now, not while we are developing + features down the line. +

+

+ With the website move to a new server, and more developers, + we are able and need to improve the test automation and developer + cooperation. + This release is a deep drawing of breath before going forward. +

+
+
+ + + Undefined property $_reporter + fatal error + + + + + + + + + The HELP_MY_TESTS_DONT_WORK_ANYMORE needs to be updated. + + README needs to be updated. + + Write XSLT code for this file so Perrick doesn't strangle me + + + + Ensure extensions are compatible with PHP5 constructor renaming in the current trunk. + + + Update PEAR package task to be compatible with latest PEAR installer. + PHP 5.3 compatible under E_STRICT + PHP 5.2.0-5 compatible under E_STRICT + PHP 5.1.0-6 compatible under E_STRICT + continuous integration + error_reporting(E_ALL|E_STRICT)gives lots of warning + Remove all deprecated methods + + Drop underscores from protected methods and + private variables. + Make all variables private and add protected + accessors where we use them internally. + + That way people will start complaining. + Upon each complaint we'll add an accessor and + capture the use case from them. + + We'll stick the use cases in the feature request tracker for now + + Move web site to new server + + + + + + + Deprecate all mentions of GroupTest without breaking + existing code. + + Need to swap the terminology for TestSuite + in method names, etc. + + + XmlReporter generating invalid XML + + + Remove reflection facade for PHP4 + + + + label not assigned to radio and checkbox + incorrect proxy requests + + + + Docblocks need to be cut back to a minimum + + + + PHP 5.0.5 compatible under E_STRICT + Move acceptance tests sample pages to new server + + + + + + + Remove reflection facade for PHP4 + + + + + + Throw away old tutorial + + + + PHP 6 compatible under E_STRICT + + Automated nightly test script that runs tests on all + targeted PHP versions. + + + +
+
+ + +
Current iteration is 1.1beta. + + + Upcoming tasks for + Unit tester, + Reporter, + Mock objects, + Parser, + Browser, + Web tester, + Documentation, + Extensions and + Build. + + + + + Trackers for : + feature requests, + bugs and + patches. + + + + + software development, + computer programmer, + php programming, + programming php, + software development company, + software development uk, + php tutorial, + bespoke software development uk, + corporate web development, + architecture, + freelancer, + php resources, + wordtracker, + web marketing, + serach engines, + web positioning, + internet marketing + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/VERSION b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/VERSION new file mode 100644 index 0000000..ab8bad0 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/VERSION @@ -0,0 +1 @@ +1.1beta \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/authentication.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/authentication.php new file mode 100644 index 0000000..5af66ec --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/authentication.php @@ -0,0 +1,237 @@ +type = $type; + $this->root = $url->getBasePath(); + $this->username = false; + $this->password = false; + } + + /** + * Adds another location to the realm. + * @param SimpleUrl $url Somewhere in realm. + * @access public + */ + function stretch($url) { + $this->root = $this->getCommonPath($this->root, $url->getPath()); + } + + /** + * Finds the common starting path. + * @param string $first Path to compare. + * @param string $second Path to compare. + * @return string Common directories. + * @access private + */ + protected function getCommonPath($first, $second) { + $first = explode('/', $first); + $second = explode('/', $second); + for ($i = 0; $i < min(count($first), count($second)); $i++) { + if ($first[$i] != $second[$i]) { + return implode('/', array_slice($first, 0, $i)) . '/'; + } + } + return implode('/', $first) . '/'; + } + + /** + * Sets the identity to try within this realm. + * @param string $username Username in authentication dialog. + * @param string $username Password in authentication dialog. + * @access public + */ + function setIdentity($username, $password) { + $this->username = $username; + $this->password = $password; + } + + /** + * Accessor for current identity. + * @return string Last succesful username. + * @access public + */ + function getUsername() { + return $this->username; + } + + /** + * Accessor for current identity. + * @return string Last succesful password. + * @access public + */ + function getPassword() { + return $this->password; + } + + /** + * Test to see if the URL is within the directory + * tree of the realm. + * @param SimpleUrl $url URL to test. + * @return boolean True if subpath. + * @access public + */ + function isWithin($url) { + if ($this->isIn($this->root, $url->getBasePath())) { + return true; + } + if ($this->isIn($this->root, $url->getBasePath() . $url->getPage() . '/')) { + return true; + } + return false; + } + + /** + * Tests to see if one string is a substring of + * another. + * @param string $part Small bit. + * @param string $whole Big bit. + * @return boolean True if the small bit is + * in the big bit. + * @access private + */ + protected function isIn($part, $whole) { + return strpos($whole, $part) === 0; + } +} + +/** + * Manages security realms. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleAuthenticator { + private $realms; + + /** + * Clears the realms. + * @access public + */ + function SimpleAuthenticator() { + $this->restartSession(); + } + + /** + * Starts with no realms set up. + * @access public + */ + function restartSession() { + $this->realms = array(); + } + + /** + * Adds a new realm centered the current URL. + * Browsers privatey wildly on their behaviour in this + * regard. Mozilla ignores the realm and presents + * only when challenged, wasting bandwidth. IE + * just carries on presenting until a new challenge + * occours. SimpleTest tries to follow the spirit of + * the original standards committee and treats the + * base URL as the root of a file tree shaped realm. + * @param SimpleUrl $url Base of realm. + * @param string $type Authentication type for this + * realm. Only Basic authentication + * is currently supported. + * @param string $realm Name of realm. + * @access public + */ + function addRealm($url, $type, $realm) { + $this->realms[$url->getHost()][$realm] = new SimpleRealm($type, $url); + } + + /** + * Sets the current identity to be presented + * against that realm. + * @param string $host Server hosting realm. + * @param string $realm Name of realm. + * @param string $username Username for realm. + * @param string $password Password for realm. + * @access public + */ + function setIdentityForRealm($host, $realm, $username, $password) { + if (isset($this->realms[$host][$realm])) { + $this->realms[$host][$realm]->setIdentity($username, $password); + } + } + + /** + * Finds the name of the realm by comparing URLs. + * @param SimpleUrl $url URL to test. + * @return SimpleRealm Name of realm. + * @access private + */ + protected function findRealmFromUrl($url) { + if (! isset($this->realms[$url->getHost()])) { + return false; + } + foreach ($this->realms[$url->getHost()] as $name => $realm) { + if ($realm->isWithin($url)) { + return $realm; + } + } + return false; + } + + /** + * Presents the appropriate headers for this location. + * @param SimpleHttpRequest $request Request to modify. + * @param SimpleUrl $url Base of realm. + * @access public + */ + function addHeaders(&$request, $url) { + if ($url->getUsername() && $url->getPassword()) { + $username = $url->getUsername(); + $password = $url->getPassword(); + } elseif ($realm = $this->findRealmFromUrl($url)) { + $username = $realm->getUsername(); + $password = $realm->getPassword(); + } else { + return; + } + $this->addBasicHeaders($request, $username, $password); + } + + /** + * Presents the appropriate headers for this + * location for basic authentication. + * @param SimpleHttpRequest $request Request to modify. + * @param string $username Username for realm. + * @param string $password Password for realm. + * @access public + */ + static function addBasicHeaders(&$request, $username, $password) { + if ($username && $password) { + $request->addHeaderLine( + 'Authorization: Basic ' . base64_encode("$username:$password")); + } + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/autorun.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/autorun.php new file mode 100644 index 0000000..03729bf --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/autorun.php @@ -0,0 +1,97 @@ +createSuiteFromClasses( + basename(initial_file()), + $loader->selectRunnableTests($candidates)); + $result = $suite->run(new DefaultReporter()); + } catch (Exception $stack_frame_fix) { + print $stack_frame_fix->getMessage(); + $result = false; + } + if (SimpleReporter::inCli()) { + exit($result ? 0 : 1); + } +} + +/** + * Checks the current test context to see if a test has + * ever been run. + * @return boolean True if tests have run. + */ +function tests_have_run() { + if ($context = SimpleTest::getContext()) { + return (boolean)$context->getTest(); + } + return false; +} + +/** + * The first autorun file. + * @return string Filename of first autorun script. + */ +function initial_file() { + static $file = false; + if (! $file) { + if (isset($_SERVER, $_SERVER['SCRIPT_FILENAME'])) { + $file = $_SERVER['SCRIPT_FILENAME']; + } else { + $included_files = get_included_files(); + $file = reset($included_files); + } + } + return $file; +} + +/** + * Just the classes from the first autorun script. May + * get a few false positives, as it just does a regex based + * on following the word "class". + * @return array List of all possible classes in first + * autorun script. + */ +function classes_defined_in_initial_file() { + if (preg_match_all('/\bclass\s+(\w+)/i', file_get_contents(initial_file()), $matches)) { + return array_map('strtolower', $matches[1]); + } + return array(); +} + +/** + * Every class since the first autorun include. This + * is safe enough if require_once() is alwyas used. + * @return array Class names. + */ +function capture_new_classes() { + global $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES; + return array_map('strtolower', array_diff(get_declared_classes(), + $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES ? + $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES : array())); +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/browser.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/browser.php new file mode 100644 index 0000000..da0379d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/browser.php @@ -0,0 +1,1094 @@ +sequence = array(); + $this->position = -1; + } + + /** + * Test for no entries yet. + * @return boolean True if empty. + * @access private + */ + protected function isEmpty() { + return ($this->position == -1); + } + + /** + * Test for being at the beginning. + * @return boolean True if first. + * @access private + */ + protected function atBeginning() { + return ($this->position == 0) && ! $this->isEmpty(); + } + + /** + * Test for being at the last entry. + * @return boolean True if last. + * @access private + */ + protected function atEnd() { + return ($this->position + 1 >= count($this->sequence)) && ! $this->isEmpty(); + } + + /** + * Adds a successfully fetched page to the history. + * @param SimpleUrl $url URL of fetch. + * @param SimpleEncoding $parameters Any post data with the fetch. + * @access public + */ + function recordEntry($url, $parameters) { + $this->dropFuture(); + array_push( + $this->sequence, + array('url' => $url, 'parameters' => $parameters)); + $this->position++; + } + + /** + * Last fully qualified URL for current history + * position. + * @return SimpleUrl URL for this position. + * @access public + */ + function getUrl() { + if ($this->isEmpty()) { + return false; + } + return $this->sequence[$this->position]['url']; + } + + /** + * Parameters of last fetch from current history + * position. + * @return SimpleFormEncoding Post parameters. + * @access public + */ + function getParameters() { + if ($this->isEmpty()) { + return false; + } + return $this->sequence[$this->position]['parameters']; + } + + /** + * Step back one place in the history. Stops at + * the first page. + * @return boolean True if any previous entries. + * @access public + */ + function back() { + if ($this->isEmpty() || $this->atBeginning()) { + return false; + } + $this->position--; + return true; + } + + /** + * Step forward one place. If already at the + * latest entry then nothing will happen. + * @return boolean True if any future entries. + * @access public + */ + function forward() { + if ($this->isEmpty() || $this->atEnd()) { + return false; + } + $this->position++; + return true; + } + + /** + * Ditches all future entries beyond the current + * point. + * @access private + */ + protected function dropFuture() { + if ($this->isEmpty()) { + return; + } + while (! $this->atEnd()) { + array_pop($this->sequence); + } + } +} + +/** + * Simulated web browser. This is an aggregate of + * the user agent, the HTML parsing, request history + * and the last header set. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleBrowser { + private $user_agent; + private $page; + private $history; + private $ignore_frames; + private $maximum_nested_frames; + + /** + * Starts with a fresh browser with no + * cookie or any other state information. The + * exception is that a default proxy will be + * set up if specified in the options. + * @access public + */ + function __construct() { + $this->user_agent = $this->createUserAgent(); + $this->user_agent->useProxy( + SimpleTest::getDefaultProxy(), + SimpleTest::getDefaultProxyUsername(), + SimpleTest::getDefaultProxyPassword()); + $this->page = new SimplePage(); + $this->history = $this->createHistory(); + $this->ignore_frames = false; + $this->maximum_nested_frames = DEFAULT_MAX_NESTED_FRAMES; + } + + /** + * Creates the underlying user agent. + * @return SimpleFetcher Content fetcher. + * @access protected + */ + protected function createUserAgent() { + return new SimpleUserAgent(); + } + + /** + * Creates a new empty history list. + * @return SimpleBrowserHistory New list. + * @access protected + */ + protected function createHistory() { + return new SimpleBrowserHistory(); + } + + /** + * Disables frames support. Frames will not be fetched + * and the frameset page will be used instead. + * @access public + */ + function ignoreFrames() { + $this->ignore_frames = true; + } + + /** + * Enables frames support. Frames will be fetched from + * now on. + * @access public + */ + function useFrames() { + $this->ignore_frames = false; + } + + /** + * Switches off cookie sending and recieving. + * @access public + */ + function ignoreCookies() { + $this->user_agent->ignoreCookies(); + } + + /** + * Switches back on the cookie sending and recieving. + * @access public + */ + function useCookies() { + $this->user_agent->useCookies(); + } + + /** + * Parses the raw content into a page. Will load further + * frame pages unless frames are disabled. + * @param SimpleHttpResponse $response Response from fetch. + * @param integer $depth Nested frameset depth. + * @return SimplePage Parsed HTML. + * @access private + */ + protected function parse($response, $depth = 0) { + $page = $this->buildPage($response); + if ($this->ignore_frames || ! $page->hasFrames() || ($depth > $this->maximum_nested_frames)) { + return $page; + } + $frameset = new SimpleFrameset($page); + foreach ($page->getFrameset() as $key => $url) { + $frame = $this->fetch($url, new SimpleGetEncoding(), $depth + 1); + $frameset->addFrame($frame, $key); + } + return $frameset; + } + + /** + * Assembles the parsing machinery and actually parses + * a single page. Frees all of the builder memory and so + * unjams the PHP memory management. + * @param SimpleHttpResponse $response Response from fetch. + * @return SimplePage Parsed top level page. + * @access protected + */ + protected function buildPage($response) { + $builder = new SimplePageBuilder(); + $page = $builder->parse($response); + $builder->free(); + unset($builder); + return $page; + } + + /** + * Fetches a page. Jointly recursive with the parse() + * method as it descends a frameset. + * @param string/SimpleUrl $url Target to fetch. + * @param SimpleEncoding $encoding GET/POST parameters. + * @param integer $depth Nested frameset depth protection. + * @return SimplePage Parsed page. + * @access private + */ + protected function fetch($url, $encoding, $depth = 0) { + $response = $this->user_agent->fetchResponse($url, $encoding); + if ($response->isError()) { + return new SimplePage($response); + } + return $this->parse($response, $depth); + } + + /** + * Fetches a page or a single frame if that is the current + * focus. + * @param SimpleUrl $url Target to fetch. + * @param SimpleEncoding $parameters GET/POST parameters. + * @return string Raw content of page. + * @access private + */ + protected function load($url, $parameters) { + $frame = $url->getTarget(); + if (! $frame || ! $this->page->hasFrames() || (strtolower($frame) == '_top')) { + return $this->loadPage($url, $parameters); + } + return $this->loadFrame(array($frame), $url, $parameters); + } + + /** + * Fetches a page and makes it the current page/frame. + * @param string/SimpleUrl $url Target to fetch as string. + * @param SimplePostEncoding $parameters POST parameters. + * @return string Raw content of page. + * @access private + */ + protected function loadPage($url, $parameters) { + $this->page = $this->fetch($url, $parameters); + $this->history->recordEntry( + $this->page->getUrl(), + $this->page->getRequestData()); + return $this->page->getRaw(); + } + + /** + * Fetches a frame into the existing frameset replacing the + * original. + * @param array $frames List of names to drill down. + * @param string/SimpleUrl $url Target to fetch as string. + * @param SimpleFormEncoding $parameters POST parameters. + * @return string Raw content of page. + * @access private + */ + protected function loadFrame($frames, $url, $parameters) { + $page = $this->fetch($url, $parameters); + $this->page->setFrame($frames, $page); + return $page->getRaw(); + } + + /** + * Removes expired and temporary cookies as if + * the browser was closed and re-opened. + * @param string/integer $date Time when session restarted. + * If omitted then all persistent + * cookies are kept. + * @access public + */ + function restart($date = false) { + $this->user_agent->restart($date); + } + + /** + * Adds a header to every fetch. + * @param string $header Header line to add to every + * request until cleared. + * @access public + */ + function addHeader($header) { + $this->user_agent->addHeader($header); + } + + /** + * Ages the cookies by the specified time. + * @param integer $interval Amount in seconds. + * @access public + */ + function ageCookies($interval) { + $this->user_agent->ageCookies($interval); + } + + /** + * Sets an additional cookie. If a cookie has + * the same name and path it is replaced. + * @param string $name Cookie key. + * @param string $value Value of cookie. + * @param string $host Host upon which the cookie is valid. + * @param string $path Cookie path if not host wide. + * @param string $expiry Expiry date. + * @access public + */ + function setCookie($name, $value, $host = false, $path = '/', $expiry = false) { + $this->user_agent->setCookie($name, $value, $host, $path, $expiry); + } + + /** + * Reads the most specific cookie value from the + * browser cookies. + * @param string $host Host to search. + * @param string $path Applicable path. + * @param string $name Name of cookie to read. + * @return string False if not present, else the + * value as a string. + * @access public + */ + function getCookieValue($host, $path, $name) { + return $this->user_agent->getCookieValue($host, $path, $name); + } + + /** + * Reads the current cookies for the current URL. + * @param string $name Key of cookie to find. + * @return string Null if there is no current URL, false + * if the cookie is not set. + * @access public + */ + function getCurrentCookieValue($name) { + return $this->user_agent->getBaseCookieValue($name, $this->page->getUrl()); + } + + /** + * Sets the maximum number of redirects before + * a page will be loaded anyway. + * @param integer $max Most hops allowed. + * @access public + */ + function setMaximumRedirects($max) { + $this->user_agent->setMaximumRedirects($max); + } + + /** + * Sets the maximum number of nesting of framed pages + * within a framed page to prevent loops. + * @param integer $max Highest depth allowed. + * @access public + */ + function setMaximumNestedFrames($max) { + $this->maximum_nested_frames = $max; + } + + /** + * Sets the socket timeout for opening a connection. + * @param integer $timeout Maximum time in seconds. + * @access public + */ + function setConnectionTimeout($timeout) { + $this->user_agent->setConnectionTimeout($timeout); + } + + /** + * Sets proxy to use on all requests for when + * testing from behind a firewall. Set URL + * to false to disable. + * @param string $proxy Proxy URL. + * @param string $username Proxy username for authentication. + * @param string $password Proxy password for authentication. + * @access public + */ + function useProxy($proxy, $username = false, $password = false) { + $this->user_agent->useProxy($proxy, $username, $password); + } + + /** + * Fetches the page content with a HEAD request. + * Will affect cookies, but will not change the base URL. + * @param string/SimpleUrl $url Target to fetch as string. + * @param hash/SimpleHeadEncoding $parameters Additional parameters for + * HEAD request. + * @return boolean True if successful. + * @access public + */ + function head($url, $parameters = false) { + if (! is_object($url)) { + $url = new SimpleUrl($url); + } + if ($this->getUrl()) { + $url = $url->makeAbsolute($this->getUrl()); + } + $response = &$this->user_agent->fetchResponse($url, new SimpleHeadEncoding($parameters)); + return ! $response->isError(); + } + + /** + * Fetches the page content with a simple GET request. + * @param string/SimpleUrl $url Target to fetch. + * @param hash/SimpleFormEncoding $parameters Additional parameters for + * GET request. + * @return string Content of page or false. + * @access public + */ + function get($url, $parameters = false) { + if (! is_object($url)) { + $url = new SimpleUrl($url); + } + if ($this->getUrl()) { + $url = $url->makeAbsolute($this->getUrl()); + } + return $this->load($url, new SimpleGetEncoding($parameters)); + } + + /** + * Fetches the page content with a POST request. + * @param string/SimpleUrl $url Target to fetch as string. + * @param hash/SimpleFormEncoding $parameters POST parameters. + * @return string Content of page. + * @access public + */ + function post($url, $parameters = false) { + if (! is_object($url)) { + $url = new SimpleUrl($url); + } + if ($this->getUrl()) { + $url = $url->makeAbsolute($this->getUrl()); + } + return $this->load($url, new SimplePostEncoding($parameters)); + } + + /** + * Equivalent to hitting the retry button on the + * browser. Will attempt to repeat the page fetch. If + * there is no history to repeat it will give false. + * @return string/boolean Content if fetch succeeded + * else false. + * @access public + */ + function retry() { + $frames = $this->page->getFrameFocus(); + if (count($frames) > 0) { + $this->loadFrame( + $frames, + $this->page->getUrl(), + $this->page->getRequestData()); + return $this->page->getRaw(); + } + if ($url = $this->history->getUrl()) { + $this->page = $this->fetch($url, $this->history->getParameters()); + return $this->page->getRaw(); + } + return false; + } + + /** + * Equivalent to hitting the back button on the + * browser. The browser history is unchanged on + * failure. The page content is refetched as there + * is no concept of content caching in SimpleTest. + * @return boolean True if history entry and + * fetch succeeded + * @access public + */ + function back() { + if (! $this->history->back()) { + return false; + } + $content = $this->retry(); + if (! $content) { + $this->history->forward(); + } + return $content; + } + + /** + * Equivalent to hitting the forward button on the + * browser. The browser history is unchanged on + * failure. The page content is refetched as there + * is no concept of content caching in SimpleTest. + * @return boolean True if history entry and + * fetch succeeded + * @access public + */ + function forward() { + if (! $this->history->forward()) { + return false; + } + $content = $this->retry(); + if (! $content) { + $this->history->back(); + } + return $content; + } + + /** + * Retries a request after setting the authentication + * for the current realm. + * @param string $username Username for realm. + * @param string $password Password for realm. + * @return boolean True if successful fetch. Note + * that authentication may still have + * failed. + * @access public + */ + function authenticate($username, $password) { + if (! $this->page->getRealm()) { + return false; + } + $url = $this->page->getUrl(); + if (! $url) { + return false; + } + $this->user_agent->setIdentity( + $url->getHost(), + $this->page->getRealm(), + $username, + $password); + return $this->retry(); + } + + /** + * Accessor for a breakdown of the frameset. + * @return array Hash tree of frames by name + * or index if no name. + * @access public + */ + function getFrames() { + return $this->page->getFrames(); + } + + /** + * Accessor for current frame focus. Will be + * false if no frame has focus. + * @return integer/string/boolean Label if any, otherwise + * the position in the frameset + * or false if none. + * @access public + */ + function getFrameFocus() { + return $this->page->getFrameFocus(); + } + + /** + * Sets the focus by index. The integer index starts from 1. + * @param integer $choice Chosen frame. + * @return boolean True if frame exists. + * @access public + */ + function setFrameFocusByIndex($choice) { + return $this->page->setFrameFocusByIndex($choice); + } + + /** + * Sets the focus by name. + * @param string $name Chosen frame. + * @return boolean True if frame exists. + * @access public + */ + function setFrameFocus($name) { + return $this->page->setFrameFocus($name); + } + + /** + * Clears the frame focus. All frames will be searched + * for content. + * @access public + */ + function clearFrameFocus() { + return $this->page->clearFrameFocus(); + } + + /** + * Accessor for last error. + * @return string Error from last response. + * @access public + */ + function getTransportError() { + return $this->page->getTransportError(); + } + + /** + * Accessor for current MIME type. + * @return string MIME type as string; e.g. 'text/html' + * @access public + */ + function getMimeType() { + return $this->page->getMimeType(); + } + + /** + * Accessor for last response code. + * @return integer Last HTTP response code received. + * @access public + */ + function getResponseCode() { + return $this->page->getResponseCode(); + } + + /** + * Accessor for last Authentication type. Only valid + * straight after a challenge (401). + * @return string Description of challenge type. + * @access public + */ + function getAuthentication() { + return $this->page->getAuthentication(); + } + + /** + * Accessor for last Authentication realm. Only valid + * straight after a challenge (401). + * @return string Name of security realm. + * @access public + */ + function getRealm() { + return $this->page->getRealm(); + } + + /** + * Accessor for current URL of page or frame if + * focused. + * @return string Location of current page or frame as + * a string. + */ + function getUrl() { + $url = $this->page->getUrl(); + return $url ? $url->asString() : false; + } + + /** + * Accessor for base URL of page if set via BASE tag + * @return string base URL + */ + function getBaseUrl() { + $url = $this->page->getBaseUrl(); + return $url ? $url->asString() : false; + } + + /** + * Accessor for raw bytes sent down the wire. + * @return string Original text sent. + * @access public + */ + function getRequest() { + return $this->page->getRequest(); + } + + /** + * Accessor for raw header information. + * @return string Header block. + * @access public + */ + function getHeaders() { + return $this->page->getHeaders(); + } + + /** + * Accessor for raw page information. + * @return string Original text content of web page. + * @access public + */ + function getContent() { + return $this->page->getRaw(); + } + + /** + * Accessor for plain text version of the page. + * @return string Normalised text representation. + * @access public + */ + function getContentAsText() { + return $this->page->getText(); + } + + /** + * Accessor for parsed title. + * @return string Title or false if no title is present. + * @access public + */ + function getTitle() { + return $this->page->getTitle(); + } + + /** + * Accessor for a list of all links in current page. + * @return array List of urls with scheme of + * http or https and hostname. + * @access public + */ + function getUrls() { + return $this->page->getUrls(); + } + + /** + * Sets all form fields with that name. + * @param string $label Name or label of field in forms. + * @param string $value New value of field. + * @return boolean True if field exists, otherwise false. + * @access public + */ + function setField($label, $value, $position=false) { + return $this->page->setField(new SimpleByLabelOrName($label), $value, $position); + } + + /** + * Sets all form fields with that name. Will use label if + * one is available (not yet implemented). + * @param string $name Name of field in forms. + * @param string $value New value of field. + * @return boolean True if field exists, otherwise false. + * @access public + */ + function setFieldByName($name, $value, $position=false) { + return $this->page->setField(new SimpleByName($name), $value, $position); + } + + /** + * Sets all form fields with that id attribute. + * @param string/integer $id Id of field in forms. + * @param string $value New value of field. + * @return boolean True if field exists, otherwise false. + * @access public + */ + function setFieldById($id, $value) { + return $this->page->setField(new SimpleById($id), $value); + } + + /** + * Accessor for a form element value within the page. + * Finds the first match. + * @param string $label Field label. + * @return string/boolean A value if the field is + * present, false if unchecked + * and null if missing. + * @access public + */ + function getField($label) { + return $this->page->getField(new SimpleByLabelOrName($label)); + } + + /** + * Accessor for a form element value within the page. + * Finds the first match. + * @param string $name Field name. + * @return string/boolean A string if the field is + * present, false if unchecked + * and null if missing. + * @access public + */ + function getFieldByName($name) { + return $this->page->getField(new SimpleByName($name)); + } + + /** + * Accessor for a form element value within the page. + * @param string/integer $id Id of field in forms. + * @return string/boolean A string if the field is + * present, false if unchecked + * and null if missing. + * @access public + */ + function getFieldById($id) { + return $this->page->getField(new SimpleById($id)); + } + + /** + * Clicks the submit button by label. The owning + * form will be submitted by this. + * @param string $label Button label. An unlabeled + * button can be triggered by 'Submit'. + * @param hash $additional Additional form data. + * @return string/boolean Page on success. + * @access public + */ + function clickSubmit($label = 'Submit', $additional = false) { + if (! ($form = $this->page->getFormBySubmit(new SimpleByLabel($label)))) { + return false; + } + $success = $this->load( + $form->getAction(), + $form->submitButton(new SimpleByLabel($label), $additional)); + return ($success ? $this->getContent() : $success); + } + + /** + * Clicks the submit button by name attribute. The owning + * form will be submitted by this. + * @param string $name Button name. + * @param hash $additional Additional form data. + * @return string/boolean Page on success. + * @access public + */ + function clickSubmitByName($name, $additional = false) { + if (! ($form = $this->page->getFormBySubmit(new SimpleByName($name)))) { + return false; + } + $success = $this->load( + $form->getAction(), + $form->submitButton(new SimpleByName($name), $additional)); + return ($success ? $this->getContent() : $success); + } + + /** + * Clicks the submit button by ID attribute of the button + * itself. The owning form will be submitted by this. + * @param string $id Button ID. + * @param hash $additional Additional form data. + * @return string/boolean Page on success. + * @access public + */ + function clickSubmitById($id, $additional = false) { + if (! ($form = $this->page->getFormBySubmit(new SimpleById($id)))) { + return false; + } + $success = $this->load( + $form->getAction(), + $form->submitButton(new SimpleById($id), $additional)); + return ($success ? $this->getContent() : $success); + } + + /** + * Tests to see if a submit button exists with this + * label. + * @param string $label Button label. + * @return boolean True if present. + * @access public + */ + function isSubmit($label) { + return (boolean)$this->page->getFormBySubmit(new SimpleByLabel($label)); + } + + /** + * Clicks the submit image by some kind of label. Usually + * the alt tag or the nearest equivalent. The owning + * form will be submitted by this. Clicking outside of + * the boundary of the coordinates will result in + * a failure. + * @param string $label ID attribute of button. + * @param integer $x X-coordinate of imaginary click. + * @param integer $y Y-coordinate of imaginary click. + * @param hash $additional Additional form data. + * @return string/boolean Page on success. + * @access public + */ + function clickImage($label, $x = 1, $y = 1, $additional = false) { + if (! ($form = $this->page->getFormByImage(new SimpleByLabel($label)))) { + return false; + } + $success = $this->load( + $form->getAction(), + $form->submitImage(new SimpleByLabel($label), $x, $y, $additional)); + return ($success ? $this->getContent() : $success); + } + + /** + * Clicks the submit image by the name. Usually + * the alt tag or the nearest equivalent. The owning + * form will be submitted by this. Clicking outside of + * the boundary of the coordinates will result in + * a failure. + * @param string $name Name attribute of button. + * @param integer $x X-coordinate of imaginary click. + * @param integer $y Y-coordinate of imaginary click. + * @param hash $additional Additional form data. + * @return string/boolean Page on success. + * @access public + */ + function clickImageByName($name, $x = 1, $y = 1, $additional = false) { + if (! ($form = $this->page->getFormByImage(new SimpleByName($name)))) { + return false; + } + $success = $this->load( + $form->getAction(), + $form->submitImage(new SimpleByName($name), $x, $y, $additional)); + return ($success ? $this->getContent() : $success); + } + + /** + * Clicks the submit image by ID attribute. The owning + * form will be submitted by this. Clicking outside of + * the boundary of the coordinates will result in + * a failure. + * @param integer/string $id ID attribute of button. + * @param integer $x X-coordinate of imaginary click. + * @param integer $y Y-coordinate of imaginary click. + * @param hash $additional Additional form data. + * @return string/boolean Page on success. + * @access public + */ + function clickImageById($id, $x = 1, $y = 1, $additional = false) { + if (! ($form = $this->page->getFormByImage(new SimpleById($id)))) { + return false; + } + $success = $this->load( + $form->getAction(), + $form->submitImage(new SimpleById($id), $x, $y, $additional)); + return ($success ? $this->getContent() : $success); + } + + /** + * Tests to see if an image exists with this + * title or alt text. + * @param string $label Image text. + * @return boolean True if present. + * @access public + */ + function isImage($label) { + return (boolean)$this->page->getFormByImage(new SimpleByLabel($label)); + } + + /** + * Submits a form by the ID. + * @param string $id The form ID. No submit button value + * will be sent. + * @return string/boolean Page on success. + * @access public + */ + function submitFormById($id) { + if (! ($form = $this->page->getFormById($id))) { + return false; + } + $success = $this->load( + $form->getAction(), + $form->submit()); + return ($success ? $this->getContent() : $success); + } + + /** + * Finds a URL by label. Will find the first link + * found with this link text by default, or a later + * one if an index is given. The match ignores case and + * white space issues. + * @param string $label Text between the anchor tags. + * @param integer $index Link position counting from zero. + * @return string/boolean URL on success. + * @access public + */ + function getLink($label, $index = 0) { + $urls = $this->page->getUrlsByLabel($label); + if (count($urls) == 0) { + return false; + } + if (count($urls) < $index + 1) { + return false; + } + return $urls[$index]; + } + + /** + * Follows a link by label. Will click the first link + * found with this link text by default, or a later + * one if an index is given. The match ignores case and + * white space issues. + * @param string $label Text between the anchor tags. + * @param integer $index Link position counting from zero. + * @return string/boolean Page on success. + * @access public + */ + function clickLink($label, $index = 0) { + $url = $this->getLink($label, $index); + if ($url === false) { + return false; + } + $this->load($url, new SimpleGetEncoding()); + return $this->getContent(); + } + + /** + * Finds a link by id attribute. + * @param string $id ID attribute value. + * @return string/boolean URL on success. + * @access public + */ + function getLinkById($id) { + return $this->page->getUrlById($id); + } + + /** + * Follows a link by id attribute. + * @param string $id ID attribute value. + * @return string/boolean Page on success. + * @access public + */ + function clickLinkById($id) { + if (! ($url = $this->getLinkById($id))) { + return false; + } + $this->load($url, new SimpleGetEncoding()); + return $this->getContent(); + } + + /** + * Clicks a visible text item. Will first try buttons, + * then links and then images. + * @param string $label Visible text or alt text. + * @return string/boolean Raw page or false. + * @access public + */ + function click($label) { + $raw = $this->clickSubmit($label); + if (! $raw) { + $raw = $this->clickLink($label); + } + if (! $raw) { + $raw = $this->clickImage($label); + } + return $raw; + } + + /** + * Tests to see if a click target exists. + * @param string $label Visible text or alt text. + * @return boolean True if target present. + * @access public + */ + function isClickable($label) { + return $this->isSubmit($label) || ($this->getLink($label) !== false) || $this->isImage($label); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/collector.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/collector.php new file mode 100644 index 0000000..0f8e91f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/collector.php @@ -0,0 +1,122 @@ + + * @package SimpleTest + * @subpackage UnitTester + * @version $Id: collector.php 1784 2008-04-26 13:07:14Z pp11 $ + */ + +/** + * The basic collector for {@link GroupTest} + * + * @see collect(), GroupTest::collect() + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleCollector { + + /** + * Strips off any kind of slash at the end so as to normalise the path. + * @param string $path Path to normalise. + * @return string Path without trailing slash. + */ + protected function removeTrailingSlash($path) { + if (substr($path, -1) == DIRECTORY_SEPARATOR) { + return substr($path, 0, -1); + } elseif (substr($path, -1) == '/') { + return substr($path, 0, -1); + } else { + return $path; + } + } + + /** + * Scans the directory and adds what it can. + * @param object $test Group test with {@link GroupTest::addTestFile()} method. + * @param string $path Directory to scan. + * @see _attemptToAdd() + */ + function collect(&$test, $path) { + $path = $this->removeTrailingSlash($path); + if ($handle = opendir($path)) { + while (($entry = readdir($handle)) !== false) { + if ($this->isHidden($entry)) { + continue; + } + $this->handle($test, $path . DIRECTORY_SEPARATOR . $entry); + } + closedir($handle); + } + } + + /** + * This method determines what should be done with a given file and adds + * it via {@link GroupTest::addTestFile()} if necessary. + * + * This method should be overriden to provide custom matching criteria, + * such as pattern matching, recursive matching, etc. For an example, see + * {@link SimplePatternCollector::_handle()}. + * + * @param object $test Group test with {@link GroupTest::addTestFile()} method. + * @param string $filename A filename as generated by {@link collect()} + * @see collect() + * @access protected + */ + protected function handle(&$test, $file) { + if (is_dir($file)) { + return; + } + $test->addFile($file); + } + + /** + * Tests for hidden files so as to skip them. Currently + * only tests for Unix hidden files. + * @param string $filename Plain filename. + * @return boolean True if hidden file. + * @access private + */ + protected function isHidden($filename) { + return strncmp($filename, '.', 1) == 0; + } +} + +/** + * An extension to {@link SimpleCollector} that only adds files matching a + * given pattern. + * + * @package SimpleTest + * @subpackage UnitTester + * @see SimpleCollector + */ +class SimplePatternCollector extends SimpleCollector { + private $pattern; + + /** + * + * @param string $pattern Perl compatible regex to test name against + * See {@link http://us4.php.net/manual/en/reference.pcre.pattern.syntax.php PHP's PCRE} + * for full documentation of valid pattern.s + */ + function __construct($pattern = '/php$/i') { + $this->pattern = $pattern; + } + + /** + * Attempts to add files that match a given pattern. + * + * @see SimpleCollector::_handle() + * @param object $test Group test with {@link GroupTest::addTestFile()} method. + * @param string $path Directory to scan. + * @access protected + */ + protected function handle(&$test, $filename) { + if (preg_match($this->pattern, $filename)) { + parent::handle($test, $filename); + } + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/compatibility.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/compatibility.php new file mode 100644 index 0000000..6e90fe4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/compatibility.php @@ -0,0 +1,166 @@ += 0) { + eval('$copy = clone $object;'); + return $copy; + } + return $object; + } + + /** + * Identity test. Drops back to equality + types for PHP5 + * objects as the === operator counts as the + * stronger reference constraint. + * @param mixed $first Test subject. + * @param mixed $second Comparison object. + * @return boolean True if identical. + * @access public + */ + static function isIdentical($first, $second) { + if (version_compare(phpversion(), '5') >= 0) { + return SimpleTestCompatibility::isIdenticalType($first, $second); + } + if ($first != $second) { + return false; + } + return ($first === $second); + } + + /** + * Recursive type test. + * @param mixed $first Test subject. + * @param mixed $second Comparison object. + * @return boolean True if same type. + * @access private + */ + protected static function isIdenticalType($first, $second) { + if (gettype($first) != gettype($second)) { + return false; + } + if (is_object($first) && is_object($second)) { + if (get_class($first) != get_class($second)) { + return false; + } + return SimpleTestCompatibility::isArrayOfIdenticalTypes( + get_object_vars($first), + get_object_vars($second)); + } + if (is_array($first) && is_array($second)) { + return SimpleTestCompatibility::isArrayOfIdenticalTypes($first, $second); + } + if ($first !== $second) { + return false; + } + return true; + } + + /** + * Recursive type test for each element of an array. + * @param mixed $first Test subject. + * @param mixed $second Comparison object. + * @return boolean True if identical. + * @access private + */ + protected static function isArrayOfIdenticalTypes($first, $second) { + if (array_keys($first) != array_keys($second)) { + return false; + } + foreach (array_keys($first) as $key) { + $is_identical = SimpleTestCompatibility::isIdenticalType( + $first[$key], + $second[$key]); + if (! $is_identical) { + return false; + } + } + return true; + } + + /** + * Test for two variables being aliases. + * @param mixed $first Test subject. + * @param mixed $second Comparison object. + * @return boolean True if same. + * @access public + */ + static function isReference(&$first, &$second) { + if (version_compare(phpversion(), '5', '>=') && is_object($first)) { + return ($first === $second); + } + if (is_object($first) && is_object($second)) { + $id = uniqid("test"); + $first->$id = true; + $is_ref = isset($second->$id); + unset($first->$id); + return $is_ref; + } + $temp = $first; + $first = uniqid("test"); + $is_ref = ($first === $second); + $first = $temp; + return $is_ref; + } + + /** + * Test to see if an object is a member of a + * class hiearchy. + * @param object $object Object to test. + * @param string $class Root name of hiearchy. + * @return boolean True if class in hiearchy. + * @access public + */ + static function isA($object, $class) { + if (version_compare(phpversion(), '5') >= 0) { + if (! class_exists($class, false)) { + if (function_exists('interface_exists')) { + if (! interface_exists($class, false)) { + return false; + } + } + } + eval("\$is_a = \$object instanceof $class;"); + return $is_a; + } + if (function_exists('is_a')) { + return is_a($object, $class); + } + return ((strtolower($class) == get_class($object)) + or (is_subclass_of($object, $class))); + } + + /** + * Sets a socket timeout for each chunk. + * @param resource $handle Socket handle. + * @param integer $timeout Limit in seconds. + * @access public + */ + static function setTimeout($handle, $timeout) { + if (function_exists('stream_set_timeout')) { + stream_set_timeout($handle, $timeout, 0); + } elseif (function_exists('socket_set_timeout')) { + socket_set_timeout($handle, $timeout, 0); + } elseif (function_exists('set_socket_timeout')) { + set_socket_timeout($handle, $timeout, 0); + } + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/cookies.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/cookies.php new file mode 100644 index 0000000..675bd20 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/cookies.php @@ -0,0 +1,380 @@ +host = false; + $this->name = $name; + $this->value = $value; + $this->path = ($path ? $this->fixPath($path) : "/"); + $this->expiry = false; + if (is_string($expiry)) { + $this->expiry = strtotime($expiry); + } elseif (is_integer($expiry)) { + $this->expiry = $expiry; + } + $this->is_secure = $is_secure; + } + + /** + * Sets the host. The cookie rules determine + * that the first two parts are taken for + * certain TLDs and three for others. If the + * new host does not match these rules then the + * call will fail. + * @param string $host New hostname. + * @return boolean True if hostname is valid. + * @access public + */ + function setHost($host) { + if ($host = $this->truncateHost($host)) { + $this->host = $host; + return true; + } + return false; + } + + /** + * Accessor for the truncated host to which this + * cookie applies. + * @return string Truncated hostname. + * @access public + */ + function getHost() { + return $this->host; + } + + /** + * Test for a cookie being valid for a host name. + * @param string $host Host to test against. + * @return boolean True if the cookie would be valid + * here. + */ + function isValidHost($host) { + return ($this->truncateHost($host) === $this->getHost()); + } + + /** + * Extracts just the domain part that determines a + * cookie's host validity. + * @param string $host Host name to truncate. + * @return string Domain or false on a bad host. + * @access private + */ + protected function truncateHost($host) { + $tlds = SimpleUrl::getAllTopLevelDomains(); + if (preg_match('/[a-z\-]+\.(' . $tlds . ')$/i', $host, $matches)) { + return $matches[0]; + } elseif (preg_match('/[a-z\-]+\.[a-z\-]+\.[a-z\-]+$/i', $host, $matches)) { + return $matches[0]; + } + return false; + } + + /** + * Accessor for name. + * @return string Cookie key. + * @access public + */ + function getName() { + return $this->name; + } + + /** + * Accessor for value. A deleted cookie will + * have an empty string for this. + * @return string Cookie value. + * @access public + */ + function getValue() { + return $this->value; + } + + /** + * Accessor for path. + * @return string Valid cookie path. + * @access public + */ + function getPath() { + return $this->path; + } + + /** + * Tests a path to see if the cookie applies + * there. The test path must be longer or + * equal to the cookie path. + * @param string $path Path to test against. + * @return boolean True if cookie valid here. + * @access public + */ + function isValidPath($path) { + return (strncmp( + $this->fixPath($path), + $this->getPath(), + strlen($this->getPath())) == 0); + } + + /** + * Accessor for expiry. + * @return string Expiry string. + * @access public + */ + function getExpiry() { + if (! $this->expiry) { + return false; + } + return gmdate("D, d M Y H:i:s", $this->expiry) . " GMT"; + } + + /** + * Test to see if cookie is expired against + * the cookie format time or timestamp. + * Will give true for a session cookie. + * @param integer/string $now Time to test against. Result + * will be false if this time + * is later than the cookie expiry. + * Can be either a timestamp integer + * or a cookie format date. + * @access public + */ + function isExpired($now) { + if (! $this->expiry) { + return true; + } + if (is_string($now)) { + $now = strtotime($now); + } + return ($this->expiry < $now); + } + + /** + * Ages the cookie by the specified number of + * seconds. + * @param integer $interval In seconds. + * @public + */ + function agePrematurely($interval) { + if ($this->expiry) { + $this->expiry -= $interval; + } + } + + /** + * Accessor for the secure flag. + * @return boolean True if cookie needs SSL. + * @access public + */ + function isSecure() { + return $this->is_secure; + } + + /** + * Adds a trailing and leading slash to the path + * if missing. + * @param string $path Path to fix. + * @access private + */ + protected function fixPath($path) { + if (substr($path, 0, 1) != '/') { + $path = '/' . $path; + } + if (substr($path, -1, 1) != '/') { + $path .= '/'; + } + return $path; + } +} + +/** + * Repository for cookies. This stuff is a + * tiny bit browser dependent. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleCookieJar { + private $cookies; + + /** + * Constructor. Jar starts empty. + * @access public + */ + function __construct() { + $this->cookies = array(); + } + + /** + * Removes expired and temporary cookies as if + * the browser was closed and re-opened. + * @param string/integer $now Time to test expiry against. + * @access public + */ + function restartSession($date = false) { + $surviving_cookies = array(); + for ($i = 0; $i < count($this->cookies); $i++) { + if (! $this->cookies[$i]->getValue()) { + continue; + } + if (! $this->cookies[$i]->getExpiry()) { + continue; + } + if ($date && $this->cookies[$i]->isExpired($date)) { + continue; + } + $surviving_cookies[] = $this->cookies[$i]; + } + $this->cookies = $surviving_cookies; + } + + /** + * Ages all cookies in the cookie jar. + * @param integer $interval The old session is moved + * into the past by this number + * of seconds. Cookies now over + * age will be removed. + * @access public + */ + function agePrematurely($interval) { + for ($i = 0; $i < count($this->cookies); $i++) { + $this->cookies[$i]->agePrematurely($interval); + } + } + + /** + * Sets an additional cookie. If a cookie has + * the same name and path it is replaced. + * @param string $name Cookie key. + * @param string $value Value of cookie. + * @param string $host Host upon which the cookie is valid. + * @param string $path Cookie path if not host wide. + * @param string $expiry Expiry date. + * @access public + */ + function setCookie($name, $value, $host = false, $path = '/', $expiry = false) { + $cookie = new SimpleCookie($name, $value, $path, $expiry); + if ($host) { + $cookie->setHost($host); + } + $this->cookies[$this->findFirstMatch($cookie)] = $cookie; + } + + /** + * Finds a matching cookie to write over or the + * first empty slot if none. + * @param SimpleCookie $cookie Cookie to write into jar. + * @return integer Available slot. + * @access private + */ + protected function findFirstMatch($cookie) { + for ($i = 0; $i < count($this->cookies); $i++) { + $is_match = $this->isMatch( + $cookie, + $this->cookies[$i]->getHost(), + $this->cookies[$i]->getPath(), + $this->cookies[$i]->getName()); + if ($is_match) { + return $i; + } + } + return count($this->cookies); + } + + /** + * Reads the most specific cookie value from the + * browser cookies. Looks for the longest path that + * matches. + * @param string $host Host to search. + * @param string $path Applicable path. + * @param string $name Name of cookie to read. + * @return string False if not present, else the + * value as a string. + * @access public + */ + function getCookieValue($host, $path, $name) { + $longest_path = ''; + foreach ($this->cookies as $cookie) { + if ($this->isMatch($cookie, $host, $path, $name)) { + if (strlen($cookie->getPath()) > strlen($longest_path)) { + $value = $cookie->getValue(); + $longest_path = $cookie->getPath(); + } + } + } + return (isset($value) ? $value : false); + } + + /** + * Tests cookie for matching against search + * criteria. + * @param SimpleTest $cookie Cookie to test. + * @param string $host Host must match. + * @param string $path Cookie path must be shorter than + * this path. + * @param string $name Name must match. + * @return boolean True if matched. + * @access private + */ + protected function isMatch($cookie, $host, $path, $name) { + if ($cookie->getName() != $name) { + return false; + } + if ($host && $cookie->getHost() && ! $cookie->isValidHost($host)) { + return false; + } + if (! $cookie->isValidPath($path)) { + return false; + } + return true; + } + + /** + * Uses a URL to sift relevant cookies by host and + * path. Results are list of strings of form "name=value". + * @param SimpleUrl $url Url to select by. + * @return array Valid name and value pairs. + * @access public + */ + function selectAsPairs($url) { + $pairs = array(); + foreach ($this->cookies as $cookie) { + if ($this->isMatch($cookie, $url->getHost(), $url->getPath(), $cookie->getName())) { + $pairs[] = $cookie->getName() . '=' . $cookie->getValue(); + } + } + return $pairs; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/default_reporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/default_reporter.php new file mode 100644 index 0000000..9ec708d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/default_reporter.php @@ -0,0 +1,163 @@ + 'case', 'c' => 'case', + 'test' => 'test', 't' => 'test', + ); + private $case = ''; + private $test = ''; + private $xml = false; + private $help = false; + private $no_skips = false; + + /** + * Parses raw command line arguments into object properties. + * @param string $arguments Raw commend line arguments. + */ + function __construct($arguments) { + if (! is_array($arguments)) { + return; + } + foreach ($arguments as $i => $argument) { + if (preg_match('/^--?(test|case|t|c)=(.+)$/', $argument, $matches)) { + $property = $this->to_property[$matches[1]]; + $this->$property = $matches[2]; + } elseif (preg_match('/^--?(test|case|t|c)$/', $argument, $matches)) { + $property = $this->to_property[$matches[1]]; + if (isset($arguments[$i + 1])) { + $this->$property = $arguments[$i + 1]; + } + } elseif (preg_match('/^--?(xml|x)$/', $argument)) { + $this->xml = true; + } elseif (preg_match('/^--?(no-skip|no-skips|s)$/', $argument)) { + $this->no_skips = true; + } elseif (preg_match('/^--?(help|h)$/', $argument)) { + $this->help = true; + } + } + } + + /** + * Run only this test. + * @return string Test name to run. + */ + function getTest() { + return $this->test; + } + + /** + * Run only this test suite. + * @return string Test class name to run. + */ + function getTestCase() { + return $this->case; + } + + /** + * Output should be XML or not. + * @return boolean True if XML desired. + */ + function isXml() { + return $this->xml; + } + + /** + * Output should suppress skip messages. + * @return boolean True for no skips. + */ + function noSkips() { + return $this->no_skips; + } + + /** + * Output should be a help message. Disabled during XML mode. + * @return boolean True if help message desired. + */ + function help() { + return $this->help && !$this->xml; + } + + /** + * Returns plain-text help message for command line runner. + * @return string String help message + */ + function getHelpText() { + return << [args...] + + -c Run only the test-case + -t Run only the test method + -s Suppress skip messages + -x Return test results in XML + -h Display this help message + +HELP; + } + +} + +/** + * The default reporter used by SimpleTest's autorun + * feature. The actual reporters used are dependency + * injected and can be overridden. + * @package SimpleTest + * @subpackage UnitTester + */ +class DefaultReporter extends SimpleReporterDecorator { + + /** + * Assembles the appopriate reporter for the environment. + */ + function __construct() { + if (SimpleReporter::inCli()) { + $parser = new SimpleCommandLineParser($_SERVER['argv']); + $interfaces = $parser->isXml() ? array('XmlReporter') : array('TextReporter'); + if ($parser->help()) { + // I'm not sure if we should do the echo'ing here -- ezyang + echo $parser->getHelpText(); + exit(1); + } + $reporter = new SelectiveReporter( + SimpleTest::preferred($interfaces), + $parser->getTestCase(), + $parser->getTest()); + if ($parser->noSkips()) { + $reporter = new NoSkipsReporter($reporter); + } + } else { + $reporter = new SelectiveReporter( + SimpleTest::preferred('HtmlReporter'), + @$_GET['c'], + @$_GET['t']); + if (@$_GET['skips'] == 'no' || @$_GET['show-skips'] == 'no') { + $reporter = new NoSkipsReporter($reporter); + } + } + parent::__construct($reporter); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/detached.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/detached.php new file mode 100644 index 0000000..a325e14 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/detached.php @@ -0,0 +1,96 @@ +command = $command; + $this->dry_command = $dry_command ? $dry_command : $command; + $this->size = false; + } + + /** + * Accessor for the test name for subclasses. + * @return string Name of the test. + * @access public + */ + function getLabel() { + return $this->command; + } + + /** + * Runs the top level test for this class. Currently + * reads the data as a single chunk. I'll fix this + * once I have added iteration to the browser. + * @param SimpleReporter $reporter Target of test results. + * @returns boolean True if no failures. + * @access public + */ + function run(&$reporter) { + $shell = &new SimpleShell(); + $shell->execute($this->command); + $parser = &$this->createParser($reporter); + if (! $parser->parse($shell->getOutput())) { + trigger_error('Cannot parse incoming XML from [' . $this->command . ']'); + return false; + } + return true; + } + + /** + * Accessor for the number of subtests. + * @return integer Number of test cases. + * @access public + */ + function getSize() { + if ($this->size === false) { + $shell = &new SimpleShell(); + $shell->execute($this->dry_command); + $reporter = &new SimpleReporter(); + $parser = &$this->createParser($reporter); + if (! $parser->parse($shell->getOutput())) { + trigger_error('Cannot parse incoming XML from [' . $this->dry_command . ']'); + return false; + } + $this->size = $reporter->getTestCaseCount(); + } + return $this->size; + } + + /** + * Creates the XML parser. + * @param SimpleReporter $reporter Target of test results. + * @return SimpleTestXmlListener XML reader. + * @access protected + */ + protected function &createParser(&$reporter) { + return new SimpleTestXmlParser($reporter); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/en/docs.css b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/en/docs.css new file mode 100644 index 0000000..18368a0 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/en/docs.css @@ -0,0 +1,121 @@ +body { + padding-left: 3%; + padding-right: 3%; +} +h1, h2, h3 { + font-family: sans-serif; +} +h1 { + text-align: center; +} +pre { + font-family: "courier new", courier, typewriter, monospace; + font-size: 90%; + border: 1px solid; + border-color: #999966; + background-color: #ffffcc; + padding: 5px; + margin-left: 20px; + margin-right: 40px; +} +.code, .new_code, pre.new_code { + font-family: "courier new", courier, typewriter, monospace; + font-weight: bold; +} +div.copyright { + font-size: 80%; + color: gray; +} +div.copyright a { + margin-top: 1em; + color: gray; +} +ul.api { + border: 2px outset; + border-color: gray; + background-color: white; + margin: 5px; + margin-left: 5%; + margin-right: 5%; +} +ul.api li { + margin-top: 0.2em; + margin-bottom: 0.2em; + list-style: none; + text-indent: -3em; + padding-left: 1em; +} +div.demo { + border: 4px ridge; + border-color: gray; + padding: 10px; + margin: 5px; + margin-left: 20px; + margin-right: 40px; + background-color: white; +} +div.demo span.fail { + color: red; +} +div.demo span.pass { + color: green; +} +div.demo h1 { + font-size: 12pt; + text-align: left; + font-weight: bold; +} +div.menu { + text-align: center; +} +table { + border: 2px outset; + border-color: gray; + background-color: white; + margin: 5px; + margin-left: 5%; + margin-right: 5%; +} +td { + font-size: 90%; +} +.shell { + color: white; +} +pre.shell { + border: 4px ridge; + border-color: gray; + padding: 10px; + margin: 5px; + margin-left: 20px; + margin-right: 40px; + background-color: #000100; + color: #99ff99; + font-size: 90%; +} +pre.file { + color: black; + border: 1px solid; + border-color: black; + padding: 10px; + margin: 5px; + margin-left: 20px; + margin-right: 40px; + background-color: white; + font-size: 90%; +} +form.demo { + background-color: lightgray; + border: 4px outset; + border-color: lightgray; + padding: 10px; + margin-right: 40%; +} +dl, dd { + margin: 10px; + margin-left: 30px; +} +em { + font-weight: bold; + font-family: "courier new", courier, typewriter, monospace; +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/fr/docs.css b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/fr/docs.css new file mode 100644 index 0000000..4917048 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/fr/docs.css @@ -0,0 +1,84 @@ +body { + padding-left: 3%; + padding-right: 3%; +} +pre { + font-family: "courier new", courier; + font-size: 80%; + border: 1px solid; + background-color: #cccccc; + padding: 5px; + margin-left: 5%; + margin-right: 8%; +} +.code, .new_code, pre.new_code { + font-weight: bold; +} +div.copyright { + font-size: 80%; + color: gray; +} +div.copyright a { + color: gray; +} +ul.api { + padding-left: 0em; + padding-right: 25%; +} +ul.api li { + margin-top: 0.2em; + margin-bottom: 0.2em; + list-style: none; + text-indent: -3em; + padding-left: 3em; +} +div.demo { + border: 4px ridge; + border-color: gray; + padding: 10px; + margin: 5px; + margin-left: 20px; + margin-right: 40px; + background-color: white; +} +div.demo span.fail { + color: red; +} +div.demo span.pass { + color: green; +} +div.demo h1 { + font-size: 12pt; + text-align: left; + font-weight: bold; +} +table { + border: 2px outset; + border-color: gray; + background-color: white; + margin: 5px; + margin-left: 5%; + margin-right: 5%; +} +td { + font-size: 80%; +} +.shell { + color: white; +} +pre.shell { + border: 4px ridge; + border-color: gray; + padding: 10px; + margin: 5px; + margin-left: 20px; + margin-right: 40px; + background-color: black; +} +form.demo { + background-color: lightgray; + border: 4px outset; + border-color: lightgray; + padding: 10px; + margin-right: 40%; +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/lastcraft/README b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/lastcraft/README new file mode 100644 index 0000000..488198a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/lastcraft/README @@ -0,0 +1 @@ +Output folder for Lastcraft site versions of documentation. \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/onpk/README b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/onpk/README new file mode 100644 index 0000000..fc1dd62 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/onpk/README @@ -0,0 +1 @@ +Rpertoire utilis pour l'extraction de la documentation au format du site onpk.net \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/pkg/README b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/pkg/README new file mode 100644 index 0000000..821b4f6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/pkg/README @@ -0,0 +1 @@ +Files here are generated from make_phpdoc_docs.sh \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/README b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/README new file mode 100644 index 0000000..4126955 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/README @@ -0,0 +1 @@ +Output folder for SimpleTest.org site versions of content, documentation & tutorial. \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/favicon.ico b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..d4c1cc1225da193f0c2d7ad1ee6015761f2e2203 GIT binary patch literal 1150 zcmZQzU<5(|0R|wcz>vYhz#zuJz@P!dKp~(AL>x#lFaYJy!TB1NKK^*8gscW1d*S)6$;LAo{vzYT9scM3{Qbj~#`|hnzhnex=!$0}u%l{S5ne(sd?3LGX>6;uMo6KYa zhk^fc-mn{9$a{J9C z$15*Sh6CLzyzbhpYGl1IcH{n}o&Ns+PQ&!VXaRwLKi<9jCku1mvP=DwV0w`0vR$Ev z#Ka)>!t}!EW5@ob!1UjLciqWy4*MTuy&(3sTT2Q}P5(WG>4DL#tpESsz5Cbd{IkQs zi!XG~-*snY?uHxlCO9n+`U=u#HHYKxq!Z=qfN70=)24rkEG+;3!1RLXjEuj>`;Qf` zgM}eTPux1wr_Vn`|DX3RKUHyfr0AHC-4j3$tJbey}*;}$-BFu5ZSx22%#1@T)Crf-6&!AAqrF+VV^ z-9|RUX@T(PhwpC@%mXlUzx@0py5M~0q~aa^hkA|{ta<$5jv-7Anf_7F!0^Ey2`e)& nyl`Y-XgJl#C2a3I>x?(LW)lprr(ZsTrwh85p2YDEX6T%+Daq z^bjcIUzY$Mj)L$&B>4Cw5DG8_1qNb+f%iQC=!2iQz<(FO ze+m!_8|T4Gd;&tE2ZQ>@04yLjHr9jx4*(C=z7P8V955~!Bd;VLxta;+nG*$HKwJ(! zlT>vlrTWAXGry^GAORuO6KWdT=Py`Zva-E;E$~KANLc!vjI5lzf})0|mbQ+r-bXX@ zPZpL|);2D#ZtidoPp_chkkGI%U&G@Q5|ffsQqvIMbMx{G3X6(MYHI818ycIMTe`Y? zdi#+51A~)O(=({qUvu*-t843jHa54mcQD5%r)TFEmsi*S;sOG&{{!nm{|DIr-~vBz zVLgNe2lOv4AQt>#VuNvT8F}%@B-KDBPUO${0`MuM;&Q4x37GiRk0?!@CkUySU#&dH z{0r^h$^Lg>f&VYE{{s7Ou6e*CY~Vxiu)zQcz!s%%@%o4M>9z1X{M)?XXfKT!E5Q*V zC)8)!uEdyAw{w^4fWH*wD%lvV`)(qxfdiz7yk^Lw&{i ztP-m!1LFa2ha#~$@{X$aMW34pb&q;(e|nq*>CGtTo7s@Cw%hugF;$`VxK`@SoG4rj zdTKa0)*Ki3K(n`O`i2hjO=b^I2@BOmMxxBs#Dd;h_Xws<#wZi<3XU)p)0l}8i zhO(O~4p6INxQ(WPH1j7~vfpq&{Xb)NXZuFhmm1ftoY4l$80>Ss#Y{swD z=(SN?dM3i|kbmPMK}w8*ptH z|E0=mmL?j}yh0;(T-1D4nW|U7esvGP{VO-m5rg#?xq1&6u3a9346RB~SsOtODa+QU z?bYXABs**AMFScl`?il=eo{q3+3YbUlnf|gN!4`g> ztZni%tg`NAD8lxe5WfR&$hvCU8|+BzGfMQWVDqFyJG~Fbj9Z&(KdQp=??hxx`|f~+ z!bfvD$pr=H8~3d>0!7K*?M<$ z|3T+bA697!pBLBWi&d*Mbz9FIj@Fc6sb**lDzz_fdO34eTi-T`{gql7S7EglydY{YAF8tFo9enxA^1;S&7MO|{!ty`DuKP{x2GahbKTGQ&dVhg_2!utn`R(2 zL~cbZaVqA$PP1((gw`D{*i=|IRo6y)qk6p28m4q&Kgsc^hq0f;n_Y_U#ID~HlR#mf zOom4&B-r6lAy}b1k?y)7Quwuy1x|Ml&=I=wk@1mPui7p-(&tCE<*}wwHmt?IgwS%^9^g-+pd}SI-0#~_v5bwZ<%fn;K1hn-<@`Um#gRHmw>Xe&& zeAkO6X@08a6PhI8VjaM62$Bk)x zDG%xMlpuMW>P@-u&stWe^JMt&|8V%hCgShhaJU}Wd)4`A&BPMlq>qMzBB zdY|t2y6D#Y(o+%{d0nQV#PkFnCtb@c#GEi7R9wCs2tDILLT^fNT{Kp#i%%54FWvZe z3g-938WT(O?4Cxji*cb>`a`C66f=E`>%t7eurKUQM7{oD4XnDH3gzx95K!DdqHDMvB;Hysq^A zdCakUozYiYeh;u}EBkWHY-C23O@&Vx&7UdHf+kPq0S1X2gr}CZe>{B#qceGmQYdK$Wx=w7N+F`vp zC(MkqE=q)8aIy_OZ@2PS#>fZpYrVbfu z8Zk7StPwkpmXSLLZ#OfvY!=P^o_5k&8PAD7)&G_}f5g$*;GDf4Fv|eA-MXIPTD{IN zLJF6vK5OCRm#X_QwH!N&Q5-zjd&@-FV^)Neyq-jFHKfq;jcwxp(d0m8Iv(T(Aq5$P zR%6OFjAJ<%bS?}w+@}(CBt5ew9fZ+$1sY606baNq7CKx4UDUht=Dy|C>MrTTkGC{4 zn?y7YJ9@v|9$#C^LKV+%i5IJ%TfXW-P_=ZgpcUd@<{-3EhDdZPq|F=c&N`q;Z+(QY z*4%cvWSu{FpUiF_j;PME!r6CTx6*IXYtY!d^(f%2$c;3ex)RKh5hYD^T1t^TdsFdh z#C{OGVS{;>{u1IHW9NEJC||e#X`!zr&u&K`>Eu_e7=Evv2VznwiVtH%iTFVDPH{75 z6SC}DDPG?i|6A=Vqr0BoXDQ*(F=&RL$7KRpr5m*Aj_%H&t08{FpTEJEu4i)S`Q#3` zbWqYczUH8#W0_Pj=!T`ok?G~MCRVG;bLY3G^g4PaHXr@MlP_p9zr()A-PVQ>r$={S zsS1`eBwtuFjFck9esuG;2uMQe^EvJTc%g)EO1YJlP5-WE+?*ZpVZO7O}=lDO{ z{6K|@<_PV&7boJ2v;%c7v=-=rp9Lw=HcAw4s8E=kcxz_p%Qfuuge|rnRF3>}Stp}J zm++ic;B~O3i7hk+h>f>|S-c_#*`yoxCtJM4MX$4LN9*M{H zfxqznUIs0O@m=gX**&1ep#?NG9W&ZIM(V+C5QJ>>8W}BNsY=T;d2F$?GdCYe3gCub zj8Xio-)TTa{An)ZBUFBIc#)byEAZpkA^B3|2<};-3Svt4nndQ?F4+qIX4uQu3yz6z z9$*l*Xp_4Uc-ct;bg&OhZ>Y+iXS!pjv7BMbPg&5pZd18vy&2>BJB$IO@=W8q+#1=& z7(2LJO_yeSM238tj@_rG&bWjo!7q}lLWO{G<(9ESP5PAo_?@dNE*JMSg@|kBUeH!R za%>y9e;fx)rp~;i*U;733hTf^cx9#f+E9+j^EdfgyW%$Q#N(Q-39iTbvVF6j_w7Zd zJ+EWarA$laNZ8>6d8K^F+6(_=WtpTD>r*t8bn(=DZHw4^`}!>M`is7I(VT@^(!v|r zJHnPTjZ7ZzxLG$p*6?n*$LTEfV`ytl*TwNMs!InI)PDJ1=FZNdiP^bz7ysUa!+nyEP8 zwwQGNR%Cu`{@h_RmU=(PJjvl|tK$HG9nI4NX^$ejou0v2%6PPqaiCgeB$wY`_3lKq z=>1LYpJa>WQ?+Z-u}H*3J;J#53K2ZfrvL=0=LUp|5m`=Qr@JU(tZ9ks5J5XtV{Er4 z3(9;n1oWFRcQ}4nH5EQ^SV@QWAc6fVwYa&Wo{BK}pD>d^{=x8lWu)w=UKby{x<0?W z7_kb^VAKLqMgW{u#VIQTJ8 zutDJdPwO(GA(4G4PHx@SqbXbUt(M?|14`4lQab=PR>BFuC7y&ANjY~Ztug_t`}QqL zeAH@XhG&&1mWbKorVuUiWw(PP-?(p|tfUN7h!vUv9$jkvJdgLA;o4Dzfm54!# zCuIbOoopgP-WK*>oW=F_h$236Ec@{MPF)IUA?5km|(z zGF8(uE6S7#O8y>*uWb!ympE5g9&#aRmhS;!>NX!k_e~D$_5(Nx6@Utb@0aP# z2<1CFH#3vAQ|4vU^0%qZg~dvwpU>&8hKUZ6at!-QttafqD2~?7#?Nauqc|!!3**Ha z&M~zuh9YrMmA7_|0FCIYHEO?#*ZM59Nobk7+Nbg>;ex|MH11u!vxz1+I5WD2g4!@E~c` zIpsHT#pxL2qep3{*Fp=KvSXN5eY7_35Ov>bYi)BhiL_I4|Mr;2MdNpkb7KB|Ynu7F ztf2u0Df7op3-Nd!Wn!csBR))*@73)R+spqEv<+!6Z!~t^1ELRpcxiEmH_l#bj>|kc zv^I@Pwv?Uc6I0Fi(2M5s(9Y#FKR*`psReO#eGl1ljWaMXy!<|SJlS_Vvh*ZOO)vYC zayD6{!j%$e8O9Q7-_-&K`=%D~p;c5XDNowM_OT1LsU9k-B<^}yIl&}NGpP2{tid+A zm5bg=VvioN`n*i7rOEeXTmyhJY-XNoT7-mNx@L(i(uj#*FFl8b#eR70^D3e%os^>Q z_4W2;mKudd$3sqqU}a{T`&w-gxzu1p;rrrQ;#vHI)%4SU@B2-e*y9+D10YgH}hApSjtOb%~?qXVx)OtsNw zJN{`lJ$+pN>x>F(0k3fw+b#5&mCAB?eKd_Kjy7aTOJDWfkQP1TU_^4J_k4M6e7jQ3 zfvkw54nd@kCT)IObYZTcs$;@v_{NI%Vwwe=_=;2>kKIcq9Jj(woNI$97=2Si zGHyeoVKZYGQNn&xR(7dluM5R!=-A`FPDWr&udn3JPiaGAT{qTVPTD&XONuYl7WR{KP!Gck z7@Kx*+Dei;v^k{{Dkb7YJN>QW;pweo{W!=;a%^?MP(a-?k>xZC&3F4rBu;i2q=tD# z`}1qgar@A-k#ikK!@=~ZUn`nkew620P9ByD&zr{tmEs3EU%^chpgTGz5^KsP>- z6>!22f(2ES=M55c8`CxjCs7Sb>mH}c)ToFr`}r;IVVaNMna>BY1hhhzSPF&i0gS~s z?=a;gD!k(X>E>v?$Na+Gp<$b& zu=li8Rkv%Pugua5Ip)&GIz^!3G0|mr$XQ|+0`%%G;egw&m2QRIXk^QxdWXU2CI{}v>-dsQ+T8^1S)ntS| zz5T=sBq7mCS$f9#E$!rQyYbE5G-hG6Vf||I)9AzrBq-sIor@?W{v|?{Q}3!v9P_(f z*a?-OF^!u?W%RL^Wu75P={?wkW;bYCxhdcMWgl$L-s<)6J>XR~ah zvfZaA>p_1}(9^$%#aGP&U>#M>H;l_ze@{w*vPqO$_UT}`840@5_$Y{6N{~3Hyj;!b zwSbEYK}mfWOB4!!TMN$&SEJ<|{YKat2M<0t>O$~^1d%GvHuzlaP$L^10b0MH%Eh+& zF8%(ko#K?VXR?omf!chmpr(O+qjfN~y}7!4pL~V(rXnWt8a9lrTOH_WE^bgQ6GU(6 z2e|TzEFdkq{mZi36tn5?c`b2nPyW}pvKay^UA%oW#ck2pGnKr!a# zeBM&VBRj&9NH73Q+-Kh3b3$hKsrr?hMS0?9Zwg_zL5+I+MQ*xpL z#IhUsCpAJDPgts$2}}EIHkw;+OfQ1&0Z=mkE!kq?xh>m$(?beBx7XIMAdoGKh*G93e6A6pca^vlOlCe+xu>N_I1n5z>4aiH{P234VE*ADX7)ze6i^s&=J!> zq)bTU3CmiaSq#HrP1w>$%?p7Kkmy%pka_L1{x>J`90a0)%MH(sT24SUf z;p2I~_seU}{JCbXIdkUE%zfX^-Yx?u)l{G=032KZ!0yffxBCF9=dW#D0suGwd;kEz zdPf}s?kn2CZ0rGcpY9l(+j&4FfRdDyl#G;;jEs_jf}Dck0WBpZ?E^N3f567d0K5YO zD=UbLn+wD$EG#ZAEUfTK}ADFM@>yfOLb>JT6%g~;3FWA83=qN0%E-bNQ7UA zo10sR|M6oHk;jh}6y*PRiQ7*ADk4BRAPNtM1At3~gGYsP+Xu+K>yH5EuFL-c4lW)( z0U^%6@&9>B04@$59xfgsE-^kX-d*%A9YBTukeWc0Mp2i;+Ea{{j_?^MJhcebJ7$9v z*Yk=nSm8X<=b{4O+{p+C3IC<~M+l(8eJH9+ji+cG&OvkJnOY>K*E{yi21$!rIo8L& zodb~J;oNnKM+J}vtdu$&f-6?#yK~z=eiJBI4-LScjyoJ*j47r(AZABvKpbMk4%!=7 zIAoRR=lrOHCC{c=vR_-QSILP<=tV;*f2P(GfuHLMd(Lt!G*SXsppPdoPBEFe1s(Xt zZzKt*t86gD>TyzmwW<~BE9Bqe%jidNVmszja?{9g^CgQpg&N#OJuL zimJ5Pb5aII@JdN#*JmcK>2vcr=N&QoZS$0rbhAgTvGV)deo)Ks-wKne6lA^Tg+5Nr3J-=L4(Lzd;-+Nqi^>s zEGI|73_>D{uQE5S&VFw`&_OwoIe_M#DF2f<^#P+TXI#Ry{pswx;k#mcNLgk|`c=@DPeUPHWm86tzN_p3_@%(2PZWtW$97GEBYG zKgb;!*EQ1>+WaHo4ikqeQ^|U}$>f(@j6pB7KZXK%;_Pk#pzG1!b<7_HcGA7P9in;7 zIDMiP^;8lm`B?H94C%Ye8%zJ4^YKeRhDm!6ibNn4_xjyd4f8l=t2+&jj&}?cB^+H2|X} zE=|OI(qdtt&vgDm5@&&==pRDPLs61-)34hrk(?-8gy#94d-P=R0LmNH;Q7akJ?nQ4 z_tRBSEzW|EaS~h#BtcJI zVLR4tE^Lt_78aK#qnKd{@#hWo%hlr`d~R5EZ=He`QKN4=K`bXZ<6cEKvO`Wwo&L$O zDJG&fnYk)AW=~!m#2{PO>H;Gx-uG$tPFM6%+3Y%mZ7Gjx<4q&@iiJXr)rh&@$EfiX zb0GfHx&Cr5$tTi=(EMimir_GnAGrB*y$26&OzPM5;xg7njEjH8cibGYb#?1BdVv+J zOSFRCsGb-6GSmNq)Ero~7x5b&krDc08uON=gXCw&M{Q%&p@FQ7x@MH=3B9yJgDc{)=!> zw&$YU>+idd`943jEL0A^F>CerS@#eX`YFr7{eW%$-VS!^G@CK(rOrEys-lbayKvz$ zRpEOB%5pzk$$ktRTZpiHO>lRg<)lB^D}%Cep(RVi5^DLSALaM^ZYMIQnAx->5C{@Wp;DgpB&UCEe<% zJu&6@Sq84}*95hJ1PpJ>CsLDC&mdrm*VuhAIYFe_!1k`ay?t!e!eW8e#;;Xj=ds>( zkA{Y52OBg{Dd*DjFxQ1WHA96^By#X*rztV`tyesU5JPIl<5bWCiw?A(!i(aIDMc3~ z?~_`_#`1IrKgdcnbkt2r`XK%QkUCw9{#NR}GCap=BX_8L(D@O{3N$-4PFR1Cj116` zytG2n+PjsJMa+k@8q{#0GCxCE?fhrIGk;_D;?OW+Qp^gpwR5=WS{ibdqc`Z`-iy2M zlSsn)N&E``Whoqnp;%B+12it? zjS950TGwJl31!Ek$gtmP?gm4#an24LT;QN1HRCT^+xsdOOxT_=cr>B{*ibdvM3|= z>C-fuCHY7fwZG!U3{F3IdURA3L#bwds@!mIJ#1)D$T*Za?3B!R^R!*%dqR`^%3yuu zx|OQQQUNlv0=|+%fr(1x1U`xT(GR&5N`aAc!sa^@i<<6&8rY^hSN*`WEsrwo%$H3) zHyV1}rX?m>t^K|!trfj)6}x9+;-36uU8Rnxi6!me{O+xHeBgH4ykCKSZ%JbFHzq*4kT+(&-cQ8**@pF zd4$A_QENu7N)zWQoJvfKr|(z*`M&;nVpy9!MX)AzihX6Qb|*zvOWUml32A%z=9l{1 zYPn~J1Nm5XT>DIwO-1D~Hrc6U@?HofZNX}2~EW+8#C9VZ`0@z7Rx_mKvdFswhw^7~Yvz9}|O zzO&c6$=F`%r~lXr{Kwl5r0pMhMY^Zfq*MgqA7BwiVYP#kE1-u7ic=}jsWeRSE`llQA8(qv5< zx`L%}c9o*~Z~nFD7Oo`No_MrKVwdrPC3ku1e7M6pU)Y|VbniK|^#6zr2qRr}P!;2G zoQhhbI6^IYuzVEoyPr|#5Yw03&m8+|``~hR!)$fppeHb?& zHq4icq&2s>-a)PfPodQX6mz*;xrS!@e}rGyx%U)zkq#~12+^vhEORdX@jRfRnnx#^ z#C{GvlZ9)1F1HYF#ym=9B}2zisgI@!m&%_M=epbizB#30XWB>pX5a^q)wI&7MIl7j z?Aez}53x0Au_>iN-WW5ChN59?T3vHv!Tse#;VfDU?KZf$K3+n~;qzyW3$}?_0Y;Xw5{~E~|Fz zmL~>vR5Ao_(KdKxKHl=zsO0G}k$Gmer`+SQXpb;`!K}P?-I2NOfHoQ!_WooS;DxP z<`3Tc2u4)zYIhedi?qE<5AdQ3N^tK?{$iZ$`YbAEd?8yNrE z60##Xhjmx;D%25O+2FSUj{uJi2>t|g_g>v-;+{N`xdO!D)hlgT7QZ^$U0J4jePy+;tEbc`EJJHQ65O;_wOV7oRnE zx5j2-X?|J3gCCm)Ur!tccFa5#>ey3<1^m4*<=E`Tzj9M5L z+L&}0#flF%?Oy$%ly}0g8m4pr!NW7r>)YMS%hGX~yB_6|5_p)BmeOnAr2HX@c{yz! z`)}w>R6+@6?ILs?S}85xB0}aY!YudufED~YE*I?ucP2op@DQEgs!iGuZXP^KB3{DI zTt~Ds%zx}7yEM_zW7k68(<3nM-H>)=Zs)d|7!HyZ?K!9_xqgp~VYI1^GB-g1=YJYM z-1Oi0!v8oSWBQApbF@%@%|_Q`N{VBWBdaYQotb<)8z{vhU)cbEjFy~0bJ%Oak&9FJ zSt;IeSMAd&J!Sz5(!BD@kZouY%78XgB+-y$1$ZedX>NHiE_jPf)D}fw5=NBx(wS2GuECk(8IOs~hbH<-*su@LnlZ2ZH+2_Eb=I`NbxdVE6s zGFohMEoKa4L^Ge8jl5VA8ASS;>}<2V!Aqq4>zM0u!I*XrH)Ypg8{umB3=DHHj`$8) zb?-QR&4fXZpDlgws0}e^NKGvIt~DOTYvYR~LiKc`E-9K&7&D7{SxgD!Jqda&53aR& zd}cJt`(a>SL;JkO6cH` zse)FkpU&D;r_uqPoAmF36y|FJU3-Af*>r+MzCcl_M}(tZ`R@Jb2CoYf&==DpN7qbP z7+msk`CDh{R)Nil+&C}l;AacZlI3jH-9%X^^t$o=jo=rb*@>je3fTAw!qU|k7+BdS zz}Ab=e+u`Uw|G?yQk;Z7OiV^u3;gJkEY-+fqgVNGRF?d3Y8WM;ZGKu+Zi0wP?2AmM zkf~})b9s;~6RE~2DrO!&k(Kc(Rvx!j^DT>H<;*;k*0TXud9eBnYx7oC_%ozx^8FKo zZL-92^VI?|0+_ZopYzvsJ&WeU*HtB{5Y&%L16(oA8qm`xINpfZXr=W)MBBRz^XCs+ zHZ1vSc=hJ)=RXENGVAqNUlE)mTsO)-r)f z?VMWxUtZfSz~1;(!!c8IHGx^*1}Gu08?>ggk%KbD?z{_^Hx#{(` zGH3_`K1YGUbY2F~4Y54fc(q26MVO#P8I$6OChPD-MGd(M4f9WDed6{aCDD_3gx1^B z^tY4}T~?IPkxr_IloAs}%?uJ2x~8(VEmDiZQDDY7?>naR?W7PPhWr6YWU7z&< z-#xX{Hp%17CknAAMrMq4ThpH`M+p}D$wXX81RSrFt1vh`O>g{f>YQG^AIZ~HJsrjH zAD*lnBu7Mvis~#rR0dlsR8`5r0H?(xCHFA_;msDOEL-Kb9kX4Kpp<1g{)x+YoS}P-u6*xVX2f4J zTh1R7(qr_}{GO$7wpaiosx zl&Zu&+xew6HH%m_YcjySiBS{V#fZ(8yAP4#%3=gh?0_ Dj{TPW literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/book-the-php-anthology-object-oriented-php-solutions.jpg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/book-the-php-anthology-object-oriented-php-solutions.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d0e502bb21a224ee5455c821bc25a2bfec6290ee GIT binary patch literal 43265 zcmeFabzD`?(>Q(!0g;f9knZkAN*XEY2H|q)?vPLvkd$tak_PD#Q0eY2X=&-a@H?Qs zlhy=lRQXUuVzm?Ck99?3~@b%-rF6;`%G-{u43-MP(!Kt?bGf8;G-Xn*3s0yu0SAO#Tsw*w6O zZ5|uQhX$B~;D5Hw0-giF4fJ?J^~dwEv8@q=^r@MxldYqftsSYD3aN&FAOv6AG8T{e$x9J@7MoMmfIkd+c6o4$%A08cR*;jC6KW% zKmq1@8uSW;f`o*07YXI=T@;La$oDWFprfFmKfuGndVqz6hkdhZ@8 z8tQ#CwENg-XlU3s2^#i~CK&${0@t5F7)T&<&^tI7au6&A3>*f`^(-)KUh+ik;=Faff^|H!hg3 zLCB#R3LEdcw!1cBAK84_uqcWdlhxZ0EIzIqXS)XVLb=J|rRzx!-dbTI@tbYr5Q$+6>5MZ*qJL52S-yG`T%L z)a0ubw7m0f*>quS*pRDw(7moLj=q4a&T-)?as;J#RCS6=ZO< z!ttPqRUfNLWGL6*8J*}?oI5t^~k7xd?&l*#oArF)AZ|sBel3O z4_BFPXANhbZ3wEHnR8>5;A*u%(@g*2BjG$qfs&(vuC+I7OJiN0p?UUfW}~xCiq&Ik?>$ z*P!=3Oe8+r2_kq0vQ|^Q-#Bokc zb3is(4unY6cR4B#waonByER2wdhE++*$@-1JS~`YVQE@x0rEh+pSn^P+3hpt{i^$p zkELZNro6SYui_v&SLL+sZm*)o7@=(O`^0ZuEREdq%w}+kj%g-i+a|k1R#(=KUg`za z1h~pm$ubll%JJZ=9HD3v@>$2J4_{fP)I#R3SR3CD$m)$u>_1ZNW&(yUZ)+in`A9sC zw1B92U}ii1SolO!!5_`0N;?)=j|7_OB@k-^F1_Wq&b>f(k5MXX2fg!7hal6CCo zEeXFqo~~?@6^cAS=8sdXs@m!-?6`l=Pw}i|s$7WNvE|cZNFZ*DIB(1IS=(3banTMa zWw08=_Y&IakF1+%1^Y)C=sUgDmM{~Ev@Es2Vrk|xgqwnLNwbiWh2Tux_R;4NuLpLz zv2`LzA|W+j1*gUEc(!Ne!Q8bLX@x1Mjj@;SK6}a*uvktZp*ag}ZxN?%T6!`Z38!9z z;ENoTB3AYi%Ony>PKtyByM#SDV1_8gwHD97a|)5typ!<>&Q(1+368{VQ$y`==R7-y z+u<`lIVSU`)tN4-bM(zhMQOu(#f=rsN);c4qq&WV=~NMO%NO8cw}#mBacKJXQ9Lw$_lxO9 zjK`6VMd+;0gQ|%w<`j8}#kTXcv+;Wb5o)nohYdUvJtZ24>fZk6P07_Hhse4lh%0tI z3ap)UQeeJo(3~C1st{YR$*XiaQPvn;L*luTp+#r(vCYk*G{bN5?>{D{=}D1yZx?q> z>)1OO=s81!@%s+VC%uj+`wL0*SXg)k`9mmdOWTsES!?)uY_scmM(59^#?M)xxZ2Iv zpyXNQI{J))gs`dC&uV=U1xDJ81}ltJmH3(ODCnyv)6%jodHeu`S zbf-E9>E>hRu^}-r8M}&^%V^quQ4@YD^(MV_>gvUWx74^SoKDJ^!EnN{>+&}Gp>`YF z(Nbx#sUpPMvZU%9O0AyfjFu9*sdS-ORL{S;uOmOLZ#698B3T)uYEFFY&didt2j&to-VKMebQoo zdsVXUN6Grc#20j$^9{#m^8&ARe?3hXZKVF@BHNjHNCbO!k|slJSSYPHhi6H zkkrQHrslMPiPSeJ`rtX22T5jwC$p6N=g;S*QNyM5haWauYD04Q+8(Y7)Y!T^r=?tU zccvYI@AeYM#Hxco@_I`?x{55iidZ>wkBC(csBv4O4I?ucTd-O@^AoLQBgpy zS5mI9P=Q#YSWyYpE5EWft_CsBqLs9SE8K}3#naMF{CF;tuPb2fZn5wjm-A%qnsU*x zxpps-WyZ_!JQCeH*L6h28vg|J7Ei0IVXd%h5HMO;jm$Wlr&RcDMk087VUbrS_Y~ar z!O`io@m=t3sy5jq3AMIkiiL9*9^o==U0etr3C!(Y#uWle;>HWp^4wQ(hnm-*zH88D z@8A*1Yfu_mvwd+7<6M%LHCJh2r(=Qv>g2K9RQ&PKyyDq=@ME#SwM8 zfW5oG*+s*wfGI6a#xj3~U8@P~#ebr9Ih%yPQSbn2v&ob`x?8-~;9nXAcAbC=4nDz+ zW8Yn4F1i>qSaQeId>I7aOQV)_pi&k}^9;-Z#J4rR^qCiU3Yyu$L=%g(E6-#$F{ z7#r&seed(C{4lg`x~RAw>T#^2ATEhJs-yF*oPWksd)_&L(LRoIVjNwXy-KyWF*L2u zSkH8w0ZPW{CgFva z=;&eJ(px}Po1nH-G06BqCU;`3GTdd%J8tq^@w8vEf3U>U3?@TJ*u#&T4Me+V@21h! zdDmV)M)7*+NR{xT31m?(*mR(yX!Oz7@0z>kS;mnni`Y>0X7I!5qS9TPut2kj^sQ^q zd3NbQV~G=wv(=M*HXScTcgrMj@>fXlWNm$wmtg+9YQf-!dkhRr^(0(Jy{FH&S~27W zNgJ-UpyHynuY|MnhwAvJ;e5L=0tdPMPtoC>;?^YzSrmkbIxpCHzl-31`kuJ-b}2lo zO~vz4A$0J2GSO?l(2#}Z{Ol0nHMVrU$T(+3hJ5f6Q5N6Mb_HtFT1>4#MBrj_LCePx zGP*?H@~_=_^9kX@`^=xSj8{ru4ax>u>R#bD^f4ZLUxRAhHMBd=uR*{b!9&Abzz8le zO*feW(B}q@cs=4&uo;+mB?c#llAww-L&B!5?GITdy!VVn}#7tvNey z?#N(QZnHMB>(Z|yJq|3A9H>?k`h$Af zwiYinZj*;&INZA4kq3j5M$e!5#XguaNNV^lyjtet<}>Jd4Jsh#$00e=^*;Gn#FcX7 zBqjC*V3#Di=s`huP;-cnvhbmEWA|jkN?^qtqB-e5vRu^)$1dw=gA07& za8>A2=p(Uu9x&1uH#nmxS2 zx$jwH0l%r*LxRbK5PO?hm}#48)N#SstCMrJh6EdZ7X@N#b>*&H=7?wK&ce327LI!7 zG&}kA^pKLve&9Qo?si&*`FZz!Y4aSOZvpml`Q94;bg?N)TkKIW*KZh)dDysnA{x zSI?;pWh$#WFPb#?=JUmew?Px>ep#LAQ)uREy)ck2OS6w+Aw8@ zZoV&p(IEj)n&K5I+Wpg4i{j~cZK6xSHb6t7h)eRVF;8D2_G>xydynw4_Y-Xjv#q^o zp=;lYZDtCiAa4!AbPn^(Nk3eJ7~EKVj+&A@CeN$Q>eCk*O00`eCdNN>%WBG738ozC z9Fm+rxq2O_=cEC#;d;u_l^*77_q81trtYJy(%k$|)Aa87J*k9OWk&66LRex$UILN^ zV^ETFGz5Gp9IKihUf<{d+?_y@S#z-NbP)t5a~s_%nDXLmwtB=d5!kl|)DP_L$RF(! zcWsyvq zA-i&&PWM;!n#2COj3E*uvjtb4~MAxZ#`KCjavk-FSFaaq>1a_O}_8|^FIzjjNp3ji0bg;?w zpev$e)4JJpzYfskK`)q0t+g#UcHNyME3fG5om*Keer9GqLsXkSrI6OiFyLKElmf@j zdl)Qr9B8_yi@JOjXzUUyT9{N-eE&&i z>+V_|j?Wn3SXH4=%&W`BOh+C9D};|vDkm=39fXC!4f7_Mhhsiu%n8F+kfehrx1uIilvQEDa*_g3Hh*qH(U#_8E9REoOz{q|)2iGh<}L*L1HuP1oo7>Yh~ zWiI>PxvyXdTI2e#z<%ajj;~mVq;YosyRFgm`FxN^wNgt{7W$MHdhR%ccRrg5#bv{R zWZmX)Vpr?PrrvZwb@J#@?$XrQ(VN!GU5PBdWgqIXot&%bqu7etIfI?I-96s}Q@(;* zH^Xy=5xE6QSltuAD_h;(WXvQ|M_GqZ#FA&u>H>`=VsyR)le%{aJ?aUzItpCZwvX`7 zwlo|L_9Qv>N_D4a?ShL|-g%qZuI|{b`ea_!Ehh}ypL3gc^XNFznp;OJ_l{|7_^B}T zH0p$hZ+NdAhF=sHjgPbTiIo<%bY-l@arMAd)!-;V53O1~y#$NrFM>%H@x?R9y6}@7 z36-(9ny-r4x;I@Ki8@w}AggR)v?Pj%Xq6?k%p`+Xo8wSr%iij=?+*P3zCO^S&0Nhi zwb|DucU%m0dlEbBtH$I!ikX>oe81u}*mXg6$k!!};jQCGbUR)joSdDl4wIl# zQzx3cr->Rl%($24PTkfmEgQ~nOxTu!DoF{&|9qAdB|cc&NrH^4|EP;nK$O5jK0D9f{G=E6>FKi~aHQ z6Q7c!0^XOhmW)N^)7Dm&0npk8Rm`|5=MD11sOG=}J3`nV(?sQ3bJ}h~!{&_zm!?+N zr!^*!!!IUD3>UJGg(bEa^Dcarw7{;{pjPIyQ@6LetDr}9z$)IveD6}@u*WYdZj_wf z+Q-Du70ofZ+iLn6gxxiH4YDb|>UqfQR(8zZ?hB%N*P^()3th2{3*>FbYuIT02vA!_ zd=xd!mF0FS?{TWV?IV}HW{B?NCsu5Cif~WZnP6MJ#ycnuYkGvdv^!w%WcsY>Ta5px zj^uz~BT-ZDIlTzXyFod4BYHNNKKAHJ>ZunEqMsl=IeOfjO^Q4^z@opF^~9{wcei#7 ztJ8b9eJ5yAh2YBQLnQap(Y{Xw!pJ?3k{9$!YkNr_iIQv&+pZRac{bF|$R-j{YKvfs zAb#L?UL>A8l{;76xJHqFJWRnn{REHn2CW<}SD!xw$4G9qgwfUt;uL(S6T~}{V{DAA z;cvLhx)$q?KLOpoQm$4v5e%E?hO@c`Nv;EbF4?Z$c6B!M6(i2U0(${_7;Hf*- zv{h^)!gQyYEV7%2W8R=Du5ljHbX3894dS66m(-UNKj0O=QsJGqp2ON$(K)%V55)}m{89v-7ISfDi297`yQi@rYF5fALlZecuQAyI`UJEN1dr8#-O>(P8!$@${3 zvoO6POhbtj%hI6lsuB1g9!u3pz6%jifM z(OvmD3Ytq@LaWuaL&o{CNuBCZwJn^=u<>u2+jC>yrUhzEdx1{ZpkT}W1B0Y-4yftW z;zfcOoNVVc=(WpO`2{xfHkHm1?t;(Q*F~51bDe-35<~;bUH$&6Xt6hMLSKjKGgDc= z50aePv<3N;3^}mNFpw8W;ppm01)Ub|**~Ara|8IGd`%fCLnlKS`9v8=ZU8xNeMV-A zBSwiv8;d*;+PQi!sP&;C%%gp6WpNx=OqIZUc=ud!rtQml_E7_ryze!HccR8+hNbL+ zSkKUIO0Y3_%XYA+>1$jTWr6He18>3T{$f5bql*MiL(EOx<-BKLo!VIhn%;r zH+68^Kk9y(9ASSwZ`)Dd)}h^|w~4SX=m$mA+u}`MZnv2Df0T)DsUF;x@7|_B0`sF4 z@@*L~Y~J9|+`la$-x@k^vaq);k8YvTAQlr7pvDSF0kb4xiNOafV6@1 z7Y^4ggy~PnEzMJ)3!!F{`_{qoR=o7%2TD ztPFNy14_42Pz7w)R<<^#K>7BPgP1t|wJhpnYyGqQ=>|dB)a+;dEo%slR_0)cqq>#c z?O^`a&z;*kpbaK)BiUhPvV{3@D=- zIy>1)L2MunhE5P;002^Tw}bpdM*e|(1G%Y@u{I?I9{=0phjVtYQkBqD1-kkv+#BKl z9U|{&3i%rZ!O+S{)zI{BFf=d(Xa{j~l5vz)m6tQJwY9n-i1Z8mH{`o!whkVTt;|h- zNecbP;H7_oftHBI5EDaZD<>d(*9GF>^l#ABe}Vswe$U8M%+|`*;V;6)_(5M(>W>Pb z2}r@#=0?_coowwCot+#Ze^nf0D?pL{0~E!`)(KFk{{X)SOtIO&qTjxov^O1rP=Fgo z`1@`C$2*E~n}_+ihTXVq{7`7j+g3ODAOcq)xe?+!;5G-cUqPT2;0Bx`@Bo*F-%b#K z!T+}t#BV2v-%b#}ogjWYLHu@t`0WJo+X>>g6U1*Ph~G{Sznvg{J3;(*g81zO@!JXF zw-dx~Cy3up5Wk%uemg<@c7pir1o7Jm;W-~hG0vG6R8mdurUkL?AABYkeV9{ z(r9qWv&!3vLCnmhJscn^9tx^p4@)qgF^#YgvVa@Eo3))a#L1A<&DzSwk>5>_=9V}= zkiP-5(2(AuI9UqPXv#k&bpkB6mgY{RfbRzrJ1--tiG!gv#MRcpl9Y{^n+720U~Iy# zEH3$z98eOZ`N_Adt1GiB2eYk%DGM7PA0G=VI}1BI6M(_w=x*a==*DE@NCEVA%Z9n; zAI<(YTyxFa(E=SIliqeE4sirKnAK2APv9(F!10hWKQ1E~MNe`@XqvCb^RfTL{@0qnH_`gD3ESVB z{G|qv1&&> zTL*U`0ha#=`@dn|$=u{WQM8+yzc77M}JAmRPgVE{H4M-(EqmMA6p#9 zf3?N^(Z!#{{%!Tvm<3`5xe=x#u+p*poM>Y(zlp7bwV{)cxwWAw zgvG)RVk*G$C-mR*`(x7s4jaI+gXNEd%#HZ|_pjfb{399v7T0fa{UZtdBjn%O^;=y3 zNCN)|`L}lc7S}(Lz&}F%tzEyx^^YX*kC1_fU|L?;#_j-2V~Y z_2=V9;a^i2L_|bX6jZ$X_woK;BEEitp@f40LZto~@s;Yj1=J02c@xz2hTWgnZA4c% z*c%{F^$U9Qg!>T-76|nU2L}rWhlq3s7||WzHXP`2f^lNhLfA@G!0i!BPDWTt@R;dbywf&zX{%ZZ^df-oj^cgNgG%@a3 z+iZ$YvNh=5EI`^6#t~P6P-RqlE7hEa0?eZ19w&$7qtD;Rd~v^&C{aaexU04wVkq?7 zF?b=&a(&^PzVYc=2u*)bd_xGi$CCuyRMr3<(#8Vt;V``y+p9D4&8ctU>B1>=dA(R` z)K5;caC>5*T)N%8Sc}a~Z-!Y?Q%wi&OQX2kG{)p4LQF-%2HccX)(qD2ajBJQElZy_ zrg9O8pQv|<+XNRsI1A$55?`=LkS2_b@8^fmfV&zKiy3+ugbrwE3aJi!%HkOno3Pj( ziD(R7oxhh@3rtDgWbX2&@X(FIRcv8rm_s$UA4!#$QObMYqsm>j%@~tgmutjj0I8ca zN^8LokjGR_)fgsEjUxYYoKDlLx*wt_!_R(xe3&uXs3U$H2`&Nq9Tep!pmQopFIi4V zH@<%I9)Tu5OEdymobLYZ<9hH$y5y$bbn;F$zCz-aVd=dPqNRG`S(vY#1d{XI;4qVbsmoVZNki%M+v$7*$fdHxwk z&f%4Ey?7nrs>ayQvDscOmeY$@wZ<4nOGn8VG%pfUXfr{z#v)%c7WZ*0j`O1{C~Fk9 z`WkDS63+D`WsuWAY;uH!Mt`VK8XabQtFy43(cYtQayNlk1G=!zdsutB7@S3A7NP-o zN|g6PgX>Uc&BZh^gd!&nd!{tar`^kP% zy_@WFKbRoTg)siEH*9U_GGyYbApWpS7rQhzG))%AxLv|ME-k0^;bu%XFl$OYA!~9l z$7tLNp~;^8Qbh0y{t!V~AObAml7{MQnQ{skgd>d8S0aS@%UK8sa{awRICC2zpVRt! zLex{8ktxVUX}VVKPYzpWtkmafDxZQ^EZ6Rb`+Pj0L*dP4ZxSfgln@cu9}#aN*gG5} zkjZ&cMTu^=E7%&=)e(x0TuxSIHY9_&)T0?D^PN7s6-h)!<%p|Bn}Iv!0R_MwnJMYF z6#GX}PMzU?9yYubSJdkV)Au=8O=JBLa$jYP6Qmd96nx&P4d}87m6zltN_g5H9K-IPhIov6z0R~ENnHxU1WT^ND|izL3sf#vUka$j1LGBnLq8Kep!`# zwq{5zbkF)yyJnG=0hQtz{h)r=lajpsy7DB`DL(2gRopWtiJC{?2sNsMgQlowgy-Sb8e-vU`@!kAcND|zRMPYV@ zjXpE#v9U?bayVU0xn=TaDPGzhxhxyw+>IayuwWO@T_ROV5Tp{rTv5itt%Y8g$ssDN zr=G1vx{n=KOV?3$*cXo`RmDM+El>2@G}z>m971o+y4kMhw{!H z%kA|MGdi!)#HbI+P0$iNq zBwW2}-{o+5%zMm=Z+ze8QP->-RM7slUI)&mes1Yq>Vhw~qe!^R8;Xe>8&ijzpK)T_ zR=TsTUT19OaBQNMvZOQ8=WDVp(Ni|fSk*1+J1puukz<6E9U&ByqDl)g!y=j}rCjHj zRo6ilKOT?G9Wbrbp&BnMiVjT+HrnwiX-W- zK_@=Lxvyh9GafD}$6u{He=gWb*Hm4uT-Dr@?^4hN6(YV&t{ArFMCGJKtqLTCjTOh1 zB`2q{RTIHO#Y#3|v==b$S98kxxe(`EgGTX_P0r>x9PscRj2AK)leN<$rJ}G^o%dz5 z2g0g8lbMM+DmhBEDh^U)STMe) z#huJWypoxuaF23&Ig4LSmx*llBsIrV8ppoEs>M;>Cz%z2F?dw3`rR;9PdoplG$z~w zXKXM*XhII%U8krJ0kYZgye4%2BJSSKc6$0S%?+J3OQih5@3y)RHbsjr3Rg9FSx$Pw-e}I9>f*>65`&fjsv^ z@!V(brmj)?621po-t|{OwQg^_Tbv6u)2@eaUqG9$UqpJBh}!zmjHN~%d|GIa{aPcK zo41IaN5`iU7)_7#sSl>gy+&ai7 zRSa9q^M3w+P-6e&Krqi%I`vB*_ zJ!@`2Cjwv6CSzb=R(GXK!UZbW$CtJw%cO3UP5jHbh^FeYQqoUInhb9zf;#;^mC{xn zxr?fe9fBGHBYe7woztFM@i?aeyPV5>x31zM5WUL5XT=S4DtgCgU-P{-BGi^cZuyhl4Pd}2NH<-*qSj87@ zOVyC4*vgc3#c4=q2<2AQ4ce8liTNs`9#~texoKH#RbDQ(Nzq^$#OrH8F+~E zeKdry*?z)Dd_alj=U#6yydvIIk&IKilj~m51&-q3?5wE4wm|G6VUfsTw3%!B(kAIE zkMb^ro_uLB3^R}BdHwj_{MEy{vA|3@@~Bp(`WmhcT*FGN#05Yi$2OPt@&* zS9BpPzebmLC7Lt3ucje5pmi0$OOz+cIq({U#F+nryD(FZlcL3$Iyz|3RkpQcDxb@! z8IGRL*FGGD`eRwi2jPtQ_o1x{GK8BrG}j}yIxF-oE;SfL_(kk)`P~s%^DjfR$n^Od z%4n^Rj|y;hvW<1kXRVS4*8^_A>T06k@RKQ5kb5 zlF;JOOcNS`qowrx2)?;Wj#(OR{WU0zI%ecdPD(S$lY|5v-|HDR5AI6CTb6aqi%}x^ z)2>>x{6T{tdBx$4-qiX^mlKt3nE>e=xun1jVWy?GXR>NEgjD1PF2rg@{W%-u!$vLT zrYk#d(vP^XbJQMy)H(-uIaAfI9H0L6Jb9}Cg4HYeocP`3Rqb5{9Ly{`MPeGyppr6T z)}CJ=`3HQP16eX@GGNE*Uxj>10J#Obwv5M3YNZi zx7F9K{l_kl#pOeH<=%SRkUY5tm1PyRynE74-}dHu^ky+<+0pR6UuLK3@JND8~MSm(Ff{$+uN;S z{hv-Ry~~2~$Dopt#)I6^i#)lxeudCU1XI&c+P4`QE?Q6 zr|g(URbh=xeu3o3+DguE16dv%Jt-=9JYdv(S0cZt1?729e04ywaV|N=EEUz)z(C~c z!Y7}iNzFg?1i>Q*hlPBB#2UAGF?YY)aR2nSDe~iDHm-a&WEZ7;EN@(D5@NI7%Rizl z19nmtDr}ULXbK?IX@ZJ1ojDJAmN@4g@9v&n~3zi}~qAeDkF{YL8T^cN$4w{m6kcS zcr6{%=9>TH%b#Dd=};vuCa3=Brzk2eqqTG&)BS%MfK+ zM%}JliWJF{K8jI4{e-Ow`ZU-)0)+4ELp2ENlBD2 zU&pP@;c6C{+X-Pm!%+&qTsD)dkSuMZ zeOc0q3r#I4@Ap&;%HFp~l~6i5X&edfecUBy8a1Y$$~wt$&!RVRuxgq)r1tWKomSY4 z$(ipbOdS77Ok&}d-3xwWoKZeaAMp?4`ewb!o1Vin)*X**iQto>_RPeK8=tp0CIz0vvjU|lbc`0p%yuU9ivX<0Cy%n7WN{m8>lb%JpN=SXQHkLb2&8!R`-GICC@~i1*5QS6Ym*#sOI1}1 zDWQ%G$n>=skz^`Z@LcKxGOgB?l+K^cQSJ^|A!(29a*iwP)Kgnvb4LgjLdQe+K#EVg~1iwdnr(?UnG&KCUL6$E)t2i`*N8d+&9&I zsC79blV1N8@70DdCgTTZKRApa(mUkZ_zs^*D=%pXb|NY-VW~IxgLP2YzmHuguh4}h zFuaJELx<4xepxN8RqcpU%(Ty{CX210_!{x)?%+bUQB*jnx@Tame*9^S9Eh|SQ$&ZD zoW_O6=jmSGa|M-$4w*F*a79=&L^V6nFGm(@kbscqW|XXGxIQXM$!-G7mg(7YdvNqb z{t^6Qn~WyC!#zuLuUeDXu*EeV-U&kI%awaE9!NTZR0iq7M>Linsc@@yclAJ38&vFmmRcht$N?4DeYX`A_pRMKF6b+fF~w z$U12U6HTI}y{PgHi3>|bqRnqusnnHz2ziG^tTpkdb~TficMSxIS{&z-NP5mj%CEqX z4?FOtI8=f56yjS1dCw6Aga#pZIWZGS>*w7nImD6(JD;?~|dCS5f@1aq;S=auoR*A}@K{sW4m*~gU6CIkeaG9!#Li<*te7@iA|2!)ks)}m zcz`bL%B9Mrb^4u9WaTvWNkv>RUe=x-_jEi*3Oj>46>m+J`2&;`uTCpj_r?1(ehWw1 z+&NeVG}7yqTB97QVBf{5?_FPm*v^{-jHWoM0R~EOgaK?~a<6Hu6hF%KMTDP;sHJ&(yiLj@bGQ!#ctxv-I1N=&2 zW++dgY<-8N;>&!d##DTVE_dKRcc6ed8#C9ISp@IiiXhwH9i?SzqkRdFV{Lx{_F#_bOJfkz43-Zsh*n zGB74lyx+qY0AjI4+7ksP9*dy?<43rIvi z{d!3owU7Cff1ONDSt{ls2V`Nzx1IP94E!4$)!;PN_T;OO4=c?ntm?5`+#=&iiu^;Al=ec})% zX?UsR_sP06n}}VC#6^Vj+>BV$k6$zHflRgDXfAX*>=gE~9Ul-1oQX4>(llncVfrCO zS>Hq6Zi`QEq@42vTB9XVDW1QyM_1wm&mILR29-RBPG*ZuG~wcS*;7wY8)Y(FyQ=R}UL#C#kD zt4I#P=ej&ZiR2oe%X!WaVPc%r!MbEJh!XoydEo0hr4#|q>|&Zt#wC$}J=|TIMdC+W z^F7!pHK&c9E|hUFuYx+cHwz1_EH#h_RMw{B_ptg5)H7M0iAZ);xu40^GPCc?vf!Ro zPbq4#yJ-z{daAv&5XtF#^4WXauxi^zlyY&);SFo6x1opp+cIyi?_n%Q4hilB9*R$@ zFOJ}})CeOV+XckRme%*18E>Du*ub|ke>Rb&HV}y{5*bN0M|eV{;76>aKDHsLRXTBPhK!q;OMR{Fi+s-lt^3F<=a32{rs~SUFh0@t74=e^*?>o#!;6_BT=nMDri4V zPJD{`aCsq&K#aZnHB1=Zx8%K9aw9q37pKAK-n55OWXlf`E1y3ad|xNRn8v(=|M@8l z>4-%4;8LdUGbgk5=Hqut3sBb3Qf_~CCoL>uPckHj(u{tMWE2lELuIy_GR?R1E&Ks{ zXjPPi5d)v=PY?<)T3Z}WYQL%|LD`yYAZ&PreH#!Oj_S289uH+XzBeiAp!K)h zi#NT`oYcIGbzIe;%z5v*i1OGvQGq+sV)oE;s@ZT1x8YYh2sZs z)jARzSEWUNwIEsaSj#Vbg6dDm9qz9?szFRRh@(^R?$S2E?@k*YqsM2wjSW&Ma_J7^ zuE4x+WN&if>`2_VVH}xto^z%eoI>-&bP~yY3MQ92gt_AFwOk%6td=yYQ9EFI(@s)J zA^O>B`hJG#Hw&~_uwiZ9IEA1(h8T9(TKB$frKVS{;6)0gAL1T}K;l*KO?pYY9&EBu zAZnu90LjS0jwW znd{oqGvV`pJK2Y1d)9Z$(C_^w@6lK~1EiNbT$_#YsM_s=58AP7!drQAlj} zCijy6+kL##_+$A)F8lEvi-ykw9)#|9>nkSBsW0jt#rRH7jU_BH&Jw9Xwc_jR7TSE9 zVzr>S-;UR&E*ibJ`yk}<5iubbw$=FP!DS@Y2VBZHt&e)+oMDS<8lF^qdTJLfYw~`L zZ7J5}!m#~Va>1~kB5a8oWbjfqGm&Z&t`EC%8p1U_F_u6lKKd-U;yieJqlbdUct>+w z&A&LvqxXK=NN~Z4C0J}^j7#`qhfm8LA*S#khI5Pav=jICQ)A)vOSbpod=arjc=j;| zyzs(ZZ*+oqI5(`=o9z9bmn*4HWeZjs@8)T>y?^`pfs#!yWNTqnA3JdSp39E3wh*yr zUYC0wQ)aC5omEbU5cfd!r;;N4^o!kn7j{K3)DhI@a=NN9U?{pmaVt^S(h5oyTg_xL#taTGHtM6>9_36 z;Ad<&ef$yc2h6UYI6tc%L(u45{KB^_l>K#Y;CKflC3dPb5+&E^}u&j_N5ZVZ;~gt9XC9kFQpjcu_^H=ED}bxRrZ46lwGc zkefNwjoJna>c7upU8qN>5F!e@LcEHjbLn0MZ+jK^&)l!(?1(>85PYDvB_L!`F(oO= zY{9TG{chPGe(55UbQPgVM_yhzUHM(=VW}#i>Dak^1a9_=UZbZ{7SeEUD-#({cRBFM z@;@@31c|?gi|3!--LMMFJAKi6-eBu5kcszjV!Co7a+N3e`J$-Vd<3cTcBb{m(vDXV zPAMr^#H%H6ufJMt7;xD)O1ZfpX=?3;&TMKlBOF_Q0dq}x>49-=e~vv^*3+33!R;@C1Ci;>`v<8ki8 z&~Ni~Tqd4?oFLDLz?lSTs=ru_w0ZZbJDsU;?_ehXQ9;jsx4U zQ?HAV4p?&;w}l6)`!(HtIW{|v{J)d<9?d>TKyaP$H_|y^^xjn<}E&H_*I$w zOW&p{!ugj-CqM3Ui<56=neYcs6@GqKo&3Hx z>v9eHz@W}0@lZPM6^%&bM}x=b6-)oI4K71;zzMeDe7=qDC9AG7$3U(WVZ#x4od zK}8~rQXY}O<5swb2`oPUG#9>0k1$8e32U6uTWefRbSC16)N8Tu6fxEE#r`_pd1V7h;-a*&?m-{@u%G1bDf@1W(>l|8J!Cbqd*#Q ztskqA+!Y#A1wXAE70V8JtMs^&>gm_Vug2*KT{5|#Nu*5S1GI0R#?r{WMWK;O zmYm|j{cuOd+qglq*Ow+yzu*n5cv4^)Y4oi2;{Ys?GgOU$2TPOr75Ak0aodeAhTTRT z8vnn#&cZ9ockBBoDj}kjl!$b9x6(b-4ALScF?6S*#Lzu7N;5DZLkx{{gD?y=bT`tC z55IHHyPkKQcfEhWz1F?1b?<%ey}zIDzBGTHTSj6jR|2IH^zIaHg{rH?b5iWeyPJ+1 zCosDFt!MnYTb~k20?wb$2Bnxa2Bj6kuulWiT<3MMl+=0k+82jyj`eFt>e!dNQ(v5-3XVWp;z5s?(V?M`-Ny|q zSVJU&|9F@(s2{0W087Hzuy~GsGDn^PP!(qmnx9l`?Ea4Wl8G@ai7V?_BjKH4Geh@YGNF zXo*gEUyPA~t@ivS6Og~I-kD4ykSUDvE;ZVcO96~SNu(nfKBwO=8&4__-^=%ErIKkP zuc25I@kI8KERu{)0Ri)2|AyPGG2-r__L>NBWSLYv^J4(phss+;e!@ZoKpQ2NAb4K$ zX(OfF#NyI@gnaVMvOd#gBsg z=Z>geoT%5x=b@4v{bG58(q-UjmybQevT?_jE8Kw4U{pNWL}Aio0dB$%Qb^F1jR%WI zqFc-2mSdUl?sK9gD7Trl@x8c|d;q;qVG~R(wc)}j@)7z&gzs2) zCEQtdOjkP$WV1OZIXhxxr13NIHV^U_>q$cdvb0S1on2O^%&BC3meLscNIsYJ^?m0$ z@@i_!0gdbgI7r_7WVi$3PXJH5=qfcbn%ZRcHL`f*fD#^Lei3GOvvGUniQr4hVj_f2 zz68xV#&+KDs|iYwY)|fZf=R|;vIM9{Pha(TOTs(Q0BSUvWUFn%y}wyDM`ohE=Z|{3 zd@r;IF!fC9K1s*~nCgy51Szu}-OD`x!CFIWT8Ny8McM{c)&rU z!OOEfy+uJ~dl0VZx@&LXhpQZ6-(G8Pixu{i@G?Z7Fntq|kSMd2q0dKc` z`u-1b%hvn%8Nc02o{t6JjHCMG;%WNc>OKjyiMPE1lk&Z zRC;m9>9uKnK5&pVnKmF%PAEW4lsdTb03{6RBc#mhj?7mXeNt`r_D`|~s1IBcg2QK# zA^62{rZGkQhvHz3NG|5nI{Dqu>eV})8tRTquYJLp{nmBczgVfQ7y%QX*;8d5rj;>m zR8_i}?S}q2{EDMt7W=|{-gd*ZK&C5uyD!UeJ@_A$pi7=nkFkO0vBGY?@`O#HiS*#M zam;-1amcc_!OJYO8^sf`Yc%_;_$IUBc+wW})6^Td`(R3Ys0%W>ZFR^Y8= z`JZCJMN36A!MAl8R<|zFpBPAyKHARW5xSXMSo8ia3xlUkJ*@H6(iX%L2=T32h8~MQ zy*}@qr=QT@aI_19W|icVJbHZAfGN1! zPz%+NH&__(76F@Z@aKz4M+-1n`nvox<#V69>b#$@nS#_KJ#Y$H9VzJ6h z*5u!4*}Ll%epYmV2Ws`M9Q;usX@7UO#G^v^37?L`v;JE2W zIc@vEA=?P#*DjH}^wN}F!Un{}4RJ&{m9HclNtseIM7<>oPLUo6%SDf4IIssTJxKVI zckqf7wBqqZa}O0Nbf0)%QUI!x{zbVld5mZ0?7>G;Vp%v>W;aKxzk@ObW7l zz{7y_%7g9S%kMfD1miikCRV`o!0V15akIgQvqqS4;b3O?;W2RRHEVR-v=C32ikH7o zylu;{m|e7Fv*}6bhIX=#d%@`ymE#&mhxaM4? z)vjvW>^WPs`hA81JhO#p4sKBLfwjg?7o?15GGxeJI~;jz5sxP@J_%bO4yj?IWBrc1 zO(SnsQvQ?6)@OB<;Q@a+ZQl%)wZ}q$_u%@u9_RWa2ZMo;tVKBsC`9F31$uY}lTz$h_x3<_%u-`nR?51}-2 z&r++_&{z%e#EdkwrmdtK^M1hX2*TP!SO3wDhIw4y{ZI3+Eb5}y!+)_}lZ7g(!;~uk>mS|b4ro{IuCIWKC#U^_qeqiVl)C+4%A z)Ej131M%l|mFY=$@o#=V&5!8K-aYxgZDxEM@!mK+WIQTTMeSTygrGS&xuq7L?8`73 zSMzvnDWis#X^${%Kgl_#%YvUdr_-Iv)sf|;*7)ZS{hmA-wDn(j!J5UZ>l%~RS%mS7_Cq>zQPGrIfz*m3k zSM`W?5_S`gbEQ+MdHh{0sH9MNt|pe{w9IkXa#2}y1QC3MZC$*~gnof0QbOES5S6J7 zhWGE2g@OKk>USg^C4y=rjG+ z?K1slsHx3%pM>`8MqAIJc~o=sgaCe#dlG)SFK1Gf0$oYM2KKwe_UeOYiKNN-2$&Jm zdGIeK_&-<>A95{9JLcG{yk?u(zgMV5m;^W`v&GFO2+15B{~QXY7?d34I!TrEMGZNA z%&>B55E>tcI}@_bcfi)pp@wcHvR^3puT{HsTpCoGT&WR`3!SpAHf_>njiMn&A8>*p z;>+jn+_~Z83}+soJ|0pO!Aw!<%$A1R%umd$A7V+`-jG=tc$-F zgop~yxac_mf!-DVjq|-Rx!bE~$zK}L_zzRBEW?VQg43X8m-soVxu8VfAnx1ghS`pb zhJdZi(vhNK*?69EXhE%_#F{?z`ndcrmdjr(_Lj+E)KGwIP*jl3ssTH^dhDMO|N2cR zg;VNvFv_+~z3;K;P3c>{q;5Y21$jNA`{bvp+Pz!8+`gRn7fXuu{(dbg&Ev?cudZck zk=ufvQ`qP&zbfvT?iz3iqep}EiM^LML%gCKL83+-)ch4vXyC#@YKfEwdTxg=QrL*~ zm0%8Bev)1jmrLlDTA^e_1^`e6cj+`DJB=3gAUz7C1uW&ZQTbR*nk%mf3Zxd_RIEDnt6Aw;G#wY zpdVU!fru{A{BhS;XOUqOH5q1aNvK3YlCtqK|E3e@l(T6qP0hOjzc%B@zb6cU5bKZJ z2I3>)lo$tM1;OHAs`nTsVn7mT!1TkwmtP|vK?Dz8Rdwl@;LEo(SaB>18$X5jWm_m* zm6Nr4C^loe>J8a7XX-C!+iv6gI4;yAw@|Xd%f@=wZJ1-ydgSCk=yzsCwDROupF_nU z#vax)6AP?Eq1DlhI7CbCR<-%1b4*6Cn*m?cCCe*0yxQYX3M+x#?@=rL@`nwODYmKX zK$#(6F=@6yI$H{MxK$Pf>HDtjA0`jy<#(6#QOm^rnbyuOB}D7g#Es?bZ=n2J9%OnA zW;3mx$j0RbGQ)@`#{5WYJ1;B$rwp&9qmFT>*)~@KzCFUvsx_Jm$}_wopqg45Ejebp z7T|A4F6UbVjL?|#7D-iN>ErhovqF&r>ws*;x#q(XmiVA0KCgJ`_XjE*6dC9F$$zod zf?+Jf#(05Xp(eXolqN|wd-%!YiB5fLCM$=P56Y?>GYw@hC8M~->CxeqhGHJ7duk)B2k zG+^(LnP@zXdy;0)s|`uRE(y>aa*Fz{oY1e>-8mlj0b(Xg9^Mz=h2Q6Ko4yH#htPEu z+Hrum1H;dM`YvQ*F06hjdzkdFZ$WrEcg;Ln5_Eph*Qf;Hv@))DN2bh3) zGoI$A`hnQ52Ksby-^7XEx#^F3Ldy@m>|aL1jVwRfT`J#d!*|!W`nL6p44`L$7A(>u zHPaBpdrI$bpG@B|&n|Kc!}3a`Oi!VRI_d!cTV0H$1lL)Shm|)+1#r?fa4_Kn#jTBq zeam#N)22)^xbmssG!!=D>$}3GtG-!s%(FRUQ_NMRL-r&+h#@eksuKHCM9V1qUBvD_ zVf9MxOfa4De=v-H$^@HdThEt7Oo5RG#A=~z>*VC`Zxu}4nrv6=TxMimR-b~=`cgFl zQ?!I-R%K#8L+FjAD3U9%h56y=H1Sc%-o@uzkIP3;PSGz-OK;kp17SrW9*ziq_?3=Z zTx#61*qd~hLoheIS{$M~+K#N*zWikLaLU6*L>8L5WT^e%sUkMl8hx50FC?-*F{Z3?j(JVh?Di~M);XFZ}7+iZ%J zrT3@Lh41^m`e!xnTwJ{`zo}?T;P&Z;rEeKg>4)e&dAcxgtl?p#KB$_qzkX?v_^g#_ z{3mfjh1;;c8F?;Z)L5_&@twQTr z_&M*+KfVdWi)2uLD$n7Un{{CC$!2>y(*qCCo@6kGZYS#2C^&SyveBNq)(1yH#L5!+ z@U&l0(vKg~yO?l2n>Ax8HOMF*%lr6?64Kw*M@*rukLt?a(93&hGLb~3L8gHT;ux0J+Pi%jdE`>^VSV%IkGE9c}fj%3)T9{G%X!! zviKIjYDqmC%o>;ejF_k!IXJ*>Ls47q#HG!Du~LHij`1`)WugEBM}ps}ztZ*gFcOi~ z-uOEdX9o(kM_86Ss%&u?$UPQUU()Vlx<%c$DB;}!lR@3$Co}^$Fh4U10RO_muuRnv z=Q|M*QN)u)$iv!V)~{2qfSgFPcn?rZ%}V;W7*1)*WW~{k4@M4^0{U7!Ycbt-bkJVG z4tabBp%StU_^NFyQN>9>fDlTn&~7Qw&@K7B?#yypX^9`o&*LHMno*ZBq-u$h)0|Y7 zn6ZK5fY>{kq|wh6b3j-@28Ksd0TOwSz3u)?q>`n;6-JUSU2EX^ZIHfq2+&Q4)rkvC zRl$3=P?02fRVf;Z9S-ApYI>vKO=dAsRiF=+Q;!hwu-&aR0Pjk}OX^eSBQCGIY7N5KF^50}wacGMe<$TkduyQc!wv-zxrxSO}rl4lsrE&TC58 z`|CcFIH9k(GjYaTWg8{l$T0g%Q>5&ZXs(@d8z*P0E1jYDMqc&69t80wRf)e#Zy^BH(Z_C|%L z5b4_OnnsQdoY(Oj{#3WDLu4OiKeOHA;AB)=KHJgbsqWAe z78a!Br+k$MYovZQpc8C4k`t!r>V=u+5cW?KbOpa1tdDxTcH_3~V?4A?`XXWvBKDW=~YR*Avz^i?FBv=kB zB#R4Pp^1K=ruVy7tu}P_p=TaLP7IImCcW;z;OaGda7VcHRLC&r!=T0i$&a}gt~{3QxO%S zNF!g4+RA!C2kp;2fML{#S5{qV;I<~U487v?5lB5DVKIU_xWN3OUh}9oJr7~~at$1= zEAdi_4XT)}&@aaDQq2xr)>Mb$ubW_MrRe;EBAqCH>`tO>dSNy$C8vW~n8@b^(E$_{ zOox-@B3ZeZIJgByCqzR-(Soegf?K99k?G}RZKGWbN4TgS{+QFQ^5?FWl~FO(QAc^U z>)7(Vt=q)R6^`W?Bd&S5M3EY(;IdbA!&rHLqlDUC)L$&ZLF@HTEj7z(GuePM zkbhgY#vBgD&mb^eUMo|ll!Gff({Y;k&%sI|d&3Ql4B--2Z-&Ga(0{RH`AmAxP9)3F z^JGYAYWpIfqJUkgHLM^4oqf9rXz=vcUn=h|5o;YjNk8oX5o@ABTFH4e=y1!{e? z28SM$dgwCo_57*u)iydP&1e-H7;bB479cGBQ^_Bzc#$lmz%&-y^z@bHrhUQpbsWF> zm+51(b;Z;DF~!!DEntI9i7Gek@6VV^*7Y#Hs&{6;qSyVdn$t*gni_IqnL&YaOn8j7 zu}U~TQD39U%|El_l31N7z0#ts5>!0>GLfY4mEsNZ(B*dgBQBn44 z_ZTCM%qap2Z(GA-@QSLs-n@QZr6u*KSSacB*tSShi{#i$tqOo3=2MkJsYsf}eThEq zbe5i3Ev}N#-9KBV+0g`$b5?8*6&P`j`x%L)y3T0Q~r0m*)wAW7Qy8*Jk2~!FEQO8 zEWQbXrpJ|cJ`2B{kPR>Ocw2WKkbbPO<#myMxuBn$)wh{ZJO2Ae{1YkW1BJ_gntBmk zUQGKV&{DOgzj_)>HMqo_hAR~ArQuKDK5>mgYjKG6#J{u^*%KLr@$Lvh<)>U%mZzfJ z-c6=EylZnH3!T*la3}K^RW)kQJC3_*Nb0^01y|VHuR{%;UcSZN@%%X*fteYm6JB-4 z4bOb_>6dYHviFbN?d9xp*k{MN$IeB=Wdb*TI@a?H52?xbETBsXxN&Wvzkxm>Gx@~~ zJ@@*Zk)iuhl;DtwYC)`^jx=KlL4#gIP5Rm!3_*Eu%0(v}D zqvqMatu@$BHuiHcj5nFbv{IvcVCA@S^u_uYrIdy0GR(Ux_m{EbRNKuwo(6_#n>!UX zVh37AA?&wc1H5(zuC>e<-483YoWArNiG#QlM6FJII$chcFyv%odvXK0Th*wEb-J1w zJCu+}+yo3ve8r;f@+XTNp;)CMdelWmrEsZDZlM35DZt#cm_y!&V`8TCOgFUpKqM%C z6Ey+zpV;2jy_E@Tq+Q?TB-9Sms5J`a`=YTGU0jWNn_Y$6H$pA&;GUO~cpU7k`eRcK zj2Sj8+-9hBfUFLlb=Yb>fcCq=vb83hE(4^g#v~v^ySIgihb%JA>MmNEs)nSN?@V7c zEAQ+-pMSz()xz_5%XsRWW^k7At;2=AAA}!CTd<8`V}wlZVe3oV%et^opWek7)qHzir)RjT16hv&J~^cYojQ~!9|i?B~h)R?kT-T398XS zV#Se8!ZPl(#b#b8aDvuZ4Rp`{h$=+{ubY2@c1!P&!Eb!+FBbCSN*boF`|tqCE*L4E zkgoT}J+@Q1 z-Uk?;wHQc?8s(`vTMuQ*E?lgJ&5P5qv-5ZDGqm>>nzB5f6yMmH5TYiL`s%U2TAfSe z*#Mplq~`C~x})4%7#lfR=D}@@kQk;tbIG#RZZ~U?94kv_%g#2P9dnZSV(+)%0iX6m zlhybW1^Q}^^!51pTRR`@zvQQ+ZSy>%ml#$Ar^YKO6O%}tx(u*AH629{Ywg5mki>)D zIY3E!YYTVYqKYmeP7OeLQid5u0c1NP)Un{UX+O6TA{T2bLis3TiUzb^h7!rLi9_VX z826`@`Lhz8)WUKcYtYzU`Ho@L9{WV`T*ZET%d4>hj9(-N(v9zEswX*3yN`@(iSP6? z>gVUCny(uDney9?dpgYm8r|$D+dYjw9M`=~gF2Cy%*cuqSj5{;Fy?7?pSQn58^nRw z#paT}XQS}#8s@REubMvUo~lOooOrI}BQj8Ljy_d;J+f5mNCm!wdN)8Fi;wFvg1m3uqbtY(^U6;W?!ojdXaidftq*yusTJCp%RPKKW{Iyw=~^}g@rzj%mDxOY z)!?QN_}eY)uZy0bdi#|(Bvp&w^d`b!;gObF3IHCb(0tPL_jb4quPPHMY1iu7*%Ll_ z-zxw>H5gC!q-tg86JtVwV#%?DHwjd?*)n|~5)OK)4|Zye3J)a|x64w{oep}{!FaF) z%uh#1cXh_8LGg$0wLeEMt*=pzk#3PM8p7v$q$BpSy$`C1c!2LDKuyi3#t;)AB*dvw)mwPc?a8|tBJ9?!5g$Sr0Kw0yXNhe zltw0gzW3h3H~lUqy3^=vmn@Fy-|LLiM6q0at&1{=&IP3^80(OM&jG8?g6!ahvIH;i zKb#6#*%5D$GmY4(xyNJ)YY5loFg2lVztA-%7ELK-__`4mili{^4A}n+W-Ep$g+|i* zwpJN(%=M@oT1snQFyHkAOz04WWsK4`-Lj>g&;L;$M2AJQP`4=>DLORfZ_&TcaUq!y zTBdJpCtUl$&dv>-zHHPTb>JN0OS?O*ZKPc)@>-cmOf>?K)q5^zL`YH`LZ*qQhE;3} zF$~shc$7^aA?1UDCL2-~*TA2o9WWQS^>kHeg_GgVOY1i6;!-}aT^8Unb~F<~BlBzD zKhLLx@{=EkdnHL7tgiNAynaYndBFN(e=Vn*n(DUTAd zHT8nAmU}89^BYDDN?4DrrkrqUgkSj(sKktiK6_=pNKWPKhx?41F+0g{?rYRhm`?uJ ze9dG72R4#_5f#(vzdHN*bC+#BNE((s$C#MVy#lpo!+nuW(qdD8GF&8cEdgZB4794Z z31t%N?KzX;GOE9yd*j{h8Qi=U%duCHQk7a1Dc`{SaecvioWf}Qox$z%JA^JN@#{w) z6&KtGnx-GY5tmY@Z#fHz1{*auuYzM<_PY9*^b>LFYoGbobLR1k%$J>(-yHjeyp!eibhdu^Gn!Q^tZ)JC zLCg=so1-k$V^U5KPiF`|*UIRamT{`rX?75cbBzlT`}Vk+m7h9j_J(H?aVZDqvK#1Z zwkYH)O1AW2#O%xJxJn~$KQVv3{ehSe@)HMoj*AQ(s5jbQodoWs1)6zT%eu}H#Tdqt zi)NUP+n&e*6!Q^(u~e(kw-V~Re5PmB3z#by>`+hZc203=zmKr9QxkI`+hZC3c+|g_ zfcx!t<%mewtmr~*Z3b+*Sf_W&B6Tx8>(Cb})YRESkY^{Q*;`LZdUKtjMnB(!T9%L9Mc4DhtRmuN3E^!6xH*)lQ*?ULjsq-Q_Atnw3J z1%>)1Wi2)o-Z2!RJoDb4i1DkOSg@B*8`x=m7JoPq!!FC1UZ1y8mQ>dt;(S(^u;GS} zR5PxHtqrMhV|06%TcmM|9-~vWT;7NB8#ziFaUkOoaS}YvsTH-=-XBvu`hCvXL{5h) z!W^J=R$tqZ#S@SKKQg3%l|r%TFPWNc?ExqRx_+DL{>>Nf;! z>T-Go7nYANPf@prmFjfT^Ze?8>bc+$>te!EdL8+W{js?@VUtKqPc9N?F@6(-S}KsMD~+QH$R=>vcBPe6s><5 z_L+c}Nj>!(g*Sf`w7-Z!2-$reYfUxWRdu}A--(tf9?lp8%FdflDw^$ z$WHa+zgPz7Ck29QKN0T0{RIS4u_b#5y!*=c`0uOUB1l8Z{md}A>6D9@4lgQ}z zc9l@9N5*koLE%d|eF1DI&tQXAHlQi1RxI2r;u4a%|5}FR>`Gw4r7Zp|z}bZ3REM6e zPS}dxt*u@hND3U47evf)T3D$z+Y#j&>QPMXQ|Wol1q#-`nDtN(2R=S~k;x^W`*I&v z0k=y6J^CPzWZ}ztpOI~Mvrd`W3#kz2+mc=^!6&hr(PX#X_f{V-y1Lesq zATlNuR1vn-S(Ob&nvplM|0oQsH*N>Yr2W?S41KLDANp%}tdPSUD6F9r5zr3TJf_Oq z$;!#2@Y$DmO()=CTa-H>akN35HGUCepue=D;(BL~{Kvap#i_K%BC=i7-WyZJbGH7c z%fvq8V#J{RA$#4dZWtDk=tYt-BVf`y@c`&JY&R94#&B{g!{TMLlFKyPmx{kJXhzVabNyW9-Sf}Q0ms{(Qq;>>t^hp|4Dg8Q<54G z^lkOz!S%0RwjgzTr^e8dtBow*zOd}CP?qq4@>-JEf6DrQ`|~|l+B!!*6qy$WZEf&7 zq#16rtIP>rzXkD?(qOaUq*xlx3gMS(d&aG&hPiVN4h9cmt*9H=<_(>Lq@TN5iVe zt6sqxbw9aZe{7$*2GBxy$t|m?)*2ljT}KvA4lDtG%UIff|Di_zMKZ{DAp^FjoA-NP zMfo%Sdu<}gzV^cOt+W5zd;DMKd`->HnC;m%Ar^C%hkz_LBF?Dy4ODmvi<+#MHR8?00XpPf+^V-uU(S5e`_^r^gcC^SZ7)G4DEB zPYrH1lXf~1-|+J<78cJ{WMU7Ei~tIKdrnC2P5;($>ulDg-E3}D|KQ0a_GapQY(Yqs zh~bY5pw(N9qv&GoR7ss(FczB!&=fZuGE@4Vq?GXiBty60ep6OqPtS6W`~_MeUU&f` z*$^J2<&L~c{%thY`x!vHAhH0dx1p9`n>DMcVXBctxBst_AJsCg7tXcF zrT+?u%Hk@9k)hEv)_HE{fymHu5sgG;t&jz;&^F(ENvSAdQ3<_@UL@L8KkF$>eL;PHRJzs(VqMcXPtnP?EWf zvv>px7m>T*ePQs!MeS;z$GfF>VrFJscSRB`c^=@j(Ilp?6Tazj&%j#0M?=Lf{ts&P z|6Kq_3Q_jR`H|q}#^`8L{q^EYOnn{Z&2hLkiIHkJWQg$)67-^F&b}Nj@M@sY)9CBC zY(#`mtvH!@7IgOpK|3a00N&4N?_cpElwcHt5G$D4)*5MG{ierC5Z_S@E6!ZXn=a-m zg};%*P6s2`w@RBRUnlAwCHoGI?Q@)2niU!?VAr0nU=n!;p=qOZ7T-QN%&xb9>gnpH zz901sw;$>WpC;4tWpEud!e$L41pB|1W=Ko0&4IS8G8+=>sTUd#`z}}$GF3hd5PhWn zguwkwMD~J;#c95|45)f4+0$i(Df~Tc7y{GR7Z9*0DJr|PY8;ITRcY6Vt@mPozKkWl zWZ@9fN3Wpa2+J)J)cwV<$b&SPs14DyMv0mH#oDGb(4dl_5zh+j_YAc4n&@`sxCbTF=yWd5@*3fWdJfYFEKJN zFg9??i?jd$03UQkSaefwW^{L9a%BKbVPkS{ZDnL>VIW3na%FdKa%*!SIJIcfcmMza z!bwCyR9J=Wm*1zuFcg5#ZYE?JO4*1#jIp=<|9{KM2qUAE5jG1)@59KNb~jDWT)VEG zrzY)}FOgrTv!-d_6Y=#C>j<%PuBxiBtw*SN3U7=#pU(gwgpg7uTI19#KF8Ktt+jLR zQRJNO_xnL*3Kbi%@3N0P&k>O^_CEDmjEKkM(OTMiPApQpPdp#C55ba+80000r{oHS~iIFbz`OD`)AP}>@9^4cJqJaYU zZj21T8RASa11|JlFnx1IU_4_);eq)%4?Sxy5a6kf zqCxi@A9-Tk&?sj|AsuH=v@h24iIMPOrO2p?MXqwqAR;$})%av=8!N>4M$rf`0W< zzvW$IRbnH1NZ=-iMY>97HFQXb`@5I^hYeGK~_53?p z7t_=(-zQ#&Kv^CHN`osNnqTh%2~p=RmrrL}l-+?q!Q^mPSI4TgDSe4|wu>*LMA&$< zWi(T#NFpT*DWj3L93?6D;5~T;36uigDz9Gf?5N5Y=f?KsetQ`G31Ur@ zdn|zJ+hqT03@zCf`&;Ngwyz2A$?;DhKdUL~3-;vmzek&l-z)S_D4tZbbi3V_JK2iY zQ?E_#8UG&2q6SJOgth(U@;kAbRIO75Q6+7OWoJjmbE9WtkDcH|@wdzqAGr^ve})ns zGPLe;&BZ*Vx3O`tKe|H-{v$Oos%~cqHko$t<~;Z@4vNuk>6bR7y}@_9>I!K6xP$Vao@~;lj2(Xx>fFpl|()!)Y;v?&sTE3{=Rsvx)>% zGScphW?%AJ*HxE1Yv5`-Q{CwlED>-Josn@1H!MA6P3$TAzCc;VhFmDCpaa?b>X*_$ z5HPq^|GH15Kf;4({*k8qR5`{sX@83bWHUm3@6TVu$XkBJU@v^Cp58uUY6W*2%YDRPGdD|K--9#k9uCtP zXVU@^OO5jy3J2c%rAX^Yy;ZCFV9!4=jbCg;) z*ZDZChAM>8Pq1C;oM^)QFP}e<32u!K+Xty20}R1~dMmMMeA8IH&tY@&xBPHm)Pd4% zNV3ahv$r!xUS7bs)>j)x{=PO>X3<7x-AeGd2UUkye0q+2+HllEUonLL?10Q|5bs(o zdRk5*dRvv@1_`fbGP@&f7w>HwKl29bmd7~+d%SeiK|z|RHj={BxpauIWzuIE$DJeX z?tT%-pEt@RAi*1URF(x#uc24Qg{IBpILX^g}2nM7*Rmep<)Ax_6vyWa|x-RPzk8Y*bB$ z*9$3Ns`_Z*B{oJ}_EL&|>}$x2vMI^(FoO4V3Qf`I9&qpqK6eG%mt%EMeg#ZW>1@QB zi?2)F4ag6EEyK$dTfBQdf42M#ep1%o2R3G59{*ZZhPcH2ud1oCVQ;|aCS^TqRh}ZV zLld0zc1y$onpabsG*?`Fb9+}zaDwn}ckW@Oz4-j$m#$TA{|vTkP-vxaSsdvz0EUE| z9X{o04z9#ZTYcDWSZDra_c)PsMgBq+%IDla4goirueAQ9KDd~D_ER3oQl1j>-LVp~ z#B17=j?PDah$bD#pQ|#(D~uMTOpz8hV;Lb_0~-;|PUeB3dYeVc!{n=wFDM%R1FSK@zd5RdAmP;v2(uvBk`(5xZyxI<6)$%T1Vf|B~yZ= z=J!Wl?K7BBB1K~`lEo|X4$|OU*C-^ZRHBUQI}Iqy=vH&4J3Tqft&Ny6g{XV)r%YzO zq84GV%1pSYwx?AumSFdua>_+##(FabKa(AqX59sdlK+yFQ4{^7vM9o=sx98mvE|O* zyMP9*JREC=TEs;riOcqlFo8rBGkl@;^@<9RcyN^116o)`RutJZ5Xx~gCaERIah4I% z`kr4v+N`$M1dVkrPtb+Fg(=@qHOSxn{mZ9Obi+(icioT2<4Qz*wQuiY*ix;leN#>J z$o=jMYJnnE=t+JBp!^=}sCbpU=5M(bLs~Gu-Mp0H!7OwQ?s9R)N;2#VC7QopJ!G!N zHU3=!Pok@xfX}g9a#G0bD2zvQ|GOxDslUWhb=t8WSH$!xGdvf*j#IS+dqy^I{+w{E zgfSWF$LX6%l9u|DpxfE6nSKStgNu(6UqzpD@Z#X%x2UL8FY2(dccF+>DMen`emL_h zhc5JCAr>O8Q+IMb_3m7mlI1uRv2~VxS&|6y_aa)A2@KjQcsQuKmkezM1;LP^#?eE+$re64&w-&`Z zHwr8_C-ZFPN5)^bp{39HM}2Xul(ct8RsN0M0#c!?eJORSU#G5u6X4TMvr(~o`487s zL~T&R2LWMAh(b#rPJ{bag8uZ|Y zC6~K({LT}U-sTW?fNoXG7byJldH+dDXKUgv)s&{$a%8SG`C?41oxR^%DyQ7QVy zQS02EaD5`7IjGN~rq7jImg>|J8(UQV+;00F`$BKeK#PC)D0tje11bdQ%Od=nd!?qw zkx;o__T%QvmZa?LZ_&lQ>qTqR(FZ!Lwk6D}Ptk1e5REnFs`9+7DnatJgu#)$BNSj( z3$qPn{nDZ)8R3xpCa}rY1u5Sggy2%Rma=@;Xa1Zx0V(Xy@5|9fO%YL3j_DQ;z_qY4 zATn=~kWx@mCbQ04$*bcu_pyOl_pyXnz3RkMU`HwBy)WV?GQCq$Nmb;7WeJZFa#Anf z_)lIvXB167(suPJOJKVu{=@=I=<+nc@IDb8`~0D~)zsI?RJA3;oVdoBALcHob~1DY zBXEt?I&E6+%ch$m{lCJWHGkv?ziL2eOzk|TWL-nv5=QSKem&!)iwul<-&i;ws{ayQTbbY=e;8&;qrwP0J7{%`2d3>s{CQFs{^l z5))qf&^+NuV02-3Q@G)l0uuAo086wJamUdqb0I)OT)Vc)981a;>-WhQOIEB@2=5h1 zfPP(Buz!w;M^9C&&U>~*j|5gPOQ^3sV-TDDD1JK@F2ne!7=F9?>)|WciWEd4IEVOK zDysD^6FEzK{6+xwk}vvGVV2PwK*_1PgN46&wF~I_aP0cb`PNcpSbz250X-`EW)=m4h^m2*PqL*UUUuIx%~HNs%@LFKv8 zh&P3CMybxi*ZsAxDFvln`ZVP}2KdWvpQYUR*;zPpd z0p|e>1DDAPOp^*Ra?%m?EkD%fFSpmQM)9N}x6!JKiY7LDx#-_w>XTiz*fl$m#Zo)T zfRD?smd!6VP7G4bH__JzUyui#tQuQp+#*wYIkF2{4G1z^2z=0nG}Y#N=_K8~?HfZe z?PxDW+{dv^>RqIVL`;1u92LL>g+NvRua%6~)PWcD3W-2QA0@CQuE~+`q&*(g{}0w; zd2+fPFdl|4dYT=4{@Kb+P^jgd;4&{aJl8CuUychzlwwQSR5Kcmf1{;&C1 zCShRBN(BPpjTfZ*r8KwCeRfLTPCY9{dwF?r0HEf50ohw%6ttbY71X@P{$+$_bCPbt zwOj0noz3~3iQiu_0$r8$++utf!k)$`0~B|KhPox)*35%S5m1+@dlR(B_Mz$g2?g8D z8hB*BQ4fQk6fZLWG-`qlekjUjcs;K>FH7@N$?#`2PSv CdO2+X literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-download.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-download.png new file mode 100644 index 0000000000000000000000000000000000000000..22990ce493c3a76d8b0fe9f12e1f2f689f6339fb GIT binary patch literal 4946 zcmb7|hd*228^@zXqgLz^BUY(dqh?DHdzKV6Yj09}hQ=PHw02R|)?STG1+_|AqgL$E zQl&wy7~vP+|KN9DuXFD`=YH-z&vVXmp8GoQL?Z)D>YHpg0RRBCwieVF03eYh-g^Pb ziDw?Szb3>Bsh_Gg3`jh}fsP5pIt5(oi5~z!Nq<#H#upIh#6~WEb#s3cA7}p{J6|V& zzMX@wkC&69n;k^M&DSZ&$JfITBG>3T9!!)nUrE(`o$UPGe7qqrH!mlE7f`&D(jUj%OW^zFpOJ6gW}}w>Q*0Ho;xt=F{%Vx3U-;?x zayEov7u>{aN5Kx>C2(76&AOOXW@k36ALoXU^AV1Y&kJ3G&}U(V5rNhDZ{EBiRRP7s zPWz0c=Js^ZE?FNuUm(^9ai zfb!!1KY1zSg3_+#dW}>VH&v0!)B8ZX7T&c?Z`*pZR3=MFTsB#A5T(Vbf#U};BxIu7 z*y4IgCu!C=f1M~6sOzSW*`ecRh*PXPEU}H=@fr?&NwnNoPXHzwAyBt<;0@0duJil# zicTe;3~;gcXg>0Hc~xT0-SFGOhk&=9DG+B!xDOboe870VRs#4KgITDj?HpUIBIBlV zLbME3X~x<~sDMtM`!ulNQX{SeYilUBhlX|H!q}oMjLqa01jrMl=P@k;kk4iD3n&wp z#Fj-v66PhUt>rBdE4Z1`KcgdKM{L*DR3^_ENYj;n`g7#I2r65hmYt>CD3^V_rw@W& zq?>T>(*!wMVTe}LafT*+l0dd34xS7lf(Ddkl+Ob+!cPV?yZ;jIboe)CK)i*Z!e@Tn zH9y){xVU2XaRPSZVB>$>dQL%mJkBz(9%Bn$3yN(nTI3Glb(SlrmkJ^tLj`nkCVKiN zNSUHC*QBE$GMw?dN&CwELuU+p+!RGeeGlCAxaQ>oB2+YKe*!nSs(^$v#CrSs`Whe4 zF0Cu1-m1_MdTQImYASUDRh;1_MbIm&bnr=udZOboijjx1n)48Cp9yf6W%sK6z@(@G z!aDg5m!8~l9E;&%e8I$DK9K5p4?KqPGOX;xYjOdRgFe#Sjym-9$M?j9^~5j6YHi9sip$0CU;rdQng{w6{H%j24^ zBazQiFCYmAqa82*TD6M);s+5=Z2ABaHWnUg-6_ET#8(kw}PS z^v75cFpq=fr$>hhK%^F}K4oqmc1HU4XA%$LtV$bN6;OG}6K<(Z>L>Z=RiQ@o{aA>z zWFFI}+3~(7mBa7Fzgk$6s_>;b$BN{e>tz2_AVoqPA>1Z_>Ro|^^SBs2l7kAaD+h%g zvFBl#*mIK*qTCQ4;n>EmNfK3=5aE+^cRn4iB|sI#M`$aAEuYQ)dzS`8K9xGO@7pf= zKs2N&kJ_~i3%R4wIi|F|>Gpj8Ab6Wwrl&R zK`7H=ZJ($Jth2OegkZS~-vcF1%QW;YURR9>itzkP!$ucTlCG&wy#JV;vabG%0SP_ZX@A^iv^*yd|k4$H-a`gs}5=#gnuc?zc5K*M<)ygRwBT)7&?X1PVv z(!P`&F7rqCDcVnpJxlY|zc0tl-4|bzcT@eH6`)86%<5O`B`Nz$agWoOwylGVBmrXpsV;7-rym0J%QsPrD(d24J7A}!`z zN!bnxDqro0Anfp|^Su%YpU#78wFV-#hv_1^Z4P2iC#jMl2_kn-#3OTu24NO4>C|-B zdl(3v!~ayLeAD+lKROpl^8Pt+pQ`(XSSLO0WIVKXUOK zx61x?`cdxui<$aTBUMxM+49mS&SYk|*wPSYA|TQ{H`;ZgFK~d|)Alss_t`1!MTEx9 zpqj7w)A;xLoekXXUX*n4Ff^w3BEw@#&(kOMktpxJ_4h>%l}qSdbe8^46A_DL=Re{F zxOI1*EF)3gt=4hcOXy2^febf%F~dnf=5VQbLzmvRc&p5}-lO$fkK?lnDMjmYC#@N` zC=a{AzlUn0d5i4FuF0B2j*S{K!K|@63eC0w+gUqKuq4seF3* z%qgJmadjG&<#{3mUmO@5n${J7Bam|1pDkL!==QG1oY?~Xk?7!Sg`K=BA=9M2$122r z4VT7t>$zpIhLrVE26#ID5ur(;vU{d#WyGkO+dBcz5K9HVNz^=k{g?8q^9AtlB)Vib zi#Sqvb(;36zgXC{e$xH8_O_)s0<3Bmcqrx^5fBgNCiTAm+gq%n3(NJH!{LWtE7!Uj zZGydB<4AlI(wbP)d}!;}?edzj?N1sEUDjM!RRj-O@de<C@R!+moO8gRvC3lj z_>nxZIe9kMbIGuIWud*0I58YjHBcV%L3S>oLJwIlm7mnaH9lN}+UYv{g*ZypC*dBY z*b*?TWUlplV)CbZvzPF7p^5!lz`vebhF_X-(Q9*Q(D2~XJ}e!G(^q}k$+9lh&Bd}# ztpB^c6{cbTpn0)QmyT!-`w}8&teGCHwS8m6dPIOR1s{5{gQiEcI=|+cCI*JV3f@o5 zi~i)3sChO_j|ZkS?LCBa~=GUaH4KSHEdjDu$xy$l=m7lCjvy>yhJ&$ z8gFOtl7JUL!V8vYOLzXlHQxDFy@~nVGQt&Af;#DEQFwczXqZeLkdXMu9auV1u}RoDqhKWv$xAm;Y-gs80aG7&!TGo6X< zG@t}}k9T!D;g_0)^y`x~ovkP_7C@KOVCT5yx=5V%Qj-4uuN@`JjoLUut+-U*tl})$ z(#*piB^oR0#O?dh)fs9Q>Srl-sK6Sz{zBpF@7hl2NT`<_6T;j$P=@-k{LAZ8-8@XS zJ$U06x{1m>A-)%*!6P$(`On)8oDUbRK8HI*NYvx|9peUW+8azR6?U6?=CKHyTa}Yd zJ$fd?+`@*ee=GN|)%_^kJY}-%UV`CjUES?e%a)1q@FKx)N{pxb)|(7i9RrizNv}d{ znvH_A{`R#OX@BtGQ)bz?zgi$o`~Yds-v?k5F7S zPdnyx-^!6zd>X+UD7en?H*SAk@m)T!%2Nb>kCc0+!2T@5wd8eiFRAy(KSvV}^79fT z=3ch8lsT3`XydXhx?#5zpLq$rd}3ApR@vlm1H2U<)BtXbQ~z{f9dSm&vD_NWNXJClmE=C!aKQ`?Q!#W76LnQd@6&K&&_=9Cp8dgEOqui z(6gjJ@s+_AHESJ^$u`pz7CT53W#U1|1-BChr1iU;VDw9)!TT&}v8eRq0Y)IU{%7j* zV9RnZC)BNzzn{CkC$f5*>Zj^}A63;-@LI=~a$g$0J1l)|j5z8LY|mttJdxpJ$X-?A z&aiiP)plwFc8fV{Vuf&IveVao_b?35v{nYe((`)F{)me>)+<>@NXlx0m`RqVS3U?8 z7Mq^j^8r%wqLdjM3}xDlTsTT>mICLJUGhh z7E89-YR`K1_lqhXF0vMimoH*%K1lu6H8yh|ko9ue+X;WS2OqFjSZCb+nE zlaA8ht(N|pl5A#|&vU$j(NX$NOD?lGRt56QLnGgThaJ`Le{b4*MmP}6lP%JpoE_Vw zouh4L$QQ-Cr2JD@{nYv%xR!y4D}!xO9QubzmA(gsmoTTA+_k0d3HOj^8*&QoZ+y;g zth0Iz@`r&(%1DFREXK&Jhw3)>GbN4(xYzS7H)u2@EAgwWSvC)FtV+x-VS3|Pv|5f1 zz8iVQb8=v%<;-Vn?Jqo*0ipdfESXTb(D_FJpQbm6nQzShEUkWF9wKi4NaE{>i5@5W znp8~`&O$PIzvoi$z7Xs0Ucx4u9PqfS`2Bpa+Cp6rT8P!*;N0RokT@*%UQRI>sq22)CVK8cFp$|U`M^D#wdk<4*={7kUuJUVvx2T9ktLk=N;0IK@>(Xl|DaNPYS6sL{`QTHjQ0B59mh|~u;%63T$DvI7X T--yZ~LM?!{x&gFC^(pdyhHP^` literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-external-bottom.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-external-bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..d976212cab3167984050aff7e3dd80e23e2a6cfb GIT binary patch literal 533 zcmeAS@N?(olHy`uVBq!ia0y~yU^D`#-gORDep`pHkSyH`96wnD-o-U3d6?5L+Ihb|GL8SHJ zU^_vq6J4~O6 zxqCCbE8N2JKn}>rEBwoJV80_w#h)zB18bvJ&ssKd=1ecm;`7W5_oo$KE7}>-VYmsX z=8^$Vm*J^f+pa$T7;vug-AslDskQgDmoB-QwKO5^R*sp~{PVZ+wilmgW6-yp>v!2c zdbY~jGV7T$cdfhpw=R5b=`}{i2Q!1Z^0v?BYj1Yq2>zMX*8enOZRqvaq0>*hYO2nh zdB(^0vJXGQpQ(lU_U}G;YhL!t*&DYyH+tsY`wFw0-fW(;ImqkP?>NinFI!Da8S0-F zcXBCe99to=SgiZ#_4jt%MhqWXX8&clqYU(_`vk^2BR0prCw-YeY$Kep*R+Vo@rCZ(?#$er{??W}<>yW>IQ+eo=O@g2mR1 zOBFz+Vj!i?MX8A;nfZANA(^?U3`VBWdJfYFEKGMFg9X;Bw7Ff z1CmKZK~#90?cGgJ@=O?p;cJHJw3x8a9lFr}|D)V!;zAP_1o}DCcR@-JS_CaVZu+fUSy2X-QArQi-n9a|M2z!px(#OY# zj4^tAe3UU}8)R>9Zwevk;o*S*1Mt5WW7O;GtDJMXzrUAjnnvsOT2D_;gcyLUiZQCL zYc)-y7^7m0yJNH2Z1iPLuF-Ez~W+U&toa?Ro1Hi9^5L6V!$%(@d zf)fBDbI6RYkTYYtaJr1s;;nq4V%qIeVxacssu2qQz2%p-R%_G|153m zU6N#s*?m5oC}`VORaGfX(=XR0$N-Gy)ZXm*e125p`cAhTV_#X8^4@=0mcgSXfYH=- zJ$P)a;(yz=N54am0T|79opLS>v!Ux9j?@S;0HZl)O=_O!zitgikO8=wbAs&LEs@`C zXWB=xAHbjaNx}adjK~1|iAzK5lE+Vi48Ul*^ii1n=@ z>kwoBuBI=@>bmaTRu0f##eWtce|+ z``eoYfbVq6GQ9Vy>w5Px-u(rzUF&P-oRTCtT4HeuK?dN@7-Q&u0RVjnG60iDkO7!H zf(*dq5o7=+k01juc?21N$s@=BOddf7VDbnu0F(D0Wr3-q4SHih00000NkvXXu0mjf DrHuP^ literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-internal-bottom.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-internal-bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..eec1b2acbebdc9ff90d8e5d68244be7770a28d95 GIT binary patch literal 516 zcmeAS@N?(olHy`uVBq!ia0y~yU^D`Bhlnx-Dv%n*= zn1O*?2!t6g-L3lr6qGM?IxvyY~FgUb;!q*NMx0=cTzyyASL67#=<(vGG6qyBHaB`)z?UmYuvCo1dT0 z)G+PLXPxr!m}(A&KiW=g3o2W996obMHartFVmPau!Z6GI1cOQc1jdYMyR};uNF-00 zxppr*!#>^TYxcbt4ffJnx(38uJ7v+7Nslc0qNcf8KHqB2cwoA%9KY`AMTrt|^QZm( z8~52}{a$W{eL1t#Wc%Gcg9^&mZ+%r`w|dH=!w(lEN^H5A6E=^Nq2Ac|?)&msJ@K!# z>o31lc^Q5}W#zS1x8E*%{dLux&AZlB|8?mORAf2C_P~AT?yR*%;nz#OG&PrgdFg$1xgvAJ lv;qY&>>ia;3=*WdJfYFEKGMFg9X;Bw7Ff z1KUYNK~#90?cK|AqdF9Y;Uz8x%D7V*CZoLnTV;|#GH_A`8xTTga0;K;!M6naG~NF< zB(fosRa+ZLHr{(L0GP1g|9$`f_$h)6z~m8R049$h12B068Gy+n$N)@UG<4B9r}cWR zrfJl5o!Yj&^>YD$!Z1`21Tw~GHk&C;Q^j%oW!z4XEtgBZzP_reDn(JGD2il^kum0G z4-No5@BKD^+O}2GG>W1~kB^VKzrWv(Gv0gOwymC@pXHoWnx;yUgzy6JTdM0?o6SaX z9P8=nNyeCedt`5KZ|b^EcXxM6)07Yc@Y_m~M0a<0vexS5hs;UOZ1VNy>t`%8pcis#Dz*y$R%Cb!J`TWauV~o14Q-{GA55;{XCUVMCf z9Q=-R7SrxmY4pedjONsy$=*-%X8)iIdSn1bbE_XJ+P@DyG617FH^_dPH*MSQXb_|iFITECXXNkFnKil0ZbNqEdl&7X!Zk`JSs8(lSf4cV6y0u0r+G5 Y1DX<?ONm)~HCBw+HER^DSu0g)*Dk(BQL}2(3XL>H zHPmj*8hxL>zxSUvpR8xx_vbw4KIb~ub?#&nqkHr;oHS%)Wb|-7Z8I{mE5^Y8Xb=_f z?c1lh3H(r?wBY6-;1vOKNdk_k{qzthGBR4Gf1fL}_^5N>ByXUORp0|(x4;m`09P_Y zN9O=vq^pakBcHBkfNO|vfH#UyvDIT14cyB5@7B8ku8x78zCL{Bo=8_RX*mfgDG5n= zr)aP>85t)Gt_?Fs7i|}-_~CvQBoel^gz2Sza+F`;+Ltv!sk(s_{O|rZD({jmy_mSv zuis?Cv1l$)#m3UXTsTeNF*G_zZBqwV=bEZyzLmBPk-*71xdY_=fs z?>YpTG7cN?{$0M)m9yT>YrBNr=wngjHdZL=qVdCI;hPR-_4YphZ(E7#(<2tT)iRt zz+qi+q?Ar4+gVu@uqZlL1k-+(E91*m+i&bm+`bM~-?=svbDeKcz)qSzdz=w9c!q?E z$fl*uRsWXX#O(vKbz2pnG3yfv?Y~+SBfcbAJg1K3b8BMW@4od_F}koQ;pBj*>og(+ ziY3bhV@ykbkxKHz_#cYF7%80ZtSm}*CO7Q!C&+%J?sz=J~2ieO$CbWMgGKlaffL}M{q74jB?lt7m;O?swG|j>V`3>7%a;WDpAVl5X7Pde z$*WV{9m5q`TlFKP{&y2}p6>Kd*uko9W`u*;iJq0mXd`pm9O5ZoQrGDDO0}nEEoH=C zHNS9`Go=Lby&u$#z1Lk@oUd=Yp!Jlb_GwBk?7TAXGinFK6WSc?$uoE}qU^i(SdEUB zDve`$&nZo^tBDme7sblsHz{6#mj_Ab+$SfiFTN;AKpHF#hbD_=lpU&%$l; z2h)uiDQ+y$osLP|!yV|1y2ZST;zVv->F$s+IcaM<@rQgwDcMHN2WhJMXi6>Aa&(EgyrCC%X>jdn z1M6;YK7OUdLVWK@=@td-&69TYEs6H*cHBK)+B^G*lYx|C=1Fhd z;98p07le9OPE2;V-o||(EZy4BJ!mO?8U2*UtS5)qCfN!C6)S^-+)ppTJp76ux;JIu zthK2wY|Lc8f1Rr0?pg;o2IR{9t%1L5XyU@1k-|SDUkn4cE`CNreXnh(h`PY_^`GJx zfK|qbtnePyJN&8_xwCPc!Z{-OAugnsBjJwad}0ooq#} zY}B5_XT8o>Hac+I8W99Jp<|ihVw;$Ju%IyPDZeBZ>=34mC{F}=Db2_h%SVQ{(D;AgF70<#_?g|Gyt?j(Eqdld&l=>W&=^9Jog7js2h~-8OTu08!$>V4*WMo z*7uEkpKtHEs6A>~mLlPqx_6Aly-C3ytLMmTQ-t83HE_b1!O5R2cW3@TK8l(>cJQ}t zx5%tBVCrfy@o&l&@>WFYqgShh^?SoK5Z;9SCK| zck%*p8dZ1s{9_Y!tW|VrDv=uiJ@i|iK_|hei%}WwZ@d%X(F)v}W^39JudK`Sy&k3T zB^~x_eC4_7PXm$kx{H<8rB~TOx=v?iFQBAYOof)gp#D5KQ{IPsmnJ>}mf6KGbJQdkD_aB@( z{W{)Fy!wugrB3vV%*$;2N@HGLW3SEazd|rZRMty$)HzZtho;1#R)fL^3*q7uox0b;aAy)BhG!-)%Yg4iVSGtd4Z1-Wa>xWM2Nh z`-kkFUW#fStp$qQ=qL2P>&yjHss5N=L5^+*bAYuB^zsEPYDpBgvQ1mz|F6ib_hbmPPIN_D{11 zHC1EzxUF1E*b=twiZp5}(YoKjLKwjw&>e`;1SBPOik>v%D9#FC_Zb}2b!{86VW4H~+)JWlk8?=9;0=o$_&9=&bGY*Dj zR-x4wSec}n%8QbmO^+gMv4`5RGO>LB+~j zzgWKSD=Yn|u}PAu%c9LRb?gF^iOrboL|0iCv&zOZFSMrJeg1B_%ML3$p-{?`z_(2C z#8&*?3Y;+{$$ao8S-K8~+0N}FIoF+?-(}xTzJ%0HPRokzDdpcEPR4Xm&d3_BcQRO5 z6u&Ez?9Z2PLk>vl+SMwi$MMB`uWUu#deVVHlsU0eJr2(%jgijv->?|2sE>r!S92w^ z#XOnv*wi2Lz52H>e3}@6;m-!@N$UkM%*>~!dp-2OZYjUBvsWGX#p_D$=95C11!(dz z(0RibUVz7F%@oG)7XU%qYx80G!fXAq(8vF!j!+h`GDW9rAJ+naca^z_i3Lkd4d8yT zxa4(S^@GSFK~jtD7euskwYgT^!#LseXr+Y-&AE5^8`iOWnwenp+Ak*2mGzs7ii&#? z-B!@j#mD`!hO&hd`I~Oi9D11)h}=A(H_+pD+;&)$+d?aKVZ6lJpr-%qI5uXbI$o0L z+=D{|s8lDHoeHG=V!G>hAS-)O$lLy1ZHDiji33;At8=jdkb$zj7m{A;J+Ra2>SsJh zEA26q6QBK&g=Jmy)4Gn~Y>RbtZv=l^b4;S;kM;}9fk>qXt!GH z0P%;!dB}3E2Y1CZT)BKVEXwltdI!*f>hCUk(WVp2?2Y0Di z?)U+=sk*DO3lM^0tK3UXwfiPqEzq>YT|F_t*<8b3j61Ir!5Eo zvr3YFn-?r!GyHqJkWq#8HZ^Nig)ENlIm;x?^4&3jjM4}oa_>gZs1!5YpNn^7N1aAp zi;EFJ!^nSK6NQ2dfb2u!s$HZO+S0<_^K3-^3RIpBid?f*d^TX2rsp)@@<%wrChnnU zVzX8Q@@BXOTm6i~SL4u~=yxtNa&d$JuUyBu?ipa`4I{_ZcP@9iZ5rni3l08bw- z-^aewT%-VE;542YCa08zhDg6!S3872#}SfFXV$om*L!hemi5COWcD2dRDWmSm?Z z@wDc@xN5a0BL3$>-Q2?NAu0RF3KP@w*^6&XfV@-v2-sO*d70PM;H zzs45s8n!`cb6pJ)LTdpWIr?ixG}SdV)qnAw^$>oHV|GM|qz10-stiMVM#f0INv>;E%`dK#W~iu?ffAJHdvQ@@9RE9;1)yh|X0C+o<5S$E zIU>m9)og=CsCNy9YO<HUua$-!FK%Mu8Hu^XDUlAZPA`dQV)Z3JPnbSAv&t3Dy>$|r*URyEU;9Yj$ zeCS$0hvsWI{}Z;r@qk4Yi^*N7M_|ktzp(UKf|siR=t16&3Wi1 zJEG+6_-q56FOPEZo3Edd?j5FqIFauFv=#HJdw93*A&N7)aoIQS!y_M<9NpCl&w3XWty2N`ysB37 zEA`LtP-+#9sQTF{M7Lxo0NV2Wzk2ppHWKA7$s~W0oY$V!)FkSonxUzKS^uGcBDqT9 zWxGDu(;)@;B_=Y|vN(;7eS((OO_q~BTfe-I2zg<4m$7!z-o9U9w#iom-xv{%H+bBG zuzrp0UmOx=Kgyt3nC{3f6Q?`Y zxR5$j>O1*sXhJZkonW6-a@S9aO#B(Oe7wKv;kH>h8d4oCnC9M2EYNtaSe z{;%6@L{%YpW`qIs>_XiIkytAHpzG$G?94{sun$!&eLqxxI?NLrEEMnrm4U{Wk@4eBOW=J^>l z>se3>etcR+*qyTD-E|fGt-5;_1^7=j>U`m}w+rLI7~h9IK8yV42xo;ah*vj)Np>t( z@M8vONAzxX6qglxNv#jCrR9CkErtrO6~YqxYl^@CuF1}Rjf+z{6^?Hl_Z7U;5aYjV z6FGbo5P7|CrMS6Tkk>_vQu{~|Rbc`Aoc28 z2CjrX`2pjm2VL(W3lC>NjWljV3*&b_Is z)uGzlDX2BD%kE=y_klk*AW9l8SqT&8K;HCgcs&Rr!TLE8is>}wAO*yL7gQSJacMV< z5xF;8X)-c0u+k!3;wNj^lv4H@^oQ#@ru=8-?k~pH9beYF$IHTH8VXl7G-kkO7qbZw*`%BJQ|N`eX+n&hX*{QI2|oh#%h`c!uG#dP zg(?q~IJvVNSB`=T7&ge(&W=(yIu!F%IORFmvwD?f{+9f4_2Of#xp&pff zNCiZ(y**8FMu&uXql7uod8%CYHz^HImeBg7HrQi=>B=JlxDsTj1MtoPp-(&}DNtg1<>~WOts7N?-lhNtax|8KWlY(92_d%iqBlL$qub$nh+AaO22=ZA@~B z0cm^beNOe@L@%lJ7Psh3VAjQR628EfJj6^jd0qR4aqNP&{Nz6&^nwbEp@1>o-~+ld zu}Ngf5E!F2g`O(V_~O?DST@Ctn6&$ukj%JMMds8GNy{SlX5Gec zu>_}_gn6!OWxoGH8>+>g_h+bSI&V&icOL7`X4bqM=#zkW-q<9%c$9RYe6L}IS3P3A z!>Gw>aAxMk?nElo*lG2VLvCs+twU{a^J%jqJ3AfKgDk4d0>n^HcdeEAv`_o3WhiT^ zK|W5dV_@U>44|QsbXT{7Roa3mVC>%P&g_W-ZQH@PIU2!z@O-XLU31ub^`mH^&K!L~ z3jG4#O~ub^MbR-S=& z4xc_7Y6RLHALMmN(OvDVACR3`nEKGRZ8G9UWMt{Zl#{v@9H+3?VT?ud&r{D0VU5FD zu+8Ud@VCs5MQ!RHzOJd6dyz~GmE}y6;{6PD$i-z0MYzLo$BnXuhVO7lVv%${omcDE z?3}6^5ze$>D}_7q{pAm94Nnh++IL$bFgsWPP~CD^Qg!}K@mhxNYGq~R6d3#%CS+Lab@kSOwI3eS?lFOnlb~G zi<>_7xFTNbIxwf|j6@59$Ww-#ptlJ5Nn`?!?hj~RK9`g=92gy?rizQ1`_W-8qBMhg zr0o3K3Yz%ok>9ISKG0;^8^W$JvW`WEgM+p?C_~+91=V7t zu*yv+D-)QSnT0?gfGnCk)kPkA{FB9$k}3<%1r;r#et#(pk;RnZ#uwk%npKl?29ZG= zi7@~ee0W4=hmGuw7}s}-WqLZ~iEBfN-~aE4DPb14=+?4vLRiT2nYHx5wFzL})~eln z5*pd=Bie}fS>4*AyNDtn2Jpns`0+0LhBE9XB@ZEz9)IZ|pTa?AWNch~{QCdu;*uGU z@d)1~Y`^5Q=?%*)td4~RVDWt+nU>eB;oT>yRW-_OY9YtyLsD%fnn^VI?Cu!!V^r_; z0ZB7o^NAj-@!5hP`_B5i%sTh@@-?2TX-tOR+dXFsXP1*A3)!_r&Fg>&=)t(YXZp|<|@zsP1%w>W4X`gQj| zfV)%Md=7#{j%JmrC0pido2dJC*z%~jV~DrmX5T}z&`jETXv{G;#YZTQDYL)7{}l@h z$ASt{`SxMhbP!&__c=SHF0igj;Gv#svbNtf88_tG%hhO%=4kWFXM5Lfr>vNNdjv>W zR|Fu(_pbzOML_0~>g(&Bly-jn#}x8srg;oL7hk%q&99gF!^-*Iy?c{v`IHVXU)_P< zMwmm{Gr_mBM*Etf!YM1-=Z14YJA;>29+2`nro-`L7rqT&w-g=w)!6BZNDnN6mP^S^ znTt33%+em?f-7DP=PWjg1E~epEt~NZ(Q-?6>992dpOE&J?*b&JsJM7}YYUpIYOG`G z7Z@ljQ|gUi1^9;mIM;Q8PV4@kEvv?4yTboI$ttA}w75_C1qUbEHxMb3S&I=<{@lL~ zm5q#yrZ)nMKB}l3&CJYbjW{TL{0(M`n}FxJE;eb&yt|WK)kPj;!JniOTjBYyO(T@Gf8PVre>WEbd(5}v#eEd*cDu3| z(p3#SIU`qMmnfqFw|nwR{{6(+a;I2eBSD^#^)RH8CBbvgApYsUG0wClAV#r_}P9BoAa literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-start-testing.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/simpletest-start-testing.png new file mode 100644 index 0000000000000000000000000000000000000000..f36a58ed30db9b8399acb53e6bf347c62965e8cf GIT binary patch literal 5952 zcmW+)1zZ$w6F%jDqokA&gd?OI1f)5-Q%aB)jyyt;t|O#Fy5UcG2$Ir`AR*n|-7WR4 z-~E1jyZi3!yz|aH^US{UMO{@65BnuH2n51YkeAj3fu8UH*Y*$$;GY(Lpaq=3E-(dc z2=McUScC!hSO|H27Z3=C=-=^Vbiwxy7^HTU(R0;u{OIa#>TC&8F*SE~w70Z?n?hyb z&X(?u&bBU4!5Zt)&wwb&KT#=XOH)_4qXSeMZf^FYBCy6&t^$6!O}v{Q9yt_qBFzw4nEu$T z9uB{tgA}S+|Md|hkV!^Sv3GVMbDC#Zw9Mbq%$)sm6C5prBovlK2-fKPii}04qhXtC zrsBwMgbGto+72J;(Ix1DC9Q+=aP+x|Iub>fWc=FbBARu)c&XeSV!KHs31)M)QAz!7 z<;f~tpq&1(Aoiez${9LH-Z}HP*iUuBI8>_GBa=Thbe!lRdDYBm|E92`QZL)8c6gNS zwj%~>7(7?$J=M<~Ku;d}F7Frv4I9n3hD~nlyc3DBXIYmdkUn7!kG;SYIS%m-->T~0 z(-grEgodkWAnjs|Gii*uh%{xmumYJlWC$yli=AD}Q*lFMN|Hz=3A!bZb5Ar5`R?Yi zGS*dBa7nwj!g|woLMzlPYm%b^wz>NLC~LEe2SV37L89kOL0Qb5Hv`hzyj$i(E>xUG zX|c_u_rmidt+WI<`QasP$z*hq10GCPeITyNw?&)z;EcW-LNER`} zB_gv8ygj1r%lz@H&)Za0d{9xH#@)j?&2}o!04FMVkn4pdcC^rA@mx{Lf%3;heWzgG z5F0>EE?Z}X8iMKXlW6ICJv&4WZbO|xeLi(tuX5L_GbRT|dSP+c6N%;$9gW)(zEleB z{s<^!qhj~l$>3?7|AFus6-dH8oT6K91jI4*h+2J`l;az2l)^_Qz;X@G#m)0ab)mMMRacrOArTV)#t8fdYXslj3S~5&*{4&i0llj~*rz_1=PIc#6QflwVtC z1lfB_t`2yr(tAG0DrF8m5;yE>AcF*R_AmeDbKj!Aw!H6U==PsjM?(^fvZ(CN&Z8*| zM}8Un=xYJne_}7@d2SV^LLhC*b*qN&L@78hh59+?D-zP_Ye%*Hi=$kL4_B@Ecl6}! z$LiViF>tB)a=VSL*B|a%6fWE3WX&1VfFqLp9B z2&l6-=9)k7dx0gHA~u5uC{9g{mKbIZ8oV9!yW@bE4>!erpKDd9nCi2q+Ad6a1m`~C zW4Bn0RT~j_{V%o1y$!f;!IHf}g~7^raXT+}HU6aww$vD`@Rt{BP#nSKH9kugz9hj- zzCMlCS!N=~(vx?mG!R;GK30oRG&${lRx&Kqzx1j9Cy?;are0wLh0x;ATM*^EdH`$8 z#>Oi6!|n;B;s00QlgK}rXYc_mxvu)Vi>^PCLPxw?>@c=$(PHSWp_*9n$*xc!^t8wt zMiPk}e)AmPmx)1^e=>0IyNWf+mT>E=1YixaZ=okxvao59 z;V5>rg}0(~_2ZjeQfEi<#MKFLTy}HmFT5s+!diFWi9TP-r&hVvUlAJ(=0@~K;$aDr%+Vh|yKudDz0%y9@vaXa_KC2F}CQR-J@=|I@@`_=2aBYfOU;v;cE z(mq64?hKb0Q0}mbI8t{K(6UY8(!|-DXW~Zs&sbNC>6aLAkMcwV`cWyWHd7Nw~A>O~C@%)o) zb+fZTMsk$nEXGoYYU%iXm*w3pnqJ`({xQD!+^A%bU!xTO*k*tOpf0}FDt%wi#^oPx zyu+w9c?>Q)3AxL2%vZ$wmTIpQD6rlM2-e*l{&$p!LATp;=lI<|={&`t<$$F&iq?TQ zgH3J%%+Gn!S4*~fT3_LT5H=JOP?hZ{<|A9PtQCl9jG`mFE$<&oFBL$IP{wTOP6b|~ zWu_S;HC(A@05m#wew&}x!-=kKVrpD4`alX0S)tGGZh4Wqmhnw6h%0lHp-Vt;@;}kw zVd`U(9hAFbpVszYFh@3p?xkUgxQfa^uHFRU6T$E93y+jjXE%aDRqMmw%oAmrPw4@mE3r>UT;vRn|O18m?E)i2<*0 zN|~~U+I!_^JGV6fAD_sc>1dNj_8v@%raLy5VBl|5;KS34-1k+sgL~!fFliosc>6x| zGg|FTec$uq+KXc9ayNWsE>&Pw!wUVrA6%o)viFz&bpMlwr*m23{zKyKlWkX%Hh&Ga z2$i$MIr_TVGW0Eq$jZNSZ^l`tZA>D@_1hAp~(nasih&~y>+uzCAkvH02R(A>}M<0l*vx&yL>91<5Clb6`9 z>%DHY;H(t@z_03rD*z*_RNlaSn_AX&w*g+**lG1%A7|(>@v?ilZ6ymW zX7#ZC=j$;Hpl(p?zNoJ6+4}Q??gL}gCPwKi9Q?(VLusJ;EeRbZ4f@gO%qHjjp7;NB zE3lH;M!0x0m3+t2eO7fTH2)s`;6U$O;#48pgdTZRci0}WC<=!IbtX@o>uUyDe7=zY zV08Nk0m-FrjFnXq5S77JGzsrY@e84fmwlze6|O)k0rm8se$j`Zx}N)D6QSfI(8qL} zct7d~?K**^n^y!j#59kJgwH@h74MW(C27$7=d2cy4{D;HVTIOY0C(=|xwg`ZMSNF0 zIH3k%%AG1XS{AKvZ!LhX@fNM&1Q!E+X(QHeZ|95D$pKfG7x*~M-T)yJ|JFzjd@eU} zE+VEmcYam8ELyqPtjZg)P7Pu~V{LrAvn_1zQzbUicwY6hr-w8f@Lk=X$rK$SoMfZl=qd{$Oxoy?rN?ClpYML%XzA(m`ZAo_(k3z}p=G^4mvEM6 z7SNf*g;YPXmt_~+FIYSHC%)1ii#Qr|oi(XTGn{*V>0~vEbPy zEd~lYPc^1AuN-qPTAffOR3F9mAN@M`B!CuMZd4UFbgYG4rMz?CmO04GWT9!tpGGk{ z>!XuoPg}rgZl!QYrzPccof&H&-lcQy)Aw*hjWXGRZ$GXKb(&_e9xy zA|5R?MX_gN)3a%*k~k*%V)$47s7V+8oqQ3b(aU_ND zJ@-(OUN_E$mk3eEgy>QaUC_`vn;8hZ@BMykr|d3`+xzu+KMn+QZK9*@iL*SrJI4jx zzLc+Tcy1EIb7%UdDMrd@S_T8?YwHT*2$I{HYc6lxTklXV%2RVF0u0okDrGnAmyy=h z1MM5k#$q+z-hb0>kI&FzR+58S6TAn-9%<^l9Slvs+@>G&GiXO&_;e7jXe!jC+AhL+ zO@sWtbHOgxi7K_{oU2jeO*}(baj73{8ep>wWLOFg;x%t*sEIU5vgy{$!kkC)1bKWk z-#C=%(|fj%`I7fDt}fn)cU^s44D)%Ay5@4l^*g103c?MIUU7WtA^ZzoQR+KrCiR4 zJxZF=C{?5?Et>V3N^KjgG+kd7R&~IB1$4%|LV<@~XGu~HxzQZ3$kuws890>e{8u}u zJl0KydzYAexF@V@9(+#$@;}JZ1>0k7ybq`MENbYY*67+M6ONXXJ-!#c%5&;r-#$6q z$c(WhheakcIBCgOB$Hv#M|VEKUp%KKQD*J_z;Tcf@u-Pkkvq2HFUNH+P-?tY;4|h& z)=KG}lw8}>NLtnC*rAn`{K9^!SUwG3ss|y$6R%Z&rovd`W0l51s4PHqgWF2w{R}u% zk1@5`mNZ31Lz9*XHWZD0CYFK1Na1O_ym9SyO$~=XkUU^=%(xkiZk|O9Iei-+RLZ}PNIP;cR4quQ_-6HE>FDr>i^r!b5`oqpJ3xye{Um#IL4Bs24L}}_V;Wv zJ{0@eQYGh0C066cr%t(^m%Y@|V=m+y1bcAH$;@$A&ABVvO(8>bV1=Q#(msPBBz!dH z*5p!OA97s~q07le*!Fl!A;FpPACC@i?$m{Lq7b!|$ z_<9#!>k_=A(f6n{jy@PyKq+pc7f^%8Dovpi*~rm|2i&$-xhH<2I&9eIAK9z>>e<>S zq^7yZ%V5lOTA(y2d~5MzoR0Ldfa-mDi&8c2opYDEZDp?eOy?RzP6%c7Atu@3vtEVU zo2rRv&kHpfpS}#O1g~he{(i8dWZs- z;gd^!O65`q>o^r>y?dYM#A82lRxSE*6`{Kn4R&>6{#-jS4{EwQw6*J;dwA01e#gX_ ztu1WkLUHr|K$@miyj0_8Ar+2k3YlthJn3V$7!sQa5peLtodYJN4q58BeY#Vr~%XcFbZPM4@i+5X3nZ+^fO%3pliTSOY2>3dMQM15vKT%QD?=pV7)`3Wk z#HfEqDKE(B{7qj95AGBRx=J0rcxNie$!=_u?aDJppZ%9vwvi<03Qg`LXv#MlvHskK zaqh>k5Wa-r{4+`~-Q%?SO{F&)q~xe1Zk1AX0&pCK)Dunzj~fRhUD2u^^_AInoxt9k zkLGWZ#`)kd;?HxO)jzC|P{a0(75hLs6$6`~b&Ds2NBx`1Z`2o{Xz?Q9qo`l}IG8<@4 zcAV52$HoFGxxxHhqr>q~h<#j`ucRnXAe2uj@+XZBTH|M|K&YldI$eY&QV$rFmyKa7 z{KB~KZ#4JqKRLC(-(Jf}DFJ&|xz#AmaXLB(tO|lW`TxUebeXW%5ZIYCVbC+&^NnG; zzL9^E91w1prF1F#x5SsUN&k|FVFE08%fPcyY{nqz$d1BrNo$8oxBD~K8UxnGFSq65 zZd`{uV4q`bYn1<7`94Oqn+Uu?-j~yPcWMAKPqBy%yx(N*q&GR0x&j2_F`X(uNC1V8T2zvTn!;J0DX1cp)qA`AuTPGNL+j*?M=gfxPHbc~R0egcBTBt&9_ zfOPkB^ZxN(&;QS^YumYZot=9-=TqNrw1&D8ISC612m~TmQC4^Z0^x}PV+RNrc)e%4 zr3t(dy2+_%L4b!p#4-xFCU#cVa|3}$X>Ol*V{?I*z=s^}in{KaPS);TX0BEsH8TrW zCkHD_TQklVwysuQPOeBdP8jChm^Uz$;dZLLtCg9%t&=0CmaT&oNK9NZJayK%FPGlfln817z=eqY3N+Mkp&HA|C@zRkqE4*f|jWoQCs&h=AaJ zCuq&`=h}tNv&H47JA530ZENtI3-;{pMdx5DIee!1U*w#qgl&>z4+6vjiR83@=4(Bb+u_kX>!u5_|GZGMR6>g&6XEti*lY!c-jkGkjVPWY@^vxorzbY zQY{ZorP=uf+wTqDmwQ_k|lRp0CzVVaaP*gX|wd{J1>lC+l@ZM9#BHLlE&^jKr_vqfTUp%N&j+{Hw*qV{O zeIrEhh($YbK$oAn`OVKM{ra4v8Q|-ad|`jcm3fF6=6Me6ol9Y^F?5>(+sw|Nql*;!U2262t@_t zC$QhHAq^wD;_|h4H)MK95sydNBGHc_u0aU-$DRb96WUaMl;@|x9T($KMfO9bVH4{y zbBiG7IpaZnxK|muLSaGNYE^4Y`>tz9B}8xA--#d0w4MpHtzBG+R7bTl-3* zDX6&Y5iZ>VNyTu#W53{OW97UN)vi1Y`P*)o=Ms0411p_JSN}2v_9*k!9w+KFVkWoq z;@M8`_5NpXr{4z`5xznzC!;+0kulCSj$t-JFBdL(I3~DDpTz{w@K$sM+z_#ce$1smJZm=$1V8Cygl=X@#I)d?$fJq;t#L?(ld;&PLWQwFMW2);WE*I^l66`MZn(|cH3~h zq5A3is;z>`!2RO(9F-MmdPpzw5#ECLKJ-RCL2Px9&bNlCG7yCN$VL&zq6jD^CVq9AS1P)ek*U&X zCh}-vm?;HBKbpzDmiQNY23 z6cxiBHpSipw$QOp?dCtnkXkVwq1 zB&Y!oF3(l%x5ToMMNI?3UY%02I-lyq4}Ihf8U6eu$_6R1xHaCqyWS&yDnGxhp2d~M zfrkcz4!l?Hn#5)17eigg-!r19u%e65B#DxUppg!75Em7L$NaeZs}x_!~QJ7 zMGrbi7z~sli*GuJ(z8WPd!r3oWPC-D<3js=t&k)P%k(F;vI#Dfv%o@_{dDwE8b4cn z@S^6C*B?R^dxoY1mhMeS6 zQ}|jug$4?lh7H+UXt-RFY;VKS;|IUlr#TeCRi^HCTDb@ zjA2G2gjl;YyV+L?)O74hcVkxGE5%>|rNGtR8k4<@K~%ZbMV|QjC>M;ZE5RAH8)oKE z)vaaoqD2E;GPbAtA&sPDph+j02kBeLsw10HDS&EJ67C`G&763Es_Ndnb;5y%b0OqK zUUK{&7DnW4%p=@G$7u)7`@qGqEX&D`-3eKbM8pH7v9ZQ8JfmZl{FmjY1gx!PTi6Q5 z3IMuhCqiW z02Tyu94DNDymS^Mt6U~0JKXZG@uAtQ5~R%i*iJ34*vb0U>=}y4?vN&Vp4!_pm8raw zjxFex&v_P`9=6?meKQa)y{%5TCoOfwnMfGazC&;S=92yv(|Vs;QgR-$$=s!YB@|8% z=o?VpZR;24-N6N{@M8gQZNz=NHNLdQ8$M~#f7E~=<8_4+8h!oD0;4$lZoiy$R##}l zz!%j)^#1LX$2Ao;*?yDE0L{ZW6z2Gs+@`L-&o!Kp|?}q6`UWYPjGMK)7 zd1CT!&-BKx%BsuGlGPv**o5FOj92VwEqKV6^-JM95*;()B1q@Qw;b_49Cb?*dON17 z3?b&sB%01BloAoi7f!kVrAGT8B+v_2Vpdy~%iFwC3m5}M$)8(iW@`45E%GcA!D^WU z!f?I0t9q*H%JN5N^dUDi1T}t(hL+3jo5fgBRlUkq_tPBbroIX5-5`Y#=;+WTL=#7! zcG*jVo@)kesy5{PcAZ|oz#M6_mcgRaiFB5J7{%vyx!#!{nfh+GKqJ=@HondXXk8xF zU}8__Y>P#Ae${TA?Nq)15V|J!eUhI?0XAhxhEN1F@$8#inRI&0Kmr6J@B6%i64)>L z$>UAHU2kC{lTpWx>*dmO;)3=_!N_a;jiA~*!z*RifK=^%lHl;|TX<|H@shJ=si(gR zwkHbepvF-;1hNZnsL~n{H>o(YSaS2QY3<=)r5t=w&kc1SzkFpSWOLo{0xl%yXqhp&%aZ*5A|H_@m>3b4rGy#RM=MH5n1eV zjWlS-zCszFwiUUE?OfMXZHs(#(k$O`l0hyFfy#8*j!j?@y=s{UYcgM`Qmk(gWX)?Hjglk1DD^YKPlJ7$^r(3 z-^w!ck`2g151(oNzp$H|JRpjY=v{BN3j@=VaCn_dYi7p@`pn9{GycO{gad@3xM&%3 zHZ-^3fh~5omuaTV@CfG>6>sI`Hs+0Zb5AKndTxc*s9YryZGp^^$w?Kt^Rk-tY2oba zT%86(w>M>EEDd94`fc;WYykw%D^PQN%p!jX+(E1-DDoy5Rv zD}(3lbBED|Ps2w7yFkhS{;LNQ2%tR_i2V)EoGOwYd8Q8r5e8QnArE$-MeZ3&1XmT; z97!ED+x_ti!C|waHBDmlGOefN{F_5%zv{(jsuw4OhCWueo9F`D%}kWyM`sRl9=7h3 z_DIojESwb(U6&*i1*KK~coAZ}^}4n7{9XeT{Me|})kN|T-MKQdR#NN8WIpV%T3TDJ z*D&(g6YohIc9mVM=?H)xi3`b#6LtIAASQ!0-e(bGU)^-YGUqUf0QG$~%G3jjno^hk zdze}YP`+Qk94QeqIB%Q6Q#m}NgBa4WY52Y2p#+@B2H)MQbFb%(-IR+&T&Qk7GAFbT z14rgujC^}wzy7cQ=B=)a7$btxj}Fj5qz9hq!E}I--+kZ$fCFz2pF@g-k89})B>*Ew zzt=`TW&DREz`&7z(<*JwFn<%3Xo?IYH*8y#;M0x(5)n8it|c@e3CmTz<}mlwtFWFV zsa-b|kGi$`eHgrZrhT|1-E*~GB5c*SFIZ5GT`Xec*e6On{)tLB4IufJ&FgrZ%sBE? zS3I@$T0tMl{5$uSGiM@zjVrR4nfGkIt8-A`px6h{0j(rUCrrnM)RHWaBX(7H2+J0g z4A=cJwIX7`oN5saWWQy!?Wbu3qS=YvI9=@z=AVU<5ufHo zFE$w$g9&of-2<2Uz+Q;vi5KL_&sC{_m}ReR?J^ee!|p0qmM>9$gvs#FlC7EzoJHP_ zjqGJK>zIS4VH~5K+P4&{U*DLU?clldX0!Yr><#5-UI5dKz@|z!RSKl2$8nyt`!m^B z9Q==}Ma)>f_+#j%KebR0B^#Z!TpFN%Up*k)JB5|a44gl-dgKL9Ioq%&n~|Y!X?eY{ z5*rFYWwoSMmwA4@0*g?^YrK*d_uIWOgsQucfE$kV!`o(dTL&$Ym+I#|bOwzOjTj(8 zt)Iv@BoXfJ8zgK0$7psEhOEN;BmIrB5&CnsZZXBO?U2A&LRJj{D!eDOp(@y%S zJ42gxYoxL)p^bw*2gx=ab4(%--%wrsd4P%~JxJMB4*%E2JeM^48qq$RReyHQkbNp# zDXgUxrRls~4ZjUw7;9RFpl0wD*ZD&Iz;z>+J_&n#V z&rH$P3|l<+?fdJQZx1k#QMT{cp`w|HlRcne&a~y(Txe28sHj4$(nnB zwk0;(NU>FlXSJFQANM!<&HQ36&tb>^;npH)PzpzYmy#@K4gbWIlCu;Q8dS6+a3%$t zEs|3lyq|1N9t4Ta;tJu}Go`|I>9DUhWLd_F3*V(ZvZC~rY z8wvk98PrS}Ti8F}F@|%hnzT$#b7!gx*dUKTaL0dlFk2)!7I;4BUNW{K?lV^Jo!4l9 zcp>$5HjwEy|ECSpf=2WAGKh}`^ldrJ%jub8URw%oJOA8o@w5oI1`0ghkc3HN#6@n( z`};=hn?o!sEmo9wFU?v$coW^x698E6)R=^lN*6l5`mXHGu5|Dbz4))bcM`LLHo~rZ zrG5EN%dug9y#gSv4Q)|$P#!0eTQxiGmCu?V(PqE&W?eti=mgiPM*8%k*Jr{m$C3Ev zpBzY_l~NO6RC4EW`Iz(MY&1huZg$O2oQP^t3Cw7fn_fjj#Dy(7QNyCV)tA}lfI}=)*?rc*e&y$OeP`p?{h>!o z{f{@oe{jY$4AV*RXLH6sl3?L5b|IwVDmi2srk9F61!{uBSK|wAI(<%tTc1ckafe@? zI$GZ)aIhLLuhyE_1AS{|GdG|NZg6zcsciDd0I@XO`=_s2bBAJ7Q#HQosQ&@I3d~3H zm!LkUxj66CJKHdNIWpw7GFY1)$XaEAm ziw{Lp(d_d6Uxp*Nz0tq#4n3qG(1P&|Hgd?)Ugr)qYXmG*ko8z1(Oc-b@=rzED zG29$y-;7XHOVv6-Q)r;JC0Q^*Jj`L0Bo!yer1>~=AE$DJPxqbHg#dG2e#Efc@fFuH zu?9)AGw{430PV6;L=u4PHa4Aseiq4Ke3$c;*CAP~Lgnr|1!4urB9T1Z7y$*$-%g@V{dy4hVA&8bK+BX zHvt#;wS_TmXObHzSD~WA$9qPYCyU<`@glFi>IqPI-P7lEmBd;lP|GQE=A~bu5`s?< Z{C%NmUXBl^fxak6MNwU$Le4bwe*gm1fiD06 literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-in-cli.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-in-cli.png new file mode 100644 index 0000000000000000000000000000000000000000..abb6159dd92bbf69a1c2f67860cd83084bbd78a6 GIT binary patch literal 46023 zcmb@t2UwF$wk#DS>*jY~s?K>ln2PFxlee#tad7T#rdvkNvuhuFlJm7i4JF3v)`J?l9GfFK zPscg@UHcimZ)AhSf9HY-((eS^trhKah(yvV6QIOvf8a(Z;n}rQ@tNn>09TZd*we}R zfHo_-NDAGOaeOSz7omCq_iu4oX5TBvtVJ@|#H#fBB!^kwRlj|H-=Wx|^XR}lUaC&I z&K&9L!b@Ts9N9ip>E`3rb8!hNe&{0uHt8096MTmM*wQ<9<864QOh5feS5&($n1 z`iQg=Y`8nU`S6FUI%~UvAxN&W=h?D_`?gO=!s|gdq3pq!v%Ug7S(PTyfxY!DuTT5r zPM4Rl60^M#k3&i*;w(z_xX-fvZ}62Apvj&KK2gNec{(5`?#rF|w8si@s3ykE7LT`< zad9$)T)BsHLOv=B*n(E(Ch>9Kcl7{CX=7}XFBP^}?hiv`&WC;(!yyG>v-JvI^E$~@YPOpEE z*A311ukyPd*r?boqH~8Mg&FR(``h6HK06SLh454e5ohPvEi`MNdz6OE$ySu%=6GgU z-AX3fx@byq^poKqSd|FWuCTd%@9rP<-#j{(G|q@L?s>1aT$yymzMjshDmm-A-Ddr) z43w)1cbaqE*JEQ~$iJ@p+cRix+iT(_iDBv_=!f&}#K^Q8Up)ivQoSsuNisi5M$ic3 zjCwFXyPwE2jIVv}JhnvLg3pJ0`u?tj#kCDT$o2VDFQWC%~xw29u^>Pu#oDLLpoDt$3|Y-DY$Xv@4Y=1tEys=h`21#e2WeK*`~nB zIRW*|U7+UI60<}U%;BK%8fQ$$>a*Zn7bt;#!9i*l8!{_@VbWCyz08KA3h$v_7$3=> z&!dhX-O86$Ns9kK$Mi&e*zDd{PX_VFT7$3j$HjxHzN*}q-nn{(uz0U*t48$dmK}r3 z=PcLq5cW|f_ECjMmPjE_XZe}t4}gNE@Z#?AE9f54uj}dd;tkGFt*%X%3k85ul0h+Y zU~_G}t|cLHG~aRtsGWBh&070zNjNe&q6IIeR9Z`3`$LkAO~}Vc*c`tX=dM&t`N|w^ z%A6ha<$e6e0?gakw>hD6H=;Y;Et|`vvgu(ig56u!vhcpKb|%Hj%d?MN%$!Cyud(L6 zED&?{znl=keV3K$aYDzPHVB`+pv6ZJzt75=C3``-e&9WpDdtztqjh&xzO>O7m07x3 z?-h+XcQ0nMM*Zl0=gXog6vew&F1P;7F}r1S+JO-mwQ*yPd|J+$f3=*h0>H+ zi@=20)E&HrE{{9=J{`8nI2KSc?E?s1FP$@L}H%kk9qeQ#${G?a4YX@KR?t?jxRdf(k_cd ziBA0H=s1h3RmR>WPtKMP_~45TGLixZ=y~crrdD1?S(9Gp;xJ{AJH@7qt}zE;#elc2 zpjDq6IrOaB#-%|HCz|pmeOGXwFR6KWWd&W$ue7G!rNM6giI$7_$@OrH}K|B_7eL{b{{V($_{=}SN zyCNZku$w)KQ+80yMB}w~Q}+=!?kOj|z=wxb6brk|Ur+9gW%b3{E~4gQc(~*5e6V^N zCr<^(0A`#YZz;0Xh)(Csq4S?b$oPXyEvS{|D;z~PnWJ&P#E1*Mv^CSZhaYZnG-#}L ztP^9!f2>{(WN4>H-(uxKGc0-0_4WjrqbmS5#P5GP%HLJpq{)y7jpJ;)_bR@ipGj11 zrE53RaYb$y@o+gc=^5ifxKSRfdFLHzpT>hF&E;F(GZit^JIDtE*Mc_8FkvlpMOvyD zJ?FKiIf&n@Hw;lV{mYLAB`%aiOw8mAkJ^)1WIYfi!KcbB(kNBmEQm}Cy(+??p5OrJX48fKq!$>!TF_j@Fr z>>?Fysi@3*DJ}4+GEK?WW#-v0wnhYdqlkPwjje^Q{;u2v?dg}4i(*})poEpj?%ytD z&z*F$ha0dsMc-J_h)!N*`Yp!#Sozw-nC8~0GG?+A7xKzNBf94CLyP{bR}z6qwp}A7 zJ=!T7@itqZ)!FzW4NIMUn^hH*=hr!~;^^Pi-(&3=t7%+*Pup={tKq!O9bftVwP@TC zK4P!p1JlRt2Qk}fDV|fbYTg$+VzHm)giicTJ|gI^vp)h^gC*B%q=yVc14E+c zQowf?k1dM)Zs7y6^*-L|dd%~|p5cjKT&Qa9dUG4g!27|`bkd8vt;nBkik$0QY35>H zM^$>FI**tx`O1oT7hPdM7=DG;_e}!a92Sms}j0x`je@Sim&|FbUZUS$l*UR0_CL}8aV(bjhwZH)IOgTkj+!qeo-zZQH?zMU zQ}syczO?SU^^IFx-)pVZoKH3Ht;|HK!eB?1SEbe0SJ!t-!Y58HMc&zPQlk^sTzYz? zWatIMs=8Q7>b2miG1)kiTQd5lyeWYSy~^c;NORkl3%BSOE}al_%t~F|wbC<0j}-h=Hrn&q&sWz~`@Op~nU;O==8C`#E863iEQ*~Zj&^9* z>215XSwKO@Np;8Nhc?W~TXln%i^H?70>U+d9e3<^z1}Ywl4@%&{W2&)3#CH{eJfBW{ui`-Az?~eJ(mB z!(@})AHJG`cZ)#<5^6aMNnS^djx`E9%knpS+=pfAKe=ugY5r+gG0W01i_Dg5e57@W zr}7iG+>Vdj;)O0P%l^#fRAJsn7Ec;9O_UF(UO$oiTv}UdA7_lRtCjoxDZJW_YUB3x zN#i@L(&@HuXd?H5s(B=xUqG{3SO-7lycTybx(^Y!MmvA3C(!opy3Ihz*uuXtji_+`CMyz2QM^J^QCo`;u2bZ@=)HNXEe#nO|m`ysbI z>ucL7Z8?Ly)Col|jN%7U=A*wt_#ZNf;1NeU7u94Ia`*G%Fqiv7Et4-RUf(4#e(8)& zD~fpd+3a$KmBcUiH89ont{|hfVC_#=M25rO|E|0eew46PTZ3!|`G4Q>qPg%(hq}qf zUhCb9-yGxgGzzy0VLzU;4>9P!XNb!0dX1bdj@iS^`Kv)-+kvJ&A9`wUpDdb0o%veF zL)En6rrArTzqqCLf4$hFJ@egolv6mIy62M^(qRp7mFZj6>LKqn_FVa0WAEhd9X=UZ zMVf;cbM#8sueOOE#4rCDej|T;w#v_IdOb+!hXAiCZ741vJ~i`(;n_s&6Yh(0Y;KxW zi~OMxrk?VNR&Ue4KVM&S6lpR|Ux@45mCiJ0Og>z85ivWmN?khERrzU`=*OuMJ?7pS;(ou7h8)dTVXK<(Ipf z#a2~jWAIS$;dr*k`gj=Jk#~R^{OdL$N&htSwsAsinUQ)~d~LJ+>(G?CO=?E2I1-GP zFsNSEQ8-mvXsBYw@yhHw3 zd_17q7L1-Lp|%Q;S^P#7$nqS}F?GkOX2h9u`K|0q8E^@1Y*_Q7rOq)f?z!A}lHAX) z`!e*pQ*7@i3r?QMe$kAB)jOX`UrjA?WpR5^>wr(HGo3#Gy4D!xk?K9G`GP5G2Buf@ zGjB$|KsIu=7sbkE?1-zN-EaZ*Nb_P$9v6w-EO^wa93Ek)6vXMHj20NAeTPmzS`{~(y zKl}3bo1Z(vkvOjk=(_)q!_pa3Fbm7H|#qi`;Vm^OR~7PcK-x|;igxW}(03d8-M1zvW9a}hC7FcUKXgyGXx}=q-*{!Xfe0-mWfsFD?3~&^)!8xb z^<~h<E|>N0mG9Kksgev%lG!!#w0hS ze?h39mjj;5R8s@5mv-n(%vd5E-(E0)zC*1A5z{d4J1N}A(YYLrT^hwxes?|erc+9R zGJZ;$ji%F&)l5sqiLDaPInrUwH98J>%B%XINDIChb_bbO{K*S}e~q&I%gLll3^eYx zA@l+^o|w7+EbNbU4)k+R5j)fS39ve=s8LN#=RK9ghC&|esOj9)Su{`KJ9SnG*`vtu zH^MjsB))(7o)gQsseAhCa$~;dVHdMX#R<|C)|3QQXcbq|Efl0D?6RE0eVZl?d1=Dc zmutrDowu7ic~LZm1a2pu&?jL?$v)PZo+6OgK3%HsZkh`Daxg<3@K^f)96*Kb_U=>u zZryN&ps{@kFb*D^v^srLZnv%qD%s8p-!KaFnF`8(HE{YfpUu{zGeSkCg$UqT1L2dWGX-I8moeC){5VOu)WY`YUz zQ8P1F`FAe82f{6q5?97wS=lI)R^~8W@pmuEK6S77_bkYqgeQ%0Wi?H6rHyz7?|^iu zvCqj-6W()e-|)O~4B*ce9}u##H8nd~21l0tU6ar`Wk|N_nHofGx8y>NtAcu#upisX zh;4Cg#!NR&JmHQ)Io%X^_StUomv&zt-CZD%{Q1Fi%*z5DhCF;`v^JiK1rx-;&sN7P0K zKxz~=)Z`z9mYX^Dr8%k)QY~ycSgO4MId<{%K3q@>CqsPPU^g2;aFQ-E$PCUw0!MGFDQ>_wG)LNdpQ+08w*QFIoF~ z{X;I6yHBjO>SlQGafJZ|^>NZh9@$2w-suj_&V#jAjO`>Y;W2~N+G!RED1dg|ZN5sQ zLyMlNyT+8N#yMR)BNkj{-F@Z}RXNnYyd%CcTcK*?58uw{nn9+@Q$9W;yhc?+a&PcA zZn4=vF7(O_)53eo(V7fKdVCI^{>xf^&1xYAcE9pf6ua$CB=O;7iHl7}xrT)ZxMNNF zdn-WEL$ie=uU2DgZ6ZrsNO9yq^q!MitJb^N!)UYKJThtZ`g2d@Mf=%&(nO>+TcYp` zo5toc{dP!6;g|@=WJEXevCB$Y))T9afEToqc!!3Ru&N??IEIptLExqE$Y z^h7o$ZgFxZpkp?Zmd~WhNIVNaF6rDEJr>;vq16f0Mn}o7OP+;_*ARs5hwiAzL&!srzW8yZk`gu$w&Ppg8O?_ETHzmZ`^KrQTfrU93ECB6TvS?cV}nWmVtB{C|h;b1CDUc33(Cy zKS8YWCT{YC^J6KL@L<@_FQryO5=?78`rT6 z3Q$D!53)NkmvO->5q#og%R9@!nX(v`eXI?C2tz>!Stkp==tUo$94oYeS)qNQ_*qjN zSb?PNq5}pn;kF78Ns6SwFC{=oEF@n0IB4QVGTfkUzv;rqkf88yuOGq}LEWQjOR9-Y zr8ikz(PgSr6=^=Xb7kO;m+i-^T+dV+}n7_ zSoN=EVY7Qehjp|?T4IcP?UiF_t@iSa`M8%nk88BA)Py`tfmXL>*(Gh4%G)%(3~G$@ zRWoM2n<#zx%ge$viwmz5^QFPF=&#zhUb6XL;&#@2XdP3Nr^#6ZA57^$U{1B(<##f( z=`!7Lo3*hpo>}E@cq=Lrp{?^sj(lCOWzFO|Og`7kCStKpV(=cXo%}SFaZGR#gGXiB z9&NbF&=a~#;sv&&tu6^0IwCxbsuD4Y-p@l$*XoHYNjG^v>8cxiTKQ$!@*oGDb}K)OjsVwDEQZ&icW(1N!z3MrS@p3rr-fOxGgDh?!NWMW zLQpBwUv>hX(tj5HoF$;y{9Q>d-e-XI@YzGo8@H4Ctg6&ysMWj7-#`dYPRo5bGwc$q zU(&B?5Ij`;|MO26N3=B4%ut{2Ch=>IR4<6 z;G@^8xw(-bq|Zc-LZ+`PurN$ZFPkJUELPBaTZLt2q6d8;qIX|&gfY_!>P+n5pNIL zl9+3F!{%`jW|0Pni|8eEvUpy0D7bvb$fcjYV(DWNS%!e2s;_N!TFy*oNQ1T^hWmZNeddV9y@q+uhS z))Eak|bVlBnmPXTB`O}OMQK6X>__x zGaz2NRPv>sL9{)>_HbW66>+v^O6Q{HG-OT}n_*X#{<=R1WKi~?M_`o8=lL3RaNxvD zNaEhU-dqt%sx0e_v9tR~I_Q1udV{#JoW%S(I{A@5^yQJXMT5tLo}x zoPWC_riHBAk-GImOiNKSGCRV*Jp9ae|3ttDIz5^D%rOfbTS6}(A zlznOJifx{6j=%utZzx(UgL|$aSIzKd_G=H`TnAh38BvF{sSoP|r6DbH7G^5Kg#sM) zuR_>IU_x#Z&sy#d?&;LcuT5r^w-?2$WdwcLk3BPFI~J^sA6trhvvVjA=KbSHeF-b^ zXq-w~-1!Ogr5OIKK|4byL8Zt1OCKhm@nLqLBrPIsdYT-3>vs}^;sgVsaA&yKK}&W~ z*Eh)pgjz()bNx}f^XOsi`E^3u>6rJ0AeP!*6ZfFfO|E#JC*iE|JiWCOZW9mMIL~#t z9=dxI9qK!wot{LhA?Ilig^tzMc2Mh9r%0m0;`(|%h2DY@wmfh35n^UALPmd-n`y`_$!*7z3 z4Vx2=IdKXWy)oSL!JQ0N24M0ei4gp@s~WDrS@r!hYTy6#*V&IGSfj3IO%hG(f)42( zbqn(GYsM-cSrTBO0jb#geK?M!p#H857+K=sb#iFKfIK~%hyW|>GB6xGY>A={_$2Y; zLEtxJX`#X9mU_(BVBZ(JT$oK??f}*yS4!uKd!&?1A8I>N|LbXSL+=Qa=pE0id(d>$j+{Pul7s3z_uuO=z^Wp zUuk-%*W45h_z4XUj{&0$`rYTaQ_h#wbxC>lY>>tiR;<@PSEMHg`Y&1SM48%$v3Czo z)C=9C747Gy{j=+(^&I^C3m9k*cJnuwZNu#G&#OFwuY)}#!zX^shRb??tuLB6Rc)8P z5Y6KLfpr-U4~rayqf@B9iFG7m(42@H*P3^49#BksoghgZpcvkzlt%M}Dv{|a- z9yp17v`7S6{~%7MJS>8p8(=%m4YlV+RZHzbh7ZqfEEItM@I+qj;QkVGy@Iv$X6u70 zx>zPVv_lQWbFeGQFS~ze#L+&Rd5B*kUnk)mtGp{u^O3>olbNyi{0R|_-}uU&%Tx+S z$*WzR9~V=r?acpV9;I%&;1T}gFK(YNUVq(vwz*6veD<4WdO58emPKc7m%URx&XS#c zxk(^G#cu#+c$?%QCmGm?8taIy;_H85#qgc zw7M>)re^&9FZd99Kn+lq(D45;nYV0i52F6Bdj8L0XM>mcUKH1P_fv77`*m#n2f0gv z|9OS~S?M{sbLtw8Oz&JCC9ki%Vfw%yfati!B%u!KMK0qLsj*gB`P!JOg2J`XtJ%S&D&mjFwPYB?=Jiso6NR*qKoBQ6>gsY=i zFw)Y}9v&RzQ&JyePv%L$urM}ydU|D)Fexb^q31jV5hx*Ao6vy?B$7)^OzbYn3Ch92 zp=WH&R8dh;1%+~DW@ai=l9H0}!g|$|hGR+*-1u2&}~VQQl=;`FE1i5Z<&i~y6kI>TCldTh+kh{k7GGl2s#YE55bXiDO2Fe%1UQ1 zFJTbPn%O2AEwD7`XXET#dd83irT8Tb!Qrs+@wYyCSy|608p%WtEFB(lv?f5gNHPw= zP$(n&Bjo;m^<(Ho+~S^_t1HI(193hZ45e{(bF%{g7Ky?y6~@}g8p+mqINY`SP7w-h zzT`|E=s19^Geg+RqpbJA9U~M_VY0_1#l^Xl#{)dg2q4{2LAIi(=v$HF^L2!Vd612P z3fts@O2yC$$~K&kO^N8GtetReL0ejKgpZgMDF2lY$$!qQkr2#v!#S~8#|K8m=guS{ z|6+QeRL_52<9}9q&h%enJ$9bmxMZous{VlYQ9@zzom7>#pA;p|?Bv|lW~=PazS3Uv zPhP1SRC-v4G4V#zx@Zf`y!qpCSGH3_%2to04Si=L9}$H#sYJRa{C zF&I$7X*ext*bWQ{k)E;J!9Xf76as-D{3f70RIz~KLVzz*vK15*BIc<4s67fQ`QrmS z0zOWqoZTI1GyNJcBvn(3uL;m*8CNVc)>Rk~dE-|YXY67`K@n3()&Uv^%3PFKc;hEw z-`pWwLFXsym9I`3>Bg3bDp2;YvMJ}0o%_JCfO#?4AlH;lt;L}IygP>a92{kLclRLi z6Ck)43)AEVyv(`ZI=+&7s!9YIaSTefW~NwS0Saj@FqK|#v`K$>sP zexXfvpTG99uP*_V%-K2!WSoaMEJ!g)sS zR@t2HpmQ*7;gZY=cX0||Ns6#!jA6#(LD{nXTS?z5h)KeS9;bC6ZJ_Yxs(NDGEY|T@ zZ#s$?8rF9xH(@`tC9!3n?TM4!gvJ(ca(eDDb_Rs@_2-`l6JbD87BSYS5VE9)_Ix1?48(vq!Y*KulVM-AF(piZJPWZ z#xM*^vawYGXGwSHW2|~++g_0KQ(S$fC+ALmmgQqDH;i* zGwrM>4G*vnZiKM}4Al+P8WztUv(7e9ZokYOBc)JO9TZdnWW^o|3-FYj9JrF(#*%m@ zM(H=X9pT!B&&>?Ga29G%f_d4XV+B7N_%)_*8(X93mlu*W5MEh-07RO1ovY3d} z0Kt<(UO*J|)1X|v;h9K_6Lb9%C%&s(l`ocP55?nv@;|bUS?D!Q(Lin(d<$ zh=PxW`XbDyc>$`(k!IVZF%#tlO$Z7>nk966_3q5rPPdtiYAPg1qK?KSnc-NJO32Bx zxfjUKnrycfk3s28*g6eom$n!3?HK64Z^(b_N=q%-oBzLu6xlVdn9M|1$zsbV=T4pa z{~?47WB+I3=0C?i7edp2T%z9HiPod_xk>ADgURQ{-CTIu#;^8_XexwtYFWs z0o!Bz_p9yF0W~&(6~hGiI^dKfl$@|0QN6fw@gm_A2H-!u&s6$9cw2mqgZ;Qrr-a{}@bQrLN~edPFb+vh$* zcdXP6+LhPreO6oB3Wydb^%rnB*#zS1>eS+L^RcW*#GmY} zqu^j*_=*hnCu+s7sGQ2-4BJ7`+rq_>#lk6M()vV+&OgAS;kcu9BwVN+Ksc4%|0U^g z5kpW_nIzPL(m^^W&yJ*SUW>qv;>9pG#rr_<0 zDhu5~bFI4}1Da~R!Z^P&hFtndhJ-krBoe@iKr%LLQ*fMgcDRad3yy9s6{deJ)5f_a z_L>ZOa`dUSiOHeNN{tC|60)7|!Y!<$%7F1y_F_iu4Qld=e56o6G z$3NLbMhcs`2pm50>X2{zi(g9cSRBwZ59+jA?=CWd+xxr^vo$1d&)x-3`(!0`{urs; zY+Ui!e^Az2U*^O&^7Dwx&?2;fXpXB@eYrj@f7_~r-#6fp7*@BVX|z5?B-5b`ixhb& zMhX?C8tGO0EAubD6b{mHHi6gH+6MXVF z3+R8>bRIuA9w2w`8r(~-nJ_J)sZ;cIJaQsa1~|XoCK%^t`b`hC8L`iL;wDe{z(%uN zdnP#U^*i#EA(g%b67VMtyet)%$#4FRwQN}h6VVfLNv+I6Gc)2J10K;Ck12?EX2d)P zE!II3SwN=-v?Zs|yW3vNtY3m4;rfnDm4tJ>X}VD~M2%8*?hyJn2?`4V*?Rk1gPK&clf(B|=H z7974>E%`$%y^NuWfe-3Tq6I;9440~^vqmg+H7cGazal&UZ zyOhlVxR^akw!ciq>6LWf+q{H6%zn74aYTCN9wLaPOtfrA_Q)|*?jw`UkWo@1e4GsGS*baahve1#Wtcs6!Vw}S54z7rNjJwxSnm>=<|ty8h9v93 zJ@h_1<|oB%$&v!u09sNI)&JJ^k}D-LQBWcJ57<9^>x@6sFsM;(+`tVp zB9zUEvB>u=OmFvGXVY0G>`y5eqLZ?2N7%)18z>eW@>lMFLQeO?TJ><90!ac^c|Ix} z!X`b0K&fV-=^swF{~*KwyM2u-7j$%SKy=cz2+zl>&W5y0s^SbKsI#ZmgpYon;l=<1 zrzgQy=bA~HfXXiEV?7La_gB|gMI*ye8K#bZHI81cV}QcV4-j5843c^^^48fJKCr(w z7TzKz_JGkN!`DL6P&(dY8~HS>XDrVMl7ECqv*!TOgLwx3{W@hv^t?waVif&1S8SM|vq7 zgaU48paW6y&t_oLh_vdLR0P z8X4LGC|p^7^m^#y>5oVs9Iuky;gl(LopR6EZlO2V7zxhh zx)V2fiWc~+X1-NJtsrQ~q0gMW$1VAgaE;@mv%sD*2V(5J1u4t7FD_4bHn5mXB=K`9Ri#~)=iATj zFAL9tsvf-I&}mc}Sf??z#AVzKP81QU$=p{@|2qJ2L zd?va+$sy}v@B|#hha3sQ$24T8$y}bi+*|^KIUy?Q)AY$Y-&Se;hR{o{NsHUf`;W~M z%pxs%4zneE!HsivS3N!;xt-skMANeD z*8a%!hka_VmsUxrUwg9hs&Bv5DCSaa1)?EU_oij#u=g+_9~$m^-Aj6;y(hwks{JG{ zgDleBGg`e%4GI7k$koE`%RMP0Lbt^<%0g}{{b*zsX2OYQ6tMfkcwOY{$b7=#BZ*eY zmVy(&{H3^zJ#O0OTFtOuK%M;MTMk<5j09Q^-CwSV`(vf-%%J z?FG&D(*i4r;K3aQ#R-i-_`1x?dh#(qS*D?H#JbFroj+`h96;%kM?;RG+Y7$=H91(H z;k5Rl8cPKQ%AoxifSJGTj0j(64cBb_c(Ss5^6Zq-B0?np{ffHx(Vf%~=MdR|sl+8Z z$$YFtG#}Q-<$>NABd`KugF355yR%c3fy!kR|v*97qqI~ z-H2Y^)his`f^r~+pyE~`Qj(a@5Fnj#6$Io7{26c%^vI|xwcL|6Z7lH5(bH<*>gG;L zW99S2ebFCnpY&yo8$SaP zV40&}wu9zNavA9G7xj$ub~WAbw#vIPB{(Dea>z>WUD_7Ab0PL(J|j_|GiX@q6)k)E zkxymU9>tPSz$BlvB}$8NPkJ@sAYlY>IK?)70#%e9y(K+unAz$Y{If)7L`FIcoSGT1 zf7|&>e38JlZv(XdUg020yOc`e_dGN`g>L}QUY%q%CtUy=`21C=PXr<;G%aKXzlJ3KLKH8h>s&;Wi{EJl0B|u zCU1iAF?1xzaozuPzfl<)1jixGVQmQ6DD1~7$~$+(e@e}N9&&%{69?EoH^ate37C|Q zh})F%)3zGeIMU_jJ1@=CkiQfHynb{cT`YWJ(Hh6$0Lqnps&PhwB&c6MFhF`(6}x-* z0}X-Nb+&V#&Tc6*2*6#v4l0gAgDaq?vz#+%zmeWC%@g{KMS z6sZ|V#`+f6)eEH9GRIc!23#6^jXy&otG=BAJzAqlq#)W!1xyzMn!7R|@MC`P9^#}y zS*9GVGyhFTR*q6m@yjEIWajLBn*`)g&*ikc#R4Mm@q1NM;dNT6(fd47EJ_AU^UHCUp7+O=95mBNeBL#%endzV4rtNl-(g$c1Kd}x#@9mYvI?q5-=q~Pubd4 z+l7!Vv0u|rv7{4=hr7muLra$H$K?ZLqK<64D9?*_^y-TUe^s^-qD*rc@h2*5eKFwu z0C`)I+C${?-OX%0OQf!G9+we{O_ZQtnYbQm2`>r-kNa`uky85S5n`h~mVu~yDSJN` z7K4MvL6}9ExlDz*kht?z|8~gu>5=PqMSnxw`KPM?4;>v6@qe%2Qc?YziaRfLO-29z zbq}lNnVb`JyhpFrZwld<4;BMWZO0T|x%HhY8ISX0j<)$%3|4OkQpofBup}-DM+=W( zVp!&%S=_;&E-&cc`r=RQT)Pv=So-I+F2eg(_{!-)2Dz!FK5@#62Uw|Ud_7Ddf;clh z^@hAhaR=ftTL`2VvYkXcS|0@Bzn?PIL5_I&gh$qyQ7PIai^@58)tnbDEiljA#msuD z$_D;sB#$gCg9DO@IE2KB4n?r(%e7=_QCmfn0lDu^HiGQVgmD{rtk`gS?!r3TDSFLX z^ymz-xdsL)NT-WrFt+ zbM*qGA(MV&DAgt*9TdZgU{Mx+{A?kK2PW3zsToSCM=0-GPq$DYKmTYGf7T%)`V zSRwn>a#;?W74G}T{- z63Vfc@V@EMBA(M?+pSsRq%!!g!OdM)TKM_5AbAHFr|m5n*yB7ReC9AIJURq~4QTHc zYD*_lqRGeiEXbG|8+cc7qSg~q(AInx)0*2BcOE<$|44Df5=Wzj@+yqCNFw#M3(O1e zBIk-Sj~cjE^yXg-AR{EW{1kZsu_FRa_u1Ur(WqPu{fv{zeQtE%C6pejmND(rsexne z8uk?^``*zWdN$i?02zQOU436kp$TwqTWjuOX*5 zr#l!^%haWs9pH=lEgB(o8E^IlfDuf^)seto(Y9t+PaL1ou_N=X=V;2_kMxGch+=r2eL75$+-wz7da4ZuAylD z5>TWlND4aLU9X$;7@JBV0pwKs?AA5@N{5O7KDCwvtRDt%XofBob8;GzyPjS9JL=k* zqjQLI3Q#8t`O`=iJ1AE@;IKxk{WE>rU0@fn>)fn1u}xf_rrTtI{e@cijS+lhwR7xd z?W8z#ln+r+%q^%XyH819LTaMnQJEHQ2jd0 zpR^Fcga}JHLg78FN&xTc_surW7@I?0gLX2H;pm3r=bN9lC@7PDU=hVQ@BmX(qQk+) zyZew(W%q1^eK62;Ic=tg{u%{kcC;TJvD{?+SQvguU<3p7wul_;ZweXtbq*08?cb6W z4vuD;{xjltLbTqx+#sz;;V9D`T7W!XY_ZriZ(9usUz)wZ+=V*nPLRr*gfE_fov79b z=WZocnqg~-|CpC&*HFyX%Wh)rzfsW&wW+IT7r<=u3%yKdp=+#V{bv`fqwHs+5Y>VOzkODm+rq4&29s{rRd&`wNhG5N8Su{t0+NommK0(42|G6PcO;#;Q{1R0 zpbddK`ubPdK7ESn0CFd>>hf1acc_2z%|@$0Cm@NPxz{u4ondd-Ga?mK;S-*l5Cd%4@aiVGzF*-bc(zP zD6bseIm)e!0NJ4bxnjS*ng`TEbNCM=&-4R*%DeW_8`Bl1AtN7AS2@}gmp-HblK{;1 z-_~n57-JbfCxxgVstZO+)=9p3@D3Rg_U9ah}cc?!oQBIu;t*v_-u@iJS5qgj_xg-GGfHWk=aTEsJZazXdZ`;kVsmj#~568AoAHZzCLWRTP;BE^zVS z#B6~TwR^q`V~;25Ijc0J<_8nV7zU4Mu#mkouNX-7Ow8PEIYp&PI1Kp~A;(D2V?$g0 zh(KHkxxlIkYj{mZQs?PbxGXW^?Zsj-^5I;aRgix?$x7B z&X@%coJ#|JvNQz|VV`JIhRQ-6?M=rl^dmj)sC||=MSJ`A;8rzwEygXZ08Wbmsh!vD5AV*>sFj)g___NR3#JS*UsnbI6UE;7}8^YGO#zaIv zY}gCq^4@4#!HG%-MM`{OpAsGwVh4u`2JXrb_(?EI!Ev=#*phK3Cn<^W#7y-NyMPq89AGMsNlm zE^9aB#JtW!N%9GqqRQC#17#*c9Aq(PQiFivh%L%u_{WB7{;rgzkJ@BuV8Qa@Z$Nt3 zt6mVd|7FNl79w~rdG&uW_tjBteczr~aVBz?zFFt)vjRp ze3A*{nS-=?evouNBvgcVo=e2cwW_co3u~`bDlWxHcI1s}g;wk;th3WEZB){Zuza(5 zsyP?h4gBKM*Xdf^&R6BGRjc&Cu0I1e_YGQU{Xjl3ZG}~r<32C&ES?Pc%5;{jUAJC; zUlad(>U9=Y{yS(;G_``R)p- zvncEpwEu(UIRDY?MH#RGoK45<^S3{gxSmG$F@INjN%J-m5ytAb@ z*$;Tn&6=w@0Z_cBc`F~eicI1#tA&G`+zqpr*Cx}9WgYl9U~*(v$ulG*oU``J?57Go zYRn=xDV7>?V z$@DWk&g#_KaHYfm!iW5-Zmax8I-o14xhgO)#DIglP|zYYT8L}@p{c*CJH(MVhYrhA zJ@4+URMf@r?k`+|hlYd)&<1O4QtK0Ynv5oD%0Xm65v~Yqy^uog0hcv;1n`*0bvYOz{`ID=olF}qk z)eWd0DE?7!=oPo@PqpE11l0Co)OhxpYF%xP!J-Q!FbKx$63^gI{r+!DBNktYPoI$m zXO`1787XX{>?7nykMs9hWR<5sNe&``Npjwjl^?xTGdzTEbPKNLK|Ww zl#+PaWry&;F*tfMh0vZ*C8CCM+ys?8ccIJ)Ow~}`!=Zaw3*Bti!L$$ULVdc2?|3lYm(XK=vEHgO@JZ>gbYaaG>|I7f)jekV|kp1|x|N9zFSupKUTT zO#R<;N$fNw2W%)@5o_8RO*y|Z&@h{ZqeltBsdb;~b&gAHQk4NnOZA*>(Sj6ms9?N8 z!kfXB3_>3iE>aZ@&cmO0edWlQ6b5k7?nryZZ}%1o2<5ly)b5PyQj|ee|g- z{KE*W+5IV~@M(08VOSk5@&0gbJf}Ez01lRWCA9+SHk~Frz4H6YQ|M3K)y%MgQv7B< zg3$*Ar!wfFbl*}pmcdB;LtkP1nFVf?_si@O`Dt+D8VPAm0lBW}7cf2Jap}=CskFlw z=+Vuo#u2qPe!v(kIuUl}E2}t}lcy<3G2moPx?>+Ee|TGAC5|sq3csT?`wNres^2Qe z$+R0dvybGJ%{6dgzu9`(Nr%=FIhgl-`F6|&Ety}yKJ_BE z_l=TM>|>m>TkeOBph>}si|!4i(gv;Pujq@zqsUYcf%QfSCE*DeY<5hY91(4xPxV|( zN@7q|`a_}U6$TumV(aB!S0f7ae6#>brEp3@d#ou0|G)@!%XansL2Zjir)HugFa(_o zPk3MuyMDbDetZaVC+d?**e>9|YdBk55i36%B24Kb?zix1vP{WPnCQA;SCKEnsJvkwfhO0rOF?R29Y9lU3l+LmA7rg$9i3`=zUcU|=2z8XQOnV=E zfN(%uU$UtYnMGLk6)5sIzlw`!V=3nV?6*z6e1h)IK)a5IX(A{|UVEZPJ1DEg^2VOo zRZ-*3l+{xNGsL>G8@Ffk)%>qFlZpKF!iQ5kV?!dds-o%7gD1Z||HegAvA<*T+DTj~ zr2Apu9i{BR?+Chi3y03YyNT1^5Tem+gV1;$ce7lZruP(7?{MGla`|G;@GVh!1k;H9 zuvZ!Q3z_J~&L2Oa9ZJU~*)5DwK-s9<<7+tB*ptGPgt=gYJiGKhocNud-Zb&9FJVDyL5Z=aj~$~nO}n= z>h6!hhVh)x_WaV-wkhMA3`^Fho3AAsUiEd2SnK_e=rsNjy3lB9B9vXaKICsp*EDwY zgnuDlDk$tN<8zG`(g#;0SQv+5GQN%gK1U4WQgiRHYgI^>l&${;GbJcJ39d_)E4jSI z`V#-?2M4;=K>|oxrGFiJrYbB38BK@LI9TFnF7cLJK`BwowWgM~w^^Z`es}v0s!QAQ zC2l9a_D0>YLQw|3O4@im6Cl>``bEbmxhG+t^^*lLI_Z&eEv0mB%*(~IZ#6aBw+)zgUWTfE0}@Ke?%z9~na`B~_D3JKdx*oYwS5j}Lnm7XNyF>>7_Z?xi^ zNUgT3!|G}$uNd6jleEaoA{KI5PIWtPt$vVoZ7$>J4KDl!=iy z*mQk5st>19XcNduKkQ<}+uxwXy{cbt?tLc^8;s4AQs)XFb=XP6Nw|@zx*?9rrPM=> z1h|ViYSEXmE8-w)^w)is6kWqOy?Dtu)O;UrA)B62de?9IS(8gZ`(4ZhdZc)gZ0{rB z6Lg^>=Z*W+ey!<_Q8X$%fnm*{=b=4J2+-gol6zbBtZHLndQ3*LH0KV|_FFG~l+fQ7 z>-t>GI+}*1rvm6~+x%A7F8FS+?Y%$W{K6N0av662`;xDu)_nb#WweyTwoGC96+zvsnuzWGLwt{1bs{5dNGuwe*qIQx(HLB2} zTuJGVJXwX=!=BLIe-f9)$p7KM=&Nw#4UWgI3oeLJ&4i9#5^(uzSQCD}na{hm5BbiP zsn&9BK9|x2X zUs}*zZvUCw+;7LM3kDG->dx;AI0T03-6A~I9^pV%`HPWG=vxNJh734l$ek-Lw zwz7W}h{cqcDuBu?*PcvEZ3~&lmKyl}6H|}&w9#hQiL~Ys1DX+1)1rKV&?W zpj!Dwd1TlV7-(}gN6@s>7pe@W1f>$fk%a0ojbcM5BL+}MA_+wTt77t7Xy!;+lpCxBt!t-8AX|x=h)%?9XK@x=`8Y0U*t_LKhW1))nN=6} zuL^YVYA&yugiZF*PUu}aThz~y({Z7~gUDCiy^3Re^Ye|40jK%Kc2!O%Gwpx1;k<-$ zzUVQ7Cn~xT{P3)yPocMAs^Z2^wh+b?fw~qo?eRhAX6P^WzhWvXJ@I7Tgb?w4yRugU zE5kpA0Jx$SA#S0Prz`Ohx&cCRvZOjf%dKb$3hPv*hNt`~j(!46Mxw~g)=Kco2LY#p zXA9(lAO5h0#I8735C z!4r%CTz((fw|xnI{vF6Cf^{WLkpZJp-hQs^W}UUm(;;U0fG0umQwYt(SC=JY4&4>E z0@oo$lOf)YI`6>|L5e5UKjrpc%v>MyJw1H-19$nUJy>%d9?SpbgDuSp*B~p-VRur_q@4SGbuV?6XNFCkuVF(gFQrj8g$KS#zON zDp?V9xMAKihB`Et`kRd5<8mvB!RPE{6K?cUc(eg<9cx?lNMMU2d=`=y;odM@-n#sfi}Z>=|(T zeZXZh?X`ED`R!bE%jtINHp>@P&boW)R(+-fJVfJURiNF*j9$`e1qJo@{68}<=>dY@ zlJgv~Jq|sij2I(d#Y@LSSHs1K1#Cr@Lz~j_TRl9Fsrb9ZAMhu>s~7Rf@VLcvVs)fH z!KWD@o78$O*o9JQqsL!XSnXJ_^yuG;wY=2FWjCv|+>>6HV)Mn%d4?SZRw1pZuB%wa zpgM|d_|-0?pD^7e;%`bbAhgPiu^X$4&bMw7MB@8|jg;tA;mt2->on*QQ1hT`jB!aI zBL?8ZEx-|97_;S3rq1~+%XWi92>Yt;^pxTGB$k5qWk}mF;SKgc(P7Qm*qWxFq`j?h zdKZ=IZgrQJuI9Z9%<${kc;bXQ53+%~|90u38UH#?jlXeRNm=WB*x{RU3Uj6_9m!=9 zeYCO83RazMa2ubO$36Xa9)Ybi4n|4EH2=BPQwAY~nt#d~f6zoI3 zegq&l$YU*!?dgnq^mi=6C|2$8IF+}q$ydG6yj(cWl;zP)A2F$hR z5;!GL97};uo6Adabx(3T+dpN7%Zo?&3#S-xQ_$AS&&!=q$zc45Ty|TBxWWZ+t$R)mP#CtSOx$x)% zK|4h)*}scWYOIDEEj45mg1ro$7NC1MP#;W+*T-5W&pM@oBd(n%l*{+yEbj@GUi@4O zW0!xZ4zEV>4Kra!yAN(7et!NU>j(AexgdwoQzf3;n=!p{zQ`uV-O*A;mG~>9eu} zkF_DcV!71%%=R(43JeR=_R~e)k?^ndf^@w--V!^ZSB9c`7>%n)i_J&y)J_2360Z<5 z_z%-O=qmR}^w82lj4g%mkxz-aTS7^#0fW_upigk}79`XlI>6`IbACu6i;d80?_yDg^Qy2jdq1UwDhZv0(p%h<6KV{pSTw{qb1t3MV4iTNiPQ6N3#2{SE>!p8raJeJEn_g;UsW)$%u&7YGv0Q8oW#y>UHQ zdb|+ajwaO&lW&@j!d~F+;R~DY@N<}TsG-=3Rn=M>lyN1nSwl2qcZTm|Jq}cdf6EZT zDjYAOnQ!J|bu)Nz7O{UDCCDi1?EX`A$tM->Mj7kP^s?u-B2P-uy%ii;OK)MN$j|8= z^9!s$O-M?svzg>B3mwp@ZB&REk-P%Yzk!WD+E9$*0Dpw*V%?hk)cG;`;=`DEmAe?a zbqgEM6fC5Rm~OkRPMQf}^r|^@#g_#v+4rHyebAIY6{y2#XElp zdSBpV@UfEsb8e0PQLqU^(561w8)*@L^08C#dgbxc^J|uBtyvm5xdDKOrS~B1b;O;D zY3x9-NXgC7fu)W6$1MPfs!#wIA%;nIMj|6aieZTTVg=UPU5BD%&jbx;t*)Hb~Js zmZ3%uf#S|l5F=DI@WfA>!KO>pY5%*HZVH`TfWduv3{|czj{1a$TxKdCiw^%j&g+av zG4Xa*6Y5CCXUoeWe^|4W{G(T=HoEr(LsY&;BP9feL(eV^&7b^yM3qzoS*kq1$XeC! zv(W1h?H!58%*AD^^f+FwJf`vmBAGv<3mt8c+wh(I+gRl$++4?^EXVBbf%Ujvx0vj9 z)J7b+#LA)!SlioZd|U=7aDI~|wAY30$?PfrTk1Gk4`$pw)9g}H!9YdfGOTim;>Q#cd?`5}*`R@yK zlc5QY^P^4IPyqvgbCV|G&w60#B3lk%R>uML$} z){W=~lV4BSGSp=xWrH5+V?$R%Tz1an5aXrXGB#k67!~`@TPJ{n||DY{n## zl@0%cJ+D)7bV0RzllMO85lE0^$fK0FGBzwvxao;G;Yy;PVz?Bm$hn(buS)`Imy)*Ro_JREz1!J@pS#eK;mm)MH)d49!aP!l{`PBq)q17Ykg3|Q{EtE=rjpOx(LZ_)I9PSx{4mdu z36N1l8UKUe+lJHdcFFiL3@hI!j-=5%``gmyVK((&G324 zx59>F3+0ws+TUr0B@J5@FiNanxA7i)r^8$>L|Y+N*T7787!+i83)5duC->I;PO48S zg6=86d#ZG4Ubo$Njixmnu3{LgV z!BMfN#7q)IKxK=2N!e2>t7x+48D0n0bJ9O9uT;=;XT1J&P|r-^t4hNR=+uNh z>3PC^Bd;6%B6L_#*XbE;MtA-#MyB{$K*MbLD_wO!d*EBv`_%>7(3 zwh=coiqzr?c6EKY$&d;}e)$ue6`U}2mG)jD!9M$hxTk?AYO!eBxIi21ona8Ok5fDE zP8?LJC{NY2N!hi{9)ZRgoyz>Ku(?jjX+A>6By-bHp@u;JzJ2letC=yHm>+#JfHkCm zX+2g&g;zG1-o$TFIG>jGX)`JF^(t?<-U;?am2{$YKw5FbFcQ+Q@y@Q=acJqQ*qP=K zJzZ2M*4fOOn_5S;f!Ek|w(rL4+uz>=X>nsL00njoxyW7Wq>3c#Y~lL)RDiO{^b3vb zX*MoKcYSu}k3|084|@|0-@H29Px|p_8}{SaC$#&n|7ye#&qA4p3U9PTPjR+&DFG1? z_jKBq)q^EKgXsuWfZBkQCXCDC*Fv zDxTum8}_sPVHH*;4T9y;#c*3o{uYAp2xh8B&h(3Z88_IqHBxQ}^XAIA#gqibz#;XN3r*>t=dUzG0o9r_?*? z2gS}Pp!h*^J+OKQp4?#}B%&8N&=qKj&bj=)C?GmBj zj`5X?NGp?bz6J_9SeDEFJ`@rFE$8FAUR7ZEzOJVm8tg(*s*p8T%eTw6Q55JERS{V@c8=WC{Dr{X7YTW&6ISh6KFggqEOn}mNXb_a z(m`TShF@#)YqGm>pXQIIM^?9E^jEb}Ig_yq)4WLU{b|@%Ad#v$E|EJLCHR@fJMY$r z!G%cituCmAPB&HTYbQgDw0S@}5(Mu28Y-rad-I!L+PZ@wv}ZMr9Wy}Q%HoLuE&0AP>o2OmEnl_>>b4A=0Y!=&mg=wHQv;TyiUB%-E)3P~lX-v~q2)~>(*c2*FRw| zo$~(NU&`3~+`S0^H=H{+<&vk_-?H6Dnu3r&>{;c zT7Aliz~DzNb85D^{Tj8%354XVbMx)|^(-$J{!Qs1vZZw^Fl9hBhCa0K5nnG^>rZsC zz?Kjv6DTP_I?yxHuExS6TWlvSkN79youg@=m23v3uNc{gs!2{C?tO#O89;_fo6y%j4a z+pCh9N1$$P9)xmLJ5J>~G))bj_^H<=VzpQdIaM1aV>WOm`z`xbLfY2mCJ5BXn1cC} zgC(lg20x#K9Q$}5a52f@@1>j9a_1f5I#|zxcf0S{h{I;O4H?0?6O$*~M>d{Zq!Vq8 zO&MNqcqp&e`In3DTP{x2YEHIv*)uJOLgW8#Ip3&~$)A6BA9-G2*2n^5;q|j1>K^Jk ze^u`(uOlamPF}1ZBy%vXFVxDl0D?Sv!wJ~+Uq$||Ux0W8O?Pd6Q!>Z4{b>I79wG4( zI`G<}t8EY0$sSslWC8^zB%ha0K|5Le4prQcZXkS~Q;a1ZpQUW+9B-q0fN7VK`R_V>rdE^2BXe(QIFY1@5#dMnAOEt|x&`Se1(RKK-Im+-RjWAbSki zv~a`i9se2pP2%B4Og=rhGmst;EfBC2PMvdNTTnA0UJbi+aFNkJ|MTjH?yNqgxJQ*H zAdLJs6iP>&bLEqMX3xhtQ0FPsLuXL_Yixc$f^bv*Cf!1yb0BN!YHIbhWmvK-3sb-v z(n@O3-OSN8zZrR`$Zuf`q2Egt@f5vkt52rcYKmG9nf!F%6B#KhZcV_fm+(b$UcQ7t za%77(q+8(o$v4*g_#bOv{|-5L;tYRlA2h?pXdw`W$keg1!?x9aultEO@jEl0jGzKN z&`kgv{L~M&xpE}4lX~D_m+RH^@qA)4Wz|DSg6@n*tvin~&hWA5=Biw)*kkaKIL*wT zaNtYn*tk^mNA3(AXVg|G@7UzY>NdT$y&*qHVg6? zPnd4fQ-PFFe~HI9Sx&6H{i+_3s4tSBH{ySA>vZu1X&oeayd4g&;=PhncA<1mbwuwU__4arw>VpjGosC2f61%YSU;l#n1=7{e{9>T+hJ&)r&s?9WD8skz)6t0NJV zZHxEu>R$<5wHg=;$-R`&75E=lgV!aU;UICCX`uZNtw~HTx%J7D+9c1OpWDyv^X=ZH zk^4VJyH5U!pM8cEqWqa_l3-)r!`R4EGcD z471jKBnL~+744uMV+Vsba|J!Br_wLBVm)R<8p6I}$^$!Kp~SuuoVAN%vc!EYhK;!u zu(sa0ig4)SkA~$^D2<$7OQ0 z|NsA|6hTOw)r{xqUK~H6XlS^E|Gq>ti1ME}e*f1W)Dls{Q8fxx(%V-)IL6(T1M=jS zp-#FlT;-U}rC&yUi+U=66&He?5Ek^UU@JVW>5H~w#25hRW#ns3Y}0b6{2G$g@$nN> z*l1Oof5Y&Jy}kV@0{-aa={XmGfGxuBuLfUQaMUz5LiQjKNeBv(>lC#a>huwM#+t6& z4G+a3SwZcDk~mXTR6IQbSD%ii@|>QZPrbB2UupH4bVpu6CKEkLz(Ma3m#}+x=*6}o z)Qui78`w70hhW1~28UTxXsHf-8ZP*7MI&lHC1 zp<{KJG`sbKWoX_XAAFn0+CBJN!gV^CBY9M1)VlZi^XHX`iFnX+#&f!nJmMu4HMLrw z!;py;D=#l_HB$FD(%T0C^AQ#kJEWwdTHV|G>4yR)8Ey-_JMT`Fq5Biuz+=+!a@(EC zBZIa%IvUUG{?bZVQt~7vHFdRIr+Q_%(OG>5m5&a>!=FEY`Wx&ghN=A3y&#w^2({_`gv_z41ZP9fhAZ$&y87$|ETva*pB0xdX~0-h*9i z4|b>%i>b!1+}$-9=<8qFe*ps510Jr2*Eyfvtak)lS-H%I2;S}tldrSkWWNaeMsm)D zdzx!zY(~_bC0m7?gNo%aLApnIXzD2Am+(*S9wf;pMqL6!nnQhH@JA>RYmX|2M&>yD zN;s?0ed?D?=^dIq?$+UIs~5Z__-)$YWtQwI+U;lWcr@2~?}%B?Y*r*z4w0nq_0agl z#DhQ6j^>8LlOw{dH!IqxH`3^Oi5`p@HMwHU6OXY;utfxrUzRjFuiv^i*VJqr<;A_c z^>|k@3<$o`zQ`h-m|;9WMjOfFw#jb(V7J1)#_;7WrRTen==a=j1q3V$3<-VBU`G)b z)ieX0PSi+v48P69AE!b*MCN53)%MAgrtPjJ86zggMI35mN#ufe%;lktQ9D!E9nW&* zA-+-S%xzN60<{)ct}J(VJ?ktD^yA{^W&8o*TyWnVvL+mFA5p%LH8Li$SuU0FLDcGEO6>#PLx&8O>$ai?@Z>&Ib%*Hv)m@y z=5|dEL6$0Mxic49LgsK@lco!R&Y$|~KToPUJqN5%EVCkrkdgm`@0RY(&QsApYQ&rr zjyX4OVu~-2@Zwf*-re9O^^62tIO~S`>gqu0SY*=8-}0NugF(IJUt)2{JAUG- zDr$3A!Py8JWHU_T!hisow!SM`um^e#Stw0;KjH4VY~iO?&oJMS%e32xXZq*^kU7-p zjK>V!MQ-sTh?;xvz(m_7!m+^Bgbrjn#+P`tvexli$D`;2JG+k3N29|t;Ne>C&6aWP zKdImMtHtLvfOtp_(a*1)dw(0u^-t#>l9WjFI~@yK@uv)`{HCdufx~U~6AN>Xa^ z=u%>oFK|X7f@V5z>C03OFk#wTTv${rc>4j7%MeO7QQ@+W42?U$dagv#RsS zi#Kz*Eqqza!Z?WHubCUUG?B#;TK<2`gssMYJ@P~j{@nvSv;Re{da!x->_uXcpP9$9kz{4zKUxGe?HMd#U~$LU`OP5^1>t34Vr%d-P}AU2mEs zKs8rg7??;Lc@VLR`tAZf{#7FXFe&RiOr2#IQ?KIT17>Ui8i1NGx4kO- zQKScs=PmiR2~W+@z<;l5VvQ|I{z}cKU#&9ULz3?gx$Cv~1nh*$0f~3kEyw zB*EWEcX;%DaI*G;`Pbh8zfA6UIwH+2OC{#%|H|EKrUHKfe(;$Eei&32rNg_n~^=ysqbiLE$69R?B#a&MBcd_-(8>LLW;Scq3q0qDS$aX*I19d4r z(op%c$)4Ex>8dylX6x6Jr%1dEP$h@7AQd;m00iNhHmAKwDVT=7lK%rL{%r=rkl z&(_*G5r2gafJ?0Zr9(s6`TEopV@z*ZPbVo(83i(2gc0#qp?<4V!_VVnsh)XM7Dk2R zvW$X-txCQ`@?3W+r*`toi(R7pd+S>pJD=5C)P6D~-yrY;3Ea8J9rU4`n*pLmnGepU z*P7cpjntuOqa;riFT1RN+L<$W#qS`9C4o9wCn?!)$?!uE`w| ze-SI>54+>@f4qGIySwOpkabgo4U*ge{BA2QK+e7V`k*s$$9vyoUe=3Gb;rq%GDJmK`RIkVDOV-gPH+-awthVr`A@ja~Wu@p|X_ zpP&a~PxL>*_nW`8ODc%_bQviV$fJ;VzbyuduY6!Mxz1m{{H{0lE}2K!q`NLBOM;^~ z_rjtWEz&vcsA4i`aNs*_pZ7an;Jfl_>h!%So5MI;ZMAXDWohFl=DlD52sy8<{CvEV z5>r2+%IyqzY?$-OmGChaM322^vS_?FUAd&}r1BkL?KQEin1-0e2fo@Fxs+#8ET*aH#jFe(x~L_36J z66uGEI)u5Wrw$}uctn0c#-IZcV86f%THbckeRM?=#&`)DH4|K44DZ}?6G@pq;7$7q}=%sxTozz`}&oNQXK|@Y80VP+BaZnbt zgY-H)pXWG1rE z$a9b=a@IQw$+eN25sYf5O^9B>6>?-90)!wZ(S3CHI9ppi?A-zcdLwXVhW~!i; z>UDx1YH7?N9N(KmtADyY&I1YZYHz#_fpj5;&H|gM!UBw=h{i~$X;#>#s!af+$bKL! zFMfGy%G4cgK1dIl-;ldX611@4hmpWZOfR8(gA57s6VpXn7=gjSMei)6Sq!w{8r55uj?ME{YLFL{B$nfazMl0#-K`rEvHjdLo zg$86pVfUNM@1q#!=urGJPFHCqBPs zQ3ZLZzBA$K0tj|!A>ewT`zwe6_r|}a-N68(fO}~Ri^6+kUo?3oaaQU-L~-s-J|l-Q zGcz)J#?twh?`*h8G1DGnkmgL{$VlKJ{Cqqk;YwYSI$HzAL!X75xo5b~L80y;d2WCx zd58!DqKe^P@*)q3Ga2Zf%M*a~-XmGlJ1QB(beB85F(+E^!>CmoYso`Z20Kco{7c9j zCLob$q0(=y-gerckY%wG|7E$&?EYU5=b#AugIc3%f2i_o@bS%!dz69eCl^guCcP*P zeCCj6&z>1#y?$0p8YV6MtpD4$j6uT>XSYrhiB#)$s&B~!hug1^-TBtmZy}b5ZBYy1 zd=w-qsfytv{83oN^zr713ibQ&5YlZLlHnY`z^!z0^QCP`A*bAwY@tm3mwbpF{9S2a z*LN$4zf=RKhZ?j-U3XP^2jm{e**y%G0H>DTy* zp|_uIn}t3VAh`Ojg7iY){#-ARkocmV-C&*DFn@Es8ejRPznyNT?z#QXg`bPVcUmJA zWVf^gcKVY)d?bHS@%z>9L@f6Qb4D3$me_(?tex7SJqK1fTF)`P2+Joqfl166}W4d z`B1HPU0qz!zzTl8`m%AMWh{|gY%N}|8< zCA2=}_uMk7hI&3g?t2-FGdw4-4vMZCSMu*6u4DU^4vi%zOF6Hs5I*|`WuC1(I;e2R zN`)yqW8cRb;ss^U{$8*8+SXRqwPPQ=y@3qK080>OM-^(76|D${54}>=$)i>#iA5N5 z6xF`sB`w8{RdNr_xxxqX+Sw0uibp#!Zf~95&#m%P>`YJUeo8NLSjs6u+@5Bk6TE%S zH}#53TgT?cbjmZ3oT4=n=Da(vZt zU}Q!>RcE1NW%;ySU4Hu4mBx7=7ZW7s$e6^s?Zk7|Px%+8h!bzEA0`{B zZC*GPf?ujAv%boJ2{V4leLR8jXr67SAuC&^#D4^yLHl5a+y~n{0eP@FTQNbHb^lxG!2o(^*892Gz%j(cs zfe4AMlRAsD>hP0jUC$~wn#8Y0$jtLQz$c+)I_s#Vn!n)JOO=yvekxxW9;Lp@QFb+a z;dfAH0(07K%Zc9gXDp$8MY z?YYo*>Wz{|_4AEWOi?Dnx>tX6jsvB1;di^t^RQhil1V9ddjh{VA^u3+tC44dTir}A9M=&W8MCi=SUK&5A3WzAH4}Y2^0i1el|P;bLRXFTob9*Qy1=( zxTqQM`GOE3+YzT>+oH5t*}@y?yrlh4^3er{UW5o{APxK-j4;Q9_hUcA5M5Kz?DGgs znKh%lev9@DtQKkaH+(VZr%s*K*|_%t-tHlin+cUvFg~l_97eWX z)vZhxBI}R*?Y-Bjb_7Y(JJ%mmC!jw}=l| zOw1RhWH>L$?fUPG{TEJjE&=B${Z&9=4q`Mk9Gicsr<>sa!qflDTTtpL^FOGkS4~Yb z;T}v+I1IlrhJ=I=^tK2=VY|hzMUGLji(UzI$2T z)?9dS_+x6`(Hv^9Adhn%45sqve?Vy}EE%2Gi}#S%*Uc{-3ugRp(oaRXx5}T_+fkIw z*~K5;hzX_%fs;SP4b*{lPVUlX)NQKf?ky@mzTR=0)k+;+^xLAXy_yuRL>87frM9TR z19R!id`2MUv(~wfUwvBDmw-n*CpAAkQh8?f`(w?xvdiuzJUv-t{CIdHvDyjClXz~2 z@k<-I5-a{&Wp5o7_4kF14vk1ENJxp4ba#h{)E5B(K@gOd?naRi3fB{BC zK*k|u&Kl|)`{JroE4kr^<#k%MuG{5C@ zYh=seX((Hw!3p7RAnMbMZ}l%JqRsv1$V#)2_V-Eig2vF{qH*uJ2Stu|begj(2A{Q8 zWxZuFEv31~EHihS*1Oki_*Ub!!V=vX`cTl{xjoyYx{~s@B=&29Mkh zZq0%XbNc_q!18=Iep6V5`tUqF+87UaHm!C4eXSq={2fJBkvx+aToya7o8gJ=HOf5L zP&}KOQRvkV2{TH>XJ=wrHk31kZ_Kw)d=9D^4wd$NE6sA}`lw_7w%}XW`I(zUF~3*e z)!EKW#&k!S`fr|Al^ypyua2ye=JJ>DJAb_4Y}00#GZ8g#c;7cX%p$Ph*mKj3Iv0jr z@i7STpQ&{I<2quIGm1ukB=v_wd6W@4E;FKvC&)j7k|p5*yg$b}Qw%*lJrDFEeW0_M ze-G_K?_Q)yEs3eloGo?kXQh{v`1L^(X%f<}3bV{Oz4b|_L}X(Q5jPFm#0@rX?3-?F z=mbx3j~#1ca4o~y!$J*2(<0C3AqF2W*#Nw(;&1Vkq`5#h@Zc3f` zt=^pRSH=~dAajdKwj*wee#{$em$Qr*dEhRuGMnw>7@g@m|A7r@vgo;uS8c-3!GnyvJ{Zo`>3;r}O=YT+6-1pfH#Gc(x{C)B=ZU2h2 z4~Ui?5!R`XxTu6<2Pt^gPm~q#=7?1vKBQsU;{lFMBAmem$LYcDUU*~{9)mmzxIki7 zi>zb}{hJ2xahUf|49;E@fAe(s*NI0&TM0DXEzy0T#FJ2BPQDkml4F!W^VxGy4Ruxd zV_cH}h$sRFxeQZYQYnRxYVZ6bQt*d=F#MF!gQP}svh)|iTjO}Nu zf#ffjbwdVUao)=WR13l5n*XVr_(c?o_dsF&WD$Dg7Fqe#dnq>$W;+_Onj@RI%jlB+ z`&5(;j}ymkALgIgeD3$8%=P&IilaxU&Ke2RL_1}Ft<7)Yp6r6(u!$r~jj1yKtn}Ov z(bBXil6=IiwpT}1zps`JoNbL2~`+{hm1S@5frzQ|5Bv1->JAiSKgY9T(PJ8qNAPHIC^E{j9KX7I1d< zAU-tj@&y!1t893NU<9V=z3o}PxK>Zc$#(1Uep2Dl>u2EWMPGr%JTnKX%NuKBpGOuO zSZX$^juro3P5&r;d3i5OEiOam|9koW+w&%g#SmE|nbnzyjnD*j%;;jDNp2s0GJa|P zZRniK?$h75@PG`H9HaA@C& zTlX#A6m2fo#I1&QkEvWiyoR3r4%EsEX(&k1exBF~j&8Y)*VR%t1!i(CIEi&Uhi}J|J=N^-c>1FU zSN+lXJoz!R3hG4c#5b6RG6{IaD48ZYXM}>{n7?llHxhnlBBYU|5D)5N>ZX34NcD9y zM*UmVE4nx`#pmL8$#vg8djXwz(L&;R7{bNHwKw$b8{{3U{L2(Rqr$SXD_0ps zSY>U+qWz7GXt0~p(Ii)IaDqxXV^Yt$ye}_*%}JibePzU%UNK-(Ei_c|k(HIsDs!ye z!NI{3z|~o__}%e)Y=oDjj3&s6kN@fPl2eVAIKJ@H1% zZIC5nHwk@QT3xLJHZ`1f*S&Z_00b$`{JJSO8Pkp4ARolkSGhGSY}Db zCr4XzQ?0?0#OmL8(yfzWoa4#7sh{TKU=!`HipU8d^x7{7pU7npLw+oM%d^EJLD8CT zNT1Ito!$5|1xM>hNt6-Qjf{t)6VM2HJ#(c5(L6S6aoCs3Rtyz*uHJ2}$8c{j_$ClO zVKPy{ryuW~mlbKFkZYn^1?-sF; zJuLUWdJ195fKk^{lE$t08+mljU6Xm|?GEB5W%PtESb0YMKTBcigT?zkwq7TK+<~a+ zC_!)0_l6(dO1-a6LF^Thx_<9V{TM3e{-h&ZIbb5W!h1E@B#$hh?TxD6U9UOqr^v}? zlyi_7M$xXyI*o6Z=}Uq}ZSRQY_!hWl*ym44#g^QTXI9wAiJDHg+Y>SP9nJGes7k$X z&PJaMU9&^?%IRsy&+_sak+7Wwb^SaQwh#A+3;DlWtJLv8%LTY~HQe2W2NlpltV%(& z={6xQ<0ZN)>H2TJ4NG&IF=(LPtkG5CPXt=U1Fjr&hq8C?H5)*p+A*Swt8gptPWiT= z^L5!M^uvXoK8DugH3j{4tOP6aE2-xZL~i@8(s>ohvDX|?5LOvt5v9m+&Wkd-N?2AD zgyqQXmZymz)9X<|T;2uWqBuYtE<3kZnLp`*Ark7)T58)p+Y>6U{kIR_+*oTB{JNNB z+cizamG3%CMU+|0g*>WyQcl_>=C!!sSc&Utm?DN$^?4oTM83rqk3i-d){!-*(*{ok z>w)kiVpcFkFUmZJws-b>ChaN@nhr0_LVMgFwa*LGVaJAT^WL<-wPYo>PX3oxA(OLC)g>e|-BSDy?wb zSjx9Hy1H*Ei=4(DDP0^~`Qv@0+~jF2neWE5HJ#{h1SNnr-4xtvp{oj={QH7|X5pv- zX5W>dSVO6}vy9Sw8tlBLO>;MSX04~@Fb}tzBDdSD_;oSY(_VdOHpl^O5v14kB2CZ> zsVTU-gA26pn1}85VspptZgJ=cKRpPDE z51-5}VlTVs(;Thq%S^jS&-eFy zBr>$PKBy_Nb6_Z8y0Ay1pZ8L@>0a`yCp&x!6_~Fh^Q0hzZhVT)x65}iBqRRIc93m4 zB7TQb_r5xr=q{Ml>fCm>fg*F5!WV#oe2-__R|x`+n&g@2Ra z`r)G@tqgbkONcHDx+y$h)y`DjhRmV{!+R&xa$SOBRusW0E^J097EJBOXcNh5=33@O-lJ2-D{i_gjlu<`e??+f~umWdOu;9qFyWhsbBcD=%VV> zat#*`%~?})-$a=aY~i&m$)7MhqqvK8;T=jU)@V-hQpFmQP+|g1c%Hr1bIoY--!S1G znu|sn8rH)8fR+( zyXG$h4CbHKHa9aD@@p8=6Gy8P6B67@Ce~$9=98wptvr)(66ou@|LR_f!1$Wo+3C>3 zMSsXQ%6>J)4SLC!T~SzS{h@u9?{A5=wi zggvAW)J!Pg^XD{5yQ3UY%ot}5tGk3zYJwN1p|IOEdv}yZPp*kA=^byusypSWUYyV7 z@SN&0&ZCtQX3lR$Kl5QSVU(UFMiZO|448Z?^jx@F*DX4RzyvGR5FBG~tE%g0UOU4# z5vYctnE%`??Maz@oBKSwVOg;02L3fwXjGyHf`pB#M4$?a5&gP1uRC?T=N1&CNj!zA+lJdv(nJMvn z^|3c5!45}~PSrG2nI3ABQl+kxv$p3>mBTP$& z{dW8uE0F^R_ znby^`guI~A%)|V^pY`zVuATbsELover?iR4bV_ANY_s|?|2*Ow9Rb^|ufcm@&IxX$S5BnNFPE&fG@L)@N?Vq)j z+Qyu^*8qmGudxVO*mX5Z5is#Wt$I;K`B&t24&KJa-;LXuE>M<}SSW-UtA;-~eU=|3 zQKk#IXTKAq`ffAqs?jzHmi>fDQ+{t(kNjKR&4@TnoMt>W@b5s6Ey*C9a;!5djcKms zLrTvGemXA59TN&!WJ*A*mD5;avD>B$XXH7DiwlyTwS?8zFMz}D*0#0`k*yA-YESCFl$Q$t)boyA zIYBpt*AARIu*9BKJ|R_h&V7flz#}YAdKeUl2&L_?ReF=BQp=-!h^9FgoZ;Wc#Zu&n8Oz#i;1+l1tU`#mY4LR4tYB3Lz>ca4C+aT|&VfW!8k>PAjq@6$`ur z%{+2z-T8696|yjcXeQW?IJ_3&gI7>GFIth?`C}5)t?!0%XmUCUrf!_=$(=ihmt_QTp5~#dlwJejAxDGWafb$u8x2*id$@byTwlQ}26Nyl_+GCHV9TgfbO( zerX#0b*dihII2dgg*mITTb@*yTxrBJu!n8B>Wd!9Q+y!#3)Wk(Z3R!CM5Fs`EP(U? zQ0Zq#kN{gvOH2TcZkF?2Bqk*#&F81MA!PZ6lHd$Q1@-1l*Ju zB@w`{pkd&^XYjYMu&}d-N5G++X~Sn-;87XAiRHNLegMb z!DGP1Rp{gG$E>uPz`XtEpi;~%nU{{v_zpu@Ts%idHE@KuxCD5D2QsBsM2Ns)r_)IU z3yR1S!{$D9;H$~AszziR3DVNhnJJLEfk#nvr}u&XQily>=a!wDSMwqx{y34MDR{{V zw;lPoGM{X<9ofvDyjR-$*)&vM9&)|1jY8l$kDUA*HGHLiwexD(bp%>m5%*wq_3+%f z&#AAWJp(#vN2k-<4bs9VGSmsb zxsZLjGijMWwt^Y`C8XJYFy{q-oY5zLG7EhZ^SpX)@8Ra)js2Xzv+n6BK8~X473YS< ztG$yVd7GF47)`dwwv=tf0j7AR50>26=PGYffV>U&^GPjXK_CnflL52KtJ|*aewD?| z@+!VHv$kCzX-**noq8Mjd|F+hPIcBhuVH-f>)CE#OIW+4J}liJYAmv}bxOq71`77x zk4dgtuBJZnkeP!~mrMtG#N ziN52IMHYqi6l8^z)^Asjw`#m>HJfSfT`5-C7v7GY^`Fa4VytZoaA~%js0cI25Jqis zx|b}TR)SIn&p3j*P*&6@jgv0nO}Irx<*Oo6;fNDUcG!#GdMo8l)$j5&j2=P|c(28ArJeifIpFxWSgpIWVis<(D3Yc6(LHCe+tirDtQSHrGkT1P6**~mJ0!I7BW zG(lY0VQx-DyN{D-UJios2A`$%tB?T~_E%I5cFtNC9_eCx|+*75eeOZBXVW1z`4 z*_9R;McCPh3;W5ak3`!ioXtIDMd6|>r5x0@l&WZB1#Q=+4xhtrIaCmHhUUeD?YI7E zwC_z}uB=^!&xus09i2_>-L|dhsoVQIwZPE7-hmpY@ogRrtgv3mC_U`Qp{wo-Mt(^x zu`X|B7ib)s5gl)><5#V=`jKj1=#g%9-5*}gc9bXy$P(?U$h#z$OWx-g;~AM~DiBj# z%=^P${PTl5;gzC@ed}5%bwJd9yCLW4?4p;_t zdTs6$T}m37+bnN2=(YJ1UOo}~L_OvBm7STH`7xq@g^!CXbB9~^C4a&ap)YV+fyxzA zQhKAt2{ESEIV*8sPUcppCBB!u+&a`UMK(D1XWW`<=usLvSc{9R+z|D}U7dCmA2q`1 zVM9nm8cj|bz5cDrh2>=jCuE+=5U9p$8SmR%GGjYBI=p3bnY+vW>PhCU1RSWiRS=NW zN*-yTo{&ttz?t8CN%E`geR`AxAJ;rGWKZDZDwNc5=^7TFIs$^ZX`o*(toYx-FuZ&aA|2TD5Ibx`7ymqlZHwc~nPT3>(?K0Q10 zKHjm@;-Uku1wVh*X17!3>hpfk=cRk!Qxkp`VC~gG0-ic}T8WXsTD8Obe5t5y`}a28 zc)7S#;|t@BR8EKinE>n{d0gkZn!8H5gUzl1_cbPV_U;1BIIoM7RidxXmhkYzlobED z`Y>F`*=wMH&TVqz<9Sug%#2M;QX-W4T5I~x`4YIm%tFznWo7DetlfZo1hYH*`}cCY zgZoi2LkX_wA#NyOJ?Id7T{I0g>p|+w#noF}?yB%#Uu`x!r0cn57C!6keP8anXA)Pw z6*?#zBSkI=MCw?(H&=(Jh211Avff&PuT2Hatn&^tqC6GL?_VJGy&ad-4NW0HGK5`y z*G3NhD`XaSGp4^qPH1YzCOgU;Elo%FVW_|0?!ao*fSNnCtShOzv6A%HwWfyw%@jat z{CLH!1~P=vn~{!RWjuRjRDGX&ft7IWCo6?wU5xvMdxXqt*1oCP09$3<_JjyFW1}Cv zWm9Z*kHtorV{641Wr!|LQmRAlJa``RFt|xL(JZ5NFeSb;dHIyBpK|_N*^Q=VrG+QN zlA?staj1Ipa`RxvND+UW?|~ebLW%@Q)#{R(Jw15%(;HrD7BiUBi;dZ@JbCbLBnI&FJYkaWQAxECosX#S8Kr;$; ze=<9*TH86IQ4eVlTse9qV9V#=^I&kZ79|)xMmJx%*Vrp)+kS%08(Yyc2Dhh*Z2L|$ z-`%J^y>*yu){a6(EW0r_wf0UXDhQ&cx9#@=;kmQdTOa&Zr890Q&(wjPZ*BKaRu86S zE80-;cb@VUO6CalZE?&A^zi)L)N6iNB_sOCH)E`=7d9n$Eha$I^nRpA!C6-|&QQzL zy?4HLaO>(oE@@LFJdI5ixnV{LcNam8Hkh4M?KKGIjrnCSqd#YVsf^?*yzemWDJg@-lJ&_Lx!s58gP=I=Rd8){Q$|^4~UtIZo3?;H$zs?3`;h54^8#|V1t_nB6m4WL6H+2b*0?c+OaKaWa_XQdJh zDw0~O_R2q>9u?-gECQGqYo~UpPI6UveZtd)^6F&F7YNMQJ#=30yPC?2Mn}pY8`DHU zO|G;mtyla|DE%lA9PVQ<4ph)T9WOTHn&tp}eDL8_g|s(XE}YY%>b!6v33KCBEo{O{gX zrAhCUoZP&_G&eTUX_7lI1YdxEid*P@IAhLdPjf@K(x%r>lw^t>)36lPYb`<$d-(P2 z+G{N?wy%K9H@3BX51gA@AVxvobs)YjV6l4j!SvYNJ0BD;PNR1T+dpAlGVIQO&_9h) zh{(%1dyKbfkZY|ZgLC*+I3(Z*8WrZxp)l+98!55Bg!HhlD<6lWW}()Rv$(C@X>AIM!@U1=#v3-~EoT3UAg z#&Os?JCkEDm`g5EjLDCq64U-hZJp+BMVMe!w#_d5PfX)R)dpUFS~OxGJ}*!;DA=HM zy(+iN&+l>1@GxyiXsEH3Ric;NoB#MfUZ~PjsHZsySvS!pbK8Loi**S5YpsM(KS6jk z`Bwz%8n)I5x*}Q9JTQswOMB>0Z`H_}-rm|jsf!D3vuzbX*dG43;a6TWpKX15xF1-= z^rhS>a|(=>tt|)O-$CQQ{}lrtFmn9#_sLM1nJm_RBif*EU0@i+#Ka)q7CpQKr^#HQ zeYqK9b*s(Im9DAn<4D8ar{;s!m8XuF-h~)zf{`tWLa>l`;TLmTjDjoWahnnr7=TCX zQkDkJpUbv=!U*uPaUM|xH8;++W^V?-DR4P8<&hODzV6XuD>%cr@)Tf1?-l`fsr!4( zRl3(&z(W#~kdO$0!GubzCKC$ti;9R4Cj*{ha&n*WVD;i;4b%N4s*?`ptREg02|aZ9 zIhnp9wXGqlJv$KSqwzN&6f?2wg9tM7jF^a?3pr`mdDvrA;G&qZDwAWsF#yfI@0~4& zV-x(GeS%`B6EYA&U2z4mvq6=!=W8w024g$BJsh`b$vK%Qi}3)lfK9-3HbH+$08oI4 zSWTGPbk)n9-0leBr$@gn4QhdcOP|ctyMQ=cGIxg<<-KI7EoQg<2SEk~Q~+^3D5LKo zRW;d(3!q0Ah^0R8OnpFIsPVcmUX3%U{Q-~ewP%*G+`1t415lLl$Ai7{a*fHu5&ymi z_Q0G;zF|&!VRB>}Ur4S_+fA~iA8WU~U01x}HD(~Yl6`T$Ka}3Yt)=x$oA#BTmkcFQ zA%Ahn>P@Stj+U3r>w^8%{SOI%=IZTft;}K09>~v8W@Dn7$UU?)pQ)=@LHQ|WEBPuI zZ@h|M(|4Muqt2$7K_O%9K5x?wS?7jNs0d*1GQpiRUdNXzWW11-eBy-H`|@CYWnkr> zS(UW%e^_*AK}G)8FBtA8(U&9|F8jyB9Oc9pIh$IOgpuAAvEVA)D0X21GAG4i0Q+oa z7E|m3v<7%Z`ma_~j|=x{r=01QK2`y-P^p4VhioCwbVKM+K&_5&FASRHleu4c_hWCW zIW+C-EXKhtGv3*rj+g*wo4knAJH`4LgvRtA?tcNm*3?W}B7-$BE(p9vwcFuL#jRRr z#HUwe%F$?uy4A4PP8yMv<}Thz?TB)d&P*P^LICtQ<34XK*d?Fe*mwh+-J`sw%So#y zk@1Q@Vc4GyEI1H51n7#Km=Gec5t&o*EsRB`J@ z&d$#F5dE5ID}MPhR%2kJyEce(nV6WYs5rSZn|q&_IBh4X9CwV%kIUlL=eV~8XPn{ zz+&ysuowVH@AA`s2Ru$q*on`jc3Fq{cG=hTV(PG0qd9=Rk3M`cRDyT{SU?~|3q`Msj7SPt7(HXXnjK&2<3OFjKuId@i_)j0qO$YyqOBFW zeYsLe2wxn`{Z-3dtt<=K!8`&GNp!#4&X^uFDTy7T4a|}1!hvAN|7N?K2ndZ;qE}gKO`dJT?%O1&bQdTa2UOV24?wRIgv6QR6EPjhUgLp}T{M+n1CN zu-x=rV>ai@(`T1J;HM3gFZtrQNA0U9|n zQWcnrsececWIB8pNHY)@Hd%KtRq;Jb@<_s8m;RY4VTO7T$iim=J{V)=(yp9>qM{L; zcyRUdUH5-dPBB`05s0+zXq1*Gw70h(JmK$nk_3(;0br_A6%dVFbwsyP$ zxJj$u8v*l}O8{~K9H)YUTYw1GP5%0%gD`A2(UuiP{ciy8bMKR|ftmz5;Pfn6>L4IC zh1!X7m&ngp{?mKc40`Pj5=Lt=kC|j1Jz9zw!%*~%|K0ZwK&g1l1h3}Ap-_%Yu`hrZ z+@GT;%hp;)B=f(iTW)E^#fXLxyyRT?epQrp@^sJ|@J^tIJZaOe9>DN`{Q)mQg#+)- zq)fbi>p!^nO2TR&*6s=Ln8he>hnFbPH%<1_C0>?mycCu&;H{~n*+7ul-QE4UkPg6UG@tOw{75#)bQTdf}o0Tmj8Fb$Jl zv+l54*Ir-lGx;a#<@7+z4ahcHS`@IC?@4{ou7U^ft;!zca;n~I5<^eW;pJmBxRxowwh`z{r5jzNYNS#|4P?qs|Ies799ahX``aybzg;>lty1Z$rTn{+ZYv`+3MPz;M##3k dwe%3L3OnvDDM&0gxZDS&t8J(S)p+vq{{g#nGaLW_ literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-with-1-fail.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-with-1-fail.png new file mode 100644 index 0000000000000000000000000000000000000000..74834deae0b6a7d40217101304f1d9be0b23de9a GIT binary patch literal 25562 zcmb@uhdY<=-v_L%Nohz*11Z^~gh(NjjIs*Jp4lU_QYoQ~kdT!mJA{m~Lb4LF$=-YO zyw30MK91-410Kiyz3;o?cQquWM7L9tWn%4G!#igiQy{|zWN zr$6x;WZ|JK#Ex-8=_8LY)stQGI+S=(t@ z>QY?O(zd*3s;gtDbyUL8QrGUDrLon~bLj@P_7oJN6jGNj-mrf=9O@u?v;Ob6tGQdD zP!%ONCHJHCUH&J2?R>B2r)Q|DdNwCmPw&yCnBLzV%5l2SV+1z67r4&yD3Y7yI3)|u z4Rv)Cz(S@b|xv-=<09d=-%Xf_(jS_WtxqSBHF!TIuMr{qK9jPp}#vBwxWx^s1^AKgd^0-;Z*&|NZm@ zNu@vB|9#B~q^7=pMZU7C{@;(3J*%5gZ?tBu<;ryLWMyTgYu1k7d|7dE@xTllyT&w|3jM>`Mk-!U+-ud;4;n%cRA>d55?x$#;V4lc`oKibtxXGfX^ z?8lE@xNzY^z0u&{V6{>DWpQyX-SWNV6&1l3oX^kB&YHA**{!YJogeSe%EG~+U*^kn zLrJM?aIjpG!Ff8~bTbPJOGo9|_UNpv;I>@Hx<7wPMw&C%jgODN`}FBWYAW~f6DJ(j zR_4}Ho#uwD@P{c8YKsGE2};qivD>lq>nKHwN=n*7um0=lv5`u1n9_?-h|7*y64uev z+jjWy;obZ9Gh;75k65Q$O8x*jML^MR!SiU9x6GZm#;*iIPL>slC0u zBlGfB&(@KTr05#SY~Qb{s@fHxtno_6%hQu4kX?OGUS8h!!oqHjirL-9{`~p*`FT#mTE_d+{p$)EG+kS-m5sIMhwnZiLGezGg_iRU#pcbMU5&n* zkG2T7Q-8_H>F((%j+XMXU+4*J%5^-;;4*)#?)|kT#U5MVSFgSeH>DXG7|d5%FU^j0 zx7xMm#_sF%*~7q4HI$Sud+S!SCVRYJncvAYqx#c%YpafiCclmN>SC{-WMjJ~-PhG6 zRuv|^&c*K5XEiofrB4Ob)i1}#%_*j*r&W^gth+8Wv5}9DkK)B)!Pk7of5!3gojpA> zndu`M{ey#DLqpr$va%NPZx<^mD^E3Q`%KhGGIVx#Kf;%FRb{1Dp7TKm15Gwy^G<(RSAjB>(;FkeJYan zFDI-m$kJD$B!ScuBnN5 z|NaS&{;xYaI_^)OZn3qs-Me=$r$yIgUb>x3Oia-+F}ta$-NG~)-mgv9T^CxJuA{&n z*4EcQd1{;6_55fKjt z>SCkhSfVY0a5C{z_V)JXtIG~?rlAuX-oJnU`_CWCfm){Fk&&(2wq^G{s;;dSyLN47 zLPEmV`7TeV<%v?2Temih&oDcK&z(C*%8ZoZ-{$6=>9cP6`66k0m65r*hlPcO|Ni}Z&S8>~ zjg9TaL7w-X!NMm_Jo@zM41NnrVd1Y|-edV|VUM>Th)hble)sNiEiEnk`}f-vB}j43 z_tf;-e9y#0r{u*!6%`fy#-=Y8QPv#%{I9WR$+a7YvIay+`s|^ly>jIWC62g&80E*0 zAA>lx9!C3*{hJ=Bdwbqyo7>yB^cUtkHf-CzUBGUX9u@FQc6O?M)e(1Ulg8u+9UXV@ z3kp%<+yes-pw^RpG(2pAGo5ALxqe|`L1?^SgGt-hU~FhPIXQ}grZj#04;5BhUB}?w zy*|{V+L^{i6;$r^)+{Mfe#|KbHOGyNjA+kWvq<_J+0^l`%x`+EJ$$Gk$uA&4d~J1Q z0hQ~@wQDh{sS1NWD@${B^7Nsf)Y6|96o`KR{{6?VU+?4Mo}E&BPrYZ)_vU-~UP|#y z%*;>p!yKNxe!c%sqPk~%JnOe_-)<-?lMl4C2}^ zdw(tDNm$sCh9u3{>){vZ&zZYb1ak10cZf<$OH-)i*s}QuO;X;xd6Qnq{$+KwTxwdH zfK~5~YOM!8pnV|;H zoAF9pkGYS}%^h%S{A^g4w78+Xyxd(OZm%2m>C43Y)y1Lp)RNxxyTvHEOd2`0^z@kD zym?df^4KMOlYedAT$^K8&R8Ce7-i?be~c8nX=tY6ZS-_?rSf{_=k3w0a47e=1@RjC zQb!j0v<#%R=ey=pxIcUL?2FCNYg~kCn%-8?pFv!gPG?3$TtxAp6ulaH{^s8O`=8IX zyJ}J#KX*>$b7p3{V%UopJ30pjPR(!~{hFIw{9wbDXx>sEh68TZ4GjlSchnbu6c>x% z&b@#0c8={eT3T94(XZ3BGLgy2azDdGG$|tS&}yx!gR8!MyXgP=^|oW~fRWU0Dp{5> zxC|f?N>Q{wk3WBuYHDkb3keH9Mr~%KIU43PS!OmeV8U}0Pc)}RG44jK)yEnGcWSZz zfq`dF8C+C&`T4hr?l{DMReEi{+sAWx*$GGUnAb&l`I;o}1cL3_%aRg56}u+f)o_{+ ze^>Y~+jY%FK~XU!Gqbd)Xk&nMJzKc9_bx2erVf0dXpDlz^1Q|3?8s95g;H6+gfE3Y zA8HKbP6trP5!^z8gIYyx-^PVOUSE=JzZt3qhMMEPa zU!9c%w(BT9Xs-K3KgNFfLhFVOB&Vz_X=HSohWTp0?{$1}U$V;>_!W=?;BjLO`>MYt z>Z#60Q$xdr`VouO)zzZn;t5i1}mL^DFOnU7cS^T3rk^Dxs(-Meh9> z->dy6B)y|ieS8nGt5>g{b6(_Ce1EmG ztJrh6F=d0kejmF{i)jSG$_sWAAx|Se+&GO&MvJOJq3N=~6vA(Mckp*yzG^>uqq({H zyTn9q)8>pjLgiwK|wzrQC;})d>^a1ot=K?_s1*&(m2~eLJr)dY8a(wdp=xH7Ft`L zqM$!-?STsY@ZrP$x>zdIlTRACbhmEZIu$fLx;igxecE4Echz`B9)-!wj2&N2Kwob~ zTs5{0*BPZd%{J*%s4tI(T9?w9v+2m+96JsW zf^GoIQSOWXt=`zbuyuOX6AGiZ#dFcj-(GNjQ&e=B{_x?gTel9pUi}pq1gLTS!U7|@ zNnh?dvFCv)e7y9w-nl#j!Mfm( z5C97UV`J^#ALNB5ifGhp0n$99qZu!(&THF_{4E9zQO&YsLLCk)pI5f=KFG7#&d$!P zHM@9uVM@StRfx{(iNF8eKMA)aot%~#d>5(|jvv z<>=!zb#*5M1rHr_k8TW*W)h=3<-9{0#zf)_i+%3W` zi;Ii-=WX#_t;Z+Etgrv;?Oo4l-CxZR@Jqd z&Q47g0^kKm7oTl+I-&04>8Xuv;j}mqD>Pkw>8+rhHAjYVuuO*HPkhy$TIw0|LA(Cid{gtjOvFRn70;j29OB zPYnFcFm1jpBjb5PR#en2NWkhn3o9!PAPibZrdcRjM`z(vnTygK`OB$$X>Cq|lzgwL zk*By@;I{7Ww}+b|v$9m_MO$3Dv&+nBKzD4f5l)ArS2J@xC?ukWHj+^u}Wx1JhxeNX1S_Wb}>UBUWcugbIS zCnBjMyG4C}8H3{;@MFHV$MXQkexr0X${LFx8C%;74-b!*wFxRIV%zQx=`^M4)~=9S zAz`i-Me?U{_DRjo|&GmrK?+PoRs?{EsZBEEbIj>*ZN}{ZES1^4S)#qHZ&Cd`FlZu z8$=e_(DTJDSym84vTx{vm+jxbpHQm#rKL3^hQ`K5FvcRFc`j~lu?V?4rlyt945CF7 zz(mn`JYKxeseX46Z3w6v# zq|Wm56ZZ5eAt9zOtswo(BL2~w+`jl*Qs6D?vKST;-UdSm^e6m(v2JT z(9^$o{CJawh6cDfwo1_1du>T?hKV}2%5LpG@94_bIoVTz5;qBHA?5yzk%TwBRQLtw z)nBKxkF9Rd=UqEFxNK)>=lI)bCj7#y(Ye$+-_~DP_(y}=U=|N)zXwFS7U6c0Py*L2 z`E++?^@D{S`61EV9r>Hi%g2YaxM-(bmOd8M@K6!mNI^{clY zHmsgbjfCQt#W3I8?rqik^BCG0a1^I@$%{1$>1(}Xo#g?nzQMVsm8hzUBWvZ4v;sbfu5c zpEUhfuLd6e|1VVjf3(l+l`y`?kCUxV-ndav8Dc(h+}^P;RNtB597RbIyblX?^_+)%L$_ZL-qR+W^j7=SweQzdVhKIsxUfHXYa@ z@pjh3%*;&dgp7>WU%v`r1)ll%oaEx#O+`fo-ks&Nz>No=AD-q_2}8NtrWq* z!2p=6qssvS0hc8uA?eHox~!b$;h|AiSAXH<U@@2Uvb=$UW zjet!K4i2}ot)Jmr6mH#;fvn}Kyn5;Bu2&%;GT>83jvT=@gPbEJB?U0iJvMe7G6;Sp z4%w=q04pnN6Zk90y^gM~mZ9OZxVV9E_UjT7y-9V>x~2vY6Lv{6ZQSz6dzS%k^`F_b z+WC36fPHVzZ&Fn?_vtRi0WACVORqV@)YtdSnKRLOc}M!^Q>Y*+uC%wcwK2K&z3K_g zFS;Qw|E;GYu%@Qw)uc`B@87?BteOv}W~8Tgj*W4g3I~^`c>etPIr9z*3aAMb|N8o9 z4jd@m!r(+Gw4tdfld$k%6xOd_zy2sI>jVp@FyN&d6;dLIJ{$!Q${5sK2rns6Q|jsz zrJGg5)e=UJ+r^qZdGZ8etMtg=)wQI-dr&C=uCUzeU;6rriHWVpvZyak{t{A4c#W#Z z&BL<})U=?W;N2|-<8-xwwO=WNXU2Y|0Q{=gw#DyAS8ElY&6%<;x5@nUl#1a!)FHRt z-d^^(=D&ZxECnr1Pg`TJ%!QbWfSrTPk1-qTFL7w*{Y1OX?ir)^%OQ8e$~qJ_2Z6!D z(lRnK^5Oq*B6voYKF%~BdI6pvAVLw4>vfP42ppd?GA2t7-2?LyaGK{t1q8m_i^>AZ zl$5vlar%snrM|1Ji^%zA>ptNGCC`Y6W16ljd}5S%D1a4uf%>!g+Qayjr#LwB^+n2m zEZ>V>x~|>Sh?Z`Ue)xG~=@v_?&hmW*W=~?n9tt~l48%q#b0nwU?e;!AZEK;`UmZc= z@9$5}!UifKQ8Tl|=ud^;zxUV2AAqFx@87@b#>O8WyHA|MZ9~B51s3l?Gljt2+1YvV z^5u=2Hf<7`{BZ)`+0oVY9nT=;^JmCmUeI9_Zrmt>`Xa}&_XWLx@4ft${epsmbcYTZ z8XFh3wuUY)-Y3e1S<9Di=m97w^9u{)L-Fvi^{k+@HvqNAfX9yoAdd3iZGJ)KEJB)qHZF1R#U zFsi?zg2H#`8=QQ6#nsi+ID}}`2ZitR!ow&A;D$mE#as#}4Oe&q%%boq70tneQnIq3 zs%Ti`*MM!ueEj%)a?+BXo_>BXKFQq5s<5zd1NJI9t2mC}uV23y85yY|SbuexVmW;} z5+M1A@cm@HN;(NIy2t71d_ZLoTm8bruY)U~`0BJ~+XTIN18o%c$~ggn&f(z~O7X?D zwR^B${HA}4pdrnJRUPEkxe{1^S6qA(lxVld* zfHHt1u=l_L9(WC8jlgU4^z`TjZC}L51S;U%0Nu0CQzMkXlNxc#a2qnj_Qa@ zXH=5iAQ9HUJptUhihC5kKYa)6RXy(l4lSXNL=?q?;6^tdXoJp7F%JvL+|u&+nKLhv zlQ|PLa?2s{;~96w1Zs3G&J3Zl+_`tJ3hmRO^YH->AD_O02OH3UNGF{rKA?Gpb@0s_ zx-iF40o01!VjX>blHeO4kvp zhUZ{>Fwo_I7Xb4=$;>=UR75E5t^?vHPfV=|wkrQoGcA?Q{y@pD`Q%pSd8MY+)t5n( z0RiSq{5O;zC9?CL+CEHKd%GoEwKav#33Dih>Pol($RsYdppnRAb|I;Fkug?!n^Yc>-lq~=G^99P1-p`>YSnM0O|Q zHa-1MB19)76gM^oEll;%9693c<+T&n&kT@?&y`nHEQG}vENI8hZ3iG%1Mp{c29v^3sX7$XEI0q8P5nlna>DAX@-ihs{ehIPzObmR2b*4BP6WpMq8 zY86v|_tK>e*gnMhu^YV|=FoevtE&ql@P0^u>i=pDcxwmK^76varPgoQaEg@`%>EH7 zF@X}$zMpw`yn~{R54BxbfS|3ecI(#GUAy!;3LdDasrjOMK}bUN`iI}Qu>ii*;1aeW zOaa1H2Wq0W;M8}-hP!;Ps=A(fys4>)lr`#yKnrP33zo#|g)t1^&=2!P+iq#r^vSNn zw;^!K3 zHmk9^Iw$wT4=nS2B3i#$SlAwCXYUe8S7=IER62bzf}-HhUpgKho;Z(|mfL6%@C@Fk zq{wHpyT40Gc?AuXR$E)U&1K0HR0nlk8#RlVO1RzHH2v#NPEJARERLfCFbN18q|n#b z$4Rj;H$TeB`4Vywu|u%YHJxYn0Ych4IB1!gdO?f_BZ5x29vcxj5glsdd8Ko3l~6V< zL8aemKh)CKmsD3jEFI&Eexq$*@Z&YxEpr>2VwhFj4Ny+H1_sJt3e%o7qeq$Vgj+(a zlE}#8EiElU!2e}sWlmV~#=n2b#*T?$LI;8;2{J?lkcoDDnev!(Mp{}_YU&=`yrrcj zwC}!@(j(mv*P=2q_Pdb{j)MfQd{D$ii1d=7KMB}@?_y)0rlfEIRDvGXH8x&xbQFYU zjzNo}8S7Ku+v(NK2?m=(RD*Ng4pQ9iyYrk*UD< zZ``~o<;Q{DCh>yyTei&*Zg!+sU-@)^y`y7yZ?A-l%LSm@Gn#pCVOMJz7-^uIn=GvLUv2b{9xKVV9Y6D)foOpn^eNX^g{vAEN zC-5|hdki07vfD>QnthAtV(4fN7oPv#dpB?H)7918!EoViQvT{2l%}cbOH>nojg#UZwNLIJ)T3G1lpg4K` zp{Go#baTzC#!1UJ#>T+2UH>D{z(dah0`_5P!9L*WAVxtDguDAj*oko;J`^-H1v9uV z?*>$ji#r7`t@Ou_D{7$vf`WcQL090!;$imy{+7ZTMf(hMSu`ZL2_X;EQk;oY$2l|R z>tR1fTXRslA|MBRQcZiprCnk^-7h~mH3ePb_}R08v$M9?+X4_Pf$v>b7Uh+cN(SrW z3DL(w5i1h4pN4_q`kgyRCnhFv8UZ(Uf#}2k!am}3nm3nyd+vd!=XP|MPWY(MOdf*Q zVYv@*XcYbV^BQ8-Zd%$OXz8>#6W~FG6&0R%M*k-~beDK_dvfI6K?5Fc&h!D%0Wbi? zfo$J3GE#}o=eFxHHs#NbZ;#+dizg^q!QO^)LrF!2r|}pb@$m5QJd8$0V@d2CB4hwp z5}8F&5k=)4d?zG4XweE2HS@iJ8uOPYw_|(X2JZOxPls#=k+p^EsNBRa)GqaAVqx(( zENIJV`j;2dNsf>Lt_CL5NrYes6w7RP+3tqkgVjJu_l1X#z6oi#ySFlggb#*?ud1pZ z#OWs42&loeId=EDy1Vg6MH7@1)zvE@2Ne0AQmn2U8myPPc8%%e$t^f$kXNb2s{j0v zfIAO!8?KU~l9B{;C6FhuF$E0`S==4AA8c<_RWT$PfI?9=o}gKy$$N%|9^SWa-_agn3<{)v4X_~sKV?l2};Kl19JNq2N(LW zuWoT$TNr*s8=4i8G7#$g!@{AK-JcmO26YQQd+!LevD;aekI5?O{e*MVSdgq$h#(UI zBUj&^dxh}IVK~I-lC*qAdygGE2A_x*U2wkQcNG1yLE>5zZ_h2-0g&|$M^V+TR#Mzwj(%<sKm;L+y?B037MJVWvtO-uoz@7%Cro~N7q!Lcg%n+Ov6B7e5Yy!sK9TSrmAOSd5BnGAPgZgJ>_sR5)+xZx%U8EfPZsxavtU9-;aNR+9Y9Mz_MY>u4t5T^mO!@@!8q;P`Ut(>aZ`+ z_n>ed6%u-jQ>CD(c^wNw;tr*yPoEySPl*Rv)@}mL0rk=-{S68LP#Nj=E-o(9Bh3f4 zZ{N;*HOLMBiqf{@Ah&x-i3AP#K6#N|T(NT!4HIQDObwpdOHP3raWDh54h{h*%M_04P_}`D6gZV2!w*48$nv5NAeu5g)IeND zTyTGD&RH}nP+;u*i#KlU&B(|=Rm3`jA#?&H1Iq@3e?ql4G&3Vh4Q9G|C!PC)2kX%7 z0ZS36c!+9x>B){`z=ODM0Bp1a-G4t`fe<2(DU_CAN=%wHObbuwQPF(i}?dc6{!wWy=$LYT%UspVP~j9Zh+Pd$pGn-$9PnaN@7 zB>U|z1+c9OA8y+2GB+#cB~gfK7CCj9;_cfn z@Q`8m!lU(j|DG8Q=mSKOf4)&h=5{PV)XHS=2lbQ6=4zRTHjkpSb*Ke2Og#HOU| z9+KVudn~%{rnTMCHrFjM$DyNl3=f}C=i%eig$aR--HK5jyd6+sreML$TQK5kTUxGy zfdcxpPWJTnMk0M#^m$njv^ffK1Z+UFwy)@2JOBLo<2rBhL_``;6Y}|YB!i&2$;$46 zrQST3j7E%wKnUQ9l+?H4;!O!k6_EL$V-XbT@9*yCSI5A;gu^V;(|R~(!jW3c9Pw8u zeE4d~w%NX6!y|Tm#brUcxEl}MT6+{9w}64fX|UhSgVk}d3s-Qaq${AZsIWV0q}oQ%sa&ZI^bmL zfqLRE)+J*Xvwu4a0D2zeb}>+QZ9mv;Z$f4p_5|6KkEZ&n)?y}aoDN_d%OxeY`1w8@ z+%)3`_O|;&Z11#v#vs|85nn|mQ&3heg$Tox&tc6Hj6&)L&mTt;$d#F$eN?mjCOmPP z>q5w@>?Vq&rprPPgHa&$!vh-j4}5)n&0Lytq^?{cY#5SmZ&mnpe4`j8M2wi+x%^`I z(hj}B`XK%h+1YRK!!Z>r0ClHNpJriW(;aQeQs8W3xELYV(cL{2A{}41rhztNYRZN> zv{LWflP>}G4T!cBp=R>+*Z}zg7V`^z;aM&#_XF?9Lrw+~ zBuj-pOftGW_pGgXxwyDoQ<+@f!r@DCUb0nFQzOnQ$ibzv;;n!F*j8OwOv7_YbzO6T zw!t)VnLsV162@NhLr#IZbXnmt#jOmJi1hRTBp=MtKpevaCvHIuB@s_-?3^qb7Y+nM z�!lL+=E(3qEf%DE#O|MR|F4sPTmUZn2l3B|t^6HJKq-06G5Y7RIc``R`47hGe%run}3f0wvx|FkZ&&Vr3TRaU#0ilTACc8_2yAsi*mIhyJWF5_z%DWR!SOCB zD$)R0d>#M3{fv6{Ui5ERmB@zb!JMO@N9==$X%J`9fU)xy2U$__zc?@PL+m5@0pIWu zC~2_0;1+>5L_kG^HsmkOgl$Y<_q7myF0+<%KY#xGQB{S+9xZeaD5X&KoGwCQfOmwS zwVWT<+Dvuig;>N<0fFF$57&cJ+ry`g5$-~hAd(2cVI7V?L?bk5r|B9=XqR$Oppi}z za9KVFJCcwyq>@R_wD)K5iD38U=H_62Q#u?($nc=p`yrp$|9d6*1#V8fQo>zS_}T|t zp%Qzb48LYqmrl~iJ%^7nH8llum*}0LTAbM+Ar*9Q`=Yo-e_oI5{;O!ez@~~6jb7s z!dnC==z-1>4K<4V1~(k*RD_EGN=xDtW8q$xK>k8r#B$^>ABfGj#uRNl4=SJ&z!e{0 z5IhnBbRnfe{G>tmMH`30Q-Di`&Hzooh z_-l)i)nKN&&pCb~XTESDEVJ#t%>AaY^ES_+B?1om07M|{9+{rL59kA2 za)-6{km#2t4Ky$Wjs!ovea6@>$7wrIPtHihag2vc1A{Cemt6ma)F0qDs=JmNUa zMK~6uf4DySkO$GXKqn+|Bnat((}5NZm?egdhd%qezCJ=Jo``tpgAh8%&W4MRM$!qD z?&Yi&;`$IRK&X!&Jxbx~>PoVsu=9F)daed>KESi!H*2|q+Jv5o4Lptvj<%s;8I~l= zW@tZ=LxH-X6Di)jS^R&NI|36WVBIJI2pvjM04_N61Slf_)s5dsasHS87ps~&2Z|~v zX}}S%iIElk0n7toQEy?g=XSnJC>*l9rBOjt-^Ns3!ZLA_z$tFfpMfQhg6eT_a6mAl z7E4B*gpPF(!QUL)5n^&7$fAhOjuJ*CJWY+WL>MX%JrEWId_0B#AjvCZba)uhWNI23 z2;PG|37A!5l#bp&ii}?6n_@(CE1_bNC%RFKW+-&J^QwYKH5(4p~|B7hO$_K%}*@!Tz<)WBNi)VDid%M3^d;6eu>Ndn@c zK;O!PPcl2)bV*5RKQ4i2ZXicEOWDIo{5(8`AS3~-%19$iqh}lc`E-nx)stjVhKC!| zjSoPjLtF>S;bjy#fDm%}@EqWe0j_jI2(9frf{u^-lA4(wZ4JRs0x?_I*aXOKk-2iE z1Ct|6JUo6Vh3_t@YGzw+#bzSK7twPABO`=2$h-wE1}&DrPk_IH0$(Tx0Hq|;VUG;` zsWWGE=0;md0Wxbn51ru`>^c;JyQSWThg-7z@GJ3zRq~t!kmE6F&EAJ!0sR9Iz6;_3 zJQ;JCao$IS%c0ibSt3SEvu~d`j29H!#-^qe(`J5mYH$~68+eJGBO_jrgrL{Fd`X>g zuN_{y^a0H%_$6p9#0EvAuLIHvFo%@1^j&~U@PK4Mb@Unogyey7NK|kitI|tga*#ma z>P~1rWTpr849y$Ks>5I+zJ_PeA~tQ`PkrD35mu|Ynude|hF}=MgxAI~9qB=;o9XCL zQQvxK)7$~0jVX`by*mmi;~Y#f-20^jr8F!E$%TCQa1>%Ifj>Cr0K|kqLL9{@B6o*} zh5Lp&M~EEwriFzC%6l?83F3^ni{t3%SaOI+%w@HI{yb4jART~&)JS6_8V6v*71qNE zN-{vDTXxak!AKGihvh_aMiZ_ zy;3|P5D-Eh!9pen8Z-i-vC`I7_0wxWJSVZ!QIjwr@&myACl-fs`w&bQY2*jc1mV5- z;0Ld;?*@Xw6CyzjxOx6G@MJtST|#NEeE{U3RoAGHRDLWQBwRcr@I{BwtUjcjjzB2T!|{15?6@EG75OO(uzL}a ze3@0iT3{=ZV#d8-8t$%%$yI3aa2*WN)gXIw!ia{cf+z@ZRylGYDapyiSHZD_?F7-6 zXa-xhJZ0DW2QG!fg;rexiwu6vfSflPKXw~#Y-0gLS^%<1=wHMGh9(1(;azTSC>j## zi2Y2xG8vJ<%^byO2>y};1u&3=xW{8LvT5J}c0mKtgRxDTNMGN{g~hy;*;{2}CdS4x zsMKJtB!Y&(Fm61{dSDMk#ZT%vui=g&AzF?GX0eb|*ACqs6iyEjM@+p)D?G=}BqKhs z9mSh+a&m}_E*9}Jqs$tVfP{rWxFAyF!yjNq2hA-O{wBn=RIS3zymVfBy}n}H4Y3xe z=P|IVu$)3dLPRN==qj!aYeGb`7S<|i2toi+Q0;J<2Py_I4TnW0`9(~FA;bhi4&APx zynLIaWGOpOI}Bkwq?C+|5-4}TaWI8R{#T5W$npgJU_)TqfJl?NKng_tgE$7GD>^|r zv`=fOzyHpiJ8mcgIOrrgXl91AD+Q6p(IfE}<5)@J&`V)nvegcWcMl*@kbVNXQ7TC< zuAPWNln!vHgPFGt|S9z}%`eltiIu_Qol zCja?eudS|r_j&}vC z;3ojFfNA(bLMzUzs;NoezkeR&nVra`m_`Fa8qHfWtA8tu#0NSY-!N+8`=X4MSxW z6;Y@M=;d1cAp}%I+>NTC^kCeB%ptL#pqxPc`jD9T9!4Tg^;KpX{tz!5w%%W%6#(cY zH)6m`{N^L}9qaHcxM+6(-4LLH`ja*AKExj3c?TR)NQ`7U6YAfvt>ETI>(ZKjqUS*> zyZ}=M#wXD1N9IlIQeNMJC4_Ob0>mU#@?C^sD;d!z$~+=J|MBCt*t)XAb}b}gguhT? z+d)J&qx8F(%}85H%J1Dpf9_qPaA06y{KE>StC*T16#=6D$6_)zgJ1qu_9Pe)659%@ zs#5TEvB$24UpO3J|Iutm3Th&T@Z6N*V<3>ChNHE^Rf~Q1&JDK?9B5!*@b2r^+v&^{ zWHe@Qc##Mt8efAz=|HZ2Kn^Phb!tLy2Rt|lB?o34;dvVO2bg~9@c@7jwNhQ(tH}gl zD4Yb8IcbR|uzmlTcYt1xzKJ4P(fgeq?+-X3PTmCo4M=OCHYTW2540LJq38}L&T-rY zWz0~))KmbQmXzFbKlccr0m)&2QE~-erS*~k;{thq4`*In{zh6Z>q%z>Ntpef0iAuQ z3N6!7(ENm9lJ2Qz7lkPu3Qb*1AxTdoZ`9TneG|6@V#8r`8SJSUEx12u=j* z87vOuF^d2g$+p1S1Zv!Wh8q7uBI=D{mF}P?qTEP%eE$3y?i~>kuE@xA!v`bH8&daG zX1_t5AYb1|wOrz{(|M6d3*0p#u^`a}?$?DxdKCQG!HT~#!%!c&;Hl0y?A)~rMu#ut zQ$l1ueY%mZ*uc{O5Cr)4UzmPznv5pn5hJ@obXhz?xYnfMTv(Y_w7D88ONJp}Esz|i zf`ac~TdWyoUK_tyoap-%N_;eODH#0ZJ0%Uo_wNaW%I?^_0fZ3LgP>i^tRV|@HB4yX&4}G88^{If%bRY`DJ3;vKHKHm zv7W_nm}z>LfieoxMG}x|%eknU#uKs2A@}miP-HN*9g8e8Du>OrmcNIM|Itd|J8i`CoP(fc&g-J9X+cvp*1o{Lg*!Zt-5g+7Spu?~-`w4B0=xqUmLzchYj(W9e1wI| zeVNW(EFD@(UB0Vpy-Cp9w?C1Btsbz(%)lG`5a1UloflvSm&>v}mIH$uCor7>*8{3= zFt_eDh(kRf$q-UEyE39;U1PXMELtp4{dp-le z3CJ7?E?{Jq1pHD{xj}4hm^K)t1DO&%7iwOyQMxa<2R7>OVGDSW^1|YR=g%jrCE!Y+ zrFf%ZB8(hc7xzB%D+a}(okhd;#wOmpgSG%Q71S&OSQA;#xQDP84~5E>g3b`#5lWC; z;7%2adahrUmDkj_I74h85qazh)bvys7g#^U6?NvvI~h-&)Xr?a>D7Q|43!C&3A33Q z5eaw|R+ImvYU}Edpgtxn9E#h-iK%ZHKyI332O)@)Fg%VRoX0zWUIgo5v9atZSYVWp z9IipCM2zn)AOX%)XI~$t8#@zoMo~`TITj+&@H@Q|Pz3FhjB;WPKU(PkUE$t{dyA## z>jDv>PEd;P?QR&bCWA#Qnq$qGNpILpp#}orNgZB7mGyn|rW_JHCS(|Ksc60AJq!cZ zP(JZ41&{pv{L?}R&!26zrpauzJp`82jrNYvfxH(p(Uf8G5;0yw!&@WiBnt~AiXIg1 z1{2R6>NCU&^s{0 zFCJBcf`Dg0kK`_@YrFsj1)pKn&a*9|=*+OX5yC*0K@8=S)BxF78gcplh9m~Pv|w;b z9EXFv2GoFd_&_+}Sqr@(r`Xv`@IDvRaKJ}M#72~QK!MLAIT2MRT>umTZ1^N(N6%t0 za4uM87_xqeQCghA8ys^e65|LA~w=wdi>=i_x}=Q~`yZ{k7gh z5suBSqm3pRLv&Pu9FK4zu)08F)#q~Kp*kXvv~I&@lHX`Gi^Z6}*TQF&GwrOp?<+1f zr$0^qH$*lDfTKbB-?64b^*xk(Nk3_N!m7NRK_E%q8 z*EnK}1wj^dwQU43O#}(MjVt8#J_e}ZyVO>-E#?rUmvYF7pWX^ND9G;>2YyyWYCVA* zUId!t_KM4sKYqn)2wFLE*-iLECc#u)l8i~f8}a^+6)9}DGFV{n=>%${Zo_a z7B5JWf-;dk%KzHmp9L1I(kG?(yJ=1S*zcz>3?PR}6h%H8CSQ5}N^`!tox`4Im%AcM zdE3(sS3o&Znn#Q@2BFi{pLzBA_4`CAgs!x>gTG)mojQG5pRHy-N^i4-P4$7-udt& z7v^+{hy!qd9e{EU>-{n+4ju@Ml~*rcilPRd5A{YjCio0N#M7srf=5DfdH`|<5w}HCCdwH4 z&YvXB>pD7&cC9uCpdEv(LOpzzl$4a6IQCo|ZGm)lOmG6-J@fWf^4kmNBL3LzQ2j4T z@d4Np1n6O}BZmsn{N?M{CFqm&UR>a|4{&IZo-Nf&BTf;tf2j(QxNSNfP&bw)ZV~h&+sOo_t(Q^ zA%eg%*9B@uBl#dDhIlCPZXRvkxgPng+v#udRs_K+rq?Ve0o73N(Zqj8lGk zUw%7HZzt{xBHA`|b`oueMFF-4C$KF7lb@&>_{N`bOC@ltK&fJ}b)DwtAR#fqNyKYH zfB`B=o&s~Bz^}rNv*YlW2t#c07U68Xyp25<`gi7?+CN1<+AkSUgxK;TjMj zSEoeQ{NT=LV2~gEwMcO6D?yXUMDpUu5d9CZ#|rxm*+C+*LUh)JO@OppAfOkZ0Icmk zOgI$ir4bL6Pj3cx1f)-7sAVz8Jvak4RDrhQurkvyF*QZT*&$>{;Eh0dK^Bq6p+FxUqZmA-P?akg!BH5;zbwg$cfB=@G{lFhRx}@>loeYP9Q) zq(cUE9L?H-O+#2Jh8-|>bdG)($Q=!6r2 zfa08z%x$G!H}oN~sG9L1%{3AZB>7IWoDqJTCViMusPtjvH9&yHN(pM>_V(uv@tYiF zViLcmHw9h9u8B)pelHMu1>Ty0FfaT=47tRa9UGLUo4hpjPKMDpoT2^8JIl`Ro5-Lq z`qXYZt#mcui9R3K&8>dUlfJ^zcr( z-9Wqq9%*X&!0gBN!dtsPDaZD(&N-%FW_whvPMRy(Seae4Mpd~yO;{F zO)%l1gZW;PoXpio8Wj*m{e`aM86M7nDB9(u2E3Co+*vx@3sQ(^rsx60f5acKXg`P>v1?cFE6F3rFs@D_DVT`> zftSS701hO;7~kUe=8ZJWSBON&up#E`&>!*i_f-YY{cLyfS_^C};uD`UKZSQ1o z5n9VR`0yArMwz>jt_B#C`qWAqXdP!zeKG9qTN3^v)7kJ*E+sV}|DB}K{kOA1R~XYR z+8_v!ps#q1965OkvabAN*-0i-ap6)e(b)91s?$3m57qB+}YCD_~A*!^6Ff^KAssNzhKxP zzaGz?eKX5=IHP{c>#EmBWXZCO3{OAGjGLGgm6fZ%+Tdn@<+z0CS z)mFoL0+q%2EY{(Uo5;ld6XhI2&1)RV|Hba_Kt#koBd_H`Qi)vce$P!ImG4V-KstXF z9Q+Ip)i1#@GML#H=C~`WhP+P%SXtGlu;f#gQcY8 z(>H6a1J;;K^nxspm>Z19c&$ z!%)^xVh(Y+5DV6afI$Wy;8WwxV9@=v;Nd`Mg8V?_Qb;|+!zM7|e<66W(<9jj0{%xj zL&W65oo5e%Vv}qc)K%`dIRQGqL@Ob|)*K7Yhg{BY`^Zjmeu`Zk_gIEoS{ zunaI6Q8@%{hsl(v8|R!iOoCfxS&z}cQ?2@BA@SnPnUw~7+9f;M9LI#oZ9)}j%(h|0 zdzVO70?zsBbgW36qxzQ3n?L^T#|2_o>|JD}*tG%54}Rh3%f!=`lF|aGYuJ%%&Xj~v z3tc>Hf`f_gHj~kg_t=qqq>12 z9d31=s9IFzEc=P$B<_pX3-zAOU-0@nhb6ON7{lGlBU%Q)53QmXC4cyDx+fkj74|*U zQ3#lWms22(Ksx3DlVjg%AZqdjf)28c#f62Ju9bI|{{m;{2Eop@|D~j)^wIA*>V$@U z=O!}m3kZd5mfWT<*jP@=_lr~;{`^VB#1+Z+@Lhc7iInJG@qs;EIw>mICQ?n%E(&AX zdd$1;%Nz32?PtIJ1G&r^ruS9p>8gESlQj>t)z{QmTuZx)#CYJye)WUJx8Fp^3n|n3 zM6v)26TFO@Hp|3&Ib$*w)SRsYa0KwE2gi`GB$Hl1zpj-T>7PG;(4I4$$r;@AJA1@d z5ctjL2^WMBqs7DwTWf0!cqO`wI(fzCjcN}rCPL*!r^O7-6$lR}W#7tWGNgkgFfqLf z2&j)~2j2vYCiB+#XGkI;YKbzCg(R;`r>Wthk0R8lOU&cL*=_pDwLuXt<|*!89-{ zPcT$-v|VW}eb7cAFDun1Yju>~u{pQxSA#Xfqft}H;{VWR$k;r^;4b+@|gA&t7lK+oAyX?NPgT4=6L+ov}JViYy8c#=)eYlp6v@U1mQ8ONeR-XXq26uV zRyjf#$xl6t=5cM7`yqav=Sxe;b@Iu+41s3B`+DB|-|u-lMDvGk=VkGWvDcVAUhFL` zEbOEUp<8D3@HrsTet?66R%Ep_O=)^)3#@ISFyHmsCDy{PgD6*)3SSPjf&7>V9TgSr*BG`n$03;NxQ?lvm4%X6-t?G#~Q<`rxmqq{ircSK3r35%Rl zS$3k4mpAuHpmE&CqgNn2H!akb)Sj8yT1V4ne~A)rn{v+|@ttuk8ObbsMpJFLU4g=vKLzkFVOHl*wze%bH{7huOh+PSZElXG9i}m)7bK#T@Ga zP4}6hVhd`T2VB|(4F_yT_lhy|0tasre-Onarj@GJ^g@)WqY6HdC?^_rO#yju&?q=ZlYq!Yzg7(Z5;WOGUo3CKbFoA;zMSw_|Cpu&a2y%~7o1>)?hoy>C%I-(zGr4fiWBXe7nQ^a1ZwB_P`b9eV>r#)K=4r4E04qtl^Vz%B>{G8J5 zFBCU#zI=6zSu%wG*=ki7+hY6Q|EIDu|7LSr)b!!{P@0W zul>Axt^Iu8&wAFgzxzmVut2Pdlp_#U$N8Nz4}f|_%8=2rU(_puTPyya^%ueGDH8EZ zmTO0Kby7O|8`^+<{Go?+zSrBG?bL^M&W5u3F{&x2xi}?6`}R6%s_2v(IK9+~^h;%h zlJK*T5_;#()U|enPHvYSIHvL{cwq5%!OtEVXYrCSQzewXwI8_ZX3yIj3bUzD2@xN1 zi;GHZfi5=jO^J&FPHv&0#oU;;dk~h+iv4;8{)_EKShoT%Hp9+$Md2gE!B1I-0<#U& z{?XH(+34RKgTcvZ7#uESGF9^nRPn70&@v0uSE4eueNPHCrFtLRnl7uj^y8~B+yZDB zc73MQBeyQJ^HDbmkQ-nEm2a$bRfF|SAigIxIE+L-f_J%?IX}KSZ5H($dYj>p73%GS zZt3homz?2?=7QihGXneFurNVug$W+vS^^`)Ov+fF*$MHH1aWpj_&tGuIC_Vt#p5a) zvsu2cB_ZcdK6?bLMp*naU7T@3VZ@mVz`$E-99cNqDP@i?LI!*ijn;9J0-CSjL<3Aa zuR_(C=Q?Ze8|rg3oa)sOCZ%6V+a5+=Ds&mQIb}Q zF4jC|XyM3k$FYQ5%8De2l-`us1dVL^q*dQd*NXovzovCQ${u&6D!x8Ng68t*QHOpB zxC7YgCZO$Ylo=I?xJxGg&Qg^-p%i9>Q0bgYgAlERGujrr^4jceU>SW4qxMPD)45M& zM3ctESpUhPZYR4mC|xe2z-DlmJQI6X33g;@b>;!-U4&Vt)z=tQ;8msgZ(ioLFRNf< zqCfLcCxHe)J?RVxC3Ye)0#a>jGgxlmr|;p)gbHAk`SLFKj_`}&`KP^ta}g1=guSoV z{6-p`oH)x{IlLVn|8n0s=_f95YFwW$ucGo}P+ zeDZ#rNKyFKgFPq=v@h-)-;$bdYpI7oY?-*X67cNGt80Q~egN(fl@~(F-4Lm$x!9z{ z7p{DSJGXdwb#5D3T`dmq&?fRH;$)_QpbpiWWi~9SE_6pQI5X!#cl9ciS|1~*MSwWS3IG|geP%wj8`deU;f$2F<0_12ac@V_zTM5qiH zx|_U-`E{6j%B|o&!cU>oz}!7M*|WgR8oBv!OXHZKi7btFZ6PxUwzRT1U&_l|PfFr^ z*0(+mxYTahJCGObQ0#)U8mk)vD0RYS@OBg}FE%D~ok6$fOCM$JoC74Qd2^?HGki>^ z&*>sGRSct?_Q&Wt^Wkvp4?v;xc7q4l)*->E`p=*uUXUW;4|e9-2#$Tj^ry?tWFUJs z(=#ZJU9Y1B(fl`p@A>-Z!lduyP&$JI6A$}f72>;Ov8er@WgAok)V98jnqFuOZwq-A zi|>*}&ex{4!?nHY)eQ5&*Jaz0}_FlTW zSlNc(ZR%+Zy9%VfZb!??k;*;};x2qAz|)}KAtJ)O3P?~Z5;4=!1z&46dID)W7FY`& zSntlqItOCehs#)=1$oM7@JT2PoMyW*`y&DWzRS+}QnrJ;gL5{nx>t|b*sZgJ@iEp5 zlFLwSPyYu#$u3Qm;lZ@mR97d>l^b+ks*PrSj6di!y(~_cD1iUUBCA~@UHij literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-with-1-pass.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/images/test-with-1-pass.png new file mode 100644 index 0000000000000000000000000000000000000000..dbbce1a2eec1e99b028ea9736c1f6733a41c8a46 GIT binary patch literal 10213 zcmeHt^;c9~`0t>A3R0qUycl#NT?*1jNl1663_}l6(jg__(B0iB-Q7cjbT^WB^Ii8J zxOd$jFKYqkoH=LjeV+Y%;&~uYK~4e-g9HNtfnZ5Veo}%!Pdm`|9w;*2KX{-`*JVS>Mp!*4o&} zT>n3Db9-YaTYF3Be>|0Dqs|Zrjh57>kIK#od-E>N$`kW{jt;EUsi>&<-x|F!dGkzP zg6rdlU`$Qzj~dEaB?h`NX_-NluWJ+viz~(46@x43Qx1a|AC*06CHRF}{!!BN?N9hn zztP~e1Uq*WBq)f__WD{N9H%D{IwZI;w{tt7z8@+_mx(L#l*)H(^nMQQ;i#QEN{`7G zSA>W6+2q3qQU5omwZYz%118rC@wY$Wdn6ip!o}a^X&}h0ue=+|* zQf`~S&G*;M&v070RaJ2_Gg?eS<_4=o z6bwvEmz6*oGc&WL-|X1w@&|KCQknr4;Nzm~2q(z#Q*-?ib#Jv3_X zSTdtEYV9*87sSNGkmskT4xHcb-1jbSZrqJoiC(5GIIo5>4Bofl2rGLco4+?JNz(;) zq!F;_6hJE7|Ji3oEA31bPxbypAlzW|j>Jq%Oxw+OJIyasyuH1ZKYt$J&XSjxSMzk; z&dpYKbgcR<=vJjVNzU(>Xr@vfd`QFp|12Zr%kcyR6;hK?=F=TvPS+!6@3{2rMjC;M(5$v)Sqqd2x+_@MO zeM;373?hPJVQKjc6LWQ{`Hpi)_+EgN%j!Q4jwoMW)D)P|$?iY-cicY^x&0 z;pXz&sjDEmkC&ex`s+7u=olE%^YSooaBx;uR`|&B^YVhU>m5-Pw6tVDf5ysJElkVF zd5Rbix3XeH_dzM2ku@=)wz09PsjGWIOf03Sh}Y54@tlYik|-x(Z2WGv+O}(cJ~1HR z>CNpe9V4UBN_*f}MuNda{;r5O5|WaVf6R8jp2-W}M%N!Sk$R>}gs&VN6r*8yg7gXs z3L;`RdJ5PJc^(=0Vsv!$@c8&O2!W?3B#c6^_is;>qI5)Z^3c(0S73O!M6vC?jS&~3 zXK=97h<#*qRAj11dt~P_;zJi3zC@qa>Xb{-1+hHzb&dkhwNl3W5vLd3OfD0&LtjQgVj0e}r$?4(6 z0TuyV{U@{Dy?gg?+xB)I+60I(-piNmDIa|*?9~~6$^5FWt&L~WtkNr=saf_T1<8Yo zj()u4gJWT?p`pQ7!TrJAUEpHDjRoL{C{(;al|i%GCKD_I1jC8QWT?OYEk8ekLeO>T z;2^xYS(wuO5ancjpv{Oq;@2%l+fYoRm@YDF2jxw)dm;H9U_jDxG-1HU<~=4$ZF zuneMTdle55{fLwZ5Af(D>zIUm`=ik*%F-QZG!=)DYtF3G!BO?V>)vU@cWThoP zDt3LWj%#3h`zOGK5^{3bXJ==!iF`4C{~9H^Zqr$DktV~>i7)1$IH94TjOt~+!@~-Z zk&!t$Isbux-d@VufTIS>_DlwPy?18Xf`pv3-@&8BSSjZE0nt+|<;Bp&%2>tRhW!wic^v0sR>+a2((Yf)t&c zoUBo968f9X(C?A5i%YE%P$wO?&y9eGrRg$PR##u8EO=b+^$k9Wj*g~PQ&U6B5p+8@ zo23M_jg}Ki%1xgcO~Ppry^XBQ&nqrgdm|pAP*hZ;fiz8W5pTTSuLq-e`}n*{5xU+j z@1x-0=hsANE;PDTgNb;d>$D#}Ckd$2P4ICk$-Y0@%a!#VptCS_%12&?<0 zozUgdW0Rqz0e}u*Z8Yv;NtMv}#yjqyqN0xvn(u{%>qea~_UFGAssf#xDL2Id^7EdX zJL>oE-tCEe7cgYaUe#<)F)$lfpTh+@+S~2gu(%;+UA%7Rj1Ztm*>!clLqeWY%f=1s z3#X6dV2RG|{GEnQZ8;#1y22^thmr&NWFcAdV z?RPu(7zkyV(}9j$l7JL&eQp=~#5h1YHgLg{e{l#z-&Y{bP^{3(?OAR5Q8f5OM3OKV=R*ixTwFpZh41(Y47PT- z+$I~({zKEY@m2ZE9MvCp1i%xH=h@Cwxyb;@)#;WfkXAYtmW>!SotB{?c}>~LTEQY; z!IWvAe{0C}v@~zvBY}5n0V8yP46pbB2TIg@v&I4;U!ULGT`Qw(GblCdD*dirT5N77 z;IVO=0t+M8XeQIiYoL)&Le-e!vzjjP0v@cyY~(d?Ruc!~LfLYOk2IQpS|ck0fuTr( zpR4P5{4;KCZLN@~2QI4PkJn=tpx=D%AMr#2l1JYW#(muRJhKq&y5#j_y2_f=+}s=$ z4J{%e!Cld{3lSF^OX#%VLQ~v$PBJ8L^1S(KqPXa)SHFv}gf^2%z?l`?-f-B8`Ctkk zs)>Im8z;i|C&C(@wWFkkf{Ea9V43nKdZ$YbYgfbg`7(mT!b}bp8XGQGg57V9xl$b_H8r&#FfZYW{7we%NqTyEKGJ2PIfB8Xm5{GrOGwid`fqG) zNm*Mn0c<1F^1;3GGH!pn@g8&ycnnD?spa%=p_O2kCdhv@G}&##_3)gzJNvM~x%v6p zouYck=6pT3kdP3P_7m_)fP2Z2s2V=LjZAzOUokN;zd@m6-WD5GV>@TD?g{w-VD9HL zreyq%1#OPkxHrS8qLsJ&v8gBjIO1hv1)W?Q@6uu}!^ZIc{rd+AA>%D;JKDWR`j1&! zSbS}AudQ0_3?&7*eekn*^=!O$@Y}a`C$(%k??$OM=p z0pKq*W_HiYW~`iDU6nL6Tzfj~M4o4xTZ3f?SjCo7cbHZ zRP%ulfpYgOSocOm^UwdJ3D5{ww0@n)Snuc=9gNvlR-_WbVpAiuLyoGBSp1)R`zSrsLvGi3mEeCXNP zm2UT)n!f-OYyrF-hQfms#3)Gvw@dfo9Su!BkWvTdKq=Gs_;~5;vD}G#HQ*2kg~7AA zYC0}rGGlXd1?vNd?1}q6mS$yXx`#5;x@9cUX(9K45Fb=A6TxZuD-Q%JT<9vNib+uL zHjO=j4|sr@G9SF4owIcpE@Mnzk@(C;~MT4N2c z^h%)0l$AO88zr9yeDE1!@kSh_cVa@tExvm-T(}4_0X*;-=qlu@>B3b|==u0G5{19( zaB^|w0Y4_uw*y#2I(L#Va=Q9+vXJ(JNf<~L){P%9$yDCy)3Ud>ANNFgT;UK*z%)uw zIwN?0bAsFeJd#}psCk_7?(hlhaOvYjrVL@F{hG82aH^n`#xiD)9|r}BioSko)es*AhK1!^6R$A=917LZGqs%dKdS9zTADjZMwY9;uivjz>-&suTpm zn?AKeEacA9=7%+w^a>jXXX-dFH<#-5>lM@4-f5t9&9c)3xf;kpl+(E;b~}SP>=?ln4{BEBOsRry3I+zBph$1hd=t6 zkRS_`8i21qj?D+nMu)YrqGBkVx@DM`E9R{8%`L-&amYxn`Qp2^O zt*qP*w&%eGgWCxOZMC(vKZCMuwKLQZ1Qs-qJb|X*5)=278TWxYn*j!cWn^b_*e!kV z!y*-rW!AQXLesOd{Pf%WA|fM2K74@u`0>N{#}78EY1TT}&O>hp$dJL(AFt;W0z~N} zk|H9H5M0);fsBIS*zHwLm4Wq$hmv%RX3793u?&d&@87?y4x0*o*yKT=bpnu`w_xs8x>@myE0*q`Aiol^d0BjfR7?_I&d%yUk&$9sK2W$wYg+GH zfoiR3%=;si?*BUS>zoiYH@}PY-F7njWZsH&eNBD*nlu@AQivVr7n^`o@Z!o~rvZN-q=H|PLBkA++eOjQIw)m$IO6~-j=!Q}J* z;6Ab=PC0u>bdS7evAgf-qXskGm|6yRZQlBE8;Y3vhY}<99#}aR@E%ozuCwvcK3?U6vT&UkX6lkNcJSep_LrBtse~B z2<(kLdS89J^VLJlGLaE`*1>vKqlORGq)b7eF}sp|Not!|tO7RU`~Iv?<)ickNu{B; zbJ}y7w%!;9H-@a6SnX(CBaJc_VJNvjY;hD+6R!O%e7u$)6BBWj80z^jFw{TtS@>Y_ zm7Z#WO4#~OmBJSS^22!}tTYIm{|Ye5dRg?CJ` zQ2%)Y(fBj)w{tUKWYgO9&Uv14i*T;^cHPEDvRSef-Ztwtf4*QWbKNXOC3Wd~S@k4@ zpn{Z{3+d*14(Gc!-HP7GY+~eDHy+ZgjOi*RG~YU{CpPodPi>3)&H9Rj{MgbfgF@=E z=Gvhkxv^_|*rvL3P8ta}&p^*~eC{!T-BlVpRGJV5E4#N^v|-6M)Z{7qNLbC>0PW*P zb;2_FSJ=0;g3RR9=8z3c7Riu*`|9i!d6@Q?mZ&lO-D+AV8KfThO38UcTy^vqRTl=HEpK}Ht{F@z4IP1 z!U!<(FiLW(>JuL|j-IT<5%$#m?9kk@{btx7it3DB;&88&cAK^}QAmiUg2qT(?b}Rw z!%s=8NF8H0FyK_M@*;A;Y z^Z-kwK_p;{qHSw?jEn~kaTspPesU{%g};wK=;puhhK)92Vcu=b%6xsbKiuUI`NX{B zJ?{9sfJV~`_S6g11>RF^AJHePtLvf$A6^f^&&aw4Dckf|mliq_rQpYwz@QTdG3-Jwo2PbFnQsuoRzH z$=N9*UlvolVP zl(TX+h6XF28nhe#o$km>J(tWVN&8uVsgCN3KKdr-3CPP7J@};Su&Auwb2=}&8X~Pr zfeWa~^CYhhlhjx>76L0>&t!kf+eg=U3rq>39sU(En|I^abOm%qrXzAfzpwCEtiF4h zKsjufZ9;;`I({aJI$saZh6ED%DB5PEm3oInKBp&PAfn((*xVm+cit6spL35R;*Ut* z2v^cj>kVzR%|K{!hsBc7RI`J|Tw{N_u7LDnN)s9X_mGH@H-Xy}VsNOSW!co>bV*lE z`8eJZ-k;!E-M7@Vezc3UL3zQ`-(7{{iuUidfG@4o8cC=u8bdXSb0R{UKqEXTe2kb8 zw-ICBG99ZG+;Z$C?Ip%#_tal*i<__|aCzmDKr8rB$C$$0bQE&vaA9Q9D?7PSl%10m z@FDzz#Xw~ZVy>3?hObjR?A?NJk~P|F+@uo;dZL%Yfr7Y1*m~3Wb&gFQbu}a5sU9oQ z!;tmCj!`O+9n+hob42hrlo{|pzH!e&f+-{{B8;MTCV`k--_e(pzhOOyn< zP-|29_0z-WdKNdzaw>@iO1p21!W)vFHPVz+>REOz>yVxv@BdK3;PxQ}A|X=e3sIO? z_zYqP-f1<>Y1w_=#o*RJ3QPK3KSM}O3QqwS!`UxaY8pA}e*Ta~({pbWg{9T)2e3Wg zW(x?g!F!ATHc~etyu(D_>hIV6JvWxw;HoGX6=r(Vo?8l@cRjkHd1=bn)*-9Qa7Q6# zoW9b{TQKXAiGv|n8rNT&rNMUo(u%LNv~+sso-;-|-G7(jeV%Xg21tF2>Mrg#1@9qJ z=l63d`46Ig!N}_LtAH%UE`ND=dZq+1u}~z!(8ffzok(?8y(ME>DrB28=x>VAdE$&e zNat@KzxD6(NAW?mcPb5QBJc5m%x-)Gyq;zC)mjzwR%^V9>x&7<3b`yTJ?#Nnj~tFN zs%>qtUsCFIW^+vcY7X7Yu0Dw+y%S+M(0Q-^+pLO96cg124R0S`PE`BxJ>sbO<-|+< zanf(xwPO>N49R47zHAYO4=M5t<(W~eDaZA9)AIctSOH&Y&_=PF4yncY@!{)9mS1Il z>`elv?-NPq z%BU9K`jJG`X4J4m;m&?})3SUsLf6EkBptyc*o854&}9Ga)F$tD9*>4y1w0yswK`5Q z=R66fsY#$rXqUE&swrnp)yo}(4t=~(v=Dbnjs1#p#b`}xq2>r{a4OMMewjjt;+lQx zhps<1xn)?9{$MAs)xdmEu|LaDh%>rcqUE&#yWq7tZuoHq1dR#IeiRI;)9ZNhH|F(+)>@q6)~*Ouq3ZF zzBy3TP?gq)QI+16(q>9x%VwqJdM8RarYShryPo_z8gelk5Ph#f+Ed)Wp}b5Nv=bC~ z7??7G45;mqRs4)M<~Bp6 z0*$~Ubr+cp*5%8n0aP4;9Ikh>1>rSgtJZr@T$^>xiRyw5lRPl6qZ;PGO&{!@hwoFr z*9~M{z^PYjh0G>%9%(o;55+4{nXi!aKCeCKHSD; zK8JJaI6qpKEoB4Zt_44YU38>y&yA>MUeJKCx?cgE}yC6V|+cme=W-(7o_Qtu`S&ZyOPqB=WhTaykVuci@ zW3$a0ZthPe(n)K=2FFV-N`lmQdWM~uttOx5p8oV0du7IYDDve`-xecJlbYtm z+f$q^oDa6i3!kpUU;HKh6k_{)l7Jy}Qha~Y>B$iaC<(V`_*(URUP-7e?d;1~D9|Sx zd3a~GJmTZ|wv6g@QH!8T6@9w(qBYK!tw5kOQn68dggcGp2j>q)vc{jKxrVt##aZ%t zlttl9Nq`Tndc{2@AXBGJ=;agrO&r(2d59{1cnLy7MkgpDIfX0ICd#%Qx=V)?1@;8^ z9NZbENMJw=txJ!kkqpnDl7A?XXEikFtQd*~{v4m}e=6ryKh7D;ZrWb6T8 zlJ`5mn|WycWNv5+f7<^h$UW>A#hUCbF>CA5=xQ`)jG}GshV7F(KNVB7H)QlezRB5? zciOizDm9qjalTi*vP!QhB8qBh4@zeUI1kM#tBo9(LC_U2ysb2)CpKkQaP5FCPeo`a z4fx$){nhRk%^uUQsyr`nBG`YM{?v^HSn=2*ZnM{ePOp8^uN~hN5$foDRn%o6bq0ZyMkivk!(R?>7HW)VWG~R@Kd^we?b5a^)V>P?JQ>-?3a+ z)5>agfouD)hecR_VbUdm2cA}$h#)^7;lHue^(us#mH(o^shu(@LM{S6nwypVVCs~dS|cq)8mJ{R`bpD^Yt-SxL#T=Q(9rMBW=5gLK=$vEi4~f1)(&`vPH=ZO3 ze-^r#wV4LQ5p$AG(l}yAvwHTVY-6m}f9_v{t`zt)dh4@p88H+Gy{h<`nCAR5^n1g~ zpr$jI^}-p=S+{C6wu5^j*KWE2s%)NYPS!r%0DO@fM3mm%X7;8!Y`--4K%z*Cs{Q-V zU>ldpb&Z^R-k{eH?E-&GMAhz%B2?U5=W09}!Ug#Ul~|0o)B_b9^dn(#^{v<&bsc@QZvxlctR HdfxvF-at|1 literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/index.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/index.html new file mode 100644 index 0000000..4a7d4b5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/index.html @@ -0,0 +1,192 @@ + + + +SimpleTest - Unit Testing for PHP + + + + + + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery-1.2.1.pack.js b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery-1.2.1.pack.js new file mode 100644 index 0000000..d646859 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery-1.2.1.pack.js @@ -0,0 +1,11 @@ +/* + * jQuery 1.2.1 - New Wave Javascript + * + * Copyright (c) 2007 John Resig (jquery.com) + * Dual licensed under the MIT (MIT-LICENSE.txt) + * and GPL (GPL-LICENSE.txt) licenses. + * + * $Date: 2007-09-16 23:42:06 -0400 (Sun, 16 Sep 2007) $ + * $Rev: 3353 $ + */ +eval(function(p,a,c,k,e,r){e=function(c){return(c35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(G(){9(1m E!="W")H w=E;H E=18.15=G(a,b){I 6 7u E?6.5N(a,b):1u E(a,b)};9(1m $!="W")H D=$;18.$=E;H u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;E.1b=E.3A={5N:G(c,a){c=c||U;9(1m c=="1M"){H m=u.2S(c);9(m&&(m[1]||!a)){9(m[1])c=E.4D([m[1]],a);J{H b=U.3S(m[3]);9(b)9(b.22!=m[3])I E().1Y(c);J{6[0]=b;6.K=1;I 6}J c=[]}}J I 1u E(a).1Y(c)}J 9(E.1n(c))I 1u E(U)[E.1b.2d?"2d":"39"](c);I 6.6v(c.1c==1B&&c||(c.4c||c.K&&c!=18&&!c.1y&&c[0]!=W&&c[0].1y)&&E.2h(c)||[c])},4c:"1.2.1",7Y:G(){I 6.K},K:0,21:G(a){I a==W?E.2h(6):6[a]},2o:G(a){H b=E(a);b.4Y=6;I b},6v:G(a){6.K=0;1B.3A.1a.16(6,a);I 6},N:G(a,b){I E.N(6,a,b)},4I:G(a){H b=-1;6.N(G(i){9(6==a)b=i});I b},1x:G(f,d,e){H c=f;9(f.1c==3X)9(d==W)I 6.K&&E[e||"1x"](6[0],f)||W;J{c={};c[f]=d}I 6.N(G(a){L(H b 1i c)E.1x(e?6.R:6,b,E.1e(6,c[b],e,a,b))})},17:G(b,a){I 6.1x(b,a,"3C")},2g:G(e){9(1m e!="5i"&&e!=S)I 6.4n().3g(U.6F(e));H t="";E.N(e||6,G(){E.N(6.3j,G(){9(6.1y!=8)t+=6.1y!=1?6.6x:E.1b.2g([6])})});I t},5m:G(b){9(6[0])E(b,6[0].3H).6u().3d(6[0]).1X(G(){H a=6;1W(a.1w)a=a.1w;I a}).3g(6);I 6},8m:G(a){I 6.N(G(){E(6).6q().5m(a)})},8d:G(a){I 6.N(G(){E(6).5m(a)})},3g:G(){I 6.3z(1q,Q,1,G(a){6.58(a)})},6j:G(){I 6.3z(1q,Q,-1,G(a){6.3d(a,6.1w)})},6g:G(){I 6.3z(1q,P,1,G(a){6.12.3d(a,6)})},50:G(){I 6.3z(1q,P,-1,G(a){6.12.3d(a,6.2q)})},2D:G(){I 6.4Y||E([])},1Y:G(t){H b=E.1X(6,G(a){I E.1Y(t,a)});I 6.2o(/[^+>] [^+>]/.14(t)||t.1g("..")>-1?E.4V(b):b)},6u:G(e){H f=6.1X(G(){I 6.67?E(6.67)[0]:6.4R(Q)});H d=f.1Y("*").4O().N(G(){9(6[F]!=W)6[F]=S});9(e===Q)6.1Y("*").4O().N(G(i){H c=E.M(6,"2P");L(H a 1i c)L(H b 1i c[a])E.1j.1f(d[i],a,c[a][b],c[a][b].M)});I f},1E:G(t){I 6.2o(E.1n(t)&&E.2W(6,G(b,a){I t.16(b,[a])})||E.3m(t,6))},5V:G(t){I 6.2o(t.1c==3X&&E.3m(t,6,Q)||E.2W(6,G(a){I(t.1c==1B||t.4c)?E.2A(a,t)<0:a!=t}))},1f:G(t){I 6.2o(E.1R(6.21(),t.1c==3X?E(t).21():t.K!=W&&(!t.11||E.11(t,"2Y"))?t:[t]))},3t:G(a){I a?E.3m(a,6).K>0:P},7c:G(a){I 6.3t("."+a)},3i:G(b){9(b==W){9(6.K){H c=6[0];9(E.11(c,"24")){H e=c.4Z,a=[],Y=c.Y,2G=c.O=="24-2G";9(e<0)I S;L(H i=2G?e:0,33=2G?e+1:Y.K;i<33;i++){H d=Y[i];9(d.26){H b=E.V.1h&&!d.9V["1Q"].9L?d.2g:d.1Q;9(2G)I b;a.1a(b)}}I a}J I 6[0].1Q.1p(/\\r/g,"")}}J I 6.N(G(){9(b.1c==1B&&/4k|5j/.14(6.O))6.2Q=(E.2A(6.1Q,b)>=0||E.2A(6.2H,b)>=0);J 9(E.11(6,"24")){H a=b.1c==1B?b:[b];E("9h",6).N(G(){6.26=(E.2A(6.1Q,a)>=0||E.2A(6.2g,a)>=0)});9(!a.K)6.4Z=-1}J 6.1Q=b})},4o:G(a){I a==W?(6.K?6[0].3O:S):6.4n().3g(a)},6H:G(a){I 6.50(a).28()},6E:G(i){I 6.2J(i,i+1)},2J:G(){I 6.2o(1B.3A.2J.16(6,1q))},1X:G(b){I 6.2o(E.1X(6,G(a,i){I b.2O(a,i,a)}))},4O:G(){I 6.1f(6.4Y)},3z:G(f,d,g,e){H c=6.K>1,a;I 6.N(G(){9(!a){a=E.4D(f,6.3H);9(g<0)a.8U()}H b=6;9(d&&E.11(6,"1I")&&E.11(a[0],"4m"))b=6.4l("1K")[0]||6.58(U.5B("1K"));E.N(a,G(){H a=c?6.4R(Q):6;9(!5A(0,a))e.2O(b,a)})})}};G 5A(i,b){H a=E.11(b,"1J");9(a){9(b.3k)E.3G({1d:b.3k,3e:P,1V:"1J"});J E.5f(b.2g||b.6s||b.3O||"");9(b.12)b.12.3b(b)}J 9(b.1y==1)E("1J",b).N(5A);I a}E.1k=E.1b.1k=G(){H c=1q[0]||{},a=1,2c=1q.K,5e=P;9(c.1c==8o){5e=c;c=1q[1]||{}}9(2c==1){c=6;a=0}H b;L(;a<2c;a++)9((b=1q[a])!=S)L(H i 1i b){9(c==b[i])6r;9(5e&&1m b[i]==\'5i\'&&c[i])E.1k(c[i],b[i]);J 9(b[i]!=W)c[i]=b[i]}I c};H F="15"+(1u 3D()).3B(),6p=0,5c={};E.1k({8a:G(a){18.$=D;9(a)18.15=w;I E},1n:G(a){I!!a&&1m a!="1M"&&!a.11&&a.1c!=1B&&/G/i.14(a+"")},4a:G(a){I a.2V&&!a.1G||a.37&&a.3H&&!a.3H.1G},5f:G(a){a=E.36(a);9(a){9(18.6l)18.6l(a);J 9(E.V.1N)18.56(a,0);J 3w.2O(18,a)}},11:G(b,a){I b.11&&b.11.27()==a.27()},1L:{},M:G(c,d,b){c=c==18?5c:c;H a=c[F];9(!a)a=c[F]=++6p;9(d&&!E.1L[a])E.1L[a]={};9(b!=W)E.1L[a][d]=b;I d?E.1L[a][d]:a},30:G(c,b){c=c==18?5c:c;H a=c[F];9(b){9(E.1L[a]){2E E.1L[a][b];b="";L(b 1i E.1L[a])1T;9(!b)E.30(c)}}J{2a{2E c[F]}29(e){9(c.53)c.53(F)}2E E.1L[a]}},N:G(a,b,c){9(c){9(a.K==W)L(H i 1i a)b.16(a[i],c);J L(H i=0,48=a.K;i<48;i++)9(b.16(a[i],c)===P)1T}J{9(a.K==W)L(H i 1i a)b.2O(a[i],i,a[i]);J L(H i=0,48=a.K,3i=a[0];i<48&&b.2O(3i,i,3i)!==P;3i=a[++i]){}}I a},1e:G(c,b,d,e,a){9(E.1n(b))b=b.2O(c,[e]);H f=/z-?4I|7T-?7Q|1r|69|7P-?1H/i;I b&&b.1c==4W&&d=="3C"&&!f.14(a)?b+"2T":b},1o:{1f:G(b,c){E.N((c||"").2l(/\\s+/),G(i,a){9(!E.1o.3K(b.1o,a))b.1o+=(b.1o?" ":"")+a})},28:G(b,c){b.1o=c!=W?E.2W(b.1o.2l(/\\s+/),G(a){I!E.1o.3K(c,a)}).66(" "):""},3K:G(t,c){I E.2A(c,(t.1o||t).3s().2l(/\\s+/))>-1}},2k:G(e,o,f){L(H i 1i o){e.R["3r"+i]=e.R[i];e.R[i]=o[i]}f.16(e,[]);L(H i 1i o)e.R[i]=e.R["3r"+i]},17:G(e,p){9(p=="1H"||p=="2N"){H b={},42,41,d=["7J","7I","7G","7F"];E.N(d,G(){b["7C"+6]=0;b["7B"+6+"5Z"]=0});E.2k(e,b,G(){9(E(e).3t(\':3R\')){42=e.7A;41=e.7w}J{e=E(e.4R(Q)).1Y(":4k").5W("2Q").2D().17({4C:"1P",2X:"4F",19:"2Z",7o:"0",1S:"0"}).5R(e.12)[0];H a=E.17(e.12,"2X")||"3V";9(a=="3V")e.12.R.2X="7g";42=e.7e;41=e.7b;9(a=="3V")e.12.R.2X="3V";e.12.3b(e)}});I p=="1H"?42:41}I E.3C(e,p)},3C:G(h,j,i){H g,2w=[],2k=[];G 3n(a){9(!E.V.1N)I P;H b=U.3o.3Z(a,S);I!b||b.4y("3n")==""}9(j=="1r"&&E.V.1h){g=E.1x(h.R,"1r");I g==""?"1":g}9(j.1t(/4u/i))j=y;9(!i&&h.R[j])g=h.R[j];J 9(U.3o&&U.3o.3Z){9(j.1t(/4u/i))j="4u";j=j.1p(/([A-Z])/g,"-$1").2p();H d=U.3o.3Z(h,S);9(d&&!3n(h))g=d.4y(j);J{L(H a=h;a&&3n(a);a=a.12)2w.4w(a);L(a=0;a<2w.K;a++)9(3n(2w[a])){2k[a]=2w[a].R.19;2w[a].R.19="2Z"}g=j=="19"&&2k[2w.K-1]!=S?"2s":U.3o.3Z(h,S).4y(j)||"";L(a=0;a<2k.K;a++)9(2k[a]!=S)2w[a].R.19=2k[a]}9(j=="1r"&&g=="")g="1"}J 9(h.3Q){H f=j.1p(/\\-(\\w)/g,G(m,c){I c.27()});g=h.3Q[j]||h.3Q[f];9(!/^\\d+(2T)?$/i.14(g)&&/^\\d/.14(g)){H k=h.R.1S;H e=h.4v.1S;h.4v.1S=h.3Q.1S;h.R.1S=g||0;g=h.R.71+"2T";h.R.1S=k;h.4v.1S=e}}I g},4D:G(a,e){H r=[];e=e||U;E.N(a,G(i,d){9(!d)I;9(d.1c==4W)d=d.3s();9(1m d=="1M"){d=d.1p(/(<(\\w+)[^>]*?)\\/>/g,G(m,a,b){I b.1t(/^(70|6Z|6Y|9Q|4t|9N|9K|3a|9G|9E)$/i)?m:a+">"});H s=E.36(d).2p(),1s=e.5B("1s"),2x=[];H c=!s.1g("<9y")&&[1,"<24>",""]||!s.1g("<9w")&&[1,"<6T>",""]||s.1t(/^<(9u|1K|9t|9r|9p)/)&&[1,"<1I>",""]||!s.1g("<4m")&&[2,"<1I><1K>",""]||(!s.1g("<9m")||!s.1g("<9k"))&&[3,"<1I><1K><4m>",""]||!s.1g("<6Y")&&[2,"<1I><1K><6L>",""]||E.V.1h&&[1,"1s<1s>",""]||[0,"",""];1s.3O=c[1]+d+c[2];1W(c[0]--)1s=1s.5p;9(E.V.1h){9(!s.1g("<1I")&&s.1g("<1K")<0)2x=1s.1w&&1s.1w.3j;J 9(c[1]=="<1I>"&&s.1g("<1K")<0)2x=1s.3j;L(H n=2x.K-1;n>=0;--n)9(E.11(2x[n],"1K")&&!2x[n].3j.K)2x[n].12.3b(2x[n]);9(/^\\s/.14(d))1s.3d(e.6F(d.1t(/^\\s*/)[0]),1s.1w)}d=E.2h(1s.3j)}9(0===d.K&&(!E.11(d,"2Y")&&!E.11(d,"24")))I;9(d[0]==W||E.11(d,"2Y")||d.Y)r.1a(d);J r=E.1R(r,d)});I r},1x:G(c,d,a){H e=E.4a(c)?{}:E.5o;9(d=="26"&&E.V.1N)c.12.4Z;9(e[d]){9(a!=W)c[e[d]]=a;I c[e[d]]}J 9(E.V.1h&&d=="R")I E.1x(c.R,"9e",a);J 9(a==W&&E.V.1h&&E.11(c,"2Y")&&(d=="9d"||d=="9a"))I c.97(d).6x;J 9(c.37){9(a!=W){9(d=="O"&&E.11(c,"4t")&&c.12)6G"O 94 93\'t 92 91";c.90(d,a)}9(E.V.1h&&/6C|3k/.14(d)&&!E.4a(c))I c.4p(d,2);I c.4p(d)}J{9(d=="1r"&&E.V.1h){9(a!=W){c.69=1;c.1E=(c.1E||"").1p(/6O\\([^)]*\\)/,"")+(3I(a).3s()=="8S"?"":"6O(1r="+a*6A+")")}I c.1E?(3I(c.1E.1t(/1r=([^)]*)/)[1])/6A).3s():""}d=d.1p(/-([a-z])/8Q,G(z,b){I b.27()});9(a!=W)c[d]=a;I c[d]}},36:G(t){I(t||"").1p(/^\\s+|\\s+$/g,"")},2h:G(a){H r=[];9(1m a!="8P")L(H i=0,2c=a.K;i<2c;i++)r.1a(a[i]);J r=a.2J(0);I r},2A:G(b,a){L(H i=0,2c=a.K;i<2c;i++)9(a[i]==b)I i;I-1},1R:G(a,b){9(E.V.1h){L(H i=0;b[i];i++)9(b[i].1y!=8)a.1a(b[i])}J L(H i=0;b[i];i++)a.1a(b[i]);I a},4V:G(b){H r=[],2f={};2a{L(H i=0,6y=b.K;i<6y;i++){H a=E.M(b[i]);9(!2f[a]){2f[a]=Q;r.1a(b[i])}}}29(e){r=b}I r},2W:G(b,a,c){9(1m a=="1M")a=3w("P||G(a,i){I "+a+"}");H d=[];L(H i=0,4g=b.K;i<4g;i++)9(!c&&a(b[i],i)||c&&!a(b[i],i))d.1a(b[i]);I d},1X:G(c,b){9(1m b=="1M")b=3w("P||G(a){I "+b+"}");H d=[];L(H i=0,4g=c.K;i<4g;i++){H a=b(c[i],i);9(a!==S&&a!=W){9(a.1c!=1B)a=[a];d=d.8M(a)}}I d}});H v=8K.8I.2p();E.V={4s:(v.1t(/.+(?:8F|8E|8C|8B)[\\/: ]([\\d.]+)/)||[])[1],1N:/6w/.14(v),34:/34/.14(v),1h:/1h/.14(v)&&!/34/.14(v),35:/35/.14(v)&&!/(8z|6w)/.14(v)};H y=E.V.1h?"4h":"5h";E.1k({5g:!E.V.1h||U.8y=="8x",4h:E.V.1h?"4h":"5h",5o:{"L":"8w","8v":"1o","4u":y,5h:y,4h:y,3O:"3O",1o:"1o",1Q:"1Q",3c:"3c",2Q:"2Q",8u:"8t",26:"26",8s:"8r"}});E.N({1D:"a.12",8q:"15.4e(a,\'12\')",8p:"15.2I(a,2,\'2q\')",8n:"15.2I(a,2,\'4d\')",8l:"15.4e(a,\'2q\')",8k:"15.4e(a,\'4d\')",8j:"15.5d(a.12.1w,a)",8i:"15.5d(a.1w)",6q:"15.11(a,\'8h\')?a.8f||a.8e.U:15.2h(a.3j)"},G(i,n){E.1b[i]=G(a){H b=E.1X(6,n);9(a&&1m a=="1M")b=E.3m(a,b);I 6.2o(E.4V(b))}});E.N({5R:"3g",8c:"6j",3d:"6g",8b:"50",89:"6H"},G(i,n){E.1b[i]=G(){H a=1q;I 6.N(G(){L(H j=0,2c=a.K;j<2c;j++)E(a[j])[n](6)})}});E.N({5W:G(a){E.1x(6,a,"");6.53(a)},88:G(c){E.1o.1f(6,c)},87:G(c){E.1o.28(6,c)},86:G(c){E.1o[E.1o.3K(6,c)?"28":"1f"](6,c)},28:G(a){9(!a||E.1E(a,[6]).r.K){E.30(6);6.12.3b(6)}},4n:G(){E("*",6).N(G(){E.30(6)});1W(6.1w)6.3b(6.1w)}},G(i,n){E.1b[i]=G(){I 6.N(n,1q)}});E.N(["85","5Z"],G(i,a){H n=a.2p();E.1b[n]=G(h){I 6[0]==18?E.V.1N&&3y["84"+a]||E.5g&&38.33(U.2V["5a"+a],U.1G["5a"+a])||U.1G["5a"+a]:6[0]==U?38.33(U.1G["6n"+a],U.1G["6m"+a]):h==W?(6.K?E.17(6[0],n):S):6.17(n,h.1c==3X?h:h+"2T")}});H C=E.V.1N&&3x(E.V.4s)<83?"(?:[\\\\w*57-]|\\\\\\\\.)":"(?:[\\\\w\\82-\\81*57-]|\\\\\\\\.)",6k=1u 47("^>\\\\s*("+C+"+)"),6i=1u 47("^("+C+"+)(#)("+C+"+)"),6h=1u 47("^([#.]?)("+C+"*)");E.1k({55:{"":"m[2]==\'*\'||15.11(a,m[2])","#":"a.4p(\'22\')==m[2]",":":{80:"im[3]-0",2I:"m[3]-0==i",6E:"m[3]-0==i",3v:"i==0",3u:"i==r.K-1",6f:"i%2==0",6e:"i%2","3v-46":"a.12.4l(\'*\')[0]==a","3u-46":"15.2I(a.12.5p,1,\'4d\')==a","7X-46":"!15.2I(a.12.5p,2,\'4d\')",1D:"a.1w",4n:"!a.1w",7W:"(a.6s||a.7V||15(a).2g()||\'\').1g(m[3])>=0",3R:\'"1P"!=a.O&&15.17(a,"19")!="2s"&&15.17(a,"4C")!="1P"\',1P:\'"1P"==a.O||15.17(a,"19")=="2s"||15.17(a,"4C")=="1P"\',7U:"!a.3c",3c:"a.3c",2Q:"a.2Q",26:"a.26||15.1x(a,\'26\')",2g:"\'2g\'==a.O",4k:"\'4k\'==a.O",5j:"\'5j\'==a.O",54:"\'54\'==a.O",52:"\'52\'==a.O",51:"\'51\'==a.O",6d:"\'6d\'==a.O",6c:"\'6c\'==a.O",2r:\'"2r"==a.O||15.11(a,"2r")\',4t:"/4t|24|6b|2r/i.14(a.11)",3K:"15.1Y(m[3],a).K",7S:"/h\\\\d/i.14(a.11)",7R:"15.2W(15.32,G(1b){I a==1b.T;}).K"}},6a:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1u 47("^([:.#]*)("+C+"+)")],3m:G(a,c,b){H d,2b=[];1W(a&&a!=d){d=a;H f=E.1E(a,c,b);a=f.t.1p(/^\\s*,\\s*/,"");2b=b?c=f.r:E.1R(2b,f.r)}I 2b},1Y:G(t,o){9(1m t!="1M")I[t];9(o&&!o.1y)o=S;o=o||U;H d=[o],2f=[],3u;1W(t&&3u!=t){H r=[];3u=t;t=E.36(t);H l=P;H g=6k;H m=g.2S(t);9(m){H p=m[1].27();L(H i=0;d[i];i++)L(H c=d[i].1w;c;c=c.2q)9(c.1y==1&&(p=="*"||c.11.27()==p.27()))r.1a(c);d=r;t=t.1p(g,"");9(t.1g(" ")==0)6r;l=Q}J{g=/^([>+~])\\s*(\\w*)/i;9((m=g.2S(t))!=S){r=[];H p=m[2],1R={};m=m[1];L(H j=0,31=d.K;j<31;j++){H n=m=="~"||m=="+"?d[j].2q:d[j].1w;L(;n;n=n.2q)9(n.1y==1){H h=E.M(n);9(m=="~"&&1R[h])1T;9(!p||n.11.27()==p.27()){9(m=="~")1R[h]=Q;r.1a(n)}9(m=="+")1T}}d=r;t=E.36(t.1p(g,""));l=Q}}9(t&&!l){9(!t.1g(",")){9(o==d[0])d.44();2f=E.1R(2f,d);r=d=[o];t=" "+t.68(1,t.K)}J{H k=6i;H m=k.2S(t);9(m){m=[0,m[2],m[3],m[1]]}J{k=6h;m=k.2S(t)}m[2]=m[2].1p(/\\\\/g,"");H f=d[d.K-1];9(m[1]=="#"&&f&&f.3S&&!E.4a(f)){H q=f.3S(m[2]);9((E.V.1h||E.V.34)&&q&&1m q.22=="1M"&&q.22!=m[2])q=E(\'[@22="\'+m[2]+\'"]\',f)[0];d=r=q&&(!m[3]||E.11(q,m[3]))?[q]:[]}J{L(H i=0;d[i];i++){H a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];9(a=="*"&&d[i].11.2p()=="5i")a="3a";r=E.1R(r,d[i].4l(a))}9(m[1]==".")r=E.4X(r,m[2]);9(m[1]=="#"){H e=[];L(H i=0;r[i];i++)9(r[i].4p("22")==m[2]){e=[r[i]];1T}r=e}d=r}t=t.1p(k,"")}}9(t){H b=E.1E(t,r);d=r=b.r;t=E.36(b.t)}}9(t)d=[];9(d&&o==d[0])d.44();2f=E.1R(2f,d);I 2f},4X:G(r,m,a){m=" "+m+" ";H c=[];L(H i=0;r[i];i++){H b=(" "+r[i].1o+" ").1g(m)>=0;9(!a&&b||a&&!b)c.1a(r[i])}I c},1E:G(t,r,h){H d;1W(t&&t!=d){d=t;H p=E.6a,m;L(H i=0;p[i];i++){m=p[i].2S(t);9(m){t=t.7O(m[0].K);m[2]=m[2].1p(/\\\\/g,"");1T}}9(!m)1T;9(m[1]==":"&&m[2]=="5V")r=E.1E(m[3],r,Q).r;J 9(m[1]==".")r=E.4X(r,m[2],h);J 9(m[1]=="["){H g=[],O=m[3];L(H i=0,31=r.K;i<31;i++){H a=r[i],z=a[E.5o[m[2]]||m[2]];9(z==S||/6C|3k|26/.14(m[2]))z=E.1x(a,m[2])||\'\';9((O==""&&!!z||O=="="&&z==m[5]||O=="!="&&z!=m[5]||O=="^="&&z&&!z.1g(m[5])||O=="$="&&z.68(z.K-m[5].K)==m[5]||(O=="*="||O=="~=")&&z.1g(m[5])>=0)^h)g.1a(a)}r=g}J 9(m[1]==":"&&m[2]=="2I-46"){H e={},g=[],14=/(\\d*)n\\+?(\\d*)/.2S(m[3]=="6f"&&"2n"||m[3]=="6e"&&"2n+1"||!/\\D/.14(m[3])&&"n+"+m[3]||m[3]),3v=(14[1]||1)-0,d=14[2]-0;L(H i=0,31=r.K;i<31;i++){H j=r[i],12=j.12,22=E.M(12);9(!e[22]){H c=1;L(H n=12.1w;n;n=n.2q)9(n.1y==1)n.4U=c++;e[22]=Q}H b=P;9(3v==1){9(d==0||j.4U==d)b=Q}J 9((j.4U+d)%3v==0)b=Q;9(b^h)g.1a(j)}r=g}J{H f=E.55[m[1]];9(1m f!="1M")f=E.55[m[1]][m[2]];f=3w("P||G(a,i){I "+f+"}");r=E.2W(r,f,h)}}I{r:r,t:t}},4e:G(b,c){H d=[];H a=b[c];1W(a&&a!=U){9(a.1y==1)d.1a(a);a=a[c]}I d},2I:G(a,e,c,b){e=e||1;H d=0;L(;a;a=a[c])9(a.1y==1&&++d==e)1T;I a},5d:G(n,a){H r=[];L(;n;n=n.2q){9(n.1y==1&&(!a||n!=a))r.1a(n)}I r}});E.1j={1f:G(g,e,c,h){9(E.V.1h&&g.4j!=W)g=18;9(!c.2u)c.2u=6.2u++;9(h!=W){H d=c;c=G(){I d.16(6,1q)};c.M=h;c.2u=d.2u}H i=e.2l(".");e=i[0];c.O=i[1];H b=E.M(g,"2P")||E.M(g,"2P",{});H f=E.M(g,"2t",G(){H a;9(1m E=="W"||E.1j.4T)I a;a=E.1j.2t.16(g,1q);I a});H j=b[e];9(!j){j=b[e]={};9(g.4S)g.4S(e,f,P);J g.7N("43"+e,f)}j[c.2u]=c;6.1Z[e]=Q},2u:1,1Z:{},28:G(d,c,b){H e=E.M(d,"2P"),2L,4I;9(1m c=="1M"){H a=c.2l(".");c=a[0]}9(e){9(c&&c.O){b=c.4Q;c=c.O}9(!c){L(c 1i e)6.28(d,c)}J 9(e[c]){9(b)2E e[c][b.2u];J L(b 1i e[c])9(!a[1]||e[c][b].O==a[1])2E e[c][b];L(2L 1i e[c])1T;9(!2L){9(d.4P)d.4P(c,E.M(d,"2t"),P);J d.7M("43"+c,E.M(d,"2t"));2L=S;2E e[c]}}L(2L 1i e)1T;9(!2L){E.30(d,"2P");E.30(d,"2t")}}},1F:G(d,b,e,c,f){b=E.2h(b||[]);9(!e){9(6.1Z[d])E("*").1f([18,U]).1F(d,b)}J{H a,2L,1b=E.1n(e[d]||S),4N=!b[0]||!b[0].2M;9(4N)b.4w(6.4M({O:d,2m:e}));b[0].O=d;9(E.1n(E.M(e,"2t")))a=E.M(e,"2t").16(e,b);9(!1b&&e["43"+d]&&e["43"+d].16(e,b)===P)a=P;9(4N)b.44();9(f&&f.16(e,b)===P)a=P;9(1b&&c!==P&&a!==P&&!(E.11(e,\'a\')&&d=="4L")){6.4T=Q;e[d]()}6.4T=P}I a},2t:G(d){H a;d=E.1j.4M(d||18.1j||{});H b=d.O.2l(".");d.O=b[0];H c=E.M(6,"2P")&&E.M(6,"2P")[d.O],3q=1B.3A.2J.2O(1q,1);3q.4w(d);L(H j 1i c){3q[0].4Q=c[j];3q[0].M=c[j].M;9(!b[1]||c[j].O==b[1]){H e=c[j].16(6,3q);9(a!==P)a=e;9(e===P){d.2M();d.3p()}}}9(E.V.1h)d.2m=d.2M=d.3p=d.4Q=d.M=S;I a},4M:G(c){H a=c;c=E.1k({},a);c.2M=G(){9(a.2M)a.2M();a.7L=P};c.3p=G(){9(a.3p)a.3p();a.7K=Q};9(!c.2m&&c.65)c.2m=c.65;9(E.V.1N&&c.2m.1y==3)c.2m=a.2m.12;9(!c.4K&&c.4J)c.4K=c.4J==c.2m?c.7H:c.4J;9(c.64==S&&c.63!=S){H e=U.2V,b=U.1G;c.64=c.63+(e&&e.2R||b.2R||0);c.7E=c.7D+(e&&e.2B||b.2B||0)}9(!c.3Y&&(c.61||c.60))c.3Y=c.61||c.60;9(!c.5F&&c.5D)c.5F=c.5D;9(!c.3Y&&c.2r)c.3Y=(c.2r&1?1:(c.2r&2?3:(c.2r&4?2:0)));I c}};E.1b.1k({3W:G(c,a,b){I c=="5Y"?6.2G(c,a,b):6.N(G(){E.1j.1f(6,c,b||a,b&&a)})},2G:G(d,b,c){I 6.N(G(){E.1j.1f(6,d,G(a){E(6).5X(a);I(c||b).16(6,1q)},c&&b)})},5X:G(a,b){I 6.N(G(){E.1j.28(6,a,b)})},1F:G(c,a,b){I 6.N(G(){E.1j.1F(c,a,6,Q,b)})},7x:G(c,a,b){9(6[0])I E.1j.1F(c,a,6[0],P,b)},25:G(){H a=1q;I 6.4L(G(e){6.4H=0==6.4H?1:0;e.2M();I a[6.4H].16(6,[e])||P})},7v:G(f,g){G 4G(e){H p=e.4K;1W(p&&p!=6)2a{p=p.12}29(e){p=6};9(p==6)I P;I(e.O=="4x"?f:g).16(6,[e])}I 6.4x(4G).5U(4G)},2d:G(f){5T();9(E.3T)f.16(U,[E]);J E.3l.1a(G(){I f.16(6,[E])});I 6}});E.1k({3T:P,3l:[],2d:G(){9(!E.3T){E.3T=Q;9(E.3l){E.N(E.3l,G(){6.16(U)});E.3l=S}9(E.V.35||E.V.34)U.4P("5S",E.2d,P);9(!18.7t.K)E(18).39(G(){E("#4E").28()})}}});E.N(("7s,7r,39,7q,6n,5Y,4L,7p,"+"7n,7m,7l,4x,5U,7k,24,"+"51,7j,7i,7h,3U").2l(","),G(i,o){E.1b[o]=G(f){I f?6.3W(o,f):6.1F(o)}});H x=P;G 5T(){9(x)I;x=Q;9(E.V.35||E.V.34)U.4S("5S",E.2d,P);J 9(E.V.1h){U.7f("<7d"+"7y 22=4E 7z=Q "+"3k=//:><\\/1J>");H a=U.3S("4E");9(a)a.62=G(){9(6.2C!="1l")I;E.2d()};a=S}J 9(E.V.1N)E.4B=4j(G(){9(U.2C=="5Q"||U.2C=="1l"){4A(E.4B);E.4B=S;E.2d()}},10);E.1j.1f(18,"39",E.2d)}E.1b.1k({39:G(g,d,c){9(E.1n(g))I 6.3W("39",g);H e=g.1g(" ");9(e>=0){H i=g.2J(e,g.K);g=g.2J(0,e)}c=c||G(){};H f="4z";9(d)9(E.1n(d)){c=d;d=S}J{d=E.3a(d);f="5P"}H h=6;E.3G({1d:g,O:f,M:d,1l:G(a,b){9(b=="1C"||b=="5O")h.4o(i?E("<1s/>").3g(a.40.1p(/<1J(.|\\s)*?\\/1J>/g,"")).1Y(i):a.40);56(G(){h.N(c,[a.40,b,a])},13)}});I 6},7a:G(){I E.3a(6.5M())},5M:G(){I 6.1X(G(){I E.11(6,"2Y")?E.2h(6.79):6}).1E(G(){I 6.2H&&!6.3c&&(6.2Q||/24|6b/i.14(6.11)||/2g|1P|52/i.14(6.O))}).1X(G(i,c){H b=E(6).3i();I b==S?S:b.1c==1B?E.1X(b,G(a,i){I{2H:c.2H,1Q:a}}):{2H:c.2H,1Q:b}}).21()}});E.N("5L,5K,6t,5J,5I,5H".2l(","),G(i,o){E.1b[o]=G(f){I 6.3W(o,f)}});H B=(1u 3D).3B();E.1k({21:G(d,b,a,c){9(E.1n(b)){a=b;b=S}I E.3G({O:"4z",1d:d,M:b,1C:a,1V:c})},78:G(b,a){I E.21(b,S,a,"1J")},77:G(c,b,a){I E.21(c,b,a,"45")},76:G(d,b,a,c){9(E.1n(b)){a=b;b={}}I E.3G({O:"5P",1d:d,M:b,1C:a,1V:c})},75:G(a){E.1k(E.59,a)},59:{1Z:Q,O:"4z",2z:0,5G:"74/x-73-2Y-72",6o:Q,3e:Q,M:S},49:{},3G:G(s){H f,2y=/=(\\?|%3F)/g,1v,M;s=E.1k(Q,s,E.1k(Q,{},E.59,s));9(s.M&&s.6o&&1m s.M!="1M")s.M=E.3a(s.M);9(s.1V=="4b"){9(s.O.2p()=="21"){9(!s.1d.1t(2y))s.1d+=(s.1d.1t(/\\?/)?"&":"?")+(s.4b||"5E")+"=?"}J 9(!s.M||!s.M.1t(2y))s.M=(s.M?s.M+"&":"")+(s.4b||"5E")+"=?";s.1V="45"}9(s.1V=="45"&&(s.M&&s.M.1t(2y)||s.1d.1t(2y))){f="4b"+B++;9(s.M)s.M=s.M.1p(2y,"="+f);s.1d=s.1d.1p(2y,"="+f);s.1V="1J";18[f]=G(a){M=a;1C();1l();18[f]=W;2a{2E 18[f]}29(e){}}}9(s.1V=="1J"&&s.1L==S)s.1L=P;9(s.1L===P&&s.O.2p()=="21")s.1d+=(s.1d.1t(/\\?/)?"&":"?")+"57="+(1u 3D()).3B();9(s.M&&s.O.2p()=="21"){s.1d+=(s.1d.1t(/\\?/)?"&":"?")+s.M;s.M=S}9(s.1Z&&!E.5b++)E.1j.1F("5L");9(!s.1d.1g("8g")&&s.1V=="1J"){H h=U.4l("9U")[0];H g=U.5B("1J");g.3k=s.1d;9(!f&&(s.1C||s.1l)){H j=P;g.9R=g.62=G(){9(!j&&(!6.2C||6.2C=="5Q"||6.2C=="1l")){j=Q;1C();1l();h.3b(g)}}}h.58(g);I}H k=P;H i=18.6X?1u 6X("9P.9O"):1u 6W();i.9M(s.O,s.1d,s.3e);9(s.M)i.5C("9J-9I",s.5G);9(s.5y)i.5C("9H-5x-9F",E.49[s.1d]||"9D, 9C 9B 9A 5v:5v:5v 9z");i.5C("X-9x-9v","6W");9(s.6U)s.6U(i);9(s.1Z)E.1j.1F("5H",[i,s]);H c=G(a){9(!k&&i&&(i.2C==4||a=="2z")){k=Q;9(d){4A(d);d=S}1v=a=="2z"&&"2z"||!E.6S(i)&&"3U"||s.5y&&E.6R(i,s.1d)&&"5O"||"1C";9(1v=="1C"){2a{M=E.6Q(i,s.1V)}29(e){1v="5k"}}9(1v=="1C"){H b;2a{b=i.5s("6P-5x")}29(e){}9(s.5y&&b)E.49[s.1d]=b;9(!f)1C()}J E.5r(s,i,1v);1l();9(s.3e)i=S}};9(s.3e){H d=4j(c,13);9(s.2z>0)56(G(){9(i){i.9q();9(!k)c("2z")}},s.2z)}2a{i.9o(s.M)}29(e){E.5r(s,i,S,e)}9(!s.3e)c();I i;G 1C(){9(s.1C)s.1C(M,1v);9(s.1Z)E.1j.1F("5I",[i,s])}G 1l(){9(s.1l)s.1l(i,1v);9(s.1Z)E.1j.1F("6t",[i,s]);9(s.1Z&&!--E.5b)E.1j.1F("5K")}},5r:G(s,a,b,e){9(s.3U)s.3U(a,b,e);9(s.1Z)E.1j.1F("5J",[a,s,e])},5b:0,6S:G(r){2a{I!r.1v&&9n.9l=="54:"||(r.1v>=6N&&r.1v<9j)||r.1v==6M||E.V.1N&&r.1v==W}29(e){}I P},6R:G(a,c){2a{H b=a.5s("6P-5x");I a.1v==6M||b==E.49[c]||E.V.1N&&a.1v==W}29(e){}I P},6Q:G(r,b){H c=r.5s("9i-O");H d=b=="6K"||!b&&c&&c.1g("6K")>=0;H a=d?r.9g:r.40;9(d&&a.2V.37=="5k")6G"5k";9(b=="1J")E.5f(a);9(b=="45")a=3w("("+a+")");I a},3a:G(a){H s=[];9(a.1c==1B||a.4c)E.N(a,G(){s.1a(3f(6.2H)+"="+3f(6.1Q))});J L(H j 1i a)9(a[j]&&a[j].1c==1B)E.N(a[j],G(){s.1a(3f(j)+"="+3f(6))});J s.1a(3f(j)+"="+3f(a[j]));I s.66("&").1p(/%20/g,"+")}});E.1b.1k({1A:G(b,a){I b?6.1U({1H:"1A",2N:"1A",1r:"1A"},b,a):6.1E(":1P").N(G(){6.R.19=6.3h?6.3h:"";9(E.17(6,"19")=="2s")6.R.19="2Z"}).2D()},1z:G(b,a){I b?6.1U({1H:"1z",2N:"1z",1r:"1z"},b,a):6.1E(":3R").N(G(){6.3h=6.3h||E.17(6,"19");9(6.3h=="2s")6.3h="2Z";6.R.19="2s"}).2D()},6J:E.1b.25,25:G(a,b){I E.1n(a)&&E.1n(b)?6.6J(a,b):a?6.1U({1H:"25",2N:"25",1r:"25"},a,b):6.N(G(){E(6)[E(6).3t(":1P")?"1A":"1z"]()})},9c:G(b,a){I 6.1U({1H:"1A"},b,a)},9b:G(b,a){I 6.1U({1H:"1z"},b,a)},99:G(b,a){I 6.1U({1H:"25"},b,a)},98:G(b,a){I 6.1U({1r:"1A"},b,a)},96:G(b,a){I 6.1U({1r:"1z"},b,a)},95:G(c,a,b){I 6.1U({1r:a},c,b)},1U:G(k,i,h,g){H j=E.6D(i,h,g);I 6[j.3L===P?"N":"3L"](G(){j=E.1k({},j);H f=E(6).3t(":1P"),3y=6;L(H p 1i k){9(k[p]=="1z"&&f||k[p]=="1A"&&!f)I E.1n(j.1l)&&j.1l.16(6);9(p=="1H"||p=="2N"){j.19=E.17(6,"19");j.2U=6.R.2U}}9(j.2U!=S)6.R.2U="1P";j.3M=E.1k({},k);E.N(k,G(c,a){H e=1u E.2j(3y,j,c);9(/25|1A|1z/.14(a))e[a=="25"?f?"1A":"1z":a](k);J{H b=a.3s().1t(/^([+-]=)?([\\d+-.]+)(.*)$/),1O=e.2b(Q)||0;9(b){H d=3I(b[2]),2i=b[3]||"2T";9(2i!="2T"){3y.R[c]=(d||1)+2i;1O=((d||1)/e.2b(Q))*1O;3y.R[c]=1O+2i}9(b[1])d=((b[1]=="-="?-1:1)*d)+1O;e.3N(1O,d,2i)}J e.3N(1O,a,"")}});I Q})},3L:G(a,b){9(E.1n(a)){b=a;a="2j"}9(!a||(1m a=="1M"&&!b))I A(6[0],a);I 6.N(G(){9(b.1c==1B)A(6,a,b);J{A(6,a).1a(b);9(A(6,a).K==1)b.16(6)}})},9f:G(){H a=E.32;I 6.N(G(){L(H i=0;i-8O?r:3I(E.17(6.T,6.1e))||0},3N:G(c,b,e){6.5u=(1u 3D()).3B();6.1O=c;6.2D=b;6.2i=e||6.2i||"2T";6.2v=6.1O;6.4q=6.4i=0;6.4r();H f=6;G t(){I f.2F()}t.T=6.T;E.32.1a(t);9(E.32.K==1){H d=4j(G(){H a=E.32;L(H i=0;i6.Y.2e+6.5u){6.2v=6.2D;6.4q=6.4i=1;6.4r();6.Y.3M[6.1e]=Q;H a=Q;L(H i 1i 6.Y.3M)9(6.Y.3M[i]!==Q)a=P;9(a){9(6.Y.19!=S){6.T.R.2U=6.Y.2U;6.T.R.19=6.Y.19;9(E.17(6.T,"19")=="2s")6.T.R.19="2Z"}9(6.Y.1z)6.T.R.19="2s";9(6.Y.1z||6.Y.1A)L(H p 1i 6.Y.3M)E.1x(6.T.R,p,6.Y.3P[p])}9(a&&E.1n(6.Y.1l))6.Y.1l.16(6.T);I P}J{H n=t-6.5u;6.4i=n/6.Y.2e;6.4q=E.3J[6.Y.3J||(E.3J.5q?"5q":"6B")](6.4i,n,0,1,6.Y.2e);6.2v=6.1O+((6.2D-6.1O)*6.4q);6.4r()}I Q}};E.2j.2F={2R:G(a){a.T.2R=a.2v},2B:G(a){a.T.2B=a.2v},1r:G(a){E.1x(a.T.R,"1r",a.2v)},6z:G(a){a.T.R[a.1e]=a.2v+a.2i}};E.1b.6m=G(){H c=0,3E=0,T=6[0],5t;9(T)8L(E.V){H b=E.17(T,"2X")=="4F",1D=T.12,23=T.23,2K=T.3H,4f=1N&&3x(4s)<8J;9(T.6V){5w=T.6V();1f(5w.1S+38.33(2K.2V.2R,2K.1G.2R),5w.3E+38.33(2K.2V.2B,2K.1G.2B));9(1h){H d=E("4o").17("8H");d=(d=="8G"||E.5g&&3x(4s)>=7)&&2||d;1f(-d,-d)}}J{1f(T.5l,T.5z);1W(23){1f(23.5l,23.5z);9(35&&/^t[d|h]$/i.14(1D.37)||!4f)d(23);9(4f&&!b&&E.17(23,"2X")=="4F")b=Q;23=23.23}1W(1D.37&&!/^1G|4o$/i.14(1D.37)){9(!/^8D|1I-9S.*$/i.14(E.17(1D,"19")))1f(-1D.2R,-1D.2B);9(35&&E.17(1D,"2U")!="3R")d(1D);1D=1D.12}9(4f&&b)1f(-2K.1G.5l,-2K.1G.5z)}5t={3E:3E,1S:c}}I 5t;G d(a){1f(E.17(a,"9T"),E.17(a,"8A"))}G 1f(l,t){c+=3x(l)||0;3E+=3x(t)||0}}})();',62,616,'||||||this|||if|||||||||||||||||||||||||||||||||function|var|return|else|length|for|data|each|type|false|true|style|null|elem|document|browser|undefined||options|||nodeName|parentNode||test|jQuery|apply|css|window|display|push|fn|constructor|url|prop|add|indexOf|msie|in|event|extend|complete|typeof|isFunction|className|replace|arguments|opacity|div|match|new|status|firstChild|attr|nodeType|hide|show|Array|success|parent|filter|trigger|body|height|table|script|tbody|cache|string|safari|start|hidden|value|merge|left|break|animate|dataType|while|map|find|global||get|id|offsetParent|select|toggle|selected|toUpperCase|remove|catch|try|cur|al|ready|duration|done|text|makeArray|unit|fx|swap|split|target||pushStack|toLowerCase|nextSibling|button|none|handle|guid|now|stack|tb|jsre|timeout|inArray|scrollTop|readyState|end|delete|step|one|name|nth|slice|doc|ret|preventDefault|width|call|events|checked|scrollLeft|exec|px|overflow|documentElement|grep|position|form|block|removeData|rl|timers|max|opera|mozilla|trim|tagName|Math|load|param|removeChild|disabled|insertBefore|async|encodeURIComponent|append|oldblock|val|childNodes|src|readyList|multiFilter|color|defaultView|stopPropagation|args|old|toString|is|last|first|eval|parseInt|self|domManip|prototype|getTime|curCSS|Date|top||ajax|ownerDocument|parseFloat|easing|has|queue|curAnim|custom|innerHTML|orig|currentStyle|visible|getElementById|isReady|error|static|bind|String|which|getComputedStyle|responseText|oWidth|oHeight|on|shift|json|child|RegExp|ol|lastModified|isXMLDoc|jsonp|jquery|previousSibling|dir|safari2|el|styleFloat|state|setInterval|radio|getElementsByTagName|tr|empty|html|getAttribute|pos|update|version|input|float|runtimeStyle|unshift|mouseover|getPropertyValue|GET|clearInterval|safariTimer|visibility|clean|__ie_init|absolute|handleHover|lastToggle|index|fromElement|relatedTarget|click|fix|evt|andSelf|removeEventListener|handler|cloneNode|addEventListener|triggered|nodeIndex|unique|Number|classFilter|prevObject|selectedIndex|after|submit|password|removeAttribute|file|expr|setTimeout|_|appendChild|ajaxSettings|client|active|win|sibling|deep|globalEval|boxModel|cssFloat|object|checkbox|parsererror|offsetLeft|wrapAll|dequeue|props|lastChild|swing|handleError|getResponseHeader|results|startTime|00|box|Modified|ifModified|offsetTop|evalScript|createElement|setRequestHeader|ctrlKey|callback|metaKey|contentType|ajaxSend|ajaxSuccess|ajaxError|ajaxStop|ajaxStart|serializeArray|init|notmodified|POST|loaded|appendTo|DOMContentLoaded|bindReady|mouseout|not|removeAttr|unbind|unload|Width|keyCode|charCode|onreadystatechange|clientX|pageX|srcElement|join|outerHTML|substr|zoom|parse|textarea|reset|image|odd|even|before|quickClass|quickID|prepend|quickChild|execScript|offset|scroll|processData|uuid|contents|continue|textContent|ajaxComplete|clone|setArray|webkit|nodeValue|fl|_default|100|linear|href|speed|eq|createTextNode|throw|replaceWith|splice|_toggle|xml|colgroup|304|200|alpha|Last|httpData|httpNotModified|httpSuccess|fieldset|beforeSend|getBoundingClientRect|XMLHttpRequest|ActiveXObject|col|br|abbr|pixelLeft|urlencoded|www|application|ajaxSetup|post|getJSON|getScript|elements|serialize|clientWidth|hasClass|scr|clientHeight|write|relative|keyup|keypress|keydown|change|mousemove|mouseup|mousedown|right|dblclick|resize|focus|blur|frames|instanceof|hover|offsetWidth|triggerHandler|ipt|defer|offsetHeight|border|padding|clientY|pageY|Left|Right|toElement|Bottom|Top|cancelBubble|returnValue|detachEvent|attachEvent|substring|line|weight|animated|header|font|enabled|innerText|contains|only|size|gt|lt|uFFFF|u0128|417|inner|Height|toggleClass|removeClass|addClass|replaceAll|noConflict|insertAfter|prependTo|wrap|contentWindow|contentDocument|http|iframe|children|siblings|prevAll|nextAll|wrapInner|prev|Boolean|next|parents|maxLength|maxlength|readOnly|readonly|class|htmlFor|CSS1Compat|compatMode|compatible|borderTopWidth|ie|ra|inline|it|rv|medium|borderWidth|userAgent|522|navigator|with|concat|1px|10000|array|ig|PI|NaN|400|reverse|fast|600|slow|Function|Object|setAttribute|changed|be|can|property|fadeTo|fadeOut|getAttributeNode|fadeIn|slideToggle|method|slideUp|slideDown|action|cssText|stop|responseXML|option|content|300|th|protocol|td|location|send|cap|abort|colg|cos|tfoot|thead|With|leg|Requested|opt|GMT|1970|Jan|01|Thu|area|Since|hr|If|Type|Content|meta|specified|open|link|XMLHTTP|Microsoft|img|onload|row|borderLeftWidth|head|attributes'.split('|'),0,{})) \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery-speakers_coaches_consultants.js b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery-speakers_coaches_consultants.js new file mode 100644 index 0000000..6cf741a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery-speakers_coaches_consultants.js @@ -0,0 +1,30 @@ +jQuery(function($) { + var themap = $('
').css({ + 'width': '90%', + 'height': '500px' + }).insertBefore('ul.people'); + + var mapstraction = new Mapstraction('themap','google'); + mapstraction.addControls({ + zoom: 'large', + map_type: true + }); + + mapstraction.setCenterAndZoom( + new LatLonPoint(30, -0.126236), + 2 // Zoom level appropriate for Brighton city centre + ); + + $('.vcard').each(function() { + var hcard = $(this); + + var latitude = hcard.find('.geo .latitude').text(); + var longitude = hcard.find('.geo .longitude').text(); + + var marker = new Marker(new LatLonPoint(latitude, longitude)); + marker.setInfoBubble( + '
' + hcard.html() + '
' + ); + mapstraction.addMarker(marker); + }); +}); \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.heartbeat.js b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.heartbeat.js new file mode 100755 index 0000000..0011793 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.heartbeat.js @@ -0,0 +1,9 @@ +$(document).ready(function() { + $('#tests-results').load('../views/heartbeat.php?tests-results'); + $('#commits').load('../views/heartbeat.php', '', function() { + $(this).find(".sparkline").each(function() { + sparklinequery($(this)); + }); + }); + $('#last-commits').load('../views/heartbeat.php?last-commits'); +}); diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.sparkline.js b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.sparkline.js new file mode 100755 index 0000000..28c55d7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/js/jquery.sparkline.js @@ -0,0 +1,76 @@ +/** + * Javascript Sparklines Library + * Based on a work by John Resig + * http://ejohn.org/projects/jspark/ + * + * This work is licensed under a Creative Commons Attribution 2.5 License + * More Info: http://creativecommons.org/licenses/by/2.5/ + * + * To use, place your data points within your HTML, like so: + * 10,8,20,5... + * + * in your CSS you might want to have the rule: + * .sparkline { display: none } + * so that non-compatible browsers don't see a huge pile of numbers. + * + */ + +function sparklinequery(o) { + var p = o.text().split(','); + o.empty(); + + var nw = "auto"; + var nh = "auto"; + + var f = 2; + var w = ( nw == "auto" || nw == 0 ? p.length * f : nw - 0 ); + var h = ( nh == "auto" || nh == 0 ? "1em" : nh ); + + var co = document.createElement("canvas"); + + if ( co.getContext ) { + o.css({ display: "inline" }); + } else { + return false; + } + + + co.style.height = h; + co.style.width = w; + co.width = w; + o.append( co ); + + var h = co.offsetHeight; + co.height = h; + + var min = 9999; + var max = -1; + + for ( var i = 0; i < p.length; i++ ) { + p[i] = p[i] - 0; + if ( p[i] < min ) min = p[i]; + if ( p[i] > max ) max = p[i]; + } + + if ( co.getContext ) { + var c = co.getContext("2d"); + c.strokeStyle = o.css("color"); + c.lineWidth = 1.0; + c.beginPath(); + + for ( var i = 0; i < p.length; i++ ) { + x = (w / p.length) * i; + if (max != min) { + y = h - (((p[i] - min) / (max - min)) * h) ; + } else { + y = 0; + } + y = 3 * i; + c.lineTo(x, y); + } + + c.stroke(); +alert(c); + o.css({ display:"inline" }); + } +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/simpletest.css b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/simpletest.css new file mode 100644 index 0000000..13fa388 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/simpletest.css @@ -0,0 +1,43 @@ +/* SimpleTest - Unit Testing for PHP */ +body { font-family : georgia, serif; } +img { border : 0; } +h1 { color : #009933; } +h3 { width : 100%; border-bottom : 1px solid #cccccc; } +blockquote { background: transparent url('images/quote.png') left top no-repeat; font-style : italic; padding-left : 40px; margin-left : 10px; } +td { vertical-align : top; } + +#logo { margin-bottom : 20px; } +#credits { margin-top : 40px; } +#actions { position : absolute; top : 20px; left : 40px; width : 335px; } +#actions div { width : 305px; } +#content { position : absolute; top : 20px; left : 400px; padding-bottom : 50px; width : 491px; } +#news { border : 2px solid #009933; padding : 20px; font-weight : bold; font-size : 18pt; width : 451px; } +#news a { color : #009933; } +#internal { background: url('images/simpletest-internal-middle.png') repeat-y; margin-top : 2em; width : 306px; } +#external { background: url('images/simpletest-external-middle.png') repeat-y; width : 306px; } +#internal > div , #external > div { padding : 0 0.5em 0 0.5em; } + +div.console { background-color: black; border: 4px ridge; border-color: gray; color : white; margin: 5px 40px 20px 20px; padding: 10px; } +div.demo { background-color: white; border: 4px ridge; border-color: gray; margin: 5px; margin-left: 20px; margin-right: 40px; padding: 10px; } +div.demo span.fail { color: red; } +div.demo span.pass { color: green; } +div.demo h1 { color: black; font-size: 12pt; font-weight: bold; text-align: left; } +pre { font-family: monospaced; border-left: 1px solid #999999; background-color: white; padding: 5px; margin-left: 5px; font-size : 10pt; } + +.screenshot { border : 1px solid #cccccc;} +.experimental { background-color : yellow; border : 4px dashed black; padding : 10px; } +.experimental pre { border-left : none; background-color : yellow; } +.bubble, .bubble h3 { font-size: 9pt; } +.people { margin : 0; list-style : none; padding : 0; } +.geo { color : #777777; } +.photo { margin-bottom : 2em; } +.photo span { display : block; } +.photo span.title { font-weight : bold; margin-top : 1em; } +.photo img { border : 1px solid #777777; padding : 1em; margin : 1em; } + +dd { font-size : 10.5pt; } +.done, .done span, .done + dd { color : #AAAAAA; text-decoration : line-through; } +.postponed, .postponed span, .postponed + dd { color : #AAAAAA; } + +dt div.fail { background-color : red; color : white; padding : 0.2em; } +dt div.pass { background-color : green; color : white; padding : 0.2em; } \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/heartbeat.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/heartbeat.php new file mode 100755 index 0000000..9b48f1c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/heartbeat.php @@ -0,0 +1,174 @@ +view($_SERVER['QUERY_STRING']); + +class SimpleHeartBeat { + public $log_directory; + public $tests_directory; + + function __construct($log_directory) { + $this->log_directory = $log_directory; + } + + function view($querystring) { + switch ($querystring) { + case "last-commits": + return $this->displayLastCommits(); + case "tests-results": + return $this->displayTestsResults(); + case "commits": + default: + return $this->displaySparkline("commits last week"); + } + } + + function displayTestsResults() { + foreach(new DirectoryIterator($this->log_directory) as $node) { + if (preg_match("/simpletest\..*\.log/", $node->getFilename())) { + $log = new SimpleHeartBeatLog($node); + if (!isset($html)) { + $html = "
"; + } + $html .= "
".$log->details()."
"; + $html .= "
".$log->info()."
"; + } + } + if (isset($html)) { + $html .= "
"; + } else { + $html = $this->dataUnavailable(); + } + + return $html; + } + + function displayLastCommits($number=5) { + $entries = array(); + $xml = simplexml_load_file($this->log_directory."/svn.xml"); + foreach ($xml->logentry as $logentry) { + $dt = $logentry->msg; + $dd = $logentry['revision']." - ".$logentry->author. " - ".$logentry->date; + $entries[] = array('dt' => $dt, 'dd' => $dd); + } + + if (count($entries) > 0) { + $html = "
"; + krsort($entries); + $i = 0; + foreach($entries as $entry) { + if ($i < $number) { + $i++; + $html .= "
".$entry['dt']."
"; + $html .= "
".$entry['dd']."
"; + } else { + break; + } + } + + $html .= "
"; + } else { + $html = $this->dataUnavailable(); + } + + return $html; + } + + function displaySparkline($name="commits last week") { + $method = $this->findMethod($name); + $data = $this->$method(); + + if (is_array($data)) { + $html = "
"; + $html .= ""; + $html .= join(",", $data); + $html .= ""; + $html .= " ".array_pop($data)." ".$name; + $html .= "
"; + } else { + $html = $this->dataUnavailable(); + } + + return $html; + } + + function dataUnavailable() { + return "
data unavailable
"; + } + function findMethod($name) { + switch ($name) { + default: + return "commitsPerWeek"; + } + } + + function commitsPerWeek() { + $data = array(); + $xml = simplexml_load_file($this->log_directory."/svn.xml"); + foreach ($xml->logentry as $logentry) { + $timestamp = strtotime($logentry->date); + $weekly = strtotime("last monday", $timestamp); + if (!isset($data[$weekly])) { + $data[$weekly] = 0; + } + $data[$weekly]++; + } + + $data = $this->normalizeData($data, "week"); + + return $data; + } + + function normalizeData($data, $period="week") { + $min = min(array_keys($data)); + $max = max(array_keys($data)); + + $normalized = array(); + $current = $min; + while ($current <= $max) { + $normalized[$current] = 0; + $current = strtotime("+1 ".$period, $current); + } + + foreach ($data as $timestamp => $value) { + $normalized[$timestamp] = $value; + } + + return $normalized; + } +} + +class SimpleHeartBeatLog { + public $node; + public $content = ""; + + function __construct($node) { + $this->node = $node; + $this->content = file_get_contents($this->node->getPathname()); + } + + function result() { + if (preg_match("/OK/", $this->content)) { + return "pass"; + } else { + return "fail"; + } + } + + function info() { + return nl2br($this->content); + } + + function details() { + $details = substr($this->node->getFilename(), 11); + $details = $this->result(). " with ".substr($details, 0, -4); + $details .= " - ".date("c", $this->node->getCTime()); + + return "
result()."\">".$details."
"; + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/photos_stream.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/photos_stream.php new file mode 100644 index 0000000..c85bcf5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/simpletest.org/views/photos_stream.php @@ -0,0 +1,37 @@ +showLastPhotos(); + +class SimpleFlickrStreamXMLElement extends SimpleXMLElement { + function showLastPhotos() { + $html = ""; + foreach ($this->entry as $entry) { + $html .= "
"; + $html .= "".$entry->title.""; + $html .= "".$this->extractFirstImage($entry).""; + $html .= "".$this->extractAuthor($entry).""; + $html .= "
"; + } + return $html; + } + + function extractAuthor($entry) { + return "author->uri."\">".$entry->author->name.""; + } + + function extractFirstImage($entry) { + $content = $entry->content; + $content = substr($content, strpos($content, "") + 3); + + return "link[0]['href']."\">".$image.""; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/about.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/about.xml new file mode 100644 index 0000000..294a197 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/about.xml @@ -0,0 +1,112 @@ + + + + About Last Craft + +
+

+ + At the moment this site is maintained by myself, + Marcus Baker + and I am an Object Oriented web developer + and father of two. + I am currently a freelancer working as a senior developer for + Wordtracker + and as a consultant to various smaller companies. + Wordtracker is an internet statistics company with a huge database + of search engine keyword popularity. + The company software development is eXtreme Programming based. +

+

+ My wife Aviva Racher is a + microbiologist and Mother of the same two. +

+
+
+

+ Read the interview + Who's really being protected? on the + O'Reilly network if you have an interest in software patents. +

+
+
+

+ Besides working for Wordtracker, I also act as an independent + consultant. + Usually in relation to bringing agile development practices into an + organisation. + Clients include Waterscape and Amnesty International. +

+

+ I did a quick site for a graphic designer and illustrator friend of mine, + Dylan Beck. + He has a very unique style. +

+

+ The Ambassadors of Om are a Jazz-Funk + fusion (?) band with an internet presence going back over five + years. Site includes samples, videos and links. The band is + managed by guitarist and lead singer Paul Grimes who is a friend of ours. +

+

+ + Mark Eichner is Aviva's uncle and run's the + + Leisure Pursuits + off-road driving school. Lots of wheels and mud! +

+
+
+ + + Last Craft people + Myself and friends and relations. + + + Issues that I care about. + + + Associated companies + and people. + + + + + + Extreme Tuesday + Club is an informal meeting in London to promote + Extreme programming. + + + PHPLondon + is a user group that meets the first thursday of every month. + + + Wordtracker + crunches internet search data for web marketing. + + + + + software development, + computer programmer, + php programming, + programming php, + software development company, + software development uk, + php tutorial, + bespoke software development uk, + corporate web development, + architecture, + freelancer, + php resources, + wordtracker, + web marketing, + serach engines, + web positioning, + internet marketing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/authentication_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/authentication_documentation.xml new file mode 100644 index 0000000..7fc01fc --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/authentication_documentation.xml @@ -0,0 +1,337 @@ + + + + SimpleTest documentation for testing log-in and authentication + + +

+ One of the trickiest, and yet most important, areas + of testing web sites is the security. + Testing these schemes is one of the core goals of + the SimpleTest web tester. +

+
+
+

+ If you fetch a page protected by basic authentication then + rather than receiving content, you will instead get a 401 + header. + We can illustrate this with this test... + + function test401Header() { + $this->get('http://www.lastcraft.com/protected/'); + $this->showHeaders(); + } +} +]]> + This allows us to see the challenge header... +

+

File test

+
+
1/1 test cases complete. + 0 passes, 0 fails and 0 exceptions.
+
+ We are trying to get away from visual inspection though, and so SimpleTest + allows to make automated assertions against the challenge. + Here is a thorough test of our header... +get('http://www.lastcraft.com/protected/'); + $this->assertAuthentication('Basic'); + $this->assertResponse(401); + $this->assertRealm('SimpleTest basic authentication'); + } +} +]]> + Any one of these tests would normally do on it's own depending + on the amount of detail you want to see. +

+

+ One theme that runs through SimpleTest is the ability to use + SimpleExpectation objects wherever a simple + match is not enough. + If you want only an approximate match to the realm for + example, you can do this... +get('http://www.lastcraft.com/protected/'); + $this->assertRealm(new PatternExpectation('/simpletest/i')); + } +} +]]> + This type of test, testing HTTP responses, is not typical. +

+

+ Most of the time we are not interested in testing the + authentication itself, but want to get past it to test + the pages underneath. + As soon as the challenge has been issued we can reply with + an authentication response... +get('http://www.lastcraft.com/protected/'); + $this->authenticate('Me', 'Secret'); + $this->assertTitle(...); + } +} +]]> + The username and password will now be sent with every + subsequent request to that directory and subdirectories. + You will have to authenticate again if you step outside + the authenticated directory, but SimpleTest is smart enough + to merge subdirectories into a common realm. +

+

+ If you want, you can shortcut this step further by encoding + the log in details straight into the URL... +get('http://Me:Secret@www.lastcraft.com/protected/'); + $this->assertTitle(...); + } +} +]]> + If your username or password has special characters, then you + will have to URL encode them or the request will not be parsed + correctly. + I'm afraid we leave this up to you. +

+

+ A problem with encoding the login details directly in the URL is + the authentication header will not be sent on subsequent requests. + If you navigate with relative URLs though, the authentication + information will be preserved along with the domain name. +

+

+ Normally though, you use the authenticate() call. + SimpleTest will then remember your login information on each request. +

+

+ Only testing with basic authentication is currently supported, and + this is only really secure in tandem with HTTPS connections. + This is usually good enough to protect test server from prying eyes, + however. + Digest authentication and NTLM authentication may be added + in the future if enough people request this feature. +

+
+
+

+ Basic authentication doesn't give enough control over the + user interface for web developers. + More likely this functionality will be coded directly into + the web architecture using cookies with complicated timeouts. + We need to be able to test this too. +

+

+ Starting with a simple log-in form... +


+    Username:
+    
+ Password: +
+ + +]]>
+ Which looks like... +

+

+

+ Username: +
+ Password: +
+ +
+

+

+ Let's suppose that in fetching this page a cookie has been + set with a session ID. + We are not going to fill the form in yet, just test that + we are tracking the user. + Here is the test... +get('http://www.my-site.com/login.php'); + $this->assertCookie('SID'); + } +} +]]> + All we are doing is confirming that the cookie is set. + As the value is likely to be rather cryptic it's not + really worth testing this with... +get('http://www.my-site.com/login.php'); + $this->assertCookie('SID', new PatternExpectation('/[a-f0-9]{32}/i')); + } +} +]]> + If you are using PHP to handle sessions for you then + this test is even more useless, as we are just testing PHP itself. +

+

+ The simplest test of logging in is to visually inspect the + next page to see if you are really logged in. + Just test the next page with WebTestCase::assertText(). +

+

+ The test is similar to any other form test, + but we might want to confirm that we still have the same + cookie after log-in as before we entered. + We wouldn't want to lose track of this after all. + Here is a possible test for this... +get('http://www.my-site.com/login.php'); + $session = $this->getCookie('SID'); + $this->setField('u', 'Me'); + $this->setField('p', 'Secret'); + $this->click('Log in'); + $this->assertText('Welcome Me'); + $this->assertCookie('SID', $session); + } +} +]]> + This confirms that the session identifier is maintained + afer log-in and we haven't accidently reset it. +

+

+ We could even attempt to hack our own system by setting + arbitrary cookies to gain access... +get('http://www.my-site.com/login.php'); + $this->setCookie('SID', 'Some other session'); + $this->get('http://www.my-site.com/restricted.php'); + $this->assertText('Access denied'); + } +} +]]> + Is your site protected from this attack? +

+
+
+

+ If you are testing an authentication system a critical piece + of behaviour is what happens when a user logs back in. + We would like to simulate closing and reopening a browser... +get('http://www.my-site.com/login.php'); + $this->setField('u', 'Me'); + $this->setField('p', 'Secret'); + $this->click('Log in'); + $this->assertText('Welcome Me'); + + $this->restart(); + $this->get('http://www.my-site.com/restricted.php'); + $this->assertText('Access denied'); + } +} +]]> + The WebTestCase::restart() method will + preserve cookies that have unexpired timeouts, but throw away + those that are temporary or expired. + You can optionally specify the time and date that the restart + happened. +

+

+ Expiring cookies can be a problem. + After all, if you have a cookie that expires after an hour, + you don't want to stall the test for an hour while waiting + for the cookie to pass it's timeout. +

+

+ To push the cookies over the hour limit you can age them + before you restart the session... +get('http://www.my-site.com/login.php'); + $this->setField('u', 'Me'); + $this->setField('p', 'Secret'); + $this->click('Log in'); + $this->assertText('Welcome Me'); + + $this->ageCookies(3600); + $this->restart(); + $this->get('http://www.my-site.com/restricted.php'); + $this->assertText('Access denied'); + } +} +]]> + After the restart it will appear that cookies are an + hour older, and any that pass their expiry will have + disappeared. +

+
+
+ + + Getting through Basic HTTP authentication + + + Testing cookie based authentication + + + Managing browser sessions and timeouts + + + + + SimpleTest project page on SourceForge. + + + SimpleTest download page on LastCraft. + + + The developer's API for SimpleTest + gives full detail on the classes and assertions available. + + + + + software development, + php programming for clients, + customer focused php, + software development tools, + acceptance testing framework, + free php scripts, + log in boxes, + unit testing authentication systems, + php resources, + HTMLUnit, + JWebUnit, + php testing, + unit test resource, + web testing, + HTTP authentication, + testing log in, + authentication testing, + security tests + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/books_website.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/books_website.xml new file mode 100644 index 0000000..0877eff --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/books_website.xml @@ -0,0 +1,73 @@ + + + + Books in and around SimpleTest + +
+

+ From time to time a book is recommanded on the mailing-list, you can find it here + with the original comments ! +

+

+ Domain-Driven Design: Tackling Complexity in the Heart of Software +

+
+ TDD is a lot about the mechanics of coding, but it says you are done + when there is no duplication. DDD considers the code in constant churn, + always renaming as the domain becomes clear and also feeding terms back + into the domain as the code evolves.
+
+ Anyways, it's a great book :) [source] +
+
+
+

+ Two of SimpleTest contributors have written books about PHP. Both have a lot + of examples with the SimpleTest Unit testing framework. +

+

+ PHP|Architect's Guide to PHP Design Patterns +
+ PHP|Architect's Guide to PHP Design Patterns
+ by Jason E. Sweat
+ (get it from : PHP|Architect | + Amazon ) +

+

+ The PHP Anthology: Object Oriented PHP Solutions +
+ The PHP Anthology: Object Oriented PHP Solutions
+ by Harry Fuecks
+ (get it from : SitePoint | + Amazon | + review on Slashdot ) +

+
+
+

+ One way to help the team of contributors is to buy books from this page through + Amazon (with the simpletest-21 tag). We all love reading stuff that's + both interesting and challenging. +

+
+
+ + + Latest recommandation + + + Books by contributors + + + Buying books + + + + + + + + + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/boundary_classes_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/boundary_classes_tutorial.xml new file mode 100644 index 0000000..eb2acbf --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/boundary_classes_tutorial.xml @@ -0,0 +1,405 @@ + + + + + PHP unit testing tutorial - Organising unit tests and "setup tests" + + + +

+ You are probably thinking that we have well and truly exhausted + the Log class by now and that there is + really nothing more to add. + Things are never that simple with object oriented programming, though. + You think you understand a problem and then something comes a long + that challenges your perspective and leads to an even deeper appreciation. + I thought I understood the logging class and that only the first page + of the tutorial would use it. + After that I would move on to something more complicated. + No one is more surprised than me that I still haven't got to + the bottom of it. + In fact I think I have only just figured out what a logger does. +

+
+
+

+ Supposing that we do not want to log to a file at all. + Perhaps we want to print to the screen, write the messages to a + socket or send them to the Unix(tm) syslog daemon for + dispatching across the network. + How do we incorporate this variation? +

+

+ Simplest is to subclass the Log + overriding the message() method + with new versions. + This will work in the short term, but there is actually something + subtle, but deeply wrong with this. + Suppose we do subclass and have loggers that write to files, + the screen and the network. + Three classes , but that is OK. + Now suppose that we want a new logging class that adds message + filtering by priority, letting only certain types of messages + through according to some configuration file. +

+

+ We are stuck. If we subclass again, we have to do it for all + three classes, giving us six classes. + The amount of duplication is horrible. +

+

+ So are you now wishing that PHP had multiple inheritence? + Well, here that would reduce the short term workload, but + complicate what should be a very simple class. + Multiple inheritance, even when supported, should be used + extremely carefully as all sorts of complicated entanglements + can result. + Treat it as a loaded gun. + In fact, our sudden need for it is telling us something else - perhaps + that we have gone wrong on the conceptual level. +

+

+ What does a logger do? + Does it send messages to a file? + Does it send messages to a network? + Does it send messages to a screen? + Nope. + It just sends messages (full stop). + The target of those messages can be chosen when setting + up the log, but after that the + logger should be left to combine and format the message + elements as that is its real job. + We restricted ourselves by assuming that target was a filename. +

+
+
+

+ The solution to this plight is a real classic. + First we encapsulate the variation in a class as this will + add a level of indirection. + Instead of passing in the file name as a string we + will pass the "thing that we will write to" + which we will call a Writer. + Back to the tests... + +require_once('../classes/writer.php'); +Mock::generate('Clock'); + +class TestOfLogging extends UnitTestCase { + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + + function testCreatingNewFile() { + $log = new Log(new FileWriter('../temp/test.log')); + $this->assertFalse(file_exists('../temp/test.log'), 'Created before message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + } + + function testAppendingToFile() { + $log = new Log(new FileWriter('../temp/test.log')); + $log->message('Test line 1'); + $this->assertWantedPattern( + '/Test line 1/', + $this->getFileLine('../temp/test.log', 0)); + $log->message('Test line 2'); + $this->assertWantedPattern( + '/Test line 2/', + $this->getFileLine('../temp/test.log', 1)); + } + + function testTimestamps() { + $clock = new MockClock($this); + $clock->setReturnValue('now', 'Timestamp'); + $log = new Log(new FileWriter('../temp/test.log')); + $log->message('Test line', $clock); + $this->assertWantedPattern( + '/Timestamp/', + $this->getFileLine('../temp/test.log', 0), + 'Found timestamp'); + } + + function getFileLine($filename, $index) { + $messages = file($filename); + return $messages[$index]; + } +} +?> +]]> + I am going to do this one step at a time so as not to get + confused. + I have replaced the file names with an imaginary + FileWriter class from + an imaginary file classes/writer.php. + This will cause the tests to crash as we have not written + the writer yet. + Should we do that now? +

+

+ We could, but we don't have to. + We do need to create the interface, though, or we won't be + able to mock it. + This makes classes/writer.php looks like... + +]]> + We need to modify the Log class + as well... + +require_once('../classes/writer.php'); + +class Log { + private $writer; + + function Log($writer) { + $this->writer = $writer; + } + + function message($message, $clock = false) { + if (! is_object($clock)) { + $clock = new Clock(); + } + $this->writer->write("[" . $clock->now() . "] $message"); + } +} +?> +]]> + There is not much that hasn't changed in our now even smaller + class. + The tests run, but fail at this point unless we add code to + the writer. + What do we do now? +

+

+ We could start writing tests and code the + FileWriter class alongside, but + while we were doing this our Log + tests would be failing and disturbing our focus. + In fact we do not have to. +

+

+ Part of our plan is to free the logging class from the file + system and there is a way to do this. + First we add a tests/writer_test.php so that + we have somewhere to place our test code from log_test.php + that we are going to shuffle around. + I won't yet add it to the all_tests.php file, + as it is the logging aspect we are tackling right now. +

+

+ Now I have done that (honest!) we remove any + tests from log_test.php that are not strictly logging + related and move them to writer_test.php for later. + We will also mock the writer so that it does not write + out to real files... + +Mock::generate('FileWriter'); + +class TestOfLogging extends UnitTestCase { + + function testWriting() { + $clock = new MockClock(); + $clock->setReturnValue('now', 'Timestamp'); + $writer = new MockFileWriter($this); + $writer->expectOnce('write', array('[Timestamp] Test line')); + $log = new Log(\$writer); + $log->message('Test line', $clock); + } +} +?> +]]> + Yes that really is the whole test case and it really is that short. + A lot has happened here... +

    +
  1. + The requirement to create the file only when needed has + moved to the FileWriter. +
  2. +
  3. + As we are dealing with mocks, no files are actually + created and so I moved the + setUp() and + tearDown() off into the + FileWriter tests. +
  4. +
  5. + The test now consists of sending a sample message and + testing the format. +
  6. +
+ Hang on a minute, where are the assertions? +

+

+ The mock objects do much more than simply behave like other + objects, they also run tests. + The expectOnce() + call told the mock to expect a single parameter of + the string "[Timestamp] Test line" when + the mock write() method is + called. + When that method is called the expected parameters are + compared with this and either a pass or a fail is sent + to the unit test as a result. +

+

+ The other expectation is that write() + will be called and called only once. + If the method is not called before the end of the test, + a failure is generated. + We can see all this in action by running the tests... +

+

All tests

+ Pass: log_test.php->Log class test->testwriting->Arguments for [write] were [String: [Timestamp] Test line]
+ Pass: log_test.php->Log class test->testwriting->Expected call count for [write] was [1], but got [1]
+ + Pass: clock_test.php->Clock class test->testclockadvance->Advancement
+ Pass: clock_test.php->Clock class test->testclocktellstime->Now is the right time
+
3/3 test cases complete. + 4 passes and 0 fails.
+
+

+
+
+

+ Something very nice has happened to the logger besides merely + getting smaller. +

+

+ The only things it depends on now are classes that we have written + ourselves, and + in the tests these are mocked and so there are no dependencies + on anything other than our own PHP code. + No writing to files or waiting for clocks to tick over. + This means that the log_test.php test case will + run as fast as the processor will carry it. + By contrast the FileWriter + and Clock classes are very + close to the system. + This makes them harder to test as real data must be moved + around and painstakingly confirmed, often by ad hoc tricks. +

+

+ Our last refactoring has helped a bit. + The hard to test classes on the boundary of the application + and the system are now smaller, as the I/O code has + been further separated from the domain logic. + They are direct mappings to PHP operations: + FileWriter::write() maps + to PHP fwrite() with the + file opened for appending and + Clock::now() maps to + PHP time(). + This makes debugging easier. + It also means that these classes will change less often. +

+

+ If they don't change a lot then there is no reason to + keep running the tests for them. + This means that tests for the boundary classes can be moved + off into there own test suite leaving the other unit tests + to run at full speed. + In fact this is what I tend to do and the test cases + in SimpleTest itself are + divided this way. +

+

+ That may not sound like much with one unit test and two + boundary tests, but typical applications can have + twenty boundary classes and two hundred application + classes. + To keep the unit tests running at full speed you will want + to keep them separate. +

+

+ Another benefit of this separation is that you are left + with the smaller test suite for all your dependencies. + Suppose you want to set up a server for your application + and you want to make sure that all underlying components, + directories and configuration are correct. + You no longer need to run the entire test suite to find out, + just run the tests for your boundary classes. + For this reason, this test suite is often called the + "setup tests". + Hand them to your system administrator, and they can set up + your server for you. +

+

+ Besides, separating off decisions of which system components + to use is good development. + Being able to change the underlying dependencies easily is a + good thing. + Perhaps all this mocking is + improving our design? +

+
+
+ + + Handling variation in our logger. + + + Abstracting further with a mock Writer class. + + + Separating outsetup tests cleans things up. + + + + + This tutorial follows the Mock objects introduction. + + + Next is test driven design. + + + You will need the SimpleTest testing framework + to try these examples. + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + organizing unit tests, + testing tips, + development tricks, + software architecture for testing, + php example code, + mock objects, + junit port, + test case examples, + php testing, + unit test tool, + php test suite + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/browser_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/browser_documentation.xml new file mode 100644 index 0000000..fb1ba68 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/browser_documentation.xml @@ -0,0 +1,281 @@ + + + + SimpleTest documentation for the scriptable web browser component + + +

+ SimpleTest's web browser component can be used not just + outside of the WebTestCase class, but also + independently of the SimpleTest framework itself. +

+
+
+

+ You can use the web browser in PHP scripts to confirm + services are up and running, or to extract information + from them at a regular basis. + For example, here is a small script to extract the current number of + open PHP 5 bugs from the PHP web site... +get('http://php.net/'); +$browser->click('reporting bugs'); +$browser->click('statistics'); +$page = $browser->click('PHP 5 bugs only'); +preg_match('/status=Open.*?by=Any.*?(\d+)<\/a>/', $page, $matches); +print $matches[1]; +?> +]]> + There are simpler methods to do this particular example in PHP + of course. + For example you can just use the PHP file() + command against what here is a pretty fixed page. + However, using the web browser for scripts allows authentication, + correct handling of cookies, automatic loading of frames, redirects, + form submission and the ability to examine the page headers. +

+

+ Methods such as periodic scraping are fragile against a site that is constantly + evolving and you would want a more direct way of accessing + data in a permanent set up, but for simple tasks this can provide + a very rapid solution. +

+

+ All of the navigation methods used in the + WebTestCase + are present in the SimpleBrowser class, but + the assertions are replaced with simpler accessors. + Here is a full list of the page navigation methods... + + + + + + + + + + + + + + + + + + + + + + +
addHeader($header)Adds a header to every fetch
useProxy($proxy, $username, $password)Use this proxy from now on
head($url, $parameters)Perform a HEAD request
get($url, $parameters)Fetch a page with GET
post($url, $parameters)Fetch a page with POST
click($label)Clicks visible link or button text
clickLink($label)Follows a link by label
clickLinkById($id)Follows a link by attribute
getUrl()Current URL of page or frame
getTitle()Page title
getContent()Raw page or frame
getContentAsText()HTML removed except for alt text
retry()Repeat the last request
back()Use the browser back button
forward()Use the browser forward button
authenticate($username, $password)Retry page or frame after a 401 response
restart($date)Restarts the browser for a new session
ageCookies($interval)Ages the cookies by the specified time
setCookie($name, $value)Sets an additional cookie
getCookieValue($host, $path, $name)Reads the most specific cookie
getCurrentCookieValue($name)Reads cookie for the current context
+ The methods SimpleBrowser::useProxy() and + SimpleBrowser::addHeader() are special. + Once called they continue to apply to all subsequent fetches. +

+

+ Navigating forms is similar to the + WebTestCase form navigation... + + + + + + + + + + + + + + +
setField($label, $value)Sets all form fields with that label or name
setFieldByName($name, $value)Sets all form fields with that name
setFieldById($id, $value)Sets all form fields with that id
getField($label)Accessor for a form element value by label tag and then name
getFieldByName($name)Accessor for a form element value using name attribute
getFieldById($id)Accessor for a form element value
clickSubmit($label)Submits form by button label
clickSubmitByName($name)Submits form by button attribute
clickSubmitById($id)Submits form by button attribute
clickImage($label, $x, $y)Clicks an input tag of type image by title or alt text
clickImageByName($name, $x, $y)Clicks an input tag of type image by name
clickImageById($id, $x, $y)Clicks an input tag of type image by ID attribute
submitFormById($id)Submits by the form tag attribute
+ At the moment there aren't many methods to list available links and fields. + + + + + + + +
isClickable($label)Test to see if a click target exists by label or name
isSubmit($label)Test for the existence of a button with that label or name
isImage($label)Test for the existence of an image button with that label or name
getLink($label)Finds a URL from it's label
getLinkById($label)Finds a URL from it's ID attribute
getUrls()Lists available links in the current page
+ This will be expanded in later versions of SimpleTest. +

+

+ Frames are a rather esoteric feature these days, but SimpleTest has + retained support for them. +

+

+ Within a page, individual frames can be selected. + If no selection is made then all the frames are merged together + in one large conceptual page. + The content of the current page will be a concatenation of all of the + frames in the order that they were specified in the "frameset" + tags. + + + + + + +
getFrames()A dump of the current frame structure
getFrameFocus()Current frame label or index
setFrameFocusByIndex($choice)Select a frame numbered from 1
setFrameFocus($name)Select frame by label
clearFrameFocus()Treat all the frames as a single page
+ When focused on a single frame, the content will come from + that frame only. + This includes links to click and forms to submit. +

+
+
+

+ All of this functionality is great when we actually manage to fetch pages, + but that doesn't always happen. + To help figure out what went wrong, the browser has some methods to + aid in debugging... + + + + + + + + + + + + + + + + + +
setConnectionTimeout($timeout)Close the socket on overrun
getUrl()Url of most recent page fetched
getRequest()Raw request header of page or frame
getHeaders()Raw response header of page or frame
getTransportError()Any socket level errors in the last fetch
getResponseCode()HTTP response of page or frame
getMimeType()Mime type of page or frame
getAuthentication()Authentication type in 401 challenge header
getRealm()Authentication realm in 401 challenge header
getBaseUrl()Base url only of most recent page fetched
setMaximumRedirects($max)Number of redirects before page is loaded anyway
setMaximumNestedFrames($max)Protection against recursive framesets
ignoreFrames()Disables frames support
useFrames()Enables frames support
ignoreCookies()Disables sending and receiving of cookies
useCookies()Enables cookie support
+ The methods SimpleBrowser::setConnectionTimeout() + SimpleBrowser::setMaximumRedirects(), + SimpleBrowser::setMaximumNestedFrames(), + SimpleBrowser::ignoreFrames(), + SimpleBrowser::useFrames(), + SimpleBrowser::ignoreCookies() and + SimpleBrowser::useCokies() continue to apply + to every subsequent request. + The other methods are frames aware. + This means that if you have an individual frame that is not + loading, navigate to it using SimpleBrowser::setFrameFocus() + and you can then use SimpleBrowser::getRequest(), etc to + see what happened. +

+
+
+

+ Anything that could be done in a + WebTestCase can + now be done in a UnitTestCase. + This means that we could freely mix domain object testing with the + web interface... +class TestOfRegistration extends UnitTestCase { + function testNewUserAddedToAuthenticator() { + $browser = new SimpleBrowser(); + $browser->get('http://my-site.com/register.php'); + $browser->setField('email', 'me@here'); + $browser->setField('password', 'Secret'); + $browser->click('Register'); + + $authenticator = new Authenticator(); + $member = $authenticator->findByEmail('me@here'); + $this->assertEqual($member->getPassword(), 'Secret'); + } +} +]]> + While this may be a useful temporary expediency, I am not a fan + of this type of testing. + The testing has cut across application layers, make it twice as + likely it will need refactoring when the code changes. +

+

+ A more useful case of where using the browser directly can be helpful + is where the WebTestCase cannot cope. + An example is where two browsers are needed at the same time. +

+

+ For example, say we want to disallow multiple simultaneous + usage of a site with the same username. + This test case will do the job... + + $first_attempt = new SimpleBrowser(); + $first_attempt->get('http://my-site.com/login.php'); + $first_attempt->setField('name', 'Me'); + $first_attempt->setField('password', 'Secret'); + $first_attempt->click('Enter'); + $this->assertEqual($first_attempt->getTitle(), 'Welcome'); + + $second_attempt = new SimpleBrowser(); + $second_attempt->get('http://my-site.com/login.php'); + $second_attempt->setField('name', 'Me'); + $second_attempt->setField('password', 'Secret'); + $second_attempt->click('Enter'); + $this->assertEqual($second_attempt->getTitle(), 'Access Denied'); + } +} +]]> + You can also use the SimpleBrowser class + directly when you want to write test cases using a different + test tool than SimpleTest, such as PHPUnit. +

+
+
+ + + Using the bundled web browser in scripts + + + Debugging failed pages + + + Complex tests with multiple web browsers + + + + + SimpleTest project page on SourceForge. + + + SimpleTest download page on LastCraft. + + + The developer's API for SimpleTest + gives full detail on the classes and assertions available. + + + + + user agent, + web browser php, + fetching pages, + spider scripts, + software development, + php programming for clients, + customer focused php, + software development tools, + acceptance testing framework, + free php scripts, + log in boxes, + unit testing authentication systems, + php resources, + HTMLUnit, + JWebUnit, + php testing, + unit test resource, + web testing, + HTTP authentication, + testing log in, + authentication testing, + security tests + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/changelog.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/changelog.xml new file mode 100755 index 0000000..ab3a6fd --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/changelog.xml @@ -0,0 +1,188 @@ + + + + SimpleTest's Changelog + +
+ + + Whitespace clean up + + + Some in line documentation fixes + + + Adding the JUnitReporter as an extension to SimpleTest (work by Patrice Neff) + + + New support page for Screencasts + + + + + Synchronizing the french translation. + + + Unit tests working for PHP 5.3 + + + Fix segfault with Zend Optimizer v3.2.2 (probably) + + + Adding some tags to help synchronise the docs + + + Add support for E_DEPRECATED + + + SimpleFileLoader::load: fix for $test_file already included, by daniel hahler - blueyed + + + New tests for UTF8 inside the browser. + + + "Update FormTesting tutorial page for hidden fields" submitted by David Heath - dgheath + + + Moving around the extensions : /ui is now deprecated, /extensions is holding all extensions, + /test/extensions is holding all extensions' test suites + + + Fixing one of the incompatible interface errors + + + Let choose which field of the same name to set + + + Clearing fatal error when throwing in a tearDown + + + Avoid a fatal error in assertLink + (when the link with a label does not exists in a page) submitted by German Rumm - german.rumm AT gmail.com + + + CssSelector chokes on single-quotes + + + clickImageByID not working : just updating the documentation + + + html special chars in links + + + decodeHtml does not decode some entities + (based on patch provided by Quandary - ai2097) + + + Radio buttons not working when set as integer + + + Missing return value + + + Inner links inside documentation for "simpletest.org" now work with *.html + + + Hostname extracted incorrectly from URIs containing @ sign + + + assertWantedText matches javascript source code + + + SimpleUrl doesn't appear to handle path after filename + + + remove call-time reference - its declared in the constructor, so that's enough + + + Adding error throwing to mocks + + + Added PHP4 patches for new mock code + + + Added filter that rewrites paths to included files in tests... + now just need to clean up all the hardcoded path references + in the existing tests and we should be able to make a start on building an extension layout + that's compatible with PEAR installer *and* manual tar/zip extraction + + + Add in default wrap to catch all 'verify' methods and wrap them in assertTrue + + + Recursive forms fails + + + SimpleFileLoader::selectRunnableTests(..) not only marks abstract classes as ignored + but filters them as well + + + renaming SimpleReflection::_isAbstractMethodInParent() into _isAbstractMethodInParents() + and making it check upwards if method was declared somewhere abstract not just in the immediate parent, + this allows to avoid ugly 'must be compatible' error in PHP5 + + + switch to Subversion (SVN) + + + + + autorun + + + browser base tag support + + + + + expectException() + + + proper skip facility + + + greater formatting control in the reporters + + + various mock object compatibility fixes + + +
+
+ + + Changelog for version 1.0.1 + + + + + SimpleTest project page on SourceForge. + + + The developer's API for SimpleTest + gives full detail on the classes and assertions available. + + + + + software development, + php programming for clients, + customer focused php, + software development tools, + acceptance testing framework, + free php scripts, + log in boxes, + unit testing authentication systems, + php resources, + HTMLUnit, + JWebUnit, + php testing, + unit test resource, + web testing, + HTTP authentication, + testing log in, + authentication testing, + security tests + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/coding_standards.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/coding_standards.xml new file mode 100644 index 0000000..f08b774 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/coding_standards.xml @@ -0,0 +1,135 @@ + + + + Coding Standards within SimpleTest + +
+

+ Here's the list we try to follow : +

    +
  1. + Short method bodies, hopefully five lines or less. +
  2. +
  3. + No final methods. + People hack their test tools in wierd and wonderful ways. +
  4. +
  5. + No type hinting. + So much of SimpeTest is unit tested, that type hints don't + currently pay their way. +
  6. +
  7. + All object variables are private. + Those currently in the code base that aren't, should be. + Exceptions are fluent interfaces. +
  8. +
  9. + ClassLikeThis, methodLikeThis(), $variables_like_this. +
  10. +
  11. + No abbreviations in names, + so $parameter rather than $param. + Acronyms are allowed if they are industry standard. + We tend to camel case them, e.g. parseXml(). +
  12. +
  13. + We prefer "get"/"set" prefix for accessors, + e.g. getMyAttribute(). + The exception is for fluent interfaces. + This preference is mainly historical though, and could be dropped. + Ruby coding standards are superceding Java ones these days, and + "get" isn't used in that environment. +
  14. +
  15. + Accessors even when a subclass calls a superclass. +
  16. +
  17. + Don't be afraid of long class and method names. + The exception is the use of $i as a loop variable. + A lot of people viewing the code are casual passers by and won't know + any secret conventions. +
  18. +
  19. + "Simple" as a class name prefix + unless it really pollutes the visible domain language. + No other namespace prefixing unless there is known library + clash in the wild. +
  20. +
  21. + Eric Evans domain driven design style + rather than pure XP/TDD. That is, slight over design + in order to make concepts clear. +
  22. +
+

+

+ Obviously these reflect Marcus Bakers' average coding style + over several projects and programming languages. +

+

+ Is should also be obvious that + the code is riddled with exceptions to these rules :). +

+
+
+

+ Please no dangling brace style. + No blank lines in methods. + So not... + + It wastes vertical space and is a hangover from long declarations in C++. + Rather this... + + White space to me should separate something, + such as a method or class. + If you feel the need to add space within a method body, just break + the code up into separate methods. + The exception is test code, which can contain a lot of mock set up. + It's still discouraged though. +

+

+ By popular demand, all functions and methods are docblocked. + Private variables are not (the extra clutter is not worth it). + The only docblock attributes we require are @return + and @param as some IDE's use them. + Please take the time to write a human friendly comment. + Imagine you are chatting to a fellow SimpleTest user and they + ask the most obvious question about that variable. +

+
+
+ + + Coding standards + + + And other Code formatting stuff. + + + + + + + + + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/display_subclass_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/display_subclass_tutorial.xml new file mode 100644 index 0000000..0e5243b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/display_subclass_tutorial.xml @@ -0,0 +1,267 @@ + + + + PHP unit testing tutorial - Subclassing the test display + + +

+ SimpleTest ships with the simplest possible interface by default. + Mostly you just want to know if your test passed, or your test failed. + If it failed, you want the reason. + Nothing more. +

+

+ Sometimes you want a more sophisticated output for stakeholders + and for acceptance testing. + If a minimal display is not enough, here + is how to roll your own. +

+
+
+

+ Do you really need to see the passes? + Oh all right then, here's how. +

+

+ We have to subclass the attached display, which in our case + is currently HtmlReporter. + The HtmlReporter class is in + the file simpletest/reporter.php and currently has + the following interface... + + Here is what the relevant methods mean. + You can see the + whole list here + if you are interested. +

    +
  • + __construct()
    + is the constructor. + Note that the unit test sets up the link to the display + rather than the other way around. + The display is a passive receiver of test events. + This allows easy adaption of the display for other test + systems beside unit tests, such as monitoring servers. + It also means that the unit test can write to more than + one display at a time. +
  • +
  • + void paintFail(string $message)
    + paints a failure. + See below. +
  • +
  • + void paintPass(string $message)
    + by default does nothing. + This is the method we will modify. +
  • +
  • + string getCss()
    + returns the CSS styles as a string for the page header + method. + Additional styles have to be appended here. +
  • +
  • + array getTestList()
    + is a convenience method for subclasses. + Lists the current nesting of the tests as a list + of test names. + The first, most deeply nested test, is first in the + list and the current test method will be last. +
  • +
+

+

+ To show the passes we just need the + paintPass() method to behave + just like paintFail(). + Of course we won't modify the original, we'll subclass. +

+
+
+

+ Firstly we'll create a tests/show_passes.php file + in our logging project and then place in it this empty class... + +]]> + A quick peruse of the + SimpleTest code base + shows the paintFail() implementation + at the time of writing to look like this... +Fail: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("->", $breadcrumb); + print "->$message
\n"; +} +]]>
+ Essentially it chains to the parent's version, which we + have to do also to preserve house keeping, and then + prints a breadcrumbs trail calculated from the current test + list. + It drops the top level tests name, though. + As it is the same on every test that would be a little bit too + much information. + Transposing this to our new class... + + function paintPass($message) { + parent::paintPass($message); + print "Pass: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("->", $breadcrumb); + print "->$message
\n"; + } +} +]]>
+ So far so good. + Now to make use of our new class we have to modify our + tests/all_tests.php file. + +require_once('show_passes.php'); +require_once('simpletest/simpletest.php'); +SimpleTest::prefer('ShowPasses'); +require_once('simpletest/autorun.php'); + +class AllTests { + function __construct() { + parent::__construct('All tests'); + $this->addTestFile('log_test.php'); + $this->addTestFile('clock_test.php'); + } +} +?> +]]> + We can run this to see the results of our handywork... +

+

All tests

+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 1/] in [Test line 1]
+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 2/] in [Test line 2]
+ Pass: log_test.php->Log class test->testcreatingnewfile->Created before message
+ Pass: log_test.php->Log class test->testcreatingnewfile->File created
+ Pass: clock_test.php->Clock class test->testclockadvance->Advancement
+ Pass: clock_test.php->Clock class test->testclocktellstime->Now is the right time
+
3/3 test cases complete. + 6 passes and 0 fails.
+
+ Nice, but no gold star. + We have lost a little formatting here. + The display does not have a CSS style for + span.pass, but we can add this + easily by overriding one more method... +Pass: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("->", $breadcrumb); + print "->$message
\n"; + } + + protected function getCss() { + return parent::getCss() . ' .pass { color: green; }'; + } +} +]]>
+ If you are adding the code as you go, you will see the style + appended when you do view source on the test results page in your browser. + To the eye the display itself should now look like this... +
+

All tests

+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 1/] in [Test line 1]
+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 2/] in [Test line 2]
+ Pass: log_test.php->Log class test->testcreatingnewfile->Created before message
+ Pass: log_test.php->Log class test->testcreatingnewfile->File created
+ Pass: clock_test.php->Clock class test->testclockadvance->Advancement
+ Pass: clock_test.php->Clock class test->testclocktellstime->Now is the right time
+
3/3 test cases complete. + 6 passes and 0 fails.
+
+ Some people definitely prefer to see the passes being added + as they are working on code; the feeling that you are getting + work done is nice after all. + Once you have to scroll up and down the page to find failures + though, you soon come to realise its dark side. +

+

+ Try it both ways and see which you prefer. + We'll leave it in for a bit anyhow when looking at the + mock objects coming up. + This is the first test tool that generates additional tests + and it will be useful to see what is happening behind the scenes. +

+
+
+ + + How to Change the display to show test passes. + + + Subclassing the HtmlReporter class. + + + + + The previous tutorial section was + subclassing the test case. + + + This section is very specific to + SimpleTest. + If you use another tool you will want to skip this. + + + + + software development test first, + php general programming advice, + programming php, + software development tools, + php tutorial, + free php sample code, + architecture, + sample test cases, + php simple test framework, + php resources, + php test case examples, + phpunit, + simpletest, + unit test, + php testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/download_website.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/download_website.xml new file mode 100644 index 0000000..542c057 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/download_website.xml @@ -0,0 +1,106 @@ + + + + Downloading SimpleTest + +
+

+ The current release is : + + SimpleTest v1.0.1. +

+

+ You can download this version from + + SourceForget.net + and your local mirror. You may also want to look at + the current changelog. +

+ +
+
+

+ If eclipse is your IDE / editor of choice, you might consider + the + Eclipse plugin. +

+

+ For automatic "find and install", the URL is : +

http://simpletest.org/eclipse/
+

+
+
+

+ SimpleTest has been packaged by the community to different flavours. +

+ +

+ Note : careful, some versions are not always up-to-date. +

+
+
+

+ The source code is hosted on Sourceforge as well : you can browse the + SVN repository + there. +

+
+
+ +
+
+ + + Current release + + + Eclipse release + + + Packages + + + Source + + + Older stable releases + + + + + + + + + SimpleTest, + download, + source code, + stable release, + eclipse release, + eclipse plugin, + debian package, + drupal module, + pear channel, + pearified package + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/expectation_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/expectation_documentation.xml new file mode 100644 index 0000000..74a0f02 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/expectation_documentation.xml @@ -0,0 +1,383 @@ + + + + + Extending the SimpleTest unit tester with additional expectation classes + + +
+

+ The default behaviour of the + mock objects + in + SimpleTest + is either an identical match on the argument or to allow any argument at all. + For almost all tests this is sufficient. + Sometimes, though, you want to weaken a test case. +

+

+ One place where a test can be too tightly coupled is with + text matching. + Suppose we have a component that outputs a helpful error + message when something goes wrong. + You want to test that the correct error was sent, but the actual + text may be rather long. + If you test for the text exactly, then every time the exact wording + of the message changes, you will have to go back and edit the test suite. +

+

+ For example, suppose we have a news service that has failed + to connect to its remote source. +class NewsService { + ... + function publish($writer) { + if (! $this->isConnected()) { + $writer->write('Cannot connect to news service "' . + $this->_name . '" at this time. ' . + 'Please try again later.'); + } + ... + } +} +]]> + Here it is sending its content to a + Writer class. + We could test this behaviour with a + MockWriter like so... + + $writer = new MockWriter(); + $writer->expectOnce('write', array( + 'Cannot connect to news service ' . + '"BBC News" at this time. ' . + 'Please try again later.')); + + $service = new NewsService('BBC News'); + $service->publish($writer); + } +} +]]> + This is a good example of a brittle test. + If we decide to add additional instructions, such as + suggesting an alternative news source, we will break + our tests even though no underlying functionality + has been altered. +

+

+ To get around this, we would like to do a regular expression + test rather than an exact match. + We can actually do this with... + + $writer->expectOnce( + 'write', + array(new PatternExpectation('/cannot connect/i'))); + + $service = new NewsService('BBC News'); + $service->publish($writer); + } +} +]]> + Instead of passing in the expected parameter to the + MockWriter we pass an + expectation class called + PatternExpectation. + The mock object is smart enough to recognise this as special + and to treat it differently. + Rather than simply comparing the incoming argument to this + object, it uses the expectation object itself to + perform the test. +

+

+ The PatternExpectation takes + the regular expression to match in its constructor. + Whenever a comparison is made by the MockWriter + against this expectation class, it will do a + preg_match() with this pattern. + With our test case above, as long as "cannot connect" + appears in the text of the string, the mock will issue a pass + to the unit tester. + The rest of the text does not matter. +

+

+ The possible expectation classes are... + + + + + + + + + + + + + + + +
AnythingExpectationWill always match
EqualExpectationAn equality, rather than the stronger identity comparison
NotEqualExpectationAn inequality comparison
IndenticalExpectationThe default mock object check which must match exactly
NotIndenticalExpectationInverts the mock object logic
WithinMarginExpectationCompares a value to within a margin
OutsideMarginExpectationChecks that a value is out side the margin
PatternExpectationUses a Perl Regex to match a string
NoPatternExpectationPasses only if failing a Perl Regex
IsAExpectationChecks the type or class name only
NotAExpectationOpposite of the IsAExpectation
MethodExistsExpectationChecks a method is available on an object
TrueExpectationAccepts any PHP variable that evaluates to true
FalseExpectationAccepts any PHP variable that evaluates to false
+ Most take the expected value in the constructor. + The exceptions are the pattern matchers, which take a regular expression, + and the IsAExpectation and NotAExpectation which takes a type + or class name as a string. +

+

+ Some examples... +

+

+expectOnce('method', array(new IdenticalExpectation(14))); +]]> + This is the same as $mock->expectOnce('method', array(14)). +expectOnce('method', array(new EqualExpectation(14))); +]]> + This is different from the previous version in that the string + "14" as a parameter will also pass. + Sometimes the additional type checks of SimpleTest are too restrictive. +expectOnce('method', array(new AnythingExpectation(14))); +]]> + This is the same as $mock->expectOnce('method', array('*')). +expectOnce('method', array(new IdenticalExpectation('*'))); +]]> + This is handy if you want to assert a literal "*". + + This matches on anything other than integer 14. + Even the string "14" would pass. + + This will accept any value from 13.999 to 14.001 inclusive. +

+
+
+

+ The expectation classes can be used not just for sending assertions + from mock objects, but also for selecting behaviour for the + mock objects. + Anywhere a list of arguments is given, a list of expectation objects + can be inserted instead. +

+

+ Suppose we want a mock authorisation server to simulate a successful login, + but only if it receives a valid session object. + We can do this as follows... + +$authorisation = new MockAuthorisation(); +$authorisation->setReturnValue( + 'isAllowed', + true, + array(new IsAExpectation('Session', 'Must be a session'))); +$authorisation->setReturnValue('isAllowed', false); +]]> + We have set the default mock behaviour to return false when + isAllowed is called. + When we call the method with a single parameter that + is a Session object, it will return true. + We have also added a second parameter as a message. + This will be displayed as part of the mock object + failure message if this expectation is the cause of + a failure. +

+

+ This kind of sophistication is rarely useful, but is included for + completeness. +

+
+
+

+ The expectation classes have a very simple structure. + So simple that it is easy to create your own versions for + commonly used test logic. +

+

+ As an example here is the creation of a class to test for + valid IP addresses. + In order to work correctly with the stubs and mocks the new + expectation class should extend + SimpleExpectation or forther extend a subclass... +class ValidIp extends SimpleExpectation { + + function test($ip) { + return (ip2long($ip) != -1); + } + + function testMessage($ip) { + return "Address [$ip] should be a valid IP address"; + } +} +]]> + There are only two methods to implement. + The test() method should + evaluate to true if the expectation is to pass, and + false otherwise. + The testMessage() method + should simply return some helpful text explaining the test + that was carried out. +

+

+ This class can now be used in place of the earlier expectation + classes. +

+

+ Here is a more typical example, matching part of a hash... +class JustField extends EqualExpectation { + private $key; + + function __construct($key, $expected) { + parent::__construct($expected); + $this->key = $key; + } + + function test($compare) { + if (! isset($compare[$this->key])) { + return false; + } + return parent::test($compare[$this->key]); + } + + function testMessage($compare) { + if (! isset($compare[$this->key])) { + return 'Key [' . $this->key . '] does not exist'; + } + return 'Key [' . $this->key . '] -> ' . + parent::testMessage($compare[$this->key]); + } +} +]]> + We tend to seperate message clauses with + " ]]>". + This allows derivative tools to reformat the output. +

+

+ Suppose some authenticator is expecting to be given + a database row corresponding to the user, and we + only need to confirm the username is correct. + We can assert just their username with... +expectOnce('authenticate', + array(new JustKey('username', 'marcus'))); +]]> +

+
+
+

+ The SimpleTest unit testing framework + also uses the expectation classes internally for the + UnitTestCase class. + We can also take advantage of these mechanisms to reuse our + homebrew expectation classes within the test suites directly. +

+

+ The most crude way of doing this is to use the generic + SimpleTest::assert() method to + test against it directly... +class TestOfNetworking extends UnitTestCase { + ... + function testGetValidIp() { + $server = &new Server(); + $this->assert( + new ValidIp(), + $server->getIp(), + 'Server IP address->%s'); + } +} +]]> + assert() will test any expectation class directly. +

+

+ This is a little untidy compared with our usual + assert...() syntax. +

+

+ For such a simple case we would normally create a + separate assertion method on our test case rather + than bother using the expectation class. + If we pretend that our expectation is a little more + complicated for a moment, so that we want to reuse it, + we get... + + function assertValidIp($ip, $message = '%s') { + $this->assert(new ValidIp(), $ip, $message); + } + + function testGetValidIp() { + $server = &new Server(); + $this->assertValidIp( + $server->getIp(), + 'Server IP address->%s'); + } +} +]]> + It is rare to need the expectations for more than pattern + matching, but these facilities do allow testers to build + some sort of domain language for testing their application. + Also, complex expectation classes could make the tests + harder to read and debug. + In effect extending the test framework to create their own tool set. +

+
+
+ + + Using expectations for + more precise testing with mock objects + + + Changing mock object behaviour with expectations + + + Extending the expectations + + + Underneath SimpleTest uses expectation classes + + + + + SimpleTest project page on SourceForge. + + + SimpleTest download page on LastCraft. + + + The expectations mimic the constraints in JMock. + + + Full API for SimpleTest + from the PHPDoc. + + + + + mock objects, + test driven development, + inheritance of expectations, + mock object constraints, + advanced PHP unit testing, + test first, + test framework architecture + expectations in simpletest + test cases + server stubs + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_dom_tester.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_dom_tester.xml new file mode 100644 index 0000000..fda46a0 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_dom_tester.xml @@ -0,0 +1,231 @@ + + + + [experimental] Testing elements by CSS selector + + +
+ Careful : this documentation refers to un-released code. It's only available in SVN. +
+

+ Before SimpleTest2 gets a new browser (PHP5 only and DOM based), a new + extension made its way to the SimpleTest trunk. +

+

+ Note : it's already PHP5 only. +

+
+
+

+ 1998 seems a long time ago now : it's the year + the the Web Standards Project (WaSP) + started fighting for standards. +

+

+ Nearly ten years later, every web developper is now familiar with CSS : + id & class are the new tools of the trade. + The tricks you've learned while styling, you can re-use them when testing your web site. +

+

+ I was about to start with the Flickr home page + but then again, this is what the HTML source looks like : + +

+
+ + + + {% endspaceless %} {% endblock form_row %} -{% block form_errors %} -{% spaceless %} - {% if not compound %} - {{ parent() }} - {% else %} - {% if errors|length > 0 %} - - - - {% endif %} - {% endif %} -{% endspaceless %} -{% endblock form_errors %} - {% block hidden_row %} {% spaceless %} @@ -45,6 +27,13 @@ {% block form_widget_compound %} {% spaceless %}
+[...] +]]> + Who said too many tables ? So I picked something else... + the SimpleTest home page ! + +
+
+ +
+
+ +[...] +]]> +

+ +
+

+ As usual we start with the necessary require_once + +]]> + The DomTestCase extends the WebTestCase, + we can just use it the same way. +

+

+assertTrue($this->get($url)); + $this->assertEqual($this->getUrl(), $url); + $this->assertElementsBySelector( + 'h2', + array('Screenshots', 'Documentation', 'Contributing') + ); + } +} +?> +]]> +

+

+ I was expecting to get a nice green bar straight away : + I did wrote the HTML template after all. + Unfortunately it didn't happen, PHP gave me some nice exceptions : +

+ home: /$ php dom_tester_doc_test.php
+ dom_tester_doc_test.php
+ Exception 1!
+ Unexpected PHP error [DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: ID simpletestlogo already defined in Entity, line: 12] severity [E_WARNING] in [/Users/perrick/Sites/simpletest/extensions/dom_tester.php line 103]
+ in testGet
+ in TestOfLiveCssSelectors
+ Exception 2!
+ Unexpected PHP error [DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: ID simpletestdownload already defined in Entity, line: 16] severity [E_WARNING] in [/Users/perrick/Sites/simpletest/extensions/dom_tester.php line 103]
+ in testGet
+ in TestOfLiveCssSelectors
+ Exception 3!
+ Unexpected PHP error [DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: ID simpleteststarttesting already defined in Entity, line: 24] severity [E_WARNING] in [/Users/perrick/Sites/simpletest/extensions/dom_tester.php line 103]
+ in testGet
+ in TestOfLiveCssSelectors
+ Exception 4!
+ Unexpected PHP error [DOMDocument::loadHTML() [function.DOMDocument-loadHTML]: ID simpletestsupport already defined in Entity, line: 38] severity [E_WARNING] in [/Users/perrick/Sites/simpletest/extensions/dom_tester.php line 103]
+ in testGet
+ in TestOfLiveCssSelectors
+ FAILURES!!!
+ Test cases run: 1/1, Passes: 3, Failures: 0, Exceptions: 4
+
+ That's what validation is all about I guess. +

+

+ Back to the drawing board... A simple fix later, everything is fine. +

+ home: /$ php dom_tester_doc_test.php
+ dom_tester_doc_test.php
+ OK
+ Test cases run: 1/1, Passes: 3, Failures: 0, Exceptions: 0
+
+

+
+
+

+ If you thought it was easy, we can make things a little bit more difficult - + or precise - with attribute selectors : +assertTrue($this->get($url)); + $this->assertEqual($this->getUrl(), $url); + $this->assertElementsBySelector( + 'h2', + array('Screenshots', 'Documentation', 'Contributing') + ); + $this->assertElementsBySelector( + 'a[href="http://simpletest.org/api/"]', + array('the complete API', 'documented API') + ); + } +} +[...] +]]> +

+ home: /$ php dom_tester_doc_test.php
+ dom_tester_doc_test.php
+ OK
+ Test cases run: 1/1, Passes: 4, Failures: 0, Exceptions: 0
+
+

+

+ Oh and by the way, combinators do work as well : +assertTrue($this->get($url)); + $this->assertEqual($this->getUrl(), $url); + $this->assertElementsBySelector( + 'h2', + array('Screenshots', 'Documentation', 'Contributing') + ); + $this->assertElementsBySelector( + 'a[href="http://simpletest.org/api/"]', + array('the complete API', 'documented API') + ); + $this->assertElementsBySelector( + 'div#content > p > strong', + array('SimpleTest PHP unit tester') + ); + } +} +[...] +]]> +

+ home: /$ php dom_tester_doc_test.php
+ dom_tester_doc_test.php
+ OK
+ Test cases run: 1/1, Passes: 5, Failures: 0, Exceptions: 0
+
+

+
+ + + A Recorder for non-developpers. + Exploring the Recorder results. + + + + The JUnit FAQ + has plenty of useful testing advice. + + + Next is grouping test + cases together. + + + You will need the SimpleTest testing framework + for these examples. + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + unit test, + automated php testing, + test cases tutorial, + explain unit test case, + unit test example, + unit test + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_intro.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_intro.xml new file mode 100644 index 0000000..430e250 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_intro.xml @@ -0,0 +1,54 @@ + + + + Experimental stuff, found in SVN only + +
+

+ If a bug is found in SimpleTest, chances are it'll get corrected + inside the Subversion (SVN) tree with the corresponding test case : just to make + sure the bug doesn't make a come back later on. +

+

+ Also the SimpleTest SVN trunk is usually full of little known + experiments with code : new ideas are usually tried out there + before a general release. Before it happens, the documentation needs + to be completed : that's where this section comes into place. You'll + find here new features the dev team is happy with : we're looking + for comments... +

+

+ The mailing-list is usually the best place to give feedback. Other options + includes submitting a bug or a patch directly on the Sourceforge trackers... +

+

+ Note : some of these features may never make it to a release or not for + a long time! +

+
+
+ + + SimpleTest mailing-lists' page on SourceForge. + + + SimpleTest trackers' page on Sourceforge as well. + + + + + php unit testing, + test integration, + documentation, + marcus baker, + simple test, + simpletest documentation, + phpunit, + pear, + experimental, + cvs, + code experiment, + feedback + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_recorder.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_recorder.xml new file mode 100644 index 0000000..e4991cc --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/experimental_recorder.xml @@ -0,0 +1,170 @@ + + + + [experimental] Using the test results for other tools with the Recorder + + +
+ Careful : this documentation refers to un-released code. It's only available in SVN. +
+

+ What the developer wants from his tests is immediate feedback. The TextReporter + and the HtmlReporter are there to show this feedback. As quickly as possible + and as close to your working tools as possible : the console, the browser. +

+
+
+

+ But often developers don't work alone : you may have a team contributing to + the same code base next door, a manager a little bit further away and even + a team of testers or power users on the other side of the planet. +

+

+ For them as well tests' results are valuable pieces of information ! They just need + to be formatted and archived somewhere. The Recorder allows you to grab all + output to a simple PHP array. + +require_once('simpletest/ui/recorder.php'); + +$group = new TestSuite(); +$group->addTestFile('test_of_module_ship.php'); +$group->addTestFile('test_of_module_pay.php'); + +$recorder = new Recorder(); +$group->run($recorder); +?> +]]> +

+

+ Within this $recorder object lies the test suite information. + Let's dump the $recorder->results variable and check what's + in it : + + array(4) { + ["time"]=> + int(1173951256) + ["status"]=> + string(6) "Passed" + ["test"]=> + string(129) "examples/test_of_module_ship.php->TestUsingParcelForce->testParcelForceIsFine" + ["message"]=> + string(97) " at [examples/test_of_module_ship.php line 7]" + } + [1]=> + array(4) { + ["time"]=> + int(1173951256) + ["status"]=> + string(6) "Passed" + ["test"]=> + string(154) "examples/test_of_module_ship.php->TestUsingMyOwnAirplane->testUsingMyOwnAirplaneOnlyWorksForSmallGifts" + ["message"]=> + string(134) "Expected false, got [Boolean: false] at [examples/test_of_module_ship.php line 13]" + } + [2]=> + array(4) { + ["time"]=> + int(1173951256) + ["status"]=> + string(6) "Passed" + ["test"]=> + string(135) "examples/test_of_module_pay.php->TestPayForParcelForce->testPayForParcelForceIsFine" + ["message"]=> + string(96) " at [examples/test_of_module_pay.php line 7]" + } + [3]=> + array(4) { + ["time"]=> + int(1173951256) + ["status"]=> + string(6) "Passed" + ["test"]=> + string(155) "examples/test_of_module_pay.php->TestPayForMyOwnAirplane->testPayForMyOwnAirplaneOnlyWorksForSmallGifts" + ["message"]=> + string(133) "Expected false, got [Boolean: false] at [examples/test_of_module_pay.php line 13]" + } +} +?> +]]> +

+
+
+

+ Each element of the $recoder->results array contains one assertion's + information : +

    +
  • time : when the assertion was executed, in a timestamp format.
  • +
  • status : either Passed or Failed
  • +
  • test : the name of the test
  • +
  • message : the actual message, useful for understanding what went wrong
  • +
+

+

+ Now iterating throught the results becomes really easy... +addTestFile('test_of_module_ship.php'); +$group->addTestFile('test_of_module_pay.php'); +$recorder = new Recorder(); +$group->run($recorder); + +foreach (recorder->results as $result) { + if ($result->status == "Failed") { + do_something_while_it_is_time(result); + } +} + +?> +]]> +

+
+
+ + A Recorder for non-developers. + Exploring the Recorder results. + + + + The JUnit FAQ + has plenty of useful testing advice. + + + Next is grouping test + cases together. + + + You will need the SimpleTest testing framework + for these examples. + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + unit test, + automated php testing, + test cases tutorial, + explain unit test case, + unit test example, + unit test + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/extension_eclipse.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/extension_eclipse.xml new file mode 100644 index 0000000..b86278b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/extension_eclipse.xml @@ -0,0 +1,279 @@ + + + + Simpletest Eclipse Plugin Documentation + +
+
    +
  • + Operating System.
    + This plugin should work on any platform on which Eclipse works. Specifically + the plugin has been tested to work on Linux, OS X, and Windows. If the + plugin does not appear to work on one of these platforms a new incompatibility + may have emerged, but this is relatively unlikely. +
  • +
  • + Eclipse
    + The plugin has been designed to work with Eclipse versions 3.1.X+ and 3.2.X+. + Eclipse in general requires a JVM version of 1.4.x; there are no additional requirements for the plugin. +
  • +
  • + PHP
    + The plugin has been tested to work with PHP 4.3.x+ (including PHP 5.1.x.). +
  • +
  • + Xdebug
    + The plugin can be configured to work with Xdebug (version 2.0.0RC1 or later). + The php.ini file which is used by the plugin (see below for specifying the php.ini file) must load the Xdebug extension. + This is usually accomplished by adding a zend_extension_ts="Some Windows Path" or zend_extension="Some Linux Path" to your php.ini file. + Specific instructions can be found at: http://xdebug.org/install.php + Do not worry about specifying any other parameters, the plugin will handle setting the necessary parameters, as needed. +
  • +
  • + Simpletest
    + The plugin has been designed to work with a specific version of Simpletest + and in fact includes the associated version of Simpletest in the plugin for compatibility. + A plugin with a version number of 1.0.0_0.0.4 would indicate that the plugin was compatible + with Simpletest version 1.0.0 and was version 0.0.4 of the plugin. + Some slight modifications to the Simpletest code are required to make the plugin + work with Simpletest; these modifications may or may not be in the released version of Simpletest. +
  • +
  • + PHPUnit2
    + Starting with plugin version 0.1.6 experimental support for the CVS version of PHPUnit2 + is available. To use PHPUnit2 select a path to PHPUnit2 and select PHPUnit2 test instead of + SimpleTest. Note: this is the path to the folder that contains the PHPUnit2 + folder. PHPUnit3 is not currently supported but will be supported in the near future. +
  • +
+
+
+
    +
  1. Download and Install Eclipse (www.eclipse.org) – if you are not sure what to download, download the Eclipse 3.1.0 SDK.
  2. +
  3. Download the latest Simpletest Eclipse plug-in zip file (Simpletest Sourceforge)
  4. +
  5. Extract the zip file to a temporary location {this will be referred to later in this documentation as $unzip}
  6. +
  7. Start Eclipse
  8. +
  9. Open the Install Wizard by clicking "Help" > "Software Updates" > "Find and Install" from the menu bar.
  10. +
  11. Select the second button, "Search for new features to install" and click "Next".
  12. +
  13. Click the button on the right hand side, "New Local Site".
  14. +
  15. Select the folder $unzip {the folder extracted previously}.
  16. +
  17. Click the "OK" button.
  18. +
  19. In the "Edit Local Site" window, Click the "OK" button
  20. +
  21. Click the "Finish" button
  22. +
  23. In the "Search Results" window, drill down and select "Simpletest plug-in 0.0.x"
  24. +
  25. Click the "Next" button.
  26. +
  27. Read the license and accept the license by clicking the "I accept the terms in the license agreement" radio button and then clicking the "Next" button
  28. +
  29. In the "Installation" window you can choose to change the location -- most users should just click the "Finish" button
  30. +
  31. In the "Feature Verification" window, click the "Install" button.
  32. +
  33. When prompted, restart Eclipse
  34. +
  35. +

    After starting Eclipse for the first time after installation + you will need to perform a quick configuration of the Simpletest Plug-in. + To perform this configuration: +

    +
      +
    1. + Select "Window" > "Preferences" from the menu bar +
    2. +
    3. + Select "Simpletest" from the categories on the left hand side of the popup box. +
    4. +
    5. + Enter or Browse for the location of a PHP executable to use. +
    6. +
    7. + Leave the include file blank +
    8. +
    9. + Enter .php as the Test File Suffix. + Alternately if you name your test PHP files with a sufficiently different suffix + (e.g sometest.tst.php) you could enter in a more differentiating suffix (e.g. .tst.php). + This helps when the plug-in is looking for tests to execute. +
    10. +
    11. + Hit the "Ok" button to close the preferences window. +
    12. +
    +
  36. +
+
+
+ Note: this will only work if you have previously installed the plugin using the + Eclipse installation wizard. If you previously copied directories for installation, + it is recommended that you shutdown Eclipse, delete the previous version directories, and + follow the Installation instructions above (you should not have to perform the initial configuration + portion). +
    +
  1. Select "Help" > "Software Updates" > "Manage Configuration" from the menu
  2. +
  3. Drill down to find the Simpletest plugin and select it
  4. +
  5. In the right hand pane click the link for "Scan for Updates"
  6. +
  7. IF no updates are found, navigate to Window > Preferences > Install/Update > Valid Updates in the Eclipse preferences and select 'Compatible', not 'equivalent'. Then repeat the steps above.
  8. +
  9. Select the feature versions that you wish to upgrade, and click "Next".
  10. +
  11. Review the license agreements for the upgraded features. If the terms of all these licenses are acceptable, check "I accept the terms in the license agreements." Do not proceed to download the features if the license terms are not acceptable.
  12. +
  13. Click "Install" to allow the downloading and installing to proceed.
  14. +
  15. Once all the features and plug-ins have been downloaded successfully and their files installed into the product on the local computer, a new configuration that incorporates these features and plug-ins will be formulated. Click Yes when asked to exit and restart the Workbench for the changes to take effect.
  16. +
+
+
+

+ Note: this will only work if the plugin was installed via the Feature Update method. If installed via alternate methods, then the plugin can be uninstalled by deleting the directories which were previously added. +

+
    +
  1. Select "Help" > "Software Updates" > "Manage Configuration"
  2. +
  3. Drill down to find the Simpletest plugin
  4. +
  5. Right-click on the Simpletest plugin and select the option "Disable"
  6. +
  7. when prompted, restart Eclipse
  8. +
  9. After Eclipse has restarted, select "Help" > "Software Updates" > "Manage Configuration" from the menu bar
  10. +
  11. Select the option from the toolbar "Show Disabled Features"
  12. +
  13. Drill down to find the Simpletest plugin
  14. +
  15. Right-click on the Simpletest plugin and select the option "Uninstall"
  16. +
  17. When prompted, restart Eclipse
  18. +
+
+
+

+ The following details some sample usages of the plugin. +

+
    +
  1. Create a new test project (a holding place for related files) +
      +
    1. Select "File" > "New" > "Project.." from the menu
    2. +
    3. Expand the folder "General" and select "Project"
    4. +
    5. Click the "Next" button
    6. +
    7. On the next tab enter a project name: "Test"
    8. +
    9. Use the default Project Contents
    10. +
    11. Click the "Finish" button
    12. +
    +
  2. +
  3. Create a Single Passing Test +
      +
    1. In the Package Explorer View right-click on the "Test" project and select "New" > "File".
    2. +
    3. For the filename enter: test1.php and click "Finish"
    4. +
    5. Double-click on the test1.php entry in the Package Explorer which should open a new view to edit the file.
    6. +
    7. Enter the following for the contents of the file: +assertEqual(3,$total, "This should pass"); + } +} +?> +]]> +
    8. +
    9. Select "File" > "Save" from the menu.
    10. +
    11. Right click on the test1.php entry and select "Run" > "Run Simpletest".
    12. +
    13. The "Result View" should populate with information about the test run and the Simpletest console should fill with some information as well.
    14. +
    +
  4. +
  5. Single Test class multiple tests +
      +
    1. In the Package Explorer View right-click on the "Test" project and select "New" > "File".
    2. +
    3. For the filename enter: test2.php and click "Finish".
    4. +
    5. Double-click on the test2.php entry in the Package Explorer which should open a new view to edit the file.
    6. +
    7. Enter the following for the contents of the file: +assertEqual(3,$total, "This should pass"); + } + function test_fail(){ + $x = 1; + $y = 2; + $total = $x + $y; + $this->assertEqual(4,$total,"This should fail"); + } +} +?> +]]> +
    8. +
    9. Select "File" > "save" from the menu bar.
    10. +
    11. Right click on the test2.php entry and select "Run" > "Run Simpletest".
    12. +
    13. The Result View should populate with information about the test run and the Simpletest console should fill with some information as well
    14. +
    +
  6. +
  7. Group Tests (test multiple files at once) +
      +
    1. In the Package Explorer View right-click on the "Test" project and select "New" > "File"
    2. +
    3. For the filename enter: grouptest.php and click "Finish".
    4. +
    5. Double-click on the grouptest.php entry in the Package Explorer which should open a new view to edit the file.
    6. +
    7. Enter the following for the contents of the file: +addTestFile(dirname(__FILE__).'/test1.php'); + $this->addTestFile(dirname(__FILE__).'/test2.php'); + } +} +?> +]]> +
    8. +
    9. Select "File" > "save" from the menu
    10. +
    11. Right click on the grouptest.php entry and select "Run" > "Run Simpletest"
    12. +
    13. The Result View should populate with information about the test run and the Simpletest console should fill with some information as well
    14. +
    +
  8. +
+
+
+
    +
  • + Make sure that if a constructor is used in the test case + that the last line of the constructor calls the parent + constructor (e.g. parent::UnitTestCase) +
  • +
  • + Do not put any assertions into the test class constructor +
  • +
  • + If you get an error indicating that a class could not load; then restart Eclipse. Once + Eclipse restarts, open the Result View manually by selecting "Window"->"Show View"->"Other..." + Then select the SimpleTest Category and select "Result View" and click "OK". +
  • +
+
+
+

These are features that should eventually make it into this plugin

+
    +
  • + Allow different "include" file on each runner (override the "master" include) +
  • +
  • + Handle fatal errors better +
  • +
+
+
+ + + + software development, + eclipse plugin, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + unit test, + automated php testing, + test cases tutorial, + explain unit test case, + unit test example, + unit test + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/first_test_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/first_test_tutorial.xml new file mode 100644 index 0000000..962ec80 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/first_test_tutorial.xml @@ -0,0 +1,436 @@ + + + + PHP unit testing tutorial - Creating an example test case in PHP + + +

+ If you are new to unit testing it is recommended that you + actually try the code out as we go. + There is actually not very much to type and you will get + a feel for the rhythm of test first programming. +

+

+ To run the examples as is, you need an empty directory with the folders + classes, tests and temp. + Unpack the SimpleTest framework + into the tests folder and make sure your web server + can reach these locations. +

+
+
+

+ The quick introductory example + featured the unit testing of a simple log class. + In this tutorial on SimpleTest I am going to try to + tell the whole story of developing this class. + This PHP class is small and simple and in the course of + this introduction will receive far more attention than + it probably would in production. + Yet even this tiny class contains some surprisingly difficult + design decisions. +

+

+ Maybe they are too difficult? + Rather than trying to design the whole thing up front + I'll start with a known requirement, namely + we want to write messages to a file. + These messages must be appended to the file if it exists. + Later we will want priorities and filters and things, but + for now we will place the file writing requirement in + the forefront of our thoughts. + We will think of nothing else for fear of getting confused. + OK, let's make a test... + +]]> + Piece by piece here is what it all means. +

+

+ The dirname(__FILE__) construct just ensures + that the path is taken relative current file. +

+

+ What is this autorun.php file? + This file does the expected work of pulling in the definitions + of UnitTestCase. + It collects all test classes in the current file and runs + them automagically. + It does this by setting up an exit handler. + More on this later when we look at modifying the output. +

+

+ The tests themselves are gathered in test case classes. + This one, the TestOfLoggingclass , is typical in extending + UnitTestCase. + When the test case is invoked by the autorunner it will + search for any method within that starts with the name "test". + Each of these methods will be executed in the order they are + defined in the class. +

+

+ Our only test method at present is called + testFirstLogMessagesCreatesFileIfNonexistent(). + There is nothing in it yet. +

+

+ Now the empty method definition on its own does not do anything. + We need to actually place some code inside it. + The UnitTestCase class + will typically generate test events when run and these events are + sent to an observing reporter using methods inherited from + UnitTestCase. +

+

+ Now to add test code... + + +class TestOfLogging extends UnitTestCase { + function testFirstLogMessagesCreatesFileIfNonexistent() { + @unlink(dirname(__FILE__) . '/../temp/test.log'); + $log = new Log(dirname(__FILE__) . '/../temp/test.log'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists(dirname(__FILE__) . '../temp/test.log')); + } +} +?> +]]> +

+

+ You are probably thinking that that is a lot of test code for + just one test and I would agree. + Don't worry. + This is a fixed cost and from now on we can add tests + pretty much as one liners. + Even less when using some of the test artifacts that we + will use later. +

+

+ You might also have been thinking that + testFirstLogMessagesCreatesFileIfNonexistent + is an awfully long method name. + Normally that would be true, but here it's a good thing. + We will never type this name again, and we save ourselves having + to write comments or specifications. +

+

+ Now comes the first of our decisions. + Our test file is called log_test.php (any name + is fine) and is in a folder called tests (anywhere is fine). + We have called our code file log.php and this is + the code we are going to test. + I have placed it into a folder called classes, so that means + we are building a class, yes? +

+

+ For this example I am, but the unit tester is not restricted + to testing classes. + It is just that object oriented code is easier to break + down and redesign for testing. + It is no accident that the fine grain testing style of unit + tests has arisen from the object community. +

+

+ The test itself is minimal. + It first deletes any previous test file that may have + been left lying around. + Design decisions now come in thick and fast. + Our class is called Log + and takes the file path in the constructor. + We create a log and immediately send a message to + it using a method named + message(). + Sadly, original naming is not a desirable characteristic + of a software developer. +

+

+ The smallest unit of a...er...unit test is the assertion. + Here we want to assert that the log file we just sent + a message to was indeed created. + UnitTestCase::assertTrue() + will send a pass event if the condition evaluates to + true and a fail event otherwise. + We can have a variety of different assertions and even more + if we extend our base test cases. +

+

+ Here is the base list... + + + + + + + + + + + + + + + + + + + + + +
assertTrue($x)Fail unless $x evaluates true
assertFalse($x)Fail unless $x evaluates false
assertNull($x)Fail unless $x is not set
assertNotNull($x)Fail unless $x is set to something
assertIsA($x, $t)Fail unless $x is the class or type $t
assertNotA($x, $t)Fail unless $x is not the class or type $t
assertEqual($x, $y)Fail unless $x == $y is true
assertNotEqual($x, $y)Fail unless $x == $y is false
assertWithinMargin($x, $y, $margin)Fail unless $x and $y are separated less than $margin
assertOutsideMargin($x, $y, $margin)Fail unless $x and $y are sufficiently different
assertIdentical($x, $y)Fail unless $x === $y for variables, $x == $y for objects of the same type
assertNotIdentical($x, $y)Fail unless $x === $y is false, or two objects are unequal or different types
assertReference($x, $y)Fail unless $x and $y are the same variable
assertCopy($x, $y)Fail unless $x and $y are the different in any way
assertSame($x, $y)Fail unless $x and $y are the same objects
assertClone($x, $y)Fail unless $x and $y are identical, but separate objects
assertPattern($p, $x)Fail unless the regex $p matches $x
assertNoPattern($p, $x)Fail if the regex $p matches $x
expectError($e)Triggers a fail if this error does not happen before the end of the test
expectException($e)Triggers a fail if this exception is not thrown before the end of the test
+

+

+ We are now ready to execute our test script by pointing the + browser at it. + What happens? + It should crash... +

+ Fatal error: Failed opening required '../classes/log.php' (include_path='') in /home/marcus/projects/lastcraft/tutorial_tests/Log/tests/log_test.php on line 7 +
+ The reason is that we have not yet created log.php. +

+

+ Hang on, that's silly! + You aren't going to build a test without creating any of the + code you are testing, surely...? +

+
+
+

+ Co-inventor of + Extreme Programming, + Kent Beck, has come up with another manifesto. + The book is called + Test driven development + or TDD and raises unit testing to a senior position in design. + In a nutshell you write a small test first and + then only get this passing by writing code. + Any code. + Just get it working. +

+

+ You write another test and get that passing. + What you will now have is some duplication and generally lousy + code. + You re-arrange, or "refactor", that code while the tests are passing. + This stops you breaking anything. + Once the code is as clean as possible you are ready to add more + functionality, which you don't do. + Instead you add another test for your feature and start the + cycle again. + Your functionality gets created by trying to pass the tests that + define it. +

+

+ Think of it as an executable specification that you create just in time. +

+

+ This is a radical approach and one that I feel is incomplete, + but it makes for a great way to explain a unit tester! + We happen to have a failing, not to say crashing, test right now so + let's write some code into log.php... + +]]> + This is the minimum to avoid a PHP fatal error. + We now get the response... +

+

TestOfLogging

+ Fail: testFirstLogMessagesCreatesFileIfNonexistent->True assertion failed.
+
1/1 test cases complete. + 0 passes, 1 fails and 0 exceptions.
+
+ And "TestOfLogging" has failed. + SimpleTest uses class names by default to describe the tests, but + we can replace the name with our own... +function __construct() { + parent::__construct('Log test'); + } + + function testFirstLogMessagesCreatesFileIfNonexistent() { + @unlink(dirname(__FILE__) . '/../temp/test.log'); + $log = new Log(dirname(__FILE__) . '/../temp/test.log'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists(dirname(__FILE__) . '/../temp/test.log')); + } +} +]]> + Giving... +
+

Log test

+ Fail: testFirstLogMessagesCreatesFileIfNonexistent->File created.
+
1/1 test cases complete. + 0 passes, 1 fails and 0 exceptions.
+
+ If you want to change the test name, then you'd have to do it by + changing the reporter output, which we look at later. +

+

+ To get the test passing we could just create the file in the + Log constructor. + This "faking it" technique is very useful for checking + that your tests work when the going gets tough. + This is especially so if you have had a run of test failures + and just want to confirm that you haven't just missed something + stupid. + We are not going that slow, so... + + var $path; + + function __construct($path) { + $this->path = $path; + } + + function message($message) { + $file = fopen($this->path, 'a'); + fwrite($file, $message . "\n"); + fclose($file); + } +} +?> +]]> + It took me no less than four failures to get to the next step. + I had not created the temporary directory, I had not made it + publicly writeable, I had one typo and I did not check in the + new directory to CVS (I found out later). + Any one of these could have kept me busy for several hours if + they had come to light later, but then that is what testing is for. +

+

+ With the necessary fixes we get... +

+

Log test

+
1/1 test cases complete. + 1 passes, 0 fails and 0 exceptions.
+
+ Success! +

+

+ You may not like the rather minimal style of the display. + Passes are not shown by default because generally you do + not need more information when you actually understand what is + going on. + If you do not know what is going on then you should write another test. +

+

+ OK, this is a little strict. + If you want to see the passes as well then you + can subclass the + HtmlReporter class + and attach that to the test instead. + Even I like the comfort factor sometimes. +

+
+
+

+ There is a subtlety here. + We don't want the file created until we actually send + a message. + Rather than think about this too deeply we will just + assert it... + + $this->assertFalse(file_exists(dirname(__FILE__) . '/../temp/test.log')); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists(dirname(__FILE__) . '/../temp/test.log')); + + } +} +]]> + ...and find it already works... +

+

TestOfLogging

+
1/1 test cases complete. + 2 passes, 0 fails and 0 exceptions.
+
+ Actually I knew it would. + I am putting this test in to confirm this partly for peace of mind, but + also to document the behaviour. + That little extra test line says more in this context than + a dozen lines of use case or a whole UML activity diagram. + That the test suite acts as a source of documentation is a pleasant + side effect of all these tests. +

+

+ Should we clean up the temporary file at the end of the test? + I usually do this once I am finished with a test method + and it is working. + I don't want to check in code that leaves remnants of + test files lying around after a test. + I don't do it while I am writing the code, though. + I probably should, but sometimes I need to see what is + going on and there is that comfort thing again. +

+

+ In a real life project we usually have more than one test case, + so we next have to look at + grouping tests into test suites. +

+
+
+ + Creating a new test case. + Test driven development in PHP. + Tests as documentation is one of many side effects. + + + + The JUnit FAQ + has plenty of useful testing advice. + + + Next is grouping test + cases together. + + + You will need the SimpleTest testing framework + for these examples. + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + unit test, + automated php testing, + test cases tutorial, + explain unit test case, + unit test example, + unit test + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/form_testing_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/form_testing_documentation.xml new file mode 100644 index 0000000..d7ccceb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/form_testing_documentation.xml @@ -0,0 +1,304 @@ + + + + SimpleTest documentation for testing HTML forms + +
+

+ When a page is fetched by the WebTestCase + using get() or + post() the page content is + automatically parsed. + This results in any form controls that are inside <form> tags + being available from within the test case. + For example, if we have this snippet of HTML... +


+    
+    
+
+]]>
+ Which looks like this... +

+

+

+ + +
+

+

+ We can navigate to this code, via the + LastCraft + site, with the following test... + + function testDefaultValue() { + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertField('a', 'A default'); + } +} +]]> + Immediately after loading the page all of the HTML controls are set at + their default values just as they would appear in the web browser. + The assertion tests that a HTML widget exists in the page with the + name "a" and that it is currently set to the value + "A default". + As usual, we could use a pattern expectation instead of a fixed + string. +get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertField('a', new PatternExpectation('/default/')); + } +} +]]> + We could submit the form straight away, but first we'll change + the value of the text field and only then submit it... +get('http://www.my-site.com/'); + $this->assertField('a', 'A default'); + $this->setField('a', 'New value'); + $this->click('Go'); + } +} +]]> + Because we didn't specify a method attribute on the form tag, and + didn't specify an action either, the test case will follow + the usual browser behaviour of submitting the form data as a GET + request back to the same location. + In general SimpleTest tries to emulate typical browser behaviour as much as possible, + rather than attempting to catch any form of HTML omission. + This is because the target of the testing framework is the PHP application + logic, not syntax or other errors in the HTML code. + For HTML errors, other tools such as + HTMLTidy should be used, + or any of the HTML and CSS validators already out there. +

+

+ If a field is not present in any form, or if an option is unavailable, + then WebTestCase::setField() will return + false. + For example, suppose we wish to verify that a "Superuser" + option is not present in this form... +

Select type of user to add:
+
+]]>
+ Which looks like... +

+

+

+ Select type of user to add: + +
+

+

+ The following test will confirm it... + + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertFalse($this->setField('type', 'Superuser')); + } +} +]]> + The current selection will not be changed if the new value is not an option. +

+

+ Here is the full list of widgets currently supported... +

    +
  • Text fields, including hidden and password fields.
  • +
  • Submit buttons including the button tag, although not yet reset buttons
  • +
  • Text area. This includes text wrapping behaviour.
  • +
  • Checkboxes, including multiple checkboxes in the same form.
  • +
  • Drop down selections, including multiple selects.
  • +
  • Radio buttons.
  • +
  • Images.
  • +
+

+

+ The browser emulation offered by SimpleTest mimics + the actions which can be perform by a user on a + standard HTML page. Javascript is not supported, and + it's unlikely that support will be added any time + soon. +

+

+ Of particular note is that the Javascript idiom of + passing form results by setting a hidden field cannot + be performed using the normal SimpleTest + commands. See below for a way to test such forms. +

+
+
+

+ SimpleTest can cope with two types of multivalue controls: Multiple + selection drop downs, and multiple checkboxes with the same name + within a form. + The multivalue nature of these means that setting and testing + are slightly different. + Using checkboxes as an example... +


+    Create privileges allowed:
+    
+ Retrieve privileges allowed: +
+ Update privileges allowed: +
+ Destroy privileges allowed: +
+ + +]]>
+ Which renders as... +

+

+

+ Create privileges allowed: +
+ Retrieve privileges allowed: +
+ Update privileges allowed: +
+ Destroy privileges allowed: +
+ +
+

+

+ If we wish to disable all but the retrieval privileges and + submit this information we can do it like this... + + function testDisableNastyPrivileges() { + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertField('crud', array('c', 'r', 'u', 'd')); + $this->setField('crud', array('r')); + $this->click('Enable Privileges'); + } +} +]]> + Instead of setting the field to a single value, we give it a list + of values. + We do the same when testing expected values. + We can then write other test code to confirm the effect of this, perhaps + by logging in as that user and attempting an update. +

+
+
+

+ If you want to test a form which relies on javascript to set a hidden + field, you can't just call setField(). + The following code will not work: +// This does *not* work + $this->setField('a_hidden_field', '123'); + $this->clickSubmit('OK'); + } +} +]]> + Instead, you need to pass the additional form parameters to the + clickSubmit() method: +$this->clickSubmit('OK', array('a_hidden_field'=>'123')); + } + +} +]]> + Bear in mind that in doing this you're effectively stubbing out a + part of your software (the javascript code in the form), and + perhaps you might be better off using something like + Selenium to ensure a complete + test. +

+
+
+

+ If you want to test a form handler, but have not yet written + or do not have access to the form itself, you can create a + form submission by hand. + + function testAttemptedHack() { + $this->post( + 'http://www.my-site.com/add_user.php', + array('type' => 'superuser')); + $this->assertNoText('user created'); + } +} +]]> + By adding data to the WebTestCase::post() + method, we are emulating a form submission. + You would normally only do this as a temporary expedient, or where + you are expecting a 3rd party to submit to a form. + The exception is when you want tests to protect you from + attempts to spoof your pages. +

+
+
+ + + Changing form values and successfully + Submitting a simple form + + + Handling widgets with multiple values + by setting lists. + + + Bypassing javascript to set a hidden field. + + + Raw posting when you don't have a button + to click. + + + + + SimpleTest project page on SourceForge. + + + SimpleTest download page on LastCraft. + + + The developer's API for SimpleTest + gives full detail on the classes and assertions available. + + + + + software development, + php programming for clients, + customer focused php, + software development tools, + acceptance testing framework, + free php scripts, + architecture, + php resources, + HTMLUnit, + JWebUnit, + php testing, + unit test resource, + web testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/gain_control_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/gain_control_tutorial.xml new file mode 100644 index 0000000..f0bbc2c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/gain_control_tutorial.xml @@ -0,0 +1,290 @@ + + + + PHP unit testing tutorial - Isolating variables when testing + + +

+ In order to test a code module you need very tight control + of its environment. + If anything can vary behind the scenes, for example a + configuration file, then this could cause the tests + to fail unexpectedly. + This would not be a fair test of the code and could + cause you to spend fruitless hours examining code that + is actually working, rather than dealing with the configuration issue + that actually failed the test. + At the very least your test cases get more complicated in + taking account the possible variations. +

+
+
+

+ There are often a lot of obvious variables that could affect + a unit test case, especially in the web development + environment in which PHP usually operates. + These include database set up, file permissions, network + resources and configuration amongst others. + The failure or misinstall of one of these components will + break the test suite. +

+

+ Do we add tests to confirm these components are installed? + This is a good idea, but if you place them into code module + tests you will start to clutter you test code with detail + that is irrelavent to the immediate task. + They should be placed in their own test suite. +

+

+ Another problem, though, is that our development machines + must have every system component installed to be able + to run the test suite. + Your tests run slower too. +

+

+ When faced with this while coding we will often create wrapper + versions of classes that deal with these resources. + Ugly details of these resources are then coded once only. + I like to call these classes "gateway classes", + as they exist at the edges of the application, + the interface of your application with the rest of the + system. + These gateway classes are best simulated during testing + by fake versions. + These run faster and are often called + "Server Stubs", or in more generic form + "Mock Objects". + It is a great time saver to wrap and stub out such resources. +

+

+ One often neglected external resource is time. +

+

+ For example, to test a session time-out coders will often + temporarily set the session time limit to a small value, say two seconds, + and then do a sleep(3) + and assert that the session is now invalid. + That adds three seconds to your test suite and is usually + a lot of extra code making your session classes that maleable. + Far simpler is to have a way to suddenly advance the clock. + To control time. +

+
+
+

+ We will again design our clock wrapper by first writing tests. + We add a clock test case to our tests/all_tests.php + test suite... +addTest(new TestOfLogging()); + $this->addTest(new TestOfClock()); + } +} +?> +]]> + Then we create the test case in the new file + tests/clock_test.php... + +class TestOfClock extends UnitTestCase { + function testClockTellsTime() { + $clock = new Clock(); + $this->assertEqual($clock->now(), time()); + } +} +?> +]]> + Our only test at the moment is that our new + Clock class acts + as a simple PHP time() + function substitute. + We will write the time shift functionality once we are green. + At the moment we are obviously not green... +

+
+ Fatal error: Failed opening required '../classes/clock.php' (include_path='') in + /home/marcus/projects/lastcraft/tutorial_tests/tests/clock_test.php on line 2 +
+
+ We create a classes/clock.php file... + +]]> + This regains our flow ready for coding. +
+

AllTests

+ Fail: TestOfClock -> testClockTellsTime -> [NULL: ] should be equal to [integer: 1050257362]
+
3/3 test cases complete. + 4 passes, 1 fails and 0 exceptions.
+
+ This is now easy to fix... + + return time(); + } +} +]]> + And we are green... +
+

AllTests

+
3/3 test cases complete. + 5 passes, 0 fails and 0 exceptions.
+
+ There is still a problem. +

+

+ The clock could roll over during the assertion causing the + result to be out by one second. + The chances are small, but if there were a lot of timing tests + you would end up with a test suite that is erratic, severely + limiting its usefulness. + We will tackle this shortly and for now just jot it onto our + "to do" list. +

+

+ The advancement test looks like this... +assertEqual($clock->now(), time()); + } + + function testClockAdvance() { + $clock = new Clock(); + $clock->advance(10); + $this->assertEqual($clock->now(), time() + 10); + } +} +]]> + The code to get to green is straight forward and just involves adding + a time offset. + + private $offset = 0; + + function now() { + return time() + $this->offset; + } + + function advance($offset) { + $this->offset += $offset; + } +} +]]> +

+
+
+

+ Our all_tests.php file has some repetition we could + do without. + We have to manually add our test cases from each included + file. + It is possible to remove it, but use of the following requires care. + The TestSuite class has a + convenience method called addFile() + that takes a PHP file as a parameter. + This mechanism makes a note of all the classes, requires in the + file and then has a look at any newly created classes. + If they are descendents of SimpleTestCase + they are added as a new TestSuite. +

+

+ Here is our refactored test suite using this method... + +require_once(dirname(__FILE__) . '/simpletest/autorun.php'); + +class AllTests extends TestSuite { + function AllTests() { + parent::__construct(); + $this->addFile('log_test.php'); + $this->addFile('clock_test.php'); + } +} +?> +]]> + The pitfalls of this are... +

    +
  1. + If the test file has already been included, + no new classes will be added to this group +
  2. +
  3. + If the test file has other classes that are + related to SimpleTestCase + then these will be added to the group test as well. +
  4. +
+ In practice neither of these turn out to be problems. + Test suites are usually a tree structure. + It's rare to need a test case in two places. + As for extra classes being included, they have to be + descendents of SimpleTestCase. + These are likely to be superclasses of helper code + for several other tests. + Simply marking them as abstract is + enough to stop them being run. +

+

+ We should really fix the glitch with the possible + clock rollover so we'll + do this next. +

+
+
+ + Time is an often neglected variable in tests. + A clock class allows us to alter time. + Tidying the group test. + + + + The previous section is + grouping unit tests. + + + The next section is + subclassing test cases. + + + You will need + the SimpleTest unit tester + for the examples. + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + unit test, + php testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/group_test_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/group_test_documentation.xml new file mode 100644 index 0000000..96c140a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/group_test_documentation.xml @@ -0,0 +1,332 @@ + + + + SimpleTest for PHP test suites + +
+

+ To run test cases as part of a group, the test cases should really + be placed in files without the runner code... + +]]> + As many cases as needed can appear in a single file. + They should include any code they need, such as the library + being tested, but none of the simple test libraries. +

+

+ If you have extended any test cases, you can include them + as well. In PHP 4... + + class MyFileTestCase extends UnitTestCase { + ... + } + SimpleTest::ignore('MyFileTestCase'); + + class FileTester extends MyFileTestCase { ... } + + class SocketTester extends UnitTestCase { ... } +?> +]]> + The FileTester class does + not contain any actual tests, but is a base class for other + test cases. + For this reason we use the + SimpleTestOptions::ignore() directive + to tell the upcoming group test to ignore it. + This directive can appear anywhere in the file and works + when a whole file of test cases is loaded (see below). +

+

+ If you are using PHP 5, you do not need this special directive at all. + Simply mark any test cases that should not be run as abstract... +abstract class MyFileTestCase extends UnitTestCase { + ... +} + +class FileTester extends MyFileTestCase { ... } + +class SocketTester extends UnitTestCase { ... } +]]> +

+

+ We will call this sample file_test.php. + Next we create a group test file, called say my_group_test.php. + You will think of a better name I am sure. +

+

+ We will add the test file using a safe method... + + require_once('file_test.php'); + + $test = &new TestSuite('All file tests'); + $test->addTestCase(new FileTestCase()); + $test->run(new HtmlReporter()); +?> +]]> + This instantiates the test case before the test suite is + run. + This could get a little expensive with a large number of test + cases, and can be surprising behaviour. +

+

+ The main problem is that for every test case + that we add we will have + to require_once() the test code + file and manually instantiate each and every test case. +

+

+ We can save a lot of typing with... + + $test->addTestFile('file_test.php'); + $test->run(new HtmlReporter()); +?> +]]> + What happens here is that the TestSuite + class has done the require_once() + for us. + It then checks to see if any new test case classes + have been created by the new file and automatically adds + them to the group test. + Now all we have to do is add each new file. +

+

+ No only that, but you can guarantee that the constructor is run + just before the first test method and, in PHP 5, the destructor + is run just after the last test method. +

+

+ There are two things that could go wrong and which require care... +

    +
  1. + The file could already have been parsed by PHP, and so no + new classes will have been added. You should make + sure that the test cases are only included in this file + and no others (Note : with the new autorun + functionnality, this problem has now been solved). +
  2. +
  3. + New test case extension classes that get included will be + placed in the group test and run also. + You will need to add a SimpleTestOptions::ignore() + directive for these classes, or make sure that they are included + before the TestSuite::addTestFile() + line, or make sure that they are abstract classes. +
  4. +
+

+
+
+

+ The above method places all of the test cases into one large group. + For larger projects though this may not be flexible enough; you + may want to group the tests in all sorts of ways. +

+

+ To get a more flexible group test we can subclass + TestSuite and then instantiate it as needed... + + class FileTestSuite extends TestSuite { + function FileTestSuite() { + $this->TestSuite('All file tests'); + $this->addTestFile('file_test.php'); + } + } +?> +]]> + This effectively names the test in the constructor and then + adds our test cases and a single group below. + Of course we can add more than one group at this point. + We can now invoke the tests from a separate runner file... + + $test = &new FileTestSuite(); + $test->run(new HtmlReporter()); +?> +]]> + ...or we can group them into even larger group tests. + We can even mix groups and test cases freely as long as + we are careful about double includes... + + $test = &new BigTestSuite('Big group'); + $test->addTestFile('file_test_suite.php'); + $test->addTestFile('some_test_case.php'); + $test->run(new HtmlReporter()); +?> +]]> + In the event of a double include, ony the first instance + of the test case will be run. +

+

+ If we still wish to run the original group test, and we + don't want all of these little runner files, we can + put the test runner code around guard bars when we create + each group. +TestSuite('All file tests'); + $test->addTestFile('file_test.php'); + } + } + + if (! defined('RUNNER')) { + define('RUNNER', true); + $test = &new FileTestSuite(); + $test->run(new HtmlReporter()); + } +?> +]]> + This approach requires the guard to be set when including + the group test file, but this is still less hassle than + lots of separate runner files. + You include the same guard on the top level tests to make sure + that run() will run once only + from the top level script that has been invoked. + + define('RUNNER', true); + require_once('file_test_suite.php'); + + $test = &new BigTestSuite('Big group'); + $test->addTestCase(new FileTestSuite()); + $test->addTestCase(...); + $test->run(new HtmlReporter()); +?> +]]> + As with the normal test cases, a TestSuite can + be loaded with the TestSuite::addTestFile() method. + + $test->addTestFile('file_test_suite.php'); + $test->addTestFile(...); + $test->run(new HtmlReporter()); +?> +]]> +

+
+
+

+ If you already have unit tests for your code or are extending external + classes that have tests, it is unlikely that all of the test cases + are in SimpleTest format. + Fortunately it is possible to incorporate test cases from other + unit testers directly into SimpleTest group tests. +

+

+ Say we have the following + PhpUnit + test case in the file config_test.php... +class ConfigFileTest extends TestCase { + function ConfigFileTest() { + $this->TestCase('Config file test'); + } + + function testContents() { + $config = new ConfigFile('test.conf'); + $this->assertRegexp('/me/', $config->getValue('username')); + } +} +]]> + The group test can recognise this as long as we include + the appropriate adapter class before we add the test + file... + + require_once('simpletest/adapters/phpunit_test_case.php'); + + $test = &new TestSuite('All file tests'); + $test->addTestFile('config_test.php'); + $test->run(new HtmlReporter()); +?> +]]> + There are only two adapters, the other is for the + PEAR + 1.0 unit tester... + + require_once('simpletest/adapters/pear_test_case.php'); + + $test = &new TestSuite('All file tests'); + $test->addTestFile('some_pear_test_cases.php'); + $test->run(new HtmlReporter()); +?> +]]> + The PEAR test cases can be freely mixed with SimpleTest + ones even in the same test file, + but you cannot use SimpleTest assertions in the legacy + test case versions. + This is done as a check that you are not accidently making + your test cases completely dependent on SimpleTest. + You may want to do a PEAR release of your library for example, + which would mean shipping it with valid PEAR::PhpUnit test + cases. +

+
+
+ + + Different ways to group tests together. + + + Combining group tests into larger groups. + + + Integrating legacy test cases from other + types of PHPUnit. + + + + + SimpleTest project page on SourceForge. + + + SimpleTest download page on LastCraft. + + + + + php unit testing, test integration, documentation, marcus baker, simple test, + simpletest documentation, phpunit, pear + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/group_test_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/group_test_tutorial.xml new file mode 100644 index 0000000..3dfd8ef --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/group_test_tutorial.xml @@ -0,0 +1,239 @@ + + + + + PHP unit testing tutorial - Grouping together unit + tests and examples of writing test cases + + + +

+ Next up we will fill in some blanks and create a test suite. +

+
+
+

+ Adding another test can be as simple as adding another method + to a test case... +UnitTestCase('Log class test'); + } + function testCreatingNewFile() { + @unlink('../temp/test.log'); + $log = new Log('../temp/test.log'); + $this->assertFalse(file_exists('../temp/test.log'), 'Created before message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + @unlink('../temp/test.log'); + } + function testAppendingToFile() { + @unlink('../temp/test.log'); + $log = new Log('../temp/test.log'); + $log->message('Test line 1'); + $messages = file('../temp/test.log'); + $this->assertWantedPattern('/Test line 1/', $messages[0]); + $log->message('Test line 2'); + $messages = file('../temp/test.log'); + $this->assertWantedPattern('/Test line 2/', $messages[1]); + @unlink('../temp/test.log'); + } +} +]]> + The assertWantedPattern() + test case method uses Perl style regular expressions for + matching. +

+

+ All we are doing in this new test method is writing a line to a file and + reading it back twice over. + We simply want to confirm that the logger appends the + text rather than writing over the old file. + A little pedantic, but hey, it's a tutorial! +

+

+ In fact this unit test actually passes straight away... +

+

Log class test

+
1/1 test cases complete. + 4 passes and 0 fails.
+
+ The trouble is there is already a lot of repetition here, + we have to delete the test file before and after every test. + With outrageous plagarism from JUnit, + SimpleTest has setUp() and + tearDown() methods + which are run before and after every test respectively. + File deletion is common to all the test methods so we + should move that operation there. +

+

+ Our tests are green so we can refactor... +UnitTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function testCreatingNewFile() { + $log = new Log('../temp/test.log'); + $this->assertFalse(file_exists('../temp/test.log'), 'Created before message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + } + function testAppendingToFile() { + $log = new Log('../temp/test.log'); + $log->message('Test line 1'); + $messages = file('../temp/test.log'); + $this->assertWantedPattern('/Test line 1/', $messages[0]); + $log->message('Test line 2'); + $messages = file('../temp/test.log'); + $this->assertWantedPattern('/Test line 2/', $messages[1]); + } +} +]]> + The test stays green. + We can add non-test methods to the test case as long as the method + name does not start with the string "test". + Only the methods that start "test" are run. + This allows further optional refactoring... +UnitTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function getFileLine($filename, $index) { + $messages = file($filename); + return $messages[$index]; + } + function testCreatingNewFile() { + $log = new Log('../temp/test.log'); + $this->assertFalse(file_exists('../temp/test.log'), 'Created before message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + } + function testAppendingToFile() { + $log = new Log('../temp/test.log'); + $log->message('Test line 1'); + $this->assertWantedPattern('/Test line 1/', $this->getFileLine('../temp/test.log', 0)); + $log->message('Test line 2'); + $this->assertWantedPattern('/Test line 2/', $this->getFileLine('../temp/test.log', 1)); + } +} +]]> + It is a matter of taste whether you prefer this version + to the previous one. There is a little more code, but + the logic of the test is clearer. +

+
+
+

+ A test case does not function alone for very long. + When coding for real we usually want to run as many tests as + quickly and as often as we can. + This means grouping them together into test suites that + could easily include every test in the application. +

+

+ Firstly we have to clean out the test running code from + our existing test case... + +require_once('../classes/log.php'); + +class TestOfLogging extends UnitTestCase { + ... +} +?> +]]> + We no longer need the SIMPLE_TEST + constant. + Next we create a group test called all_tests.php + in the tests folder... +addTestCase(new TestOfLogging()); +$test->run(new HtmlReporter()); +?> +]]> + We hardly notice the difference when things work... +

+

All tests

+
1/1 test cases complete. + 4 passes and 0 fails.
+
+ Group tests add to the test case count. + Adding new test cases is very straight forward. + Simply include the test cases file and add any contained test + cases individually. + You can also nest group tests within other group tests + (although you should avoid loops). +

+

+ In the next page + we will add these more quickly. +

+
+
+ + + Adding another test to the test case + and refactoring. + + + The crude way to group unit tests. + + + + + Next is controlling + how the class under test interacts with the rest + of the system. + + + Previous is the creation + of a first test. + + + You need SimpleTest to run these examples. + + + + + software development, + php programming, + programming in php, + test first, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + unit test, + phpunit, + PHP unit testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/heartbeat.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/heartbeat.xml new file mode 100755 index 0000000..fc702c6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/heartbeat.xml @@ -0,0 +1,57 @@ + + + + Heartbeat : how is SimpleTest doing ? + + + + + +

+ Want to know check how healthy SimpleTest's codebase is? + Well, do enjoy the tests results, commit history and last commits... +

+
+
+

+
+
+

+
+
+

+
+
+ + + Current tests results + + + Commits per week + + + Last commits + + + + + software development, + computer programmer, + php programming, + programming php, + software development company, + software development uk, + php tutorial, + bespoke software development uk, + corporate web development, + architecture, + freelancer, + php resources, + wordtracker, + web marketing, + serach engines, + web positioning, + internet marketing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/ideas.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/ideas.xml new file mode 100644 index 0000000..2eabee2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/ideas.xml @@ -0,0 +1,188 @@ + + + + Ideas for Google Summer of Code Projects + + +

+ Most of the stuff on the SimpleTest2 road map is incremental. + Ideas for Google Summer of Code projects are of another kind. + There're here to unleash and promote new crazy ideas to the project + and to PHP's testing universe! +

+

+ Of course this list is not exhaustive: + if you have another itch to scratch, feel free + to add your wishes on the mailing-list. +

+
+ Careful though : currently the SimpleTest project is taking part under the + PHP umbrella. + So handle with care! +
+
+
+
+
+ Enable JavaScript inside SimpleTest browser. +
+
+ This would be a MASSIVE feature to have. + We're probably talking about integrating + a C-based or Java-based JavaScript engine. + The Java folks have + HttpUnit + already : some stuff could be derived from there. + Demonstrating the feasibility alone would be a real + step forward. The hard work is the DOM emulation. +
+
+ Add layer testing. +
+
+ When using an MVC framework is to support + bypassing the webserver, and interacting with the framework at + the level of Request and Response objects. + It would be nice to see if we could develop an interface standard for + the HTTP layer which would allow SimpleTest to work cleanly with + different frameworks. On the other hand, maybe there already is enough + of an interface in the standard PHP superglobals. + Symfony with its lime test framework works in exactly this manner. +
+
+ Make parsers switchable and change the HTML Parser. +
+
+ Replace the html parser with + tidylib. + It's super-fast compared to parsing in PHP. + If there are worries about adding a dependency, + then maybe make it an optional plug-in instead. +
+
+ Web Form Fuzzer. +
+
+ Fuzz testing is a software testing technique that provides random data + ("fuzz") to the inputs of a program. If the program fails (for + example, by crashing, or by failing built-in code assertions), the + defects can be noted. +
+ A Web Form Fuzzer would be built on top of the basic WebTestCase api, + enabling developers to point a test case at a target URL and have it + introspect form inputs and post actions. The fuzzer would generate + random data strings, populate the input fields, and repeatedly post + the forms, looking for errors, validation responses, and HTTP status + codes that reflect how the site handled a combination of well-formed + and malformed input. This would have the potential to completely wreck + some websites, but would be great for testing the robustness and edge + case behavior of CMS's and other online administration tools. +
+
+
+
+
+
+ Mutation test coverage. +
+
+
+
+
+
+ Standalone notifying tool +
+
+ Based on rules, this notifying tool detects a file change + within a particular directory (maybe with + php-inotifytools : + such a monitor could learn how your code works by observing it being tested. + For example, call graphing via static analysis might work, as would + running Xdebug code coverage while running the tests and monitoring + the code executed after each test method, as would some sort of + DBG-derived client that received notifications from Xdebug while + the code was being executed like a debugging client. + We'd have "rings" of functionality. The first + ring is the tests that exercises the particular method/function + you're working with by a direct call. + Then start working rings out based on how far away the test method + is when that code is called. + These rings would then be executed on a save, starting with the inner + most. Any failure would stop further tests cause a system alert to + something like Growl or Snarl or any Reporter that you drop in. +
+
+ PDT (Eclipse) : implement PHPUnit hooks +
+
+ There are somme hooks inside PDT implemented for PHPUnit. + But it seems there're unused since PHPUnit changed too much + recently. SimpleTest could use them as well : + the SimpleTest Eclipse plugin could then become + the PDT Test plugin while fixing those hooks. +
+
+ PDT (Eclipse) : debug while unit testing +
+
+ The GUI for Eclipse recently caught up with PDT : debugging while + running a SimpleTest test case is finally doable. +
+
+ Creative IDE integration +
+
+ For example, running a subset of tests after each edit. +
+
+ Firefox plugin to create SimpleTest file on the fly. +
+
+ The same way Selenium IDE currently works. +
+
+ Komodo integration. +
+
+ Integration with monitoring tools such as Nagios. +
+
+
+
+ + + Browser-based + + + ... and Unit testing-related ideas for GSOC2008. + + + Also of interest, + integration with third-party tools. + + + + + Google Summer of Code 2008. + + + + + software development, + computer programmer, + php programming, + programming php, + software development company, + software development uk, + php tutorial, + bespoke software development uk, + corporate web development, + architecture, + integration, + ide integration, + google summer of code, + mutation test coverage, + javascript + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/improving_design_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/improving_design_tutorial.xml new file mode 100644 index 0000000..fc59981 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/improving_design_tutorial.xml @@ -0,0 +1,195 @@ + + + + + PHP unit testing tutorial - Top down design + test first with mock objects + + +
+

+ I lied. +

+

+ I haven't created a writer test at all, only the + FileWriter interface that I showed + earlier. + In fact I'll go one step further away from a finished article and assume + only an abstract writer in classes/writer.php... +Writer { + + function Writer() { + } + + function write($message) { + } +} +?> +]]> + The corresponding test changes are... + +Mock::generate('Writer'); + +class TestOfLogging extends UnitTestCase { + function TestOfLogging() { + $this->UnitTestCase('Log class test'); + } + function testWriting() { + $clock = &new MockClock($this); + $clock->setReturnValue('now', 'Timestamp'); + $writer = &new MockWriter($this); + $writer->expectOnce('write', array('[Timestamp] Test line')); + $log = &new Log($writer); + $log->message('Test line', &$clock); + $writer->tally(); + } +} +?> +]]> + In order to use the logging class we would need to code a file + writer or other sort of writer, but at the moment we are only + testing and so we do not yet need it. + So, in other words, using mocks we can defer the creation of + lower level objects until we feel like it. + Not only can we design top down, but we can test top down too. +

+
+
+

+ Imagine for the moment that we had started the logging class + from another direction. + Pretend that we had coded just enough of the Log + to realise we needed a Writer somehow. + How would we have included it? +

+

+ Well, inheriting from the writer would not have allowed us to mock it + from the testing point of view. + From the design point of view we would have been restricted to + just one writer without multiple inheritence. +

+

+ Creating the writer internally, rather than passing it in the constructor, + by choosing a class name is possible, but we would have less control + of the mock object set up. + From the design point of view it would have been nearly impossible + to pass parameters to the writer in all the different formats ever needed. + You would have to have the writer restricted to say a hash or complicated + string describing the target details. + Needlessly complicated at best. +

+

+ Using a factory method to create the writer internally would be + possible, but would mean subclassing it for testing so that the factory + method could be replaced with one returning a mock. + More work from the test point of view, although still possible. + From the design point of view it would mean a new logger subclass + for every type of writer that we want to use. + This is called a parallel class hiearchy and obviously involves + duplication. + Yuk. +

+

+ At the other extreme, passing or creating the writer on every + message would have been repetitive and reduced the + Log class code to a single + method, a sure sign that the whole class has become redundant. +

+

+ This tension between ease of testing and avoiding repetition + has allowed us to find a flexible and clean design. + Remember our brief yearning for multiple inheritence? + We have replaced it with polymorphism (lots of writers) and separated the + logging hierachy from the writing hierarchy. + We connect the two through this simpler Log + by aggregation. + This trick is actually a design pattern called a "Bridge". +

+

+ So we have been pushed by test code (we haven't written much else yet) + into a design pattern. + Think about this for a second. + Tests improve code quality, certainly in my case, but this is + something far more profound and far more powerful. +

+

+ Testing has improved the design. +

+
+
+

+ Creating a mock object is as easy as creating the interface in text + form. + If you have UML or other tools that create these interfaces for you, + then you have an even more flexible route to quickly generate + test objects. + Even if you do not, you can switch from white board drawing, to + writing a test case, to writing a mock, to generating an interface + which takes us back to the whiteboard drawing again, fairly easily. + Like refactoring, design, code and test become unified. +

+

+ Because mock objects work top down they can be bought into the design + more quickly than normal refactoring, which requires at least + partially working code before it kicks in. + This means that the testing code interacts with the design faster + and this means that the design quality goes up sooner. +

+

+ A unit tester is a coding tool. + A unit tester with mock objects is a design tool. +

+
+
+ + + Mock now, code later. + + + We derive the bridge pattern. + + + Designing and testing hand in hand. + + + + + This tutorial follows Boundary classes. + + + You will need the SimpleTest testing framework + to try these examples. + + + For more mock object discussion see the + Extreme Tuesday Wiki + or the + C2 Wiki + + + + + software development, + php programming tutorial, + programming php test cases, + software development tools, + php tutorial, + free php code, + architecture, + php examples, + mock object examples, + junit style testing, + php testing frameworks, + unit test, + mock objects in PHP, + php testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/index.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/index.xml new file mode 100644 index 0000000..730cafb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/index.xml @@ -0,0 +1,220 @@ + + + + + The Last Craft? Web developer tutorials on PHP, Extreme programming + and Object Oriented development + + + +

+ This site focuses mostly on developing with lightweight web technologies such as + PHP, + especially when applied with agile methodologies such as + XP. + No guarantee of quality is given or even intended. + It is hoped only that what you find gives you ideas and enthusiasm + from a fellow computer programmer. +

+

+ I've been a little busy of late with children (two versions). + They take quite a chunk of your professional life and 100% of + what's left! + Hopefully the projects below should start to get back on track. +

+
+
+

+ My latest project is Cgreen. + It's a C unit tester. + There are a couple of C unit testing tools out there already of course. + What makes Cgreen different is that it is pure C99, includes + a tutorial right here and has facilities for creating mock functions. + Mock functions should lead to more decoupled C code if Mock objects are + anything to go by. + It's alpha status right now until I get feedback from other users. + So if you want to be influential, try it out right now. + The project has been mostly funded by Wordtracker, + for which I am very grateful. +

+

+ Along with Jon Ramsey, I am a founder of + PHP London, a PHP user + group not surprisingly based in London. + It's going well. + The networking meetings take place on the first Thursday of every month + at a pub. +

+

+ In addition the group organises other events that include the 2nd + London UK PHP Conference. + This is a one day event on Friday the 23rd of February 2007 and costs only + fifty quid. +

+

+ The SimpleTest PHP unit tester + is available for download from your nearest + SourceForge. + It is a PHP unit test and web test framework. + Users of JUnit will be + familiar with most of the interface. + The JWebUnit + style functionality is more complete now. + It has support for SSL, forms, frames, proxies and basic authentication. + The current CVS code should become the 1.0.1 release real soon now and + includes file upload and many small improvements. + The idea is that common but fiddly PHP tasks, such as logging into a site, + can be tested easily. +

+

+ My most neglected project right now is a requirents testing + and sign-off tool called + Arbiter. + It's actually best described in this + Sitepoint thread, + but basically think of it as a document driven FIT for small + web projects only. + The project is currently stalled due the birth of children and + writing projects. +

+

+ Also on the subject of open source, Wordtracker + have kindly agreed to publish some of their in house tools. + A Wordtracker spin off is fakeMail. + Testing applications that send e-mails can be a right royal pain because + of all of the infrastructure involved. + You will likely need an SMPT gateway that talks to a POP client that + you can read the queue from. + That's a lot of set up. + Fakemail acts as an SMTP gateway on any port + you define. + When you send it a mail it simply copies that mail to the local file + system in whatever directory you want. + You then just have to look at the local file. + It means that you must be able to configure your application to use + a port other than 25, but that's not usualy difficult. +

+
+
+

+ A craft is defined as... +

+ Art or skill; dexterity in particular manual employment; + hence, the occupation or employment itself; manual art; a + trade. +
+

+

+ If you lose a screw or clasp from a hand made jewellery box it is hopeless to + try to find a replacement. Nothing else is quite the same and the mechanism will + fail to work. It may even cause more damage when applied. You need to find the original maker + or someone of the same skill to make you another. + Sound like software? + Yet mechanical parts today are interchangeable. +

+

+ Writing software has resisted mass production. + As soon as a part of it becomes + routine it can be automated. + Once it is you don't need a programmer any more. + Routine programming jobs no longer exist. + All that is left is the unsolved problems that require + a higher level of skill in constructing their solutions. +

+

+ This dependency on the ability of the artisan, combined with nothing quite fitting + together properly, is what gives software the pre-industrial feel. +

+
+
+

+ The panel at the top is supposed to resemble a standard office index card. + The way it is marked out is called a + CRC card. + It stands for Classes, Responsibilities and + Collaborations and is the cheapest software development tool you + can find. + You really do buy a pack of cards. +

+

+ The role is written at the top and would often be just a class + name. + The left side is the object's responsibilities and on the + right collaborations (within the page I have treated these as + internal links and external links repectively). + A group of developers can point at, discuss and discard cards + in the heat of design session. + It makes it especially difficult for only one person to take charge + of a discussion in the way you can with a UML tool or notepad. + Try scribbling out five cards before someone gets a look in. +

+

+ Now nothing beats a whiteboard for collaboration, but if the level + of detail is getting too high and you want a temporary record, + give the CRC cards a try. +

+
+
+ + + Projects under development. + All free and open source software. + + + Why Last Craft? + Odd name isn't it? + + + Why this index card at the top? + + + + + SimpleTest is a PHP unit test framework. + + + My article on TDD + + + My article on the + Registry Pattern. + + + Site E-mail is + SpamCop + filtered which I cannot recommend enough. + + + + + software development, + computer programmer, + php programming, + programming php, + software development tools, + software development company, + php tutorial, + free php scripts, + bespoke software development uk, + corporate web development, + architecture, + php resources, + wordtracker, + xslt, + java, + bug tracker, + bug reporting, + unit test, + php testing, + test cases tutorial, + explain unit test case, + unit test example, + xml + + + A web site of software development tutorials and examples with an + emphasis on web programming, testing, agile methodology and PHP + development + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/intro.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/intro.xml new file mode 100644 index 0000000..87882c4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/intro.xml @@ -0,0 +1,54 @@ + + + + + Summary of SimpleTest including it's Java tool roots. + + + +

+ The SimpleTest PHP unit tester is in + the 1.0.1 release cycle and is available for download from your nearest SourceForge. +

+

+ It is a PHP unit test, mock objects and web test framework. + Users of JUnit will be + familiar with most of the interface. + For web testing a small web browser is included, similar to + JWebUnit. + It has support for SSL, frames, proxies, basic authentication, redirects, + and the standard HTML form controls. + The idea is that common but fiddly PHP tasks, such as logging into a site, + can be tested easily as calling click(). +

+

+ There is currently no support for JavaScript in the web tester. + For testing these elements we recommend + Selenium. +

+
+
+ + + software development, + computer programmer, + php programming, + programming php, + software development tools, + software development company, + php tutorial, + free php scripts, + bespoke software development uk, + corporate web development, + architecture, + php resources, + unit test, + php testing, + test cases tutorial, + explain unit test case, + unit test example, + xml + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/mock_objects_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/mock_objects_documentation.xml new file mode 100644 index 0000000..96f39a5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/mock_objects_documentation.xml @@ -0,0 +1,708 @@ + + + + SimpleTest for PHP mock objects documentation + +
+

+ Mock objects have two roles during a test case: actor and critic. +

+

+ The actor behaviour is to simulate objects that are difficult to + set up or time consuming to set up for a test. + The classic example is a database connection. + Setting up a test database at the start of each test would slow + testing to a crawl and would require the installation of the + database engine and test data on the test machine. + If we can simulate the connection and return data of our + choosing we not only win on the pragmatics of testing, but can + also feed our code spurious data to see how it responds. + We can simulate databases being down or other extremes + without having to create a broken database for real. + In other words, we get greater control of the test environment. +

+

+ If mock objects only behaved as actors they would simply be + known as server stubs. + This was originally a pattern named by Robert Binder (Testing + object-oriented systems: models, patterns, and tools, + Addison-Wesley) in 1999. +

+

+ A server stub is a simulation of an object or component. + It should exactly replace a component in a system for test + or prototyping purposes, but remain lightweight. + This allows tests to run more quickly, or if the simulated + class has not been written, to run at all. +

+

+ However, the mock objects not only play a part (by supplying chosen + return values on demand) they are also sensitive to the + messages sent to them (via expectations). + By setting expected parameters for a method call they act + as a guard that the calls upon them are made correctly. + If expectations are not met they save us the effort of + writing a failed test assertion by performing that duty on our + behalf. +

+

+ In the case of an imaginary database connection they can + test that the query, say SQL, was correctly formed by + the object that is using the connection. + Set them up with fairly tight expectations and you will + hardly need manual assertions at all. +

+
+
+

+ In the same way that we create server stubs, all we need is an + existing class, say a database connection that looks like this... +class DatabaseConnection { + function DatabaseConnection() { + } + + function query() { + } + + function selectQuery() { + } +} +]]> + The class does not need to have been implemented yet. + To create a mock version of the class we need to include the + mock object library and run the generator... +require_once('simpletest/unit_tester.php'); +require_once('simpletest/mock_objects.php'); +require_once('database_connection.php'); + +Mock::generate('DatabaseConnection'); +]]> + This generates a clone class called + MockDatabaseConnection. + We can now create instances of the new class within + our test case... + +class MyTestCase extends UnitTestCase { + + function testSomething() { + $connection = &new MockDatabaseConnection(); + } +} +]]> + Unlike the generated stubs the mock constructor needs a reference + to the test case so that it can dispatch passes and failures while + checking its expectations. + This means that mock objects can only be used within test cases. + Despite this their extra power means that stubs are hardly ever used + if mocks are available. +

+

+

Mocks as actors

+

+

+ The mock version of a class has all the methods of the original, + so that operations like + query()]]> are still + legal. + The return value will be null, + but we can change that with... +$connection->setReturnValue('query', 37) +]]> + Now every time we call + query()]]> we get + the result of 37. + We can set the return value to anything, say a hash of + imaginary database results or a list of persistent objects. + Parameters are irrelevant here, we always get the same + values back each time once they have been set up this way. + That may not sound like a convincing replica of a + database connection, but for the half a dozen lines of + a test method it is usually all you need. +

+

+ We can also add extra methods to the mock when generating it + and choose our own class name... +Mock::generate('DatabaseConnection', 'MyMockDatabaseConnection', array('setOptions')); +]]> + Here the mock will behave as if the setOptions() + existed in the original class. + This is handy if a class has used the PHP overload() + mechanism to add dynamic methods. + You can create a special mock to simulate this situation. +

+

+ Things aren't always that simple though. + One common problem is iterators, where constantly returning + the same value could cause an endless loop in the object + being tested. + For these we need to set up sequences of values. + Let's say we have a simple iterator that looks like this... + + This is about the simplest iterator you could have. + Assuming that this iterator only returns text until it + reaches the end, when it returns false, we can simulate it + with... + + $iterator = &new MockIterator(); + $iterator->setReturnValue('next', false); + $iterator->setReturnValueAt(0, 'next', 'First string'); + $iterator->setReturnValueAt(1, 'next', 'Second string'); + ... + } +} +]]> + When next() is called on the + mock iterator it will first return "First string", + on the second call "Second string" will be returned + and on any other call false will + be returned. + The sequenced return values take precedence over the constant + return value. + The constant one is a kind of default if you like. +

+

+ Another tricky situation is an overloaded + get() operation. + An example of this is an information holder with name/value pairs. + Say we have a configuration class like... + + This is a classic situation for using mock objects as + actual configuration will vary from machine to machine, + hardly helping the reliability of our tests if we use it + directly. + The problem though is that all the data comes through the + getValue() method and yet + we want different results for different keys. + Luckily the mocks have a filter system... +$config = &new MockConfiguration(); +$config->setReturnValue('getValue', 'primary', array('db_host')); +$config->setReturnValue('getValue', 'admin', array('db_user')); +$config->setReturnValue('getValue', 'secret', array('db_password')); +]]> + The extra parameter is a list of arguments to attempt + to match. + In this case we are trying to match only one argument which + is the look up key. + Now when the mock object has the + getValue() method invoked + like this... +getValue('db_user') +]]> + ...it will return "admin". + It finds this by attempting to match the calling arguments + to its list of returns one after another until + a complete match is found. +

+

+ You can set a default argument argument like so... + +$config->setReturnValue('getValue', false, array('*')); +]]> + This is not the same as setting the return value without + any argument requirements like this... + +$config->setReturnValue('getValue', false); +]]> + In the first case it will accept any single argument, + but exactly one is required. + In the second case any number of arguments will do and + it acts as a catchall after all other matches. + Note that if we add further single parameter options after + the wildcard in the first case, they will be ignored as the wildcard + will match first. + With complex parameter lists the ordering could be important + or else desired matches could be masked by earlier wildcard + ones. + Declare the most specific matches first if you are not sure. +

+

+ There are times when you want a specific object to be + dished out by the mock rather than a copy. + The PHP4 copy semantics force us to use a different method + for this. + You might be simulating a container for example... + + In this case you can set a reference into the mock's + return list... + +$vector = &new MockVector(); +$vector->setReturnReference('get', $thing, array(12)); +]]> + With this arrangement you know that every time + get(12)]]> is + called it will return the same + $thing each time. + This is compatible with PHP5 as well. +

+

+ These three factors, timing, parameters and whether to copy, + can be combined orthogonally. + For example... + +$complex->setReturnReferenceAt(3, 'get', $stuff, array('*', 1)); +]]> + This will return the $stuff only on the third + call and only if two parameters were set the second of + which must be the integer 1. + That should cover most simple prototyping situations. +

+

+ A final tricky case is one object creating another, known + as a factory pattern. + Suppose that on a successful query to our imaginary + database, a result set is returned as an iterator with + each call to next() giving + one row until false. + This sounds like a simulation nightmare, but in fact it can all + be mocked using the mechanics above. +

+

+ Here's how... + + $result = &new MockResultIterator(); + $result->setReturnValue('next', false); + $result->setReturnValueAt(0, 'next', array(1, 'tom')); + $result->setReturnValueAt(1, 'next', array(3, 'dick')); + $result->setReturnValueAt(2, 'next', array(6, 'harry')); + + $connection = &new MockDatabaseConnection(); + $connection->setReturnValue('query', false); + $connection->setReturnReference( + 'query', + $result, + array('select id, name from users')); + + $finder = &new UserFinder($connection); + $this->assertIdentical( + $finder->findNames(), + array('tom', 'dick', 'harry')); + } +} +]]> + Now only if our + $connection is called with the correct + query() will the + $result be returned that is + itself exhausted after the third call to next(). + This should be enough + information for our UserFinder class, + the class actually + being tested here, to come up with goods. + A very precise test and not a real database in sight. +

+
+
+

+ Although the server stubs approach insulates your tests from + real world disruption, it is only half the benefit. + You can have the class under test receiving the required + messages, but is your new class sending correct ones? + Testing this can get messy without a mock objects library. +

+

+ By way of example, suppose we have a + SessionPool class that we + want to add logging to. + Rather than grow the original class into something more + complicated, we want to add this behaviour with a decorator (GOF). + The SessionPool code currently looks + like this... +class SessionPool { + function SessionPool() { + ... + } + + function &findSession($cookie) { + ... + } + ... +} + +class Session { + ... +} +]]> + While our logging code looks like this... + +class Log { + function Log() { + ... + } + + function message() { + ... + } +} + +class LoggingSessionPool { + function LoggingSessionPool(&$session_pool, &$log) { + ... + } + + function &findSession($cookie) { + ... + } + ... +} +]]> + Out of all of this, the only class we want to test here + is the LoggingSessionPool. + In particular we would like to check that the + findSession() method is + called with the correct session ID in the cookie and that + it sent the message "Starting session $cookie" + to the logger. +

+

+ Despite the fact that we are testing only a few lines of + production code, here is what we would have to do in a + conventional test case: +

    +
  1. Create a log object.
  2. +
  3. Set a directory to place the log file.
  4. +
  5. Set the directory permissions so we can write the log.
  6. +
  7. Create a SessionPool object.
  8. +
  9. Hand start a session, which probably does lot's of things.
  10. +
  11. Invoke findSession().
  12. +
  13. Read the new Session ID (hope there is an accessor!).
  14. +
  15. Raise a test assertion to confirm that the ID matches the cookie.
  16. +
  17. Read the last line of the log file.
  18. +
  19. Pattern match out the extra logging timestamps, etc.
  20. +
  21. Assert that the session message is contained in the text.
  22. +
+ It is hardly surprising that developers hate writing tests + when they are this much drudgery. + To make things worse, every time the logging format changes or + the method of creating new sessions changes, we have to rewrite + parts of this test even though this test does not officially + test those parts of the system. + We are creating headaches for the writers of these other classes. +

+

+ Instead, here is the complete test method using mock object magic... + + $session = &new MockSession(); + $pool = &new MockSessionPool(); + $pool->setReturnReference('findSession', $session); + $pool->expectOnce('findSession', array('abc')); + + $log = &new MockLog(); + $log->expectOnce('message', array('Starting session abc')); + + $logging_pool = &new LoggingSessionPool($pool, $log); + $this->assertReference($logging_pool->findSession('abc'), $session); + } +} +]]> + We start by creating a dummy session. + We don't have to be too fussy about this as the check + for which session we want is done elsewhere. + We only need to check that it was the same one that came + from the session pool. +

+

+ findSession() is a factory + method the simulation of which is described above. + The point of departure comes with the first + expectOnce() call. + This line states that whenever + findSession() is invoked on the + mock, it will test the incoming arguments. + If it receives the single argument of a string "abc" + then a test pass is sent to the unit tester, otherwise a fail is + generated. + This was the part where we checked that the right session was asked for. + The argument list follows the same format as the one for setting + return values. + You can have wildcards and sequences and the order of + evaluation is the same. +

+

+ We use the same pattern to set up the mock logger. + We tell it that it should have + message() invoked + once only with the argument "Starting session abc". + By testing the calling arguments, rather than the logger output, + we insulate the test from any display changes in the logger. +

+

+ We start to run our tests when we create the new + LoggingSessionPool and feed + it our preset mock objects. + Everything is now under our control. +

+

+ This is still quite a bit of test code, but the code is very + strict. + If it still seems rather daunting there is a lot less of it + than if we tried this without mocks and this particular test, + interactions rather than output, is always more work to set + up. + More often you will be testing more complex situations without + needing this level or precision. + Also some of this can be refactored into a test case + setUp() method. +

+

+ Here is the full list of expectations you can set on a mock object + in SimpleTest... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ExpectationNeeds tally()
expect($method, $args)No
expectAt($timing, $method, $args)No
expectCallCount($method, $count)Yes
expectMaximumCallCount($method, $count)No
expectMinimumCallCount($method, $count)Yes
expectNever($method)No
expectOnce($method, $args)Yes
expectAtLeastOnce($method, $args)Yes
+ Where the parameters are... +

+
$method
+
The method name, as a string, to apply the condition to.
+
$args
+
+ The arguments as a list. Wildcards can be included in the same + manner as for setReturn(). + This argument is optional for expectOnce() + and expectAtLeastOnce(). +
+
$timing
+
+ The only point in time to test the condition. + The first call starts at zero. +
+
$count
+
The number of calls expected.
+
+ The method expectMaximumCallCount() + is slightly different in that it will only ever generate a failure. + It is silent if the limit is never reached. +

+

+ Also if you have juste one call in your test, make sure you're using + expectOnce.
+ Using $mocked->expectAt(0, 'method', 'args); + on its own will not be catched : + checking the arguments and the overall call count + are currently independant. +

+

+ Like the assertions within test cases, all of the expectations + can take a message override as an extra parameter. + Also the original failure message can be embedded in the output + as "%s". +

+
+
+

+ There are three approaches to creating mocks including the one + that SimpleTest employs. + Coding them by hand using a base class, generating them to + a file and dynamically generating them on the fly. +

+

+ Mock objects generated with SimpleTest + are dynamic. + They are created at run time in memory, using + eval(), rather than written + out to a file. + This makes the mocks easy to create, a one liner, + especially compared with hand + crafting them in a parallel class hierarchy. + The problem is that the behaviour is usually set up in the tests + themselves. + If the original objects change the mock versions + that the tests rely on can get out of sync. + This can happen with the parallel hierarchy approach as well, + but is far more quickly detected. +

+

+ The solution, of course, is to add some real integration + tests. + You don't need very many and the convenience gained + from the mocks more than outweighs the small amount of + extra testing. + You cannot trust code that was only tested with mocks. +

+

+ If you are still determined to build static libraries of mocks + because you want to simulate very specific behaviour, you can + achieve the same effect using the SimpleTest class generator. + In your library file, say mocks/connection.php for a + database connection, create a mock and inherit to override + special methods or add presets... + + Mock::generate('Connection', 'BasicMockConnection'); + class MockConnection extends BasicMockConnection { + function MockConnection() { + $this->BasicMockConnection(); + $this->setReturn('query', false); + } + } +?> +]]> + The generate call tells the class generator to create + a class called BasicMockConnection + rather than the usual MockConnection. + We then inherit from this to get our version of + MockConnection. + By intercepting in this way we can add behaviour, here setting + the default value of query() to be false. + By using the default name we make sure that the mock class + generator will not recreate a different one when invoked elsewhere in the + tests. + It never creates a class if it already exists. + As long as the above file is included first then all tests + that generated MockConnection should + now be using our one instead. + If we don't get the order right and the mock library + creates one first then the class creation will simply fail. +

+

+ Use this trick if you find you have a lot of common mock behaviour + or you are getting frequent integration problems at later + stages of testing. +

+
+
+ + + What are mock objects? + + + Creating mock objects. + + + Mocks as actors or stubs. + + + Mocks as critics with expectations. + + + Other approaches including mock libraries. + + + + + The original + Mock objects paper. + + + SimpleTest project page on SourceForge. + + + SimpleTest home page on LastCraft. + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + unit test, + php testing, + jmock, + nmock + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/mock_objects_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/mock_objects_tutorial.xml new file mode 100644 index 0000000..875adfd --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/mock_objects_tutorial.xml @@ -0,0 +1,359 @@ + + + + PHP unit testing tutorial - Using mock objects in PHP + +
+

+ Before more functionality is added there is some refactoring + to do. + We are going to do some timing tests and so the + TimeTestCase class definitely needs + its own file. + Let's say tests/time_test_case.php... +UnitTestCase($test_name); + } + function assertSameTime($time1, $time2, $message = '') { + if (! $message) { + $message = "Time [$time1] should match time [$time2]"; + } + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } +} +?> +]]> + We can then require() this file into + the all_tests.php script. +

+
+
+

+ I don't know quite what the format of the log message should + be for the test, so to check for a timestamp we could do the + simplest possible thing, which is to look for a sequence of digits. + +require_once('../classes/clock.php'); + +class TestOfLogging extends TimeTestCase { + function TestOfLogging() { + $this->TimeTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function getFileLine($filename, $index) { + $messages = file($filename); + return $messages[$index]; + } + function testCreatingNewFile() { + ... + } + function testAppendingToFile() { + ... + } + function testTimestamps() { + $log = new Log('../temp/test.log'); + $log->message('Test line'); + $this->assertTrue( + preg_match('/(\d+)/', $this->getFileLine('../temp/test.log', 0), $matches), + 'Found timestamp'); + $clock = new clock(); + $this->assertSameTime((integer)$matches[1], $clock->now(), 'Correct time'); + } +} +?> +]]> + The test case creates a new Log + object and writes a message. + We look for a digit sequence and then test it against the current + time using our Clock object. + Of course it doesn't work until we write the code. +

+

All tests

+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 1/] in [Test line 1]
+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 2/] in [Test line 2]
+ Pass: log_test.php->Log class test->testcreatingnewfile->Created before message
+ Pass: log_test.php->Log class test->testcreatingnewfile->File created
+ Fail: log_test.php->Log class test->testtimestamps->Found timestamp
+
+ Notice: Undefined offset: 1 in /home/marcus/projects/lastcraft/tutorial_tests/tests/log_test.php on line 44
+ Fail: log_test.php->Log class test->testtimestamps->Correct time
+ Pass: clock_test.php->Clock class test->testclockadvance->Advancement
+ Pass: clock_test.php->Clock class test->testclocktellstime->Now is the right time
+
3/3 test cases complete. + 6 passes and 2 fails.
+
+ The test suite is still showing the passes from our earlier + modification. +

+

+ We can get the tests to pass simply by adding a timestamp + when writing out to the file. + Yes, of course all of this is trivial and + I would not normally test this fanatically, but it is going + to illustrate a more general problem. + The log.php file becomes... + +require_once('../classes/clock.php'); + +class Log { + var $_file_path; + + function Log($file_path) { + $this->_file_path = $file_path; + } + + function message($message) { + $clock = new Clock(); + $file = fopen($this->_file_path, 'a'); + fwrite($file, "[" . $clock->now() . "] $message\n"); + fclose($file); + } +} +?> +]]> + The tests should now pass. +

+

+ Our new test is full of problems, though. + What if our time format changes to something else? + Things are going to be a lot more complicated to test if this + happens. + It also means that any changes to the clock class time + format will cause our logging tests to fail also. + This means that our log tests are tangled up with the clock tests + and extremely fragile. + It lacks cohesion, which is the same as saying it is not + tightly focused, testing facets of the clock as well as the log. + Our problems are caused in part because the clock output + is unpredictable when + all we really want to test is that the logging message + contains the output of + Clock::now(). + We don't + really care about the contents of that method call. +

+

+ Can we make that call predictable? + We could if we could get the log to use a dummy version + of the clock for the duration of the test. + The dummy clock class would have to behave the same way + as the Clock class + except for the fixed output from the + now() method. + Hey, that would even free us from using the + TimeTestCase class! +

+

+ We could write such a class pretty easily although it is + rather tedious work. + We just create another clock class with same interface + except that the now() method + returns a value that we can change with some other setter method. + That is quite a lot of work for a pretty minor test. +

+

+ Except that it is really no work at all. +

+
+
+

+ To reach instant testing clock nirvana we need + only three extra lines of code... + + This includes the mock generator code. + It is simplest to place this in the all_tests.php + script as it gets used rather a lot. + + This is the line that does the work. + The code generator scans the class for all of its + methods, creates code to generate an identically + interfaced class, but with the name "Mock" added, + and then eval()s the new code to + create the new class. + + This line can be added to any test method we are interested in. + It creates the dummy clock ready to receive our instructions. +

+

+ Our test case is on the first steps of a radical clean up... + +Mock::generate('Clock'); + +class TestOfLogging extends UnitTestCase { + function TestOfLogging() { + $this->UnitTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function getFileLine($filename, $index) { + $messages = file($filename); + return $messages[$index]; + } + function testCreatingNewFile() { + ... + } + function testAppendingToFile() { + ... + } + function testTimestamps() { + $clock = &new MockClock($this); + $clock->setReturnValue('now', 'Timestamp'); + $log = new Log('../temp/test.log'); + $log->message('Test line', &$clock); + $this->assertWantedPattern( + '/Timestamp/', + $this->getFileLine('../temp/test.log', 0), + 'Found timestamp'); + } +} +?> +]]> + This test method creates a MockClock + object and then sets the return value of the + now() method to be the string + "Timestamp". + Every time we call $clock->now() + it will return this string. + This should be easy to spot. +

+

+ Next we create our log and send a message. + We pass into the message() + call the clock we would like to use. + This means that we will have to add an optional parameter to + the logging class to make testing possible... +_file_path = $file_path; + } + + function message($message, $clock = false) { + if (!is_object($clock)) { + $clock = new Clock(); + } + $file = fopen($this->_file_path, 'a'); + fwrite($file, "[" . $clock->now() . "] $message\n"); + fclose($file); + } +} +]]> + All of the tests now pass and they test only the logging code. + We can breathe easy again. +

+

+ Does that extra parameter in the Log + class bother you? + We have changed the interface just to facilitate testing after + all. + Are not interfaces the most important thing? + Have we sullied our class with test code? +

+

+ Possibly, but consider this. + Next chance you get, look at a circuit board, perhaps the motherboard + of the computer you are looking at right now. + On most boards you will find the odd empty hole, or solder + joint with nothing attached or perhaps a pin or socket + that has no obvious function. + Chances are that some of these are for expansion and + variations, but most of the remainder will be for testing. +

+

+ Think about that. + The factories making the boards many times over wasting material + on parts that do not add to the final function. + If hardware engineers can make this sacrifice of elegance I am + sure we can too. + Our sacrifice wastes no materials after all. +

+

+ Still bother you? + Actually it bothers me too, but not so much here. + The number one priority is code that works, not prizes + for minimalism. + If it really bothers you, then move the creation of the clock + into another protected factory method. + Then subclass the clock for testing and override the + factory method with one that returns the mock. + Your tests are clumsier, but your interface is intact. +

+

+ Again I leave the decision to you. +

+
+
+ + + Refactoring the tests so we can reuse + our new time test. + + Adding Log timestamps. + Mocking the clock to make the test cohesive. + + + + This follows the unit test tutorial. + + + Next is distilling boundary classes. + + + You will need the SimpleTest + tool to run the examples. + + + Mock objects papers. + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + unit test, + php testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/overview.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/overview.xml new file mode 100644 index 0000000..f01b3cb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/overview.xml @@ -0,0 +1,460 @@ + + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +
+

+ The heart of SimpleTest is a testing framework built around + test case classes. + These are written as extensions of base test case classes, + each extended with methods that actually contain test code. + Top level test scripts then invoke the run() + methods on every one of these test cases in order. + Each test method is written to invoke various assertions that + the developer expects to be true such as + assertEqual(). + If the expectation is correct, then a successful result is dispatched to the + observing test reporter, but any failure triggers an alert + and a description of the mismatch. +

+

+ A test case looks like this... +MyTestCase extends UnitTestCase { + + function testCreatedLogFile() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

+

+ These tools are designed for the developer. + Tests are written in the PHP language itself more or less + as the application itself is built. + The advantage of using PHP itself as the testing language is that + there are no new languages to learn, testing can start straight away, + and the developer can test any part of the code. + Basically, all parts that can be accessed by the application code can also be + accessed by the test code, if they are in the same programming language. +

+

+ The simplest type of test case is the + UnitTestCase. + This class of test case includes standard tests for equality, + references and pattern matching. + All these test the typical expectations of what you would + expect the result of a function or method to be. + This is by far the most common type of test in the daily + routine of development, making up about 95% of test cases. +

+

+ The top level task of a web application though is not to + produce correct output from its methods and objects, but + to generate web pages. + The WebTestCase class tests web + pages. + It simulates a web browser requesting a page, complete with + cookies, proxies, secure connections, authentication, forms, frames and most + navigation elements. + With this type of test case, the developer can assert that + information is present in the page and that forms and + sessions are handled correctly. +

+

+ A WebTestCase looks like this... +MySiteTest extends WebTestCase { + + function testHomePage() { + $this->get('http://www.my-site.com/index.php'); + $this->assertTitle('My Home Page'); + $this->clickLink('Contact'); + $this->assertTitle('Contact me'); + $this->assertPattern('/Email me at/'); + } +} +?> +]]> +

+
+
+

+ The following is a very rough outline of past and future features + and their expected point of release. + I am afraid it is liable to change without warning, as meeting the + milestones rather depends on time available. + Green stuff has been coded, but not necessarily released yet. + If you have a pressing need for a green but unreleased feature + then you should check-out the code from Sourceforge SVN directly. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FeatureDescriptionRelease
Unit test caseCore test case class and assertions1.0
Html displaySimplest possible display1.0
Autoloading of test cases + Reading a file with test cases and loading them into a + group test automatically + 1.0
Mock objects + Objects capable of simulating other objects removing + test dependencies + 1.0
Web test caseAllows link following and title tag matching1.0
Partial mocks + Mocking parts of a class for testing less than a class + or for complex simulations + 1.0
Web cookie handlingCorrect handling of cookies when fetching pages1.0
Following redirectsPage fetching automatically follows 300 redirects1.0
Form parsingAbility to submit simple forms and read default form values1.0
Command line interfaceTest display without the need of a web browser1.0
Exposure of expectation classesCan create precise tests with mocks as well as test cases1.0
XML output and parsing + Allows multi host testing and the integration of acceptance + testing extensions + 1.0
Browser component + Exposure of lower level web browser interface for more + detailed test cases + 1.0
HTTP authentication + Fetching protected web pages with basic authentication + only + 1.0
SSL supportCan connect to https: pages1.0
Proxy supportCan connect via. common proxies1.0
Frames supportHandling of frames in web test cases1.0
File upload testingCan simulate the input type file tag1.0.1
Mocking interfaces + Can generate mock objects to interfaces as well as classes + and class interfaces are carried for type hints + 1.0.1
Testing exceptionsSimilar to testing PHP errors1.0.1
HTML label supportCan access all controls using the visual label1.0.1
Base tag supportRespects page base tag when clicking1.0.1
PHP 5 E_STRICT compliantPHP 5 only version that works with the E_STRICT error level1.1
BDD style fixturesCan import fixtures using a mixin like given() method1.5
Reporting machinery enhancementsImproved message passing for better cooperation with IDEs1.5
Fluent mock interfaceMore flexible and concise mock objects1.6
LocalisationMessages abstracted and code generated1.6
CSS selectorsHTML content can be examined using CSS selectors1.7
HTML table assertionsCan match HTML or table elements to expectations1.7
Unified acceptance testing modelContent searchable through selectors combined with expectations1.7
DatabaseTestCaseSQL selectors and DB drivers1.7
IFrame supportReads IFrame content that can be refreshed1.8
Alternate HTML parsersCan detect compiled parsers for performance improvements1.8
Integrated Selenium supportEasy to use built in Selenium driver and tutorial1.9
Code coverageReports using the bundled tool when using XDebug1.9
Deprecation of old methodsSimpler interface for SimpleTest22.0
Javascript suportUse of PECL module to add Javascript to the native browser3.0
+ PHP5 migraton will start straight after the version 1.0.1 series, + whereupon only PHP 5.1+ will be supported. + SimpleTest is currently compatible with PHP 5, but will not + make use of all of the new features until version 1.1. +

+
+
+

+ Process is at least as important as tools. + The type of process that makes the heaviest use of a developer's + testing tool is of course + Extreme Programming. + This is one of the + Agile Methodologies + which combine various practices to "flatten the cost curve" of software development. + More extreme still is Test Driven Development, + where you very strictly adhere to the rule of no coding until you have a test. + If you're more of a planner, or believe that experience trumps evolution, + you may prefer the + RUP approach. + I haven't tried it, but even I can see that you will need test tools (see figure 9). +

+

+ Most unit testers clone JUnit to some degree, + as far as the interface at least. There is a wealth of information on the + JUnit site including the + FAQ + which contains plenty of general advice on testing. + Once you get bitten by the bug you will certainly appreciate the phrase + test infected + coined by Eric Gamma. + If you are still reviewing which unit tester to use you can find pretty complete + lists from + Wikipedia, + Software testing FAQ, + and Open source testing. +

+

+ There is still very little material on using mock objects, which is a shame + as unit testing without them is a lot more work. + The original mock objects paper + is very Java focused, but still worth a read. + The most authoritive sources are probably + the original mock objects site and + JMock. + Java centric, but tucked away in PDFs they contain some deep knowledge on using mocks from the + extended experience of the concept inventors. + As a new technology there are plenty of discussions and debate on how to use mocks, + often on Wikis such as + Extreme Tuesday + or www.mockobjects.com + or the original C2 Wiki. + Injecting mocks into a class is the main area of debate for which this + paper on IBM + makes a good starting point. +

+

+ There are plenty of web testing tools, but the scriptable ones + are mostly are written in Java and + tutorials and advice are rather thin on the ground. + The only hope is to look at the documentation for + HTTPUnit, + HTMLUnit + or JWebUnit and hope for clues. + There are some XML driven test frameworks, but again most + require Java to run. +

+

+ Most significant is a new generation of tools that run directly in the web browser + are now available. + These include + Selenium and + Watir. + They are non-trivial to set up and slow to run, but can essentially test anything. + As SimpleTest does not support JavaScript you would probably + have to look at these tools anyway if you have highly dynamic + pages. +

+
+
+ + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Perrick Pennet + + General manager{@link mailto:perrick@noparking.net perrick@noparking.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/partial_mocks_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/partial_mocks_documentation.xml new file mode 100644 index 0000000..ffc013d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/partial_mocks_documentation.xml @@ -0,0 +1,402 @@ + + + + SimpleTest for PHP partial mocks documentation + + +

+ A partial mock is simply a pattern to alleviate a specific problem + in testing with mock objects, + that of getting mock objects into tight corners. + It's quite a limited tool and possibly not even a good idea. + It is included with SimpleTest because I have found it useful + on more than one occasion and has saved a lot of work at that point. +

+
+
+

+ When one object uses another it is very simple to just pass a mock + version in already set up with its expectations. + Things are rather tricker if one object creates another and the + creator is the one you want to test. + This means that the created object should be mocked, but we can + hardly tell our class under test to create a mock instead. + The tested class doesn't even know it is running inside a test + after all. +

+

+ For example, suppose we are building a telnet client and it + needs to create a network socket to pass its messages. + The connection method might look something like... +read( ... ); + ... + } +} +?> +]]> + We would really like to have a mock object version of the socket + here, what can we do? +

+

+ The first solution is to pass the socket in as a parameter, + forcing the creation up a level. + Having the client handle this is actually a very good approach + if you can manage it and should lead to factoring the creation from + the doing. + In fact, this is one way in which testing with mock objects actually + forces you to code more tightly focused solutions. + They improve your programming. +

+

+ Here this would be... +function &connect(&$socket, $username, $password) { + $socket->read( ... ); + ... + } +} +?> +]]> + This means that the test code is typical for a test involving + mock objects. + + $socket = &new MockSocket($this); + ... + $telnet = &new Telnet(); + $telnet->connect($socket, 'Me', 'Secret'); + ... + } +} +]]> + It is pretty obvious though that one level is all you can go. + You would hardly want your top level application creating + every low level file, socket and database connection ever + needed. + It wouldn't know the constructor parameters anyway. +

+

+ The next simplest compromise is to have the created object passed + in as an optional parameter... + + function &connect($ip, $port, $username, $password, $socket = false) { + if (!$socket) { + $socket = &new Socket($ip, $port); + } + $socket->read( ... ); + ... + return $socket; + } +} +?> +]]> + For a quick solution this is usually good enough. + The test now looks almost the same as if the parameter + was formally passed... + + $socket = &new MockSocket($this); + ... + $telnet = &new Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret', &$socket); + ... + } +} +]]> + The problem with this approach is its untidiness. + There is test code in the main class and parameters passed + in the test case that are never used. + This is a quick and dirty approach, but nevertheless effective + in most situations. +

+

+ The next method is to pass in a factory object to do the creation... + + function Telnet(&$network) { + $this->_network = &$network; + } + ... + function &connect($ip, $port, $username, $password) { + $socket = &$this->_network->createSocket($ip, $port); + $socket->read( ... ); + ... + return $socket; + } +} +?> +]]> + This is probably the most highly factored answer as creation + is now moved into a small specialist class. + The networking factory can now be tested separately, but mocked + easily when we are testing the telnet class... + + $socket = &new MockSocket($this); + ... + $network = &new MockNetwork($this); + $network->setReturnReference('createSocket', $socket); + $telnet = &new Telnet($network); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} +]]> + The downside is that we are adding a lot more classes to the + library. + Also we are passing a lot of factories around which will + make the code a little less intuitive. + The most flexible solution, but the most complex. +

+

+ Is there a middle ground? +

+
+
+

+ There is a way we can circumvent the problem without creating + any new application classes, but it involves creating a subclass + when we do the actual testing. + Firstly we move the socket creation into its own method... + + $socket = &$this->_createSocket($ip, $port); + $socket->read( ... ); + ... + } + + function &_createSocket($ip, $port) { + return new Socket($ip, $port); + } +} +?> +]]> + This is the only change we make to the application code. +

+

+ For the test case we have to create a subclass so that + we can intercept the socket creation... +class TelnetTestVersion extends Telnet { + var $_mock; + + function TelnetTestVersion(&$mock) { + $this->_mock = &$mock; + $this->Telnet(); + } + + function &_createSocket() { + return $this->_mock; + } +} +]]> + Here I have passed the mock in the constructor, but a + setter would have done just as well. + Note that the mock was set into the object variable + before the constructor was chained. + This is necessary in case the constructor calls + connect(). + Otherwise it could get a null value from + _createSocket(). +

+

+ After the completion of all of this extra work the + actual test case is fairly easy. + We just test our new class instead... + + $socket = &new MockSocket($this); + ... + $telnet = &new TelnetTestVersion($socket); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} +]]> + The new class is very simple of course. + It just sets up a return value, rather like a mock. + It would be nice if it also checked the incoming parameters + as well. + Just like a mock. + It seems we are likely to do this often, can + we automate the subclass creation? +

+
+
+

+ Of course the answer is "yes" or I would have stopped writing + this by now! + The previous test case was a lot of work, but we can + generate the subclass using a similar approach to the mock objects. +

+

+ Here is the partial mock version of the test... +Mock::generatePartial( + 'Telnet', + 'TelnetTestVersion', + array('_createSocket')); + +class TelnetTest extends UnitTestCase { + ... + function testConnection() { + $socket = &new MockSocket($this); + ... + $telnet = &new TelnetTestVersion($this); + $telnet->setReturnReference('_createSocket', $socket); + $telnet->Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} +]]> + The partial mock is a subclass of the original with + selected methods "knocked out" with test + versions. + The generatePartial() call + takes three parameters: the class to be subclassed, + the new test class name and a list of methods to mock. +

+

+ Instantiating the resulting objects is slightly tricky. + The only constructor parameter of a partial mock is + the unit tester reference. + As with the normal mock objects this is needed for sending + test results in response to checked expectations. +

+

+ The original constructor is not run yet. + This is necessary in case the constructor is going to + make use of the as yet unset mocked methods. + We set any return values at this point and then run the + constructor with its normal parameters. + This three step construction of "new", followed + by setting up the methods, followed by running the constructor + proper is what distinguishes the partial mock code. +

+

+ Apart from construction, all of the mocked methods have + the same features as mock objects and all of the unmocked + methods behave as before. + We can set expectations very easily... +setReturnReference('_createSocket', $socket); + $telnet->expectOnce('_createSocket', array('127.0.0.1', 21)); + $telnet->Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + $telnet->tally(); + } +} +]]> +

+
+
+

+ The mocked out methods don't have to be factory methods, + they could be any sort of method. + In this way partial mocks allow us to take control of any part of + a class except the constructor. + We could even go as far as to mock every method + except one we actually want to test. +

+

+ This last situation is all rather hypothetical, as I haven't + tried it. + I am open to the possibility, but a little worried that + forcing object granularity may be better for the code quality. + I personally use partial mocks as a way of overriding creation + or for occasional testing of the TemplateMethod pattern. +

+

+ It's all going to come down to the coding standards of your + project to decide which mechanism you use. +

+
+
+ + + The mock injection problem. + + + Moving creation to a protected factory method. + + + Partial mocks generate subclasses. + + + Partial mocks test less than a class. + + + + + SimpleTest project page on SourceForge. + + + Full API for SimpleTest + from the PHPDoc. + + + The protected factory is described in + this paper from IBM. + This is the only formal comment I have seen on this problem. + + + + + php software development, + php test case development, + database programming php, + software development tools, + php advanced tutorial, + phpunit style scripts, + architecture, + php resources, + mock objects, + junit, + php test framework, + unit test, + php testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/photos_stream.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/photos_stream.xml new file mode 100644 index 0000000..ed90b7d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/photos_stream.xml @@ -0,0 +1,51 @@ + + + + Photos & pictures tagged SimpleTest + + +

+ A set of photos and pictures tagged with SimpleTest. +

+
+
+ + + +
+
+ + + + Pictures tagged + SimpleTest on Flickr + + + + + + software development, + computer programmer, + php programming, + programming php, + software development company, + software development uk, + php tutorial, + bespoke software development uk, + corporate web development, + architecture, + freelancer, + php resources, + wordtracker, + web marketing, + serach engines, + web positioning, + internet marketing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/reporter_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/reporter_documentation.xml new file mode 100644 index 0000000..efc4ce2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/reporter_documentation.xml @@ -0,0 +1,471 @@ + + + + SimpleTest for PHP test runner and display documentation + + +

+ SimpleTest pretty much follows the MVC pattern + (Model-View-Controller). + The reporter classes are the view and the model is your + test cases and their hiearchy. + The controller is mostly hidden from the user of + SimpleTest unless you want to change how the test cases + are actually run, in which case it is possible to + override the runner objects from within the test case. + As usual with MVC, the controller is mostly undefined + and there are other places to control the test run. +

+
+
+

+ The default test display is minimal in the extreme. + It reports success and failure with the conventional red and + green bars and shows a breadcrumb trail of test groups + for every failed assertion. + Here's a fail... +

+

File test

+ Fail: createnewfile->True assertion failed.
+
1/1 test cases complete. + 0 passes, 1 fails and 0 exceptions.
+
+ And here all tests passed... +
+

File test

+
1/1 test cases complete. + 1 passes, 0 fails and 0 exceptions.
+
+ The good news is that there are several points in the display + hiearchy for subclassing. +

+

+ For web page based displays there is the + HtmlReporter class with the following + signature... + + Here is what some of these methods mean. First the display methods + that you will probably want to override... +

    +
  • + HtmlReporter(string $encoding)
    + is the constructor. + Note that the unit test sets up the link to the display + rather than the other way around. + The display is a mostly passive receiver of test events. + This allows easy adaption of the display for other test + systems beside unit tests, such as monitoring servers. + The encoding is the character encoding you wish to + display the test output in. + In order to correctly render debug output when + using the web tester, this should match the encoding + of the site you are trying to test. + The available character set strings are described in + the PHP html_entities() + function. +
  • +
  • + void paintHeader(string $test_name)
    + is called once at the very start of the test when the first + start event arrives. + The first start event is usually delivered by the top level group + test and so this is where $test_name + comes from. + It paints the page titles, CSS, body tag, etc. + It returns nothing (void). +
  • +
  • + void paintFooter(string $test_name)
    + Called at the very end of the test to close any tags opened + by the page header. + By default it also displays the red/green bar and the final + count of results. + Actually the end of the test happens when a test end event + comes in with the same name as the one that started it all + at the same level. + The tests nest you see. + Closing the last test finishes the display. +
  • +
  • + void paintMethodStart(string $test_name)
    + is called at the start of each test method. + The name normally comes from method name. + The other test start events behave the same way except + that the group test one tells the reporter how large + it is in number of held test cases. + This is so that the reporter can display a progress bar + as the runner churns through the test cases. +
  • +
  • + void paintMethodEnd(string $test_name)
    + backs out of the test started with the same name. +
  • +
  • + void paintFail(string $message)
    + paints a failure. + By default it just displays the word fail, a breadcrumbs trail + showing the current test nesting and the message issued by + the assertion. +
  • +
  • + void paintPass(string $message)
    + by default does nothing. +
  • +
  • + string getCss()
    + Returns the CSS styles as a string for the page header + method. + Additional styles have to be appended here if you are + not overriding the page header. + You will want to use this method in an overriden page header + if you want to include the original CSS. +
  • +
+ There are also some accessors to get information on the current + state of the test suite. + Use these to enrich the display... +
    +
  • + array getTestList()
    + is the first convenience method for subclasses. + Lists the current nesting of the tests as a list + of test names. + The first, most deeply nested test, is first in the + list and the current test method will be last. +
  • +
  • + integer getPassCount()
    + returns the number of passes chalked up so far. + Needed for the display at the end. +
  • +
  • + integer getFailCount()
    + is likewise the number of fails so far. +
  • +
  • + integer getExceptionCount()
    + is likewise the number of errors so far. +
  • +
  • + integer getTestCaseCount()
    + is the total number of test cases in the test run. + This includes the grouping tests themselves. +
  • +
  • + integer getTestCaseProgress()
    + is the number of test cases completed so far. +
  • +
+ One simple modification is to get the HtmlReporter to display + the passes as well as the failures and errors... +class ShowPasses extends HtmlReporter { + + function paintPass($message) { + parent::paintPass($message); + print "&Pass: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("->", $breadcrumb); + print "->$message
\n"; + } + + protected function getCss() { + return parent::getCss() . ' .pass { color: green; }'; + } +} +]]>
+

+

+ One method that was glossed over was the makeDry() + method. + If you run this method, with no parameters, on the reporter + before the test suite is run no actual test methods + will be called. + You will still get the events of entering and leaving the + test methods and test cases, but no passes or failures etc, + because the test code will not actually be executed. +

+

+ The reason for this is to allow for more sophistcated + GUI displays that allow the selection of individual test + cases. + In order to build a list of possible tests they need a + report on the test structure for drawing, say a tree view + of the test suite. + With a reporter set to dry run that just sends drawing events + this is easily accomplished. +

+
+
+

+ Rather than simply modifying the existing display, you might want to + produce a whole new HTML look, or even generate text or XML. + Rather than override every method in + HtmlReporter we can take one + step up the class hiearchy to SimpleReporter + in the simple_test.php source file. +

+

+ A do nothing display, a blank canvas for your own creation, would + be... +require_once('simpletest/simple_test.php'); + +class MyDisplay extends SimpleReporter { + + function paintHeader($test_name) { + } + + function paintFooter($test_name) { + } + + function paintStart($test_name, $size) { + parent::paintStart($test_name, $size); + } + + function paintEnd($test_name, $size) { + parent::paintEnd($test_name, $size); + } + + function paintPass($message) { + parent::paintPass($message); + } + + function paintFail($message) { + parent::paintFail($message); + } +} +]]> + No output would come from this class until you add it. +

+
+
+

+ SimpleTest also ships with a minimal command line reporter. + The interface mimics JUnit to some extent, but paints the + failure messages as they arrive. + To use the command line reporter simply substitute it + for the HTML version... +addTestFile('tests/file_test.php'); +$test->run(new TextReporter()); +?> +]]> + Then invoke the test suite from the command line... +

+php file_test.php
+
+ You will need the command line version of PHP installed + of course. + A passing test suite looks like this... +
+File test
+OK
+Test cases run: 1/1, Failures: 0, Exceptions: 0
+
+ A failure triggers a display like this... +
+File test
+1) True assertion failed.
+    in createnewfile
+FAILURES!!!
+Test cases run: 1/1, Failures: 1, Exceptions: 0
+
+

+

+ One of the main reasons for using a command line driven + test suite is of using the tester as part of some automated + process. + To function properly in shell scripts the test script should + return a non-zero exit code on failure. + If a test suite fails the value false + is returned from the SimpleTest::run() + method. + We can use that result to exit the script with the desired return + code... +addTestFile('tests/file_test.php'); +exit ($test->run(new TextReporter()) ? 0 : 1); +?> +]]> + Of course we don't really want to create two test scripts, + a command line one and a web browser one, for each test suite. + The command line reporter includes a method to sniff out the + run time environment... +addTestFile('tests/file_test.php'); +if (TextReporter::inCli()) { + exit ($test->run(new TextReporter()) ? 0 : 1); +} +$test->run(new HtmlReporter()); +?> +]]> + This is the form used within SimpleTest itself. +

+
+
+

+ SimpleTest ships with an XmlReporter class + used for internal communication. + When run the output looks like... +


+
+  
+    Remote tests
+    
+      Visual test with 48 passes, 48 fails and 4 exceptions
+      
+        testofunittestcaseoutput
+        
+          testofresults
+          This assertion passed
+          This assertion failed
+        
+        
+          ...
+        
+      
+    
+  
+
+]]>
+ You can make use of this format with the parser + supplied as part of SimpleTest itself. + This is called SimpleTestXmlParser and + resides in xml.php within the SimpleTest package... +parse($test_output); +?> +]]> + The $test_output should be the XML format + from the XML reporter, and could come from say a command + line run of a test case. + The parser sends events to the reporter just like any + other test run. + There are some odd occasions where this is actually useful. +

+

+ A problem with large test suites is thet they can exhaust + the default 8Mb memory limit on a PHP process. + By having the test groups output in XML and run in + separate processes, the output can be reparsed to + aggregate the results into a much smaller footprint top level + test. +

+

+ Because the XML output can come from anywhere, this opens + up the possibility of aggregating test runs from remote + servers. + A test case already exists to do this within the SimpleTest + framework, but it is currently experimental... +require_once('../remote.php'); +require_once('../reporter.php'); + +$test_url = ...; +$dry_url = ...; + +$test = &new TestSuite('Remote tests'); +$test->addTestCase(new RemoteTestCase($test_url, $dry_url)); +$test->run(new HtmlReporter()); +?> +]]> + The RemoteTestCase takes the actual location + of the test runner, basically a web page in XML format. + It also takes the URL of a reporter set to do a dry run. + This is so that progress can be reported upward correctly. + The RemoteTestCase can be added to test suites + just like any other group test. +

+
+
+ + + Displaying results in HTML + + + Displaying and reporting results + in other formats + + + Using SimpleTest from the command line + + + Using Using XML for remote testing + + + + + SimpleTest project page on SourceForge. + + + SimpleTest download page on LastCraft. + + + The developer's API for SimpleTest + gives full detail on the classes and assertions available. + + + + + php unit testing, + documentation, + marcus baker, + simple test, + simpletest, + remote testing, + xml tests, + automated testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/screencasts.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/screencasts.xml new file mode 100644 index 0000000..b003e0a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/screencasts.xml @@ -0,0 +1,76 @@ + + + + Screencasts : Basic and Advanced TDD using SimpleTest + +
+

+ Want to see a basic TDD session in PHP ? + Here's a screencast from a session presented at + the PHP Everywhere Conference + by Andre John Cruz + (Application Developer, Barclays Singapore). +

+

+ Basic TDD in PHP Demo, 1 of 3
+ +
+
+ Basic TDD in PHP Demo, 2 of 3
+ +
+
+ Basic TDD in PHP Demo, 3 of 3
+ +

+

+ Advanced TDD in PHP Demo, 1 of 4
+ +
+
+ Advanced TDD in PHP Demo, 2 of 4
+ +
+
+ Advanced TDD in PHP Demo, 3 of 4
+ +
+
+ Advanced TDD in PHP Demo, 4 of 4
+ +

+
+
+ + + A screencast + covering "Basic and Advanced TDD in PHP". + + + + + The PHP User Group + Philippines organized the event. + + + + + software development, + test case example, + programming php, + software development tools, + php tutorial, + creating subclass, + free php scripts, + architecture, + php resources, + junit, + phpunit style testing, + unit test, + php testing, + screencast, + basic TDD, + advanced TDD + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/simple_test.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/simple_test.xml new file mode 100644 index 0000000..10aa862 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/simple_test.xml @@ -0,0 +1,524 @@ + + + + + Download the Simple Test testing framework - + Unit tests and mock objects for PHP + + + + 1.0.1 release cycle started. + Features include include file upload, better PHP5 support for + mock objects, and HTML label support. + There is also a big clean up of method names and some internals + refactoring. + + +

+ The following assumes that you are familiar with the concept + of unit testing as well as the PHP web development language. + It is a guide for the impatient new user of + SimpleTest. + For fuller documentation, especially if you are new + to unit testing see the ongoing + documentation, and for + example test cases see the + unit testing tutorial. +

+
+
+

+ Amongst software testing tools, a unit tester is the one + closest to the developer. + In the context of agile development the test code sits right + next to the source code as both are written simultaneously. + In this context SimpleTest aims to be a complete PHP developer + test solution and is called "Simple" because it + should be easy to use and extend. + It wasn't a good choice of name really. + It includes all of the typical functions you would expect from + JUnit and the + PHPUnit + ports, and includes + mock objects. +

+

+ What makes this tool immediately useful to the PHP developer is the internal + web browser. + This allows tests that navigate web sites, fill in forms and test pages. + Being able to write these test in PHP means that it is easy to write + integrated tests. + An example might be confirming that a user was written to a database + after a signing up through the web site. +

+

+ The quickest way to demonstrate SimpleTest is with an example. +

+

+ Let us suppose we are testing a simple file logging class called + Log in classes/log.php. + We start by creating a test script which we will call + tests/log_test.php and populate it as follows... +require_once('simpletest/autorun.php'); +require_once('../classes/log.php'); + +class TestOfLogging extends UnitTestCase { +} +?> +]]> + Here the simpletest folder is either local or in the path. + You would have to edit these locations depending on where you + unpacked the toolset. + The "autorun.php" file does more than just include the + SimpleTest files, it also runs our test for us. +

+

+ The TestOfLogging is our first test case and it's + currently empty. + Each test case is a class that extends one of the SimpleTet base classes + and we can have as many of these in the file as we want. +

+

+ With three lines of scaffolding, and our Log class + include, we have a test suite. + No tests though. +

+

+ For our first test, we'll assume that the Log class + takes the file name to write to in the constructor, and we have + a temporary folder in which to place this file... +testLogCreatesNewFileOnFirstMessage() { + @unlink('/temp/test.log'); + $log = new Log('/temp/test.log'); + $this->assertFalse(file_exists('/temp/test.log')); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('/temp/test.log')); + } +} +?> +]]> + When a test case runs, it will search for any method that + starts with the string "test" + and execute that method. + If the method starts "test", it's a test. + Note the very long name testLogCreatesNewFileOnFirstMessage(). + This is considered good style and makes the test output more readable. +

+

+ We would normally have more than one test method in a test case, + but that's for later. +

+

+ Assertions within the test methods trigger messages to the + test framework which displays the result immediately. + This immediate response is important, not just in the event + of the code causing a crash, but also so that + print statements can display + their debugging content right next to the assertion concerned. +

+

+ To see these results we have to actually run the tests. + No other code is necessary - we can just open the page + with our browser. +

+

+ On failure the display looks like this... +

+

TestOfLogging

+ Fail: testLogCreatesNewFileOnFirstMessage->True assertion failed.
+
1/1 test cases complete. + 1 passes and 1 fails.
+
+ ...and if it passes like this... +
+

TestOfLogging

+
1/1 test cases complete. + 2 passes and 0 fails.
+
+ And if you get this... +
+ Fatal error: Failed opening required '../classes/log.php' (include_path='') in /home/marcus/projects/lastcraft/tutorial_tests/Log/tests/log_test.php on line 7 +
+ it means you're missing the classes/Log.php file that could look like... + +class Log { + function Log($file_path) { + } + + function message() { + } +} +?> +]]> + It's fun to write the code after the test. + More than fun even - + this system is called "Test Driven Development". +

+

+ For more information about UnitTestCase, see + the unit test documentation. +

+
+
+

+ It is unlikely in a real application that we will only ever run + one test case. + This means that we need a way of grouping cases into a test + script that can, if need be, run every test for the application. +

+

+ Our first step is to create a new file called tests/all_tests.php + and insert the following code... +require_once('simpletest/autorun.php'); + +class AllTests extends TestSuite { + function AllTests() { + $this->TestSuite('All tests'); + $this->addFile('log_test.php'); + } +} +?> +]]> + The "autorun" include allows our upcoming test suite + to be run just by invoking this script. +

+

+ The TestSuite subclass must chain it's constructor. + This limitation will be removed in future versions. +

+

+ The method TestSuite::addFile() + will include the test case file and read any new classes + that are descended from SimpleTestCase. + UnitTestCase is just one example of a class derived from + SimpleTestCase, and you can create your own. + TestSuite::addFile() can include other test suites. +

+

+ The class will not be instantiated yet. + When the test suite runs it will construct each instance once + it reaches that test, then destroy it straight after. + This means that the constructor is run just before each run + of that test case, and the destructor is run before the next test case starts. +

+

+ It is common to group test case code into superclasses which are not + supposed to run, but become the base classes of other tests. + For "autorun" to work properly the test case file should not blindly run + any other test case extensions that do not actually run tests. + This could result in extra test cases being counted during the test + run. + Hardly a major problem, but to avoid this inconvenience simply mark your + base class as abstract. + SimpleTest won't run abstract classes. + If you are still using PHP4, then + a SimpleTestOptions::ignore() directive + somewhere in the test case file will have the same effect. +

+

+ Also, the test case file should not have been included + elsewhere or no cases will be added to this group test. + This would be a more serious error as if the test case classes are + already loaded by PHP the TestSuite::addFile() + method will not detect them. +

+

+ To display the results it is necessary only to invoke + tests/all_tests.php from the web server or the command line. +

+

+ For more information about building test suites, + see the test suite documentation. +

+
+
+

+ Let's move further into the future and do something really complicated. +

+

+ Assume that our logging class is tested and completed. + Assume also that we are testing another class that is + required to write log messages, say a + SessionPool. + We want to test a method that will probably end up looking + like this... + +class SessionPool { + ... + function logIn($username) { + ... + $this->_log->message("User $username logged in."); + ... + } + ... +} + +]]> + In the spirit of reuse, we are using our + Log class. + A conventional test case might look like this... +require_once('../classes/session_pool.php'); + +class TestOfSessionLogging extends UnitTestCase { + + function setUp() { + @unlink('/temp/test.log'); + } + + function tearDown() { + @unlink('/temp/test.log'); + } + + function testLoggingInIsLogged() { + $log = new Log('/temp/test.log'); + $session_pool = &new SessionPool($log); + $session_pool->logIn('fred'); + $messages = file('/temp/test.log'); + $this->assertEqual($messages[0], "User fred logged in.\n"); + } +} +?> +]]> + We'll explain the setUp() and tearDown() + methods later. +

+

+ This test case design is not all bad, but it could be improved. + We are spending time fiddling with log files which are + not part of our test. + We have created close ties with the Log class and + this test. + What if we don't use files any more, but use ths + syslog library instead? + It means that our TestOfSessionLogging test will + fail, even thouh it's not testing Logging. +

+

+ It's fragile in smaller ways too. + Did you notice the extra carriage return in the message? + Was that added by the logger? + What if it also added a time stamp or other data? +

+

+ The only part that we really want to test is that a particular + message was sent to the logger. + We can reduce coupling if we pass in a fake logging class + that simply records the message calls for testing, but + takes no action. + It would have to look exactly like our original though. +

+

+ If the fake object doesn't write to a file then we save on deleting + the file before and after each test. We could save even more + test code if the fake object would kindly run the assertion for us. +

+

+ Too good to be true? + We can create such an object easily... +Mock::generate('Log'); + +class TestOfSessionLogging extends UnitTestCase { + + function testLoggingInIsLogged() { + $log = &new MockLog(); + $log->expectOnce('message', array('User fred logged in.')); + $session_pool = &new SessionPool($log); + $session_pool->logIn('fred'); + } +} +?> +]]> + The Mock::generate() call code generated a new class + called MockLog. + This looks like an identical clone, except that we can wire test code + to it. + That's what expectOnce() does. + It says that if message() is ever called on me, it had + better be with the parameter "User fred logged in.". +

+

+ The test will be triggered when the call to + message() is invoked on the + MockLog object by SessionPool::logIn() code. + The mock call will trigger a parameter comparison and then send the + resulting pass or fail event to the test display. + Wildcards can be included here too, so you don't have to test every parameter of + a call when you only want to test one. +

+

+ If the mock reaches the end of the test case without the + method being called, the expectOnce() + expectation will trigger a test failure. + In other words the mocks can detect the absence of + behaviour as well as the presence. +

+

+ The mock objects in the SimpleTest suite can have arbitrary + return values set, sequences of returns, return values + selected according to the incoming arguments, sequences of + parameter expectations and limits on the number of times + a method is to be invoked. +

+

+ For more information about mocking and stubbing, see the + mock objects documentation. +

+
+
+

+ One of the requirements of web sites is that they produce web + pages. + If you are building a project top-down and you want to fully + integrate testing along the way then you will want a way of + automatically navigating a site and examining output for + correctness. + This is the job of a web tester. +

+

+ The web testing in SimpleTest is fairly primitive, as there is + no JavaScript. + Most other browser operations are simulated. +

+

+ To give an idea here is a trivial example where a home + page is fetched, from which we navigate to an "about" + page and then test some client determined content. +require_once('simpletest/web_tester.php'); + +class TestOfAbout extends WebTestCase { + function testOurAboutPageGivesFreeReignToOurEgo() { + $this->get('http://test-server/index.php'); + $this->click('About'); + $this->assertTitle('About why we are so great'); + $this->assertText('We are really great'); + } +} +?> +]]> + With this code as an acceptance test, you can ensure that + the content always meets the specifications of both the + developers, and the other project stakeholders. +

+

+ You can navigate forms too... +get('http://google.com/'); + $this->setField('q', 'simpletest'); + $this->click("I'm Feeling Lucky"); + $this->assertTitle('SimpleTest - Unit Testing for PHP'); + } +} +?> +]]> + ...although this could violate Google's(tm) terms and conditions. +

+

+ For more information about web testing, see the + scriptable + browser documentation and the + WebTestCase. +

+

+ SourceForge.net Logo +

+
+
+ + + Using unit tester + with an example. + + + Grouping tests + for testing with one click. + + + Using mock objects + to ease testing and gain tighter control. + + + Testing web pages + at the browser level. + + + + + Download PHP Simple Test + from SourceForge. + + + The developer's API for SimpleTest + gives full detail on the classes and assertions available. + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + junit, + php testing, + php unit, + methodology, + test first, + sourceforge, + open source, + unit test, + web tester, + web testing, + html testing tools, + testing web pages, + php mock objects, + navigating websites automatically, + automated testing, + web scripting, + wget, + curl testing, + jmock for php, + jwebunit, + phpunit, + php unit testing, + php web testing, + jason sweat, + marcus baker, + topstyle plug in, + phpedit plug in + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/softwares_using_simpletest.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/softwares_using_simpletest.xml new file mode 100644 index 0000000..368a501 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/softwares_using_simpletest.xml @@ -0,0 +1,164 @@ + + + + Softwares using SimpleTest + +
+

+ Some projects are able to extend SimpleTest's functionnality : +

+
+
+ + Limb Unit + +
+
+ limb_unit is an advanced SimpleTest based tests runner + utility for PHP5. In a nutshell, limb_unit finds and executes tests within + the file system. It's similar to phpunit utility from PHPUnit, + yet more powerful. +
+
+ + SimpleTestXUL + +
+
+ A XUL interface to SimpleTest framework. +
+
+ + Stagehand_TestRunner + +
+
+ Automated test runners for PHPUnit and SimpleTest. +
+
+ + Suite Tester + +
+
+ Suite Tester is an AJAX-driven add-on for the + PHP SimpleTest unit-testing tool. The main benefits are conveniently testing + an entire application or a single unit in one place, and quickly viewing + a suite's results one unit at a time. +
+ +
+
+
+

+ Others are using SimpleTest to build stuff : +

+
+
+ + CakePHP + +
+
+ CakePHP is a rapid development framework for PHP + which uses commonly known design patterns like ActiveRecord, + Association Data Mapping, Front Controller and MVC. +
+
+ + Web Application Component Toolkit + +
+
+ The Web Application Component Toolkit is + a framework for creating web applications. + WACT facilitates a modular approach where individual, + independent or reusable components may be integrated into a larger web + application. WACT assists in implementing the Model View Controller + pattern and the related Domain Model, Template View, Front Controller + and Application Controller patterns. +
+
+ + Limb3 + +
+
+ Limb is an OpenSource(LGPL) PHP framework aimed for + rapid web application development. + It is a committed proponents of the beautiful and + easy-to-maintain code that simply works. + That is why the Limb code is developed and constantly refactored in a + test driven manner using the best agile development practices. +
+
+ + Drupal | SimpleTest + +
+
+ A framework for running automated unit tests in Drupal. + This module comes with a set of core tests. These can be helpful when + making patches for the drupal core or when building your own set of + modules. +
+
+ + WideImage + +
+
+ WideImage is an object-oriented PHP image library, written + in/for PHP5. Uses GD2 and is unit-tested with Simpletest. Promotes ease of + use and extensibility. +
+
+ + Aperiplus + +
+
+ Aperiplus is a general purpose, unit-tested, OOP library + for PHP5. It contains extensions for SimpleTest. +
+
+ + Flux CMS + +
+
+ Flux CMS is a XML/XSLT CMS based on PHP 5 and Popoon. + It's easy to use for the enduser and has WYSIWYG editing capabilites, + but it's also very extensible and powerful for implementors to suit + your needs. +
+
+ + Moodle + +
+
+ Moodle is a course management system (CMS) - + a free, Open Source software package designed using sound pedagogical + principles, to help educators create effective online learning communities. +
+
+
+
+ + + Projects extending SimpleTest + + + And some using SimpleTest + + + + + + + + + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/speakers_coaches_consultancy.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/speakers_coaches_consultancy.xml new file mode 100644 index 0000000..ed0a67e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/speakers_coaches_consultancy.xml @@ -0,0 +1,94 @@ + + + + Speakers, coaches and consultants + +
+

+ Providing a tool -- SimpleTest -- to enable developpers + get started with Unit Testing and TDD is sometimes not enough. +

+

+ You need the "whole solution" : enjoying the knowledge of an + experienced coach or consultant can boost your strategy. + The team developping SimpleTest can offer in-depth expertise + to you projects. +

+
+
+ + + + + + +
+
+ + + + Providing the whole solution + + + Speakers, coaches and consultants close to you + + + + + + software development, + computer programmer, + php programming, + programming php, + software development company, + software development uk, + php tutorial, + bespoke software development uk, + corporate web development, + architecture, + freelancer, + php resources, + wordtracker, + web marketing, + serach engines, + web positioning, + internet marketing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/subclass_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/subclass_tutorial.xml new file mode 100644 index 0000000..17c5ce9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/subclass_tutorial.xml @@ -0,0 +1,255 @@ + + + + PHP unit testing tutorial - Subclassing a test case + +
+

+ We left our clock test with a hole. + If the PHP time() + function rolled over during this comparison... +assertEqual($clock->now(), time(), 'Now is the right time'); +} +]]> + ...our test would be out by one second and would cause + a false failure. + Erratic behaviour of our test suite is not what we want when + we could be running it a hundred times a day. +

+

+ We could rewrite the test as... + + $time1 = $clock->now(); + $time2 = time(); + $this->assertTrue($time1 == $time2) || ($time1 + 1 == $time2), 'Now is the right time'); +} +]]> + This is hardly a clear design though and we will have to repeat + this for every timing test that we do. + Repetition is public enemy number one and so we'll + use this as incentive to factor out the new test code. +UnitTestCase('Clock class test'); + } + function assertSameTime($time1, $time2, $message) { + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } + function testClockTellsTime() { + $clock = new Clock(); + $this->assertSameTime($clock->now(), time(), 'Now is the right time'); + } + function testClockAdvance() { + $clock = new Clock(); + $clock->advance(10); + $this->assertSameTime($clock->now(), time() + 10, 'Advancement'); + } +} +]]> + Of course each time I make one of these changes I rerun the + tests to make sure we are still OK. + Refactor on green. + It's a lot safer. +

+
+
+

+ It may be that we want more than one test case that is + timing sensitive. + Perhaps we are reading timestamps from database rows + or other places that could allow an extra second to + tick over. + For these new test classes to take advantage of our new assertion + we need to place it into a superclass. +

+

+ Here is the complete clock_test.php file after + promoting our assertSameTime() + method to its own superclass... + +class TimeTestCase extends UnitTestCase { + function TimeTestCase($test_name) { + $this->UnitTestCase($test_name); + } + function assertSameTime($time1, $time2, $message) { + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } +} + +class TestOfClock extends TimeTestCase { + function TestOfClock() { + $this->TimeTestCase('Clock class test'); + } + function testClockTellsTime() { + $clock = new Clock(); + $this->assertSameTime($clock->now(), time(), 'Now is the right time'); + } + function testClockAdvance() { + $clock = new Clock(); + $clock->advance(10); + $this->assertSameTime($clock->now(), time() + 10, 'Advancement'); + } +} +?> +]]> + Now we get the benefit of our new assertion every + time we inherit from our own + TimeTestCase class + rather than the default + UnitTestCase. + This is very much how the JUnit tool was designed + to be used and SimpleTest is a port of that interface. + It is a testing framework from which your own test + system can be grown. +

+

+ If we run the tests now we get a slight niggle... +

+ Warning: Missing argument 1 for timetestcase() + in /home/marcus/projects/lastcraft/tutorial_tests/tests/clock_test.php on line 5
+

All tests

+
3/3 test cases complete. + 6 passes and 0 fails.
+
+ The reasons for this are quite tricky. +

+

+ Our subclass requires a constructor parameter that has + not been supplied and yet it appears that we did + supply it. + When we inherited our new class we passed it in our own + constructor. + It's right here... +TimeTestCase('Clock class test'); +} +]]> + In fact we are right, that is not the problem. +

+

+ Remember when we built our all_tests.php + group test by using the + addTestFile() method. + This method looks for test case classes, instantiates + them if they are new and then runs all of their tests. + What's happened is that it has found our + test case extension as well. + This is harmless as there are no test methods within it, + that is, method names that start with the string + "test". + No extra tests are run. +

+

+ The trouble is that it instantiates the class and does this without + the $test_name parameter + which is what causes our warning. + This parameter is not normally required of a test + case and not normally of its assertions either. + To make our extended test case match the + UnitTestCase interface + we must make these optional... +$test_name = false) { + $this->UnitTestCase($test_name); + } + function assertSameTime($time1, $time2, $message = false) { + if (! $message) { + $message = "Time [$time1] should match time [$time2]"; + } + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } +} +]]> + Of course it should still bother you that this class is + instantiated by the test suite unnecessarily. + Here is a modification to prevent it running... +SimpleTestOptions::ignore('TimeTestCase'); +class TimeTestCase extends UnitTestCase { + function TimeTestCase($test_name = false) { + $this->UnitTestCase($test_name); + } + function assertSameTime($time1, $time2, $message = '') { + if (!$message) { + $message = "Time [$time1] should match time [$time2]"; + } + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } +} +]]> + This just tells SimpleTest to always ignore this class when + building test suites. + It can be included anywhere in the test case file. +

+

+ Six passes looks good, but does not tell the casual + observer what has been tested. + For that you have to look at the code. + If that sounds like drudge to you and you would like this + information displayed before you then we should go on + to show the passes next. +

+
+
+ + + A timing insensitive assertion + that allows a one second gain. + + + Subclassing the test case + so as to reuse the test method. + + + + + The previous section was + controlling test variables. + + + The next tutorial section was + changing the test display. + + + You will need the + SimpleTest test tool to run the + sample code. + + + + + software development, + test case example, + programming php, + software development tools, + php tutorial, + creating subclass, + free php scripts, + architecture, + php resources, + junit, + phpunit style testing, + unit test, + php testing + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/support_website.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/support_website.xml new file mode 100644 index 0000000..15b179d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/support_website.xml @@ -0,0 +1,59 @@ + + + + Support mailing list + + +

+ The simpletest-support mailing-list is probably + the most active area around SimpleTest : + help, advice, bugs and workarounds tend to happen most of the time. +

+
+
+

+ It's really + + easy to subscribe + and it's + + fully searchable too. +

+

+ At the last count, there were about 114 subscribers and 1908 message sent. + That's anything between 1 and 4 messages per day on average. +

+
+
+ + + To subscribe. + + + + + Subscribing to the + + Support mailing list. + + + Reading the + + archive. + + + + + SimpleTest, + download, + source code, + stable release, + eclipse release, + eclipse plugin, + debian package, + drupal module, + pear channel, + pearified package + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/unit_test_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/unit_test_documentation.xml new file mode 100644 index 0000000..adc9236 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/unit_test_documentation.xml @@ -0,0 +1,313 @@ + + + + SimpleTest for PHP regression test documentation + +
+

+ The core system is a regression testing framework built around + test cases. + A sample test case looks like this... +class FileTestCase extends UnitTestCase { +} +]]> + Actual tests are added as methods in the test case whose names + by default start with the string "test" and + when the test case is invoked all such methods are run in + the order that PHP introspection finds them. + As many test methods can be added as needed. +

+

+ For example... +UnitTestCase('File test'); + } + + function setUp() { + @unlink('../temp/test.txt'); + } + + function tearDown() { + @unlink('../temp/test.txt'); + } + + function testCreation() { + $writer = &new FileWriter('../temp/test.txt'); + $writer->write('Hello'); + $this->assertTrue(file_exists('../temp/test.txt'), 'File created'); + } +} +]]> + The constructor is optional and usually omitted. + Without a name, the class name is taken as the name of the test case. +

+

+ Our only test method at the moment is testCreation() + where we check that a file has been created by our + Writer object. + We could have put the unlink() + code into this method as well, but by placing it in + setUp() and + tearDown() we can use it with + other test methods that we add. +

+

+ The setUp() method is run + just before each and every test method. + tearDown() is run just after + each and every test method. +

+

+ You can place some test case set up into the constructor to + be run once for all the methods in the test case, but + you risk test inteference that way. + This way is slightly slower, but it is safer. + Note that if you come from a JUnit background this will not + be the behaviour you are used to. + JUnit surprisingly reinstantiates the test case for each test + method to prevent such interference. + SimpleTest requires the end user to use setUp(), but + supplies additional hooks for library writers. +

+

+ The means of reporting test results (see below) are by a + visiting display class + that is notified by various assert...() + methods. + Here is the full list for the UnitTestCase + class, the default for SimpleTest... + + + + + + + + + + + + + + + + + + + +
assertTrue($x)Fail if $x is false
assertFalse($x)Fail if $x is true
assertNull($x)Fail if $x is set
assertNotNull($x)Fail if $x not set
assertIsA($x, $t)Fail if $x is not the class or type $t
assertNotA($x, $t)Fail if $x is of the class or type $t
assertEqual($x, $y)Fail if $x == $y is false
assertNotEqual($x, $y)Fail if $x == $y is true
assertWithinMargin($x, $y, $m)Fail if abs($x - $y) < $m is false
assertOutsideMargin($x, $y, $m)Fail if abs($x - $y) < $m is true
assertIdentical($x, $y)Fail if $x == $y is false or a type mismatch
assertNotIdentical($x, $y)Fail if $x == $y is true and types match
assertReference($x, $y)Fail unless $x and $y are the same variable
assertClone($x, $y)Fail unless $x and $y are identical copies
assertPattern($p, $x)Fail unless the regex $p matches $x
assertNoPattern($p, $x)Fail if the regex $p matches $x
expectError($x)Swallows any upcoming matching error
assert($e)Fail on failed expectation object $e
+ All assertion methods can take an optional description as a + last parameter. + This is to label the displayed result with. + If omitted a default message is sent instead, which is usually + sufficient. + This default message can still be embedded in your own message + if you include "%s" within the string. + All the assertions return true on a pass or false on failure. +

+

+ Some examples... +$this->assertNull($variable, 'Should be cleared'); +]]> + ...will pass and normally show no message. + If you have + set up the tester to display passes + as well then the message will be displayed as is. +$this->assertIdentical(0, false, 'Zero is not false [%s]'); +]]> + This will fail as it performs a type + check, as well as a comparison, between the two values. + The "%s" part is replaced by the default + error message that would have been shown if we had not + supplied our own. +$this->assertReference($a, $b); +]]> + Will fail as the variable $a is a copy of $b. +$this->assertPattern('/hello/i', 'Hello world'); +]]> + This will pass as using a case insensitive match the string + hello is contained in Hello world. +$this->expectError(); +trigger_error('Catastrophe'); +]]> + Here the check catches the "Catastrophe" + message without checking the text and passes. + This removes the error from the queue. +$this->expectError('Catastrophe'); +trigger_error('Catastrophe'); +]]> + The next error check tests not only the existence of the error, + but also the text which, here matches so another pass. + If any unchecked errors are left at the end of a test method then + an exception will be reported in the test. +

+

+ Note that SimpleTest cannot catch compile time PHP errors. +

+

+ The test cases also have some convenience methods for debugging + code or extending the suite... + + + + + + + + +
setUp()Runs this before each test method
tearDown()Runs this after each test method
pass()Sends a test pass
fail()Sends a test failure
error()Sends an exception event
signal($type, $payload)Sends a user defined message to the test reporter
dump($var)Does a formatted print_r() for quick and dirty debugging
+

+
+
+

+ Of course additional test methods can be added to create + specific types of test case, so as to extend framework... + +class FileTester extends UnitTestCase { + function FileTester($name = false) { + $this->UnitTestCase($name); + } + + function assertFileExists($filename, $message = '%s') { + $this->assertTrue( + file_exists($filename), + sprintf($message, 'File [$filename] existence check')); + } +} +]]> + Here the SimpleTest library is held in a folder called + simpletest that is local. + Substitute your own path for this. +

+

+ To prevent this test case being run accidently, it is + advisable to mark it as abstract. +

+

+ Alternatively you could add a + SimpleTestOptions::ignore('FileTester'); + directive in your code. +

+

+ This new case can be now be inherited just like + a normal test case... +FileTester { + + function setUp() { + @unlink('../temp/test.txt'); + } + + function tearDown() { + @unlink('../temp/test.txt'); + } + + function testCreation() { + $writer = &new FileWriter('../temp/test.txt'); + $writer->write('Hello'); + $this->assertFileExists('../temp/test.txt'); + } +} +]]> +

+

+ If you want a test case that does not have all of the + UnitTestCase assertions, + only your own and a few basics, + you need to extend the SimpleTestCase + class instead. + It is found in simple_test.php rather than + unit_tester.php. + See later if you + want to incorporate other unit tester's + test cases in your test suites. +

+
+
+

+ You won't often run single test cases except when bashing + away at a module that is having difficulty, and you don't + want to upset the main test suite. + With autorun no particular scaffolding is needed, + just launch your particular test file and you're ready to go. +

+

+ You can even decide which reporter (for example, + TextReporter or HtmlReporter) + you prefer for a specific file when launched on its own... + +SimpleTest :: prefer(new TextReporter()); +require_once('../classes/writer.php'); + +class FileTestCase extends UnitTestCase { + ... +} +?> +]]> + This script will run as is, but of course will output zero passes + and zero failures until test methods are added. +

+
+
+ + + Unit test cases and basic assertions. + + + Extending test cases to + customise them for your own project. + + + Running a single case as + a single script. + + + + + SimpleTest project page on SourceForge. + + + SimpleTest download page on LastCraft. + + + Full API for SimpleTest + from the PHPDoc. + + + + + php unit testing, + test integration, + documentation, + marcus baker, + simple test, + simpletest documentation, + phpunit, + junit, + xunit, + agile web development, + eXtreme Programming, + Test Driven, + TDD + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/web_tester_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/web_tester_documentation.xml new file mode 100644 index 0000000..e2c9699 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/web_tester_documentation.xml @@ -0,0 +1,379 @@ + + + + Simple Test for PHP web script testing documentation + +
+

+ Testing classes is all very well, but PHP is predominately + a language for creating functionality within web pages. + How do we test the front end presentation role of our PHP + applications? + Well the web pages are just text, so we should be able to + examine them just like any other test data. +

+

+ This leads to a tricky issue. + If we test at too low a level, testing for matching tags + in the page with pattern matching for example, our tests will + be brittle. + The slightest change in layout could break a large number of + tests. + If we test at too high a level, say using mock versions of a + template engine, then we lose the ability to automate some classes + of test. + For example, the interaction of forms and navigation will + have to be tested manually. + These types of test are extremely repetitive and error prone. +

+

+ SimpleTest includes a special form of test case for the testing + of web page actions. + The WebTestCase includes facilities + for navigation, content and cookie checks and form handling. + Usage of these test cases is similar to the + UnitTestCase... +class TestOfLastcraft extends WebTestCase { +} +]]> + Here we are about to test the + Last Craft site itself. + If this test case is in a file called lastcraft_test.php + then it can be loaded in a runner script just like unit tests... + +require_once('simpletest/web_tester.php'); +SimpleTest::prefer(new TextReporter()); + +class WebTests extends TestSuite { + function WebTests() { + $this->TestSuite('Web site tests'); + $this->addFile('lastcraft_test.php'); + } +} +?> +]]> + I am using the text reporter here to more clearly + distinguish the web content from the test output. +

+

+ Nothing is being tested yet. + We can fetch the home page by using the + get() method... + + function testHomepage() { + $this->assertTrue($this->get('http://www.lastcraft.com/')); + } +} +]]> + The get() method will + return true only if page content was successfully + loaded. + It is a simple, but crude way to check that a web page + was actually delivered by the web server. + However that content may be a 404 response and yet + our get() method will still return true. +

+

+ Assuming that the web server for the Last Craft site is up + (sadly not always the case), we should see... +

+Web site tests
+OK
+Test cases run: 1/1, Failures: 0, Exceptions: 0
+
+ All we have really checked is that any kind of page was + returned. + We don't yet know if it was the right one. +

+
+
+

+ To confirm that the page we think we are on is actually the + page we are on, we need to verify the page content. + + $this->get('http://www.lastcraft.com/'); + $this->assertText('Why the last craft'); + } +} +]]> + The page from the last fetch is held in a buffer in + the test case, so there is no need to refer to it directly. + The pattern match is always made against the buffer. +

+

+ Here is the list of possible content assertions... + + + + + + + + + + + + + + + + + + + + + +
assertTitle($title)Pass if title is an exact match
assertText($text)Pass if matches visible and "alt" text
assertNoText($text)Pass if doesn't match visible and "alt" text
assertPattern($pattern)A Perl pattern match against the page content
assertNoPattern($pattern)A Perl pattern match to not find content
assertLink($label)Pass if a link with this text is present
assertNoLink($label)Pass if no link with this text is present
assertLinkById($id)Pass if a link with this id attribute is present
assertNoLinkById($id)Pass if no link with this id attribute is present
assertField($name, $value)Pass if an input tag with this name has this value
assertFieldById($id, $value)Pass if an input tag with this id has this value
assertResponse($codes)Pass if HTTP response matches this list
assertMime($types)Pass if MIME type is in this list
assertAuthentication($protocol)Pass if the current challenge is this protocol
assertNoAuthentication()Pass if there is no current challenge
assertRealm($name)Pass if the current challenge realm matches
assertHeader($header, $content)Pass if a header was fetched matching this value
assertNoHeader($header)Pass if a header was not fetched
assertCookie($name, $value)Pass if there is currently a matching cookie
assertNoCookie($name)Pass if there is currently no cookie of this name
+ As usual with the SimpleTest assertions, they all return + false on failure and true on pass. + They also allow an optional test message and you can embed + the original test message inside using "%s" inside + your custom message. +

+

+ So now we could instead test against the title tag with... +$this->assertTitle('The Last Craft? Web developer tutorials on PHP, Extreme programming and Object Oriented development'); +]]> + ...or, if that is too long and fragile... +$this->assertTitle(new PatternExpectation('/The Last Craft/')); +]]> + As well as the simple HTML content checks we can check + that the MIME type is in a list of allowed types with... +$this->assertMime(array('text/plain', 'text/html')); +]]> + More interesting is checking the HTTP response code. + Like the MIME type, we can assert that the response code + is in a list of allowed values... +get('http://www.lastcraft.com/test/redirect.php'); + $this->assertResponse(200); + } +} +]]> + Here we are checking that the fetch is successful by + allowing only a 200 HTTP response. + This test will pass, but it is not actually correct to do so. + There is no page, instead the server issues a redirect. + The WebTestCase will + automatically follow up to three such redirects. + The tests are more robust this way and we are usually + interested in the interaction with the pages rather + than their delivery. + If the redirects are of interest then this ability must + be disabled... + + $this->setMaximumRedirects(0); + $this->get('http://www.lastcraft.com/test/redirect.php'); + $this->assertResponse(200); + } +} +]]> + The assertion now fails as expected... +

+Web site tests
+1) Expecting response in [200] got [302]
+    in testhomepage
+    in testoflastcraft
+    in lastcraft_test.php
+FAILURES!!!
+Test cases run: 1/1, Failures: 1, Exceptions: 0
+
+ We can modify the test to correctly assert redirects with... +setMaximumRedirects(0); + $this->get('http://www.lastcraft.com/test/redirect.php'); + $this->assertResponse(array(301, 302, 303, 307)); + } +} +]]> + This now passes. +

+
+
+

+ Users don't often navigate sites by typing in URLs, but by + clicking links and buttons. + Here we confirm that the contact details can be reached + from the home page... +get('http://www.lastcraft.com/'); + $this->clickLink('About'); + $this->assertTitle(new PatternExpectation('/About Last Craft/')); + } +} +]]> + The parameter is the text of the link. +

+

+ If the target is a button rather than an anchor tag, then + clickSubmit() can be used + with the button title... +$this->clickSubmit('Go!'); +]]> + If you are not sure or don't care, the usual case, then just + use the click() method... +$this->click('Go!'); +]]> +

+

+ The list of navigation methods is... + + + + + + + + + + + + + + + + + + + + + + + + + +
getUrl()The current location
get($url, $parameters)Send a GET request with these parameters
post($url, $parameters)Send a POST request with these parameters
head($url, $parameters)Send a HEAD request without replacing the page content
retry()Reload the last request
back()Like the browser back button
forward()Like the browser forward button
authenticate($name, $password)Retry after a challenge
restart()Restarts the browser as if a new session
getCookie($name)Gets the cookie value for the current context
ageCookies($interval)Ages current cookies prior to a restart
clearFrameFocus()Go back to treating all frames as one page
clickSubmit($label)Click the first button with this label
clickSubmitByName($name)Click the button with this name attribute
clickSubmitById($id)Click the button with this ID attribute
clickImage($label, $x, $y)Click an input tag of type image by title or alt text
clickImageByName($name, $x, $y)Click an input tag of type image by name
clickImageById($id, $x, $y)Click an input tag of type image by ID attribute
submitFormById($id)Submit a form without the submit value
clickLink($label, $index)Click an anchor by the visible label text
clickLinkById($id)Click an anchor by the ID attribute
getFrameFocus()The name of the currently selected frame
setFrameFocusByIndex($choice)Focus on a frame counting from 1
setFrameFocus($name)Focus on a frame by name
+

+

+ The parameters in the get(), post() or + head() methods are optional. + The HTTP HEAD fetch does not change the browser context, only loads + cookies. + This can be useful for when an image or stylesheet sets a cookie + for crafty robot blocking. +

+

+ The retry(), back() and + forward() commands work as they would on + your web browser. + They use the history to retry pages. + This can be handy for checking the effect of hitting the + back button on your forms. +

+

+ The frame methods need a little explanation. + By default a framed page is treated just like any other. + Content will be searced for throughout the entire frameset, + so clicking a link will work no matter which frame + the anchor tag is in. + You can override this behaviour by focusing on a single + frame. + If you do that, all searches and actions will apply to that + frame alone, such as authentication and retries. + If a link or button is not in a focused frame then it cannot + be clicked. +

+

+ Testing navigation on fixed pages only tells you when you + have broken an entire script. + For highly dynamic pages, such as for bulletin boards, this can + be crucial for verifying the correctness of the application. + For most applications though, the really tricky logic is usually in + the handling of forms and sessions. + Fortunately SimpleTest includes + tools for testing web forms + as well. +

+
+
+

+ Although SimpleTest does not have the goal of testing networking + problems, it does include some methods to modify and debug + the requests it makes. + Here is another method list... + + + + + + + + + + + +
getTransportError()The last socket error
showRequest()Dump the outgoing request
showHeaders()Dump the incoming headers
showSource()Dump the raw HTML page content
ignoreFrames()Do not load framesets
setCookie($name, $value)Set a cookie from now on
addHeader($header)Always add this header to the request
setMaximumRedirects($max)Stop after this many redirects
setConnectionTimeout($timeout)Kill the connection after this time between bytes
useProxy($proxy, $name, $password)Make requests via this proxy URL
+ These methods are principally for debugging. +

+
+
+ + + Successfully fetching a web page + + + Testing the page content + + + Navigating a web site + while testing + + + Raw request modifications and debugging methods + + + + + SimpleTest project page on SourceForge. + + + SimpleTest download page on LastCraft. + + + The developer's API for SimpleTest + gives full detail on the classes and assertions available. + + + + + software development, + php programming for clients, + customer focused php, + software development tools, + acceptance testing framework, + free php scripts, + architecture, + php resources, + HTMLUnit, + JWebUnit, + php testing, + unit test resource, + web testing + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/writing_extensions.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/writing_extensions.xml new file mode 100644 index 0000000..6e34afc --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/en/writing_extensions.xml @@ -0,0 +1,128 @@ + + + + Writing an extension for SimpleTest + + +

+ SimpleTest is coded to be flexible and extensible. + It means you can add your own assertions. + You can also add your own reporter or any other tool worth your fancy. + In fact there's a special directory inside SimpleTest SVN trunk devoted + to such kind of experimentations. +

+
+
+

+ There's a growing list of available extensions: +

+
+
colortext_reporter
+
+ provides an ANSI-colored {@link TextReporter} for viewing test results. +
+
dom_tester
+
+ create a CSS Selector expectation. +
+
pear_test_case
+
+ provides an adapter for PEAR PHPUnit test case to allow + legacy PEAR test cases to be used with SimpleTest. +
+
phpunit_test_case
+
+ provides an adapter for sourceforge PHPUnit test case to allow + legacy test cases to be used with SimpleTest. +
+
recorder
+
+ returns an array with timestamp, status, test name + and message for each pass and failure. +
+
selenese_tester
+
+ integrates selenese html test suite support + (can be generated by selenium-IDE). +
+
selenium
+
+ provides a bridge to a Selenium server. +
+
testdox
+
+ ... +
+
treemap_reporter
+
+ constructs and renders a treemap visualization of a test run. +
+
webunit_reporter
+
+ ... +
+
+
+
+

+ If you want to have your own extension accepted inside the SVN trunk, + juste make sure you follow these simple rules: +

    +
  1. + Main code goes into a file located at
    + /extensions/my_new_extension.php +
  2. +
  3. + If you need extra stuff (classes, sub-routines, js or css files), + make sure everything is located your own
    + /extensions/my_new_extension/* +
  4. +
  5. + And since your package is unit-tested, + your tests go into
    + /extensions/my_new_extension/test/*
    + or
    + /extensions/my_new_extension/* +
  6. +
  7. + Bonus : you can get your own test suite caught directly + from SimpleTest. There's dedicated test scanning recursively + the extensions' directories and running the test file matching + /test.php$/. + An easy way for us to check if everyone's extension carries + on working with the current code base... +
  8. +
+ Also for general coding practices, you can have a look at the + coding standards and formatting. +

+
+
+ + Existing extensions + Committing a new extension + + + + + + software development, + php programming, + programming php, + software development tools, + php tutorial, + free php scripts, + architecture, + php resources, + mock objects, + plugins, + extensions, + extension, + selenium, + selenese, + testdox, + treemap, + reporter + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/authentication_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/authentication_documentation.xml new file mode 100644 index 0000000..b3ef8d1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/authentication_documentation.xml @@ -0,0 +1,307 @@ + + + + + Documentation Simple Test : tester l'authentification + + +

+ Un des secteurs la fois dlicat et important lors d'un test + de site web reste la scurit. Tester ces schmas est au coeur + des objectifs du testeur web de SimpleTest. +

+
+
+

+ Si vous allez chercher une page web protge + par une authentification basique, vous hriterez d'une entte 401. + Nous pouvons reprsenter ceci par ce test... + + function test401Header() { + $this->get('http://www.lastcraft.com/protected/'); + $this->showHeaders(); + } +} +]]> + Ce qui nous permet de voir les enttes reues... +

+

File test

+
+
1/1 test cases complete. + 0 passes, 0 fails and 0 exceptions.
+
+ Sauf que nous voulons viter l'inspection visuelle, + on souhaite que SimpleTest puisse nous dire si oui ou non + la page est protge. Voici un test en profondeur sur nos enttes... +get('http://www.lastcraft.com/protected/'); + $this->assertAuthentication('Basic'); + $this->assertResponse(401); + $this->assertRealm('SimpleTest basic authentication'); + } +} +]]> + N'importe laquelle de ces assertions suffirait, + tout dpend de la masse de dtails que vous souhaitez voir. +

+

+ La plupart du temps, nous ne souhaitons pas tester + l'authentification en elle-mme, mais plutt + les pages protges par cette authentification. + Ds que la tentative d'authentification est reue, + nous pouvons y rpondre l'aide d'une rponse d'authentification : +get('http://www.lastcraft.com/protected/'); + $this->authenticate('Me', 'Secret'); + $this->assertTitle(...); + } +} +]]> + Le nom d'utilisateur et le mot de passe seront dsormais + envoys chaque requte vers ce rpertoire + et ses sous-rpertoires. + En revanche vous devrez vous authentifier nouveau + si vous sortez de ce rpertoire mais SimpleTest est assez + intelligent pour fusionner les sous-rpertoires dans un mme domaine. +

+

+ Vous pouvez gagner une ligne en dfinissant + l'authentification au niveau de l'URL... +get('http://Me:Secret@www.lastcraft.com/protected/'); + $this->assertTitle(...); + } +} +]]> + Si votre nom d'utilisateur ou mot de passe comporte + des caractres spciaux, alors n'oubliez pas de les encoder, + sinon la requte ne sera pas analyse correctement. + De plus cette entte ne sera pas envoye aux + sous requtes si vous la dfinissez avec une URL absolue. + Par contre si vous naviguez avec des URL relatives, + l'information d'authentification sera prserve. +

+

+ Pour l'instant, seule l'authentification de base est implmente + et elle n'est rellement fiable qu'en tandem avec une connexion HTTPS. + C'est gnralement suffisant pour protger + le serveur test des regards malveillants. + Les authentifications Digest et NTLM pourraient tre ajoutes prochainement. +

+
+
+

+ L'authentification de base ne donne pas assez de contrle + au dveloppeur Web sur l'interface utilisateur. + Il y a de forte chance pour que cette fonctionnalit + soit code directement dans l'architecture web + grand renfort de cookies et de timeouts compliqus. +

+

+ Commenons par un simple formulaire de connexion... +


+    Username:
+    
+ Password: +
+ + +]]>
+ Lequel doit ressembler ... +

+

+

+ Username: +
+ Password: +
+ +
+

+

+ Supposons que, durant le chargement de la page, + un cookie ait t inscrit avec un numro d'identifiant de session. + Nous n'allons pas encore remplir le formulaire, + juste tester que nous pistons bien l'utilisateur. + Voici le test... +get('http://www.my-site.com/login.php'); + $this->assertCookie('SID'); + } +} +]]> + Nous nous contentons ici de vrifier que le cookie a bien t dfini. + Etant donn que sa valeur est plutt nigmatique, + elle ne vaut pas la peine d'tre teste. +

+

+ Le reste du test est le mme que dans n'importe quel autre formulaire, + mais nous pourrions souhaiter nous assurer + que le cookie n'a pas t modifi depuis la phase de connexion. + Voici comment cela pourrait tre test : +get('http://www.my-site.com/login.php'); + $session = $this->getCookie('SID'); + $this->setField('u', 'Me'); + $this->setField('p', 'Secret'); + $this->clickSubmit('Log in'); + $this->assertWantedPattern('/Welcome Me/'); + $this->assertCookie('SID', $session); + } +} +]]> + Ceci confirme que l'identifiant de session + est identique avant et aprs la connexion. +

+

+ Nous pouvons mme essayer de duper notre propre systme + en crant un cookie arbitraire pour se connecter... +get('http://www.my-site.com/login.php'); + $this->setCookie('SID', 'Some other session'); + $this->get('http://www.my-site.com/restricted.php'); + $this->assertWantedPattern('/Access denied/'); + } +} +]]> + Votre site est-il protg contre ce type d'attaque ? +

+
+
+

+ Si vous testez un systme d'authentification, + la reconnexion par un utilisateur est un point sensible. + Essayons de simuler ce qui se passe dans ce cas : +get('http://www.my-site.com/login.php'); + $this->setField('u', 'Me'); + $this->setField('p', 'Secret'); + $this->clickSubmit('Log in'); + $this->assertWantedPattern('/Welcome Me/'); + + $this->restart(); + $this->get('http://www.my-site.com/restricted.php'); + $this->assertWantedPattern('/Access denied/'); + } +} +]]> + La mthode WebTestCase::restart() prserve les cookies + dont le timeout a expir, mais conserve les cookies temporaires ou expirs. + Vous pouvez spcifier l'heure et la date de leur ractivation. +

+

+ L'expiration des cookies peut tre un problme. + Si vous avez un cookie qui doit expirer au bout d'une heure, + nous n'allons pas mettre le test en veille en attendant + que le cookie expire... +

+

+ Afin de provoquer leur expiration, + vous pouvez dater manuellement les cookies, + avant le dbut de la session. +get('http://www.my-site.com/login.php'); + $this->setField('u', 'Me'); + $this->setField('p', 'Secret'); + $this->clickSubmit('Log in'); + $this->assertWantedPattern('/Welcome Me/'); + + $this->ageCookies(3600); + $this->restart(); + $this->get('http://www.my-site.com/restricted.php'); + $this->assertWantedPattern('/Access denied/'); + } +} +]]> + Aprs le redmarrage, les cookies seront plus vieux + d'une heure et que tous ceux dont la date d'expiration + sera passe auront disparus. +

+
+
+ + + Passer au travers d'une authentification HTTP basique + + + Tester l'authentification base sur des cookies + + + Grer les sessions du navigateur et les timeouts + + + + + La page du projet SimpleTest sur SourceForge. + + + La page de tlchargement de SimpleTest sur LastCraft. + + + L'API du dveloppeur pour SimpleTest donne tous les dtails sur les classes et les assertions disponibles. + + + + + dveloppement logiciel, + programmation php, + php orient client, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + architecture, + ressources php, + objets fantaise, + php testing, + php unit, + mthodologie, + dveloppement pilot par les tests, + outils tests html, + tester des web pages, + php objets fantaise, + naviguer automatiquement sur des sites web, + test automatis, + scripting web, + HTMLUnit, + JWebUnit, + phpunit, + php unit testing, + php web testing, + test unitaire de systme d'authentification, + authentification HTTP, + test de connexion, + test d'authentification, + test de scurit + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/books_website.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/books_website.xml new file mode 100644 index 0000000..5e198fd --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/books_website.xml @@ -0,0 +1,77 @@ + + + + + Livres avec / propos / pas loin de SimpleTest + +
+

+ De temps en temsp, un livre est recommand sur la mailing-list, + vous le trouverez ci-dessous avec les commentaires originaux ! +

+

+ Domain-Driven Design: Tackling Complexity in the Heart of Software +

+
+ Le Dveloppement Pilot par les Tests est principalement intress par + les mcanismes pour coder, mais il dit que c'est fini quand il n'y plus + de duplication. Le Dveloppement Pilot par la Conception (DDD) considre + que le code est constamment in churn, changeant de terminologie au + fur et mesure que le domaine devient plus clair, et aussi nourrisant le domaine + avec des nouveaux termes quand le code volue..
+
+ Et puis, c'est un super bouquin :) + [source] +
+
+
+

+ Deux contributeurs de Simpletest ont crit des livres sur PHP. + Tous les deux ont de nombreux exemples avec le framework SimpleTest. +

+

+ PHP|Architect's Guide to PHP Design Patterns +
+ PHP|Architect's Guide to PHP Design Patterns
+ par Jason E. Sweat
+ (l'obtenir depuis : PHP|Architect | + Amazon ) +

+

+ The PHP Anthology: Object Oriented PHP Solutions +
+ The PHP Anthology: Object Oriented PHP Solutions
+ par Harry Fuecks
+ (l'obtenir depuis : SitePoint | + Amazon | + critique sur Slashdot ) +

+
+
+

+ Une manire d'aider l'quipe de contributeurs, c'est d'acheter des livres via + cete page avec Amazon (avec le mot-cl simpletest-21). + Nous adorons tous lire des trucs la fois intressants et stimulants. +

+
+
+ + + Latest recommandation + + + Books by contributors + + + Buying books + + + + + + + + + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/boundary_classes_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/boundary_classes_tutorial.xml new file mode 100644 index 0000000..bf26c71 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/boundary_classes_tutorial.xml @@ -0,0 +1,410 @@ + + + + + + Tutorial de tests unitaires PHP - Organiser les tests unitaires et les scnarios de test de classe frontire + + + +

+ Vous pensez probablement que nous avons dsormais puis + les modifications sur la classe Log + et qu'il n'y a plus rien ajouter. + Sauf que les choses ne sont jamais simples avec la Programmation Orient Objet. + Vous pensez comprendre un problme et un nouveau cas arrive : + il dfie votre point de vue et vous conduit + vers une analyse encore plus profonde. + Je pensais comprendre la classe de log et + que seule la premire page du tutorial l'utiliserait. + Aprs a, je serais pass quelque chose de plus compliqu. + Personne n'est plus surpris que moi de ne pas l'avoir boucle. + En fait je pense que je viens peine + de me rendre compte de ce qu'un loggueur fait. +

+
+
+

+ Supposons que nous ne voulons plus seulement enregistrer + les logs vers un fichier. Nous pourrions vouloir les afficher l'cran, + les envoyer au daemon syslog d'Unix(tm) via un socket. + Comment s'accommoder de tels changements ? +

+

+ Le plus simple est de crer des sous-classes de Log + qui crasent la mthode message() avec les nouvelles versions. + Ce systme fonctionne bien court terme, sauf qu'il a quelque chose + de subtilement mais foncirement erron. Supposons que nous crions + ces sous-classes et que nous ayons des loggueurs crivant vers un fichier, + sur l'cran et via le rseau. Trois classes en tout : a fonctionne. + Maintenant supposons que nous voulons ajouter une nouvelle classe de log + qui ajoute un filtrage par priorit des messages, ne laissant passer + que les messages d'un certain type, le tout suivant un fichier de configuration. +

+

+ Nous sommes coincs. Si nous crons de nouvelles sous-classes, + nous devons le faire pour l'ensemble des trois classes, + ce qui nous donnerait six classes. L'envergure de la duplication est horrible. +

+

+ Alors, est-ce que vous tes en train de souhaiter que PHP ait + l'hritage multiple ? Effectivement, cela rduirait l'ampleur + de la tche court terme, mais aussi compliquerait quelque + chose qui devrait tre une classe trs simple. L'hritage multiple, + mme support, devrait tre utilis avec le plus grand soin car + toutes sortes d'enchevtrements peuvent en dcouler. + En fait ce soudain besoin nous dit quelque chose d'autre + - peut-tre que notre erreur si situe au niveau de la conception. +

+

+ Qu'est-ce que doit faire un loggueur ? Est-ce qu'il envoie + un message vers un fichier ? A l'cran ? Via le rseau ? Non. + Il envoie un message, point final. La cible de ses messages + peut tre slectionne l'initialisation du log, + mais aprs a pas touche : le loggueur doit pouvoir combiner + et formater les lments du message puisque tel est son vritable boulot. + Prsumer que la cible fut un nom de fichier tait une belle paire d'oeillres. +

+
+
+

+ La solution de cette mauvaise passe est un classique. + Tout d'abord nous encapsulons la variation de la classe : + cela ajoute un niveau d'indirection. Au lieu d'introduire + le nom du fichier comme une chane, nous l'introduisons comme + "cette chose vers laquelle on crit" et que + nous appelons un Writer. Retour aux tests... + + require_once('../classes/writer.php'); + Mock::generate('Clock'); + + class TestOfLogging extends UnitTestCase { + function TestOfLogging() { + $this->UnitTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function getFileLine($filename, $index) { + $messages = file($filename); + return $messages[$index]; + } + function testCreatingNewFile() { + $log = new Log(new FileWriter('../temp/test.log')); + $this->assertFalse(file_exists('../temp/test.log'), 'Created before message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + } + function testAppendingToFile() { + $log = new Log(new FileWriter('../temp/test.log')); + $log->message('Test line 1'); + $this->assertWantedPattern( + '/Test line 1/', + $this->getFileLine('../temp/test.log', 0)); + $log->message('Test line 2'); + $this->assertWantedPattern( + '/Test line 2/', + $this->getFileLine('../temp/test.log', 1)); + } + function testTimestamps() { + $clock = &new MockClock($this); + $clock->setReturnValue('now', 'Timestamp'); + $log = new Log(new FileWriter('../temp/test.log')); + $log->message('Test line', &$clock); + $this->assertWantedPattern( + '/Timestamp/', + $this->getFileLine('../temp/test.log', 0), + 'Found timestamp'); + } + } +?> +]]> + Je vais parcourir ces tests pas pas pour ne pas ajouter + trop de confusion. J'ai remplac les noms de fichier par + une classe imaginaire FileWriter en provenance + d'un fichier classes/writer.php. + Par consquent les tests devraient planter + puisque nous n'avons pas encore crit ce scripteur. + Doit-on le faire maintenant ? +

+

+ Nous pourrions, mais ce n'est pas oblig. + Par contre nous avons besoin de crer l'interface, + ou alors il ne sera pas possible de la simuler. + Au final classes/writer.php ressemble ... + +]]> + Nous avons aussi besoin de modifier la classe Log... + + require_once('../classes/writer.php'); + + class Log { + var $_writer; + + function Log(&$writer) { + $this->_writer = &$writer; + } + + function message($message, $clock = false) { + if (! is_object($clock)) { + $clock = new Clock(); + } + $this->_writer->write("[" . $clock->now() . "] $message"); + } + } +?> +]]> + Il n'y a pas grand chose qui n'ait pas chang y compris + dans la plus petite de nos classes. Dsormais les tests + s'excutent mais ne passent pas, moins que nous ajoutions + du code dans le scripteur. Alors que faisons nous ? +

+

+ Nous pourrions commencer par crire des tests et + dvelopper la classe FileWriter paralllement, + mais lors de cette tape nos tests de Log + continueraient d'chouer et de nous distraire. + En fait nous n'en avons pas besoin. +

+

+ Une partie de notre objectif est de librer la classe + du loggueur de l'emprise du systme de fichiers + et il existe un moyen d'y arriver. + Tout d'abord nous crons le fichier tests/writer_test.php + de manire avoir un endroit pour placer + notre code test en provenance de log_test.php + et que nous allons brasser. Sauf que je ne vais pas l'ajouter + dans le fichier all_tests.php pour l'instant + puisque qu'il s'agit de la partie de log que nous sommes en train d'aborder. +

+

+ Nous enlevons tous les test de log_test.php + qui ne sont pas strictement en lien avec le journal + et nous les gardons bien prcieusement dans + writer_test.php pour plus tard. + Nous allons aussi simuler le scripteur pour qu'il n'crive pas + rellement dans un fichier... + + Mock::generate('FileWriter'); + + class TestOfLogging extends UnitTestCase { + function TestOfLogging() { + $this->UnitTestCase('Log class test'); + } + function testWriting() { + $clock = &new MockClock($this); + $clock->setReturnValue('now', 'Timestamp'); + $writer = &new MockFileWriter($this); + $writer->expectArguments('write', array('[Timestamp] Test line')); + $writer->expectCallCount('write', 1); + $log = &new Log($writer); + $log->message('Test line', &$clock); + $writer->tally(); + } + } +?> +]]> + Eh oui c'est tout : il s'agit bien de l'ensemble du scnario de test + et c'est normal qu'il soit aussi court. Pas mal de choses se sont passes... +

    +
  1. + La ncessit de crer le fichier uniquement + si ncessaire a t dplace vers le FileWriter. +
  2. +
  3. + tant donn que nous travaillons avec des objets fantaisie, + aucun fichier n'a t cr et donc setUp() + et tearDown() passent dans les tests du scripteur. +
  4. +
  5. + Dsormais le test consiste simplement dans l'envoi + d'un message type et du test de son format. +
  6. +
+ Attendez un instant, o sont les assertions ? +

+

+ Les objets fantaisie font beaucoup plus que se comporter + comme des objets, ils excutent aussi des test. + L'appel expectArguments() dit l'objet fantaisie + d'attendre un seul paramtre de la chane "[Timestamp] Test" + quand la mthode fantaise write() est appele. + Lorsque cette mthode est appele les paramtres attendus + sont compars avec ceci et un succs ou un chec est renvoy + comme rsultat au test unitaire. + C'est pourquoi un nouvel objet fantaisie a une rfrence + vers $this dans son constructeur, + il a besoin de ce $this pour l'envoi de son propre rsultat. +

+

+ L'autre attente, c'est que le write ne soit appel + qu'une seule et unique fois. Juste l'initialiser ne serait pas suffisant. + L'objet fantaisie attendrait une ternit + si la mthode n'tait jamais appele + et par consquent n'enverrait jamais + le message d'erreur la fin du test. + Pour y faire face, l'appel tally() lui dit de vrifier + le nombre d'appel ce moment l. + Nous pouvons voir tout a en lanant les tests... +

+

All tests

+ Pass: log_test.php->Log class test->testwriting->Arguments for [write] were [String: [Timestamp] Test line]
+ Pass: log_test.php->Log class test->testwriting->Expected call count for [write] was [1], but got [1]
+ + Pass: clock_test.php->Clock class test->testclockadvance->Advancement
+ Pass: clock_test.php->Clock class test->testclocktellstime->Now is the right time
+
3/3 test cases complete. + 4 passes and 0 fails.
+
+

+

+ En fait nous pouvons encore raccourcir nos tests. + L'attente de l'objet fantaisie expectOnce() + peut combiner les deux attentes spares. +setReturnValue('now', 'Timestamp'); + $writer = &new MockFileWriter($this); + $writer->expectOnce('write', array('[Timestamp] Test line')); + $log = &new Log($writer); + $log->message('Test line', &$clock); + $writer->tally(); +} +]]> + Cela peut tre une abrviation utile. +

+
+
+

+ Quelque chose de trs agrable est arrive au loggueur + en plus de devenir purement et simplement plus court. +

+

+ Les seules choses dont il dpend sont maintenant + des classes que nous avons crites nous-mme + et qui dans les tests sont simules : + donc aucune dpendance hormis notre propre code PHP. + Pas de fichier crire ni de dclenchement + via une horloge attendre. Cela veut dire que le scnario + de test log_test.php va s'excuter aussi vite + que le processeur le permet. + Par contraste les classes FileWriter et Clock + sont trs proches du systme. + Plus difficile tester puisque de vraies donnes + doivent tre dplaces et valides avec soin, + souvent par des astuces ad hoc. +

+

+ Notre dernire factorisation a beaucoup aid. + Les classes aux frontires de l'application et du systme, + celles qui sont difficiles tester, sont dsormais plus courtes + tant donn que le code d'I/O a t loign + encore plus de la logique applicative. + Il existe des liens directs vers des oprations PHP : + FileWriter::write() s'apparente l'quivalent + PHP fwrite() avec le fichier ouvert pour l'ajout + et Clock::now() s'apparente lui aussi + un quivalent PHP time(). + Primo le dbogage devient plus simple. + Secundo ces classes devraient bouger moins souvent. +

+

+ Si elles ne changent pas beaucoup alors il n'y a aucune raison + pour continuer en excuter les tests. + Cela veut dire que les tests pour les classes frontires + peuvent tre dplaces vers leur propre suite de tests, + laissant les autres tourner plein rgime. + En fait c'est comme a que j'ai tendance travailler + et les scnarios de test de SimpleTest + lui-mme sont diviss de cette manire. +

+

+ Peut-tre que a ne vous parat pas beaucoup + avec un test unitaire et deux tests aux frontires, + mais une application typique peut contenir + vingt classes de frontire et deux cent classes d'application. + Pour continuer leur excution toute vitesse, + vous voudrez les tenir spares. +

+

+ De plus, un bon dveloppement passe par des dcisions + de tri entre les composants utiliser. + Peut-tre, qui sait, tous ces simulacres pourront + amliorer votre conception. +

+
+
+ + + + Variations sur un log + + + Abstraire un niveau supplmentaire via une classe + fantaisie d'un scripteur + + + Sparer les tests des classes frontires + pour un petit nettoyage + + + + + Ce tutorial suit l'introduction aux + objets fantaisies. + + + Ensuite vient la + conception pilote par les tests. + + + Vous aurez besoin du + framework de test SimpleTest pour essayer ces exemples. + + + + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + organisation de tests unitaires, + conseil de test, + astuce de dveloppement, + architecture logicielle pour des tests, + exemple de code php, + objets fantaisie, + port de junit, + exemples de scnarios de test, + test php, + outil de test unitaire, + suite de test php + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/browser_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/browser_documentation.xml new file mode 100644 index 0000000..db373eb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/browser_documentation.xml @@ -0,0 +1,259 @@ + + + + + Documentation SimpleTest : le composant de navigation web scriptable + + +

+ Le composant de navigation web de SimpleTest peut tre utilis + non seulement l'extrieur de la classe WebTestCase, + mais aussi indpendamment du framework SimpleTest lui-mme. +

+
+
+

+ Vous pouvez utiliser le navigateur web dans des scripts PHP + pour confirmer que des services marchent bien comme il faut + ou pour extraire des informations partir de ceux-ci de faon rgulire. + Par exemple, voici un petit script pour extraire + le nombre de bogues ouverts dans PHP 5 partir + du site web PHP... +get('http://php.net/'); + $browser->clickLink('reporting bugs'); + $browser->clickLink('statistics'); + $browser->clickLink('PHP 5 bugs only'); + $page = $browser->getContent(); + preg_match('/status=Open.*?by=Any.*?(\d+)<\/a>/', $page, $matches); + print $matches[1]; +?> +]]> + Bien sr Il y a des mthodes plus simple pour raliser + cet exemple en PHP. Par exemple, vous pourriez juste + utiliser la commande PHP file() sur ce qui est + ici une page fixe. Cependant, en utilisant des scripts + avec le navigateur web vous vous autorisez l'authentification, + la gestion des cookies, le chargement automatique des fentres, + les redirections, la transmission de formulaires et la capacit + d'examiner les enttes. De telles mthodes sont fragiles dans + un site en constante volution et vous voudrez employer une mthode + plus directe pour accder aux donnes de faon permanente, + mais pour des tches simples cette technique peut s'avrer + une solution trs rapide. +

+

+ Toutes les mthode de navigation utilises dans WebTestCase sont prsente dans la classe SimpleBrowser, mais les assertions sont remplaces par de simples accesseurs. Voici une liste complte des mthodes de navigation de page page... + + + + + + + + + + + + + + + + + + + + + + + +
addHeader($header)Ajouter une entte chaque tlchargement
useProxy($proxy, $username, $password)Utilise ce proxy partir de maintenant
head($url, $parameters)Effectue une requte HEAD
get($url, $parameters)Tlcharge une page avec un GET
post($url, $parameters)Tlcharge une page avec un POST
clickLink($label)Suit un lien par son tiquette
isLink($label)Vrifie l'existance d'un lien par son tiquette
clickLinkById($id)Suit un lien par son attribut d'identification
isLinkById($id)Vrifie l'existance d'un lien par son attribut d'identification
getUrl()La page ou la fentre URL en cours
getTitle()Le titre de la page
getContent()Le page ou la fentre brute
getContentAsText()Sans code HTML l'exception du text "alt"
retry()Rpte la dernire requte
back()Utilise le bouton "prcdent" du navigateur
forward()Utilise le bouton "suivant" du navigateur
authenticate($username, $password)Retente la page ou la fentre aprs une rponse 401
restart($date)Relance le navigateur pour une nouvelle session
ageCookies($interval)Change la date des cookies
setCookie($name, $value)Lance un nouveau cookie
getCookieValue($host, $path, $name)Lit le cookie le plus spcifique
getCurrentCookieValue($name)Lit le contenue du cookie en cours
+ Les mthode SimpleBrowser::useProxy() et + SimpleBrowser::addHeader() sont spciales. + Une fois appeles, elles continuent s'appliquer sur les tlchargements suivants. +

+

+ Naviguer dans les formulaires est similaire la navigation des formulaires via WebTestCase... + + + + + + + + + + + + +
setField($name, $value)Modifie tous les champs avec ce nom
setFieldById($id, $value)Modifie tous les champs avec cet identifiant
getField($name)Accesseur de la valeur d'un lment de formulaire
getFieldById($id)Accesseur de la valeur de l'lment de formulaire avec cet identifiant
clickSubmit($label)Transmet le formulaire avec l'tiquette de son bouton
clickSubmitByName($name)Transmet le formulaire avec l'attribut de son bouton
clickSubmitById($id)Transmet le formulaire avec l'identifiant de son bouton
clickImage($label, $x, $y)Clique sur une balise input de type image par son titre (title="*") our son texte alternatif (alt="*")
clickImageByName($name, $x, $y)Clique sur une balise input de type image par son attribut (name="*")
clickImageById($id, $x, $y)Clique sur une balise input de type image par son identifiant (id="*")
submitFormById($id)Transmet le formulaire par son identifiant propre
+ Au jourd d'aujourd'hui il n'existe aucune mthode pour lister + les formulaires et les champs disponibles : ce sera probablement + ajout dans des versions successives de SimpleTest. +

+

+ A l'intrieur d'une page, les fentres individuelles peuvent tre + slectionnes. Si aucune slection n'est ralise alors + toutes les fentres sont fusionnes ensemble dans + une unique et grande page. + Le contenu de la page en cours sera une concatnation des + toutes les fentres dans l'ordre spcifi par les balises "frameset". + + + + + + +
getFrames()Un dchargement de la structure de la fentre courante
getFrameFocus()L'index ou l'tiquette de la fentre en courante
setFrameFocusByIndex($choice)Slectionne la fentre numrote partir de 1
setFrameFocus($name)Slectionne une fentre par son tiquette
clearFrameFocus()Traite toutes les fentres comme une seule page
+ Lorsqu'on est focalis sur une fentre unique, + le contenu viendra de celle-ci uniquement. + Cela comprend les liens cliquer et les formulaires transmettre. +

+
+
+

+ Toute cette masse de fonctionnalits est gniale + lorsqu'on arrive bien tlcharger les pages, + mais ce n'est pas toujours vident. + Pour aider dcouvrir les erreurs, le navigateur a aussi + des mthodes pour aider au dbogage. + + + + + + + + + + + + + +
setConnectionTimeout($timeout)Ferme la socket avec un dlai trop long
getRequest()L'entte de la requte brute de la page ou de la fentre
getHeaders()L'entte de rponse de la page ou de la fentre
getTransportError()N'importe quel erreur au niveau de la socket dans le dernier tlchargement
getResponseCode()La rponse HTTP de la page ou de la fentre
getMimeType()Le type Mime de la page our de la fentre
getAuthentication()Le type d'authentification dans l'entte d'une provocation 401
getRealm()Le realm d'authentification dans l'entte d'une provocation 401
setMaximumRedirects($max)Nombre de redirections avant que la page ne soit charge automatiquement
setMaximumNestedFrames($max)Protection contre des framesets rcursifs
ignoreFrames()Neutralise le support des fentres
useFrames()Autorise le support des fentres
+ Les mthodes SimpleBrowser::setConnectionTimeout(), + SimpleBrowser::setMaximumRedirects(), + SimpleBrowser::setMaximumNestedFrames(), + SimpleBrowser::ignoreFrames() + et SimpleBrowser::useFrames() continuent s'appliquer + sur toutes les requtes suivantes. + Les autres mthodes tiennent compte des fentres. + Cela veut dire que si une fentre individuelle ne se charge pas, + il suffit de se diriger vers elle avec + SimpleBrowser::setFrameFocus() : ensuite on utilisera + SimpleBrowser::getRequest(), etc. pour voir ce qui se passe. +

+
+
+

+ Tout ce qui peut tre fait dans + WebTestCase peut maintenant + tre fait dans un UnitTestCase. + Ce qui revient dire que nous pouvons librement mlanger + des tests sur des objets de domaine avec l'interface web... + +class TestOfRegistration extends UnitTestCase { + function testNewUserAddedToAuthenticator() { + $browser = &new SimpleBrowser(); + $browser->get('http://my-site.com/register.php'); + $browser->setField('email', 'me@here'); + $browser->setField('password', 'Secret'); + $browser->clickSubmit('Register'); + + $authenticator = &new Authenticator(); + $member = &$authenticator->findByEmail('me@here'); + $this->assertEqual($member->getPassword(), 'Secret'); + } +} +]]> + Bien que a puisse tre utile par convenance temporaire, + je ne suis pas fan de ce genre de test. Ce test s'applique + plusieurs couches de l'application, a implique qu'il est + plus que probable qu'il faudra le remanier lorsque le code changera. +

+

+ Un cas plus utile d'utilisation directe du navigateur est + le moment o le WebTestCase ne peut plus suivre. + Un exemple ? Quand deux navigateurs doivent tre utiliss en mme temps. +

+

+ Par exemple, supposons que nous voulions interdire + des usages simultans d'un site avec le mme login d'identification. + Ce scnario de test le vrifie... +get('http://my-site.com/login.php'); + $first->setField('name', 'Me'); + $first->setField('password', 'Secret'); + $first->clickSubmit('Enter'); + $this->assertEqual($first->getTitle(), 'Welcome'); + + $second = &new SimpleBrowser(); + $second->get('http://my-site.com/login.php'); + $second->setField('name', 'Me'); + $second->setField('password', 'Secret'); + $second->clickSubmit('Enter'); + $this->assertEqual($second->getTitle(), 'Access Denied'); + } +} +]]> + Vous pouvez aussi utiliser la classe SimpleBrowser + quand vous souhaitez crire des scnarios de test en utilisant + un autre outil que SimpleTest. +

+
+
+ + + Utiliser le navigateur web dans des scripts + + + Dboguer les erreurs sur les pages + + + Tests complexes avec des navigateurs web multiples + + + + + La page du projet SimpleTest sur + SourceForge. + + + La page de tlchargement de SimpleTest sur + LastCraft. + + + L'API de dveloppeur pour SimpleTest + donne tous les dtails sur les classes et les assertions disponibles. + + + + + dveloppement logiciel, + programmation php pour des clients, + php centr autour du client, + outils de dveloppement logiciel, + framework de test de recette, + scripts php gratuits, + test unitaire de systmes d'authentification, + ressources php, + HTMLUnit, + JWebUnit, + test php, + ressource de test unitaire, + test web, + authentification HTTP, + tester la connection, + tester l'authentification, + tests de scurit + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/display_subclass_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/display_subclass_tutorial.xml new file mode 100644 index 0000000..7157637 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/display_subclass_tutorial.xml @@ -0,0 +1,282 @@ + + + + + Tutorial de test unitaire en PHP - Sous-classer l'affichage du test + + +

+ Le composant affichage de SimpleTest est en fait + la dernire partie dvelopper. + Des morceaux de la section suivante changeront prochainement + et -- avec optimisme -- des composants d'affichage + plus sophistiqus seront crits, mais pour l'instant + si un affichage minime n'est pas suffisant, + voici comment raliser le votre. +

+
+
+

+ Bon d'accord, voici comment. +

+

+ Nous devons crer une sous-classe de l'affichage utilise, + dans notre cas il s'agit de HtmlReporter. + La classe HtmlReporter est situ dans le fichier + simpletest/reporter.php : + pour l'instant elle a l'interface suivante... + + Voici ce que les mthodes pertinentes veulent dire. + Vous pouvez consulter la + liste complte ici + si cela vous intresse. +

    +
  • + HtmlReporter()
    + est le constructeur. Notez qu'un test unitaire initie + le lien vers l'affichage plutt que l'inverse. + L'affichage est un rceptacle passif des vnements de test. + Cela permet une adaptation facile de l'affichage + pour d'autres systmes de test en dehors + des tests unitaires comme la surveillance + de serveurs par exemple. + Autre avantage, un test unitaire peut crire + vers plus d'un affichage la fois. +
  • +
  • + void paintFail(string $message)
    + peint un chec. Voir ci-dessous. +
  • +
  • + void paintPass(string \$message)
    + ne fait rien par dfaut. C'est cette mthode + que nous allons modifier. +
  • +
  • + string getCss()
    + renvoie le style CSS - via une chane - pour + la mthode d'entte de la page. + Des styles complmentaires peuvent tre ajouts ici. +
  • +
  • + array getTestList()
    + est une mthode commode pour des sous-classes. + Elle liste l'embotement courant des tests + via une liste de noms de test. + Le premier, le test embot le plus profondment, + est le premier dans la liste et la mthode + du test courant sera la dernire. +
  • +
+

+

+ Pour afficher les succs nous avons juste + besoin que la mthode paintPass() + se comporte comme paintFail(). + Bien sr nous n'allons pas modifier l'original. + Nous allons juste crer une sous-classe. +

+
+
+

+ Premirement nous allons crer un fichier + tests/show_passes.php dans notre projet de log + et y placer cette classe vide... +HtmlReporter(); + } + } +?> +]]> + Une rapide mais attentive lecture du + code de SimpleTest + indique que l'implmentation de paintFail() ressemble ... +Fail: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("->", $breadcrumb); + print "->$message
\n"; +} +]]>
+ Essentiellement elle s'enchane la version du parent, + que nous devons aussi raliser pour garantir le mnage, + et ensuite imprime une trace calcule partir de la liste + des tests courants. Par contre elle perd au passage + le nom du test du premier niveau. + Etant donn qu'il est identique pour chaque test, + ce serait un peu trop d'informations. + En la transposant dans notre nouvelle classe... +HtmlReporter(); + } + + function paintPass($message) { + parent::paintPass($message); + print "Pass: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("->", $breadcrumb); + print "->$message
\n"; + }
+} +]]>
+ Pour l'instant tout roule. + Maintenant pour utiliser notre nouvelle classe, + nous allons modifier notre fichier tests/all_tests.php... + + require_once('show_passes.php'); + + $test = &new GroupTest('All tests'); + $test->addTestFile('log_test.php'); + $test->addTestFile('clock_test.php'); + $test->run(new ShowPasses()); +?> +]]> + Nous pouvons le lancer pour voir le rsultat de notre bricolage... +

+

All tests

+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 1/] in [Test line 1]
+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 2/] in [Test line 2]
+ Pass: log_test.php->Log class test->testcreatingnewfile->Created before message
+ Pass: log_test.php->Log class test->testcreatingnewfile->File created
+ Pass: clock_test.php->Clock class test->testclockadvance->Advancement
+ Pass: clock_test.php->Clock class test->testclocktellstime->Now is the right time
+
3/3 test cases complete. + 6 passes and 0 fails.
+
+ Joli, mais pas encore digne d'une mdaille d'or. + Nous avons perdu un peu d'information au passage. + L'affichage du span.pass n'est pas styl en CSS, + mais nous pouvons l'ajouter en modifiant une autre mthode... +HtmlReporter(); + } + + function paintPass($message) { + parent::paintPass($message); + print "Pass: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("->", $breadcrumb); + print "->$message
\n"; + } + + protected function getCss() { + return parent::getCss() . ' .pass { color: green; }'; + } +} +]]>
+ Si vous ajoutez le code au fur et mesure, + vous verrez l'ajout du style dans le code source + du rsultat via le navigateur. A l'oeil, + l'affichage devrait ressembler ... +
+

All tests

+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 1/] in [Test line 1]
+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 2/] in [Test line 2]
+ Pass: log_test.php->Log class test->testcreatingnewfile->Created before message
+ Pass: log_test.php->Log class test->testcreatingnewfile->File created
+ Pass: clock_test.php->Clock class test->testclockadvance->Advancement
+ Pass: clock_test.php->Clock class test->testclocktellstime->Now is the right time
+
3/3 test cases complete. + 6 passes and 0 fails.
+
+ Certains prfrent voir les succs quand ils travaillent sur le code; + le sentiment de travail achev est sympathique aprs tout. + Une fois que vous commencez naviguer + de haut en bas pour trouver les erreurs, assez vite + vous en comprendrez le ct obscur. +

+

+ Essayez les deux mthodes pour dterminer votre prfrence. + Nous allons le laisser tel que pour l'tape qui approche : + les objets fantaisie. + Il s'agit du premier outil de test qui ajoute des tests additionnels : + il sera utile de voir ce qui se passe dans les coulisses. +

+
+
+ + + Comment changer l'affichage pour afficher + les passages avec succs. + + + Sous classer + la classe HtmlReporter. + + + + + La section prcdente : + sous-classer les scnarios de test + + + Cette section est trs spcifique + SimpleTest. + Si vous utilisez un autre outil, + n'hsitez pas sauter pardessus. + + + + + dveloppement logiciel pilot par les tests, + conseil pour programmer en php, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + architecture, + exemple de scnario de test, + framework de tests unitaires, + ressources php, + exemple de code php, + junit, + phpunit, + simpletest, + test php, + outil de test unitaire, + suite de test php + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/download_website.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/download_website.xml new file mode 100644 index 0000000..b64af48 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/download_website.xml @@ -0,0 +1,110 @@ + + + + + Télécharger SimpleTest + +
+

+ La version courante est : + + SimpleTest v1.0.1. +

+

+ Vous pouvez télécharger cette version depuis + + SourceForget.net + et votre miroir le plus proche. Vous pouvez aussi jeter un oeil du côté + du changelog actuel. +

+

+ Au fait, ne soyez pas effrayé par le mot beta : + pas mal d'utilisateurs vont même jusqu'à utiliser la version SVN. +

+
+
+

+ Si Eclipse est votre IDE / éditeur de prédilection, vous aurez + peut-être envie d'utiliser le + + plugin Eclipse. +

+

+ Pour utilser les procédures automatiques, l'URL est : +

http://simpletest.org/eclipse/
+

+
+
+

+ SimpleTest a été packagé par la communauté avec d'autres parfums encore. +

+ +

+ Attention : certains paquets ne sont pas toujours très à jour. +

+
+
+

+ Le code source est hébergé par SourceForge : vous pouvez l'étudier / le butiner + via le + dépôt SVN. +

+
+
+ +
+
+ + + Version courante + + + Paquet Eclipse + + + Autres paquets + + + Source + + + Autres versions stables + + + + + + + + + SimpleTest, + download, + source code, + stable release, + eclipse release, + eclipse plugin, + debian package, + drupal module, + pear channel, + pearified package + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/expectation_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/expectation_documentation.xml new file mode 100644 index 0000000..c9acdc6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/expectation_documentation.xml @@ -0,0 +1,308 @@ + + + + + Documentation SimpleTest : tendre le testeur unitaire avec des classes d'attentes supplmentaires + +
+

+ Le comportement par dfaut des + objets fantaisie dans + SimpleTest + est soit une correspondance identique sur l'argument, + soit l'acceptation de n'importe quel argument. + Pour la plupart des tests, c'est suffisant. + Cependant il est parfois ncessaire de ramollir un scnario de test. +

+

+ Un des endroits o un test peut tre trop serr + est la reconnaissance textuelle. Prenons l'exemple + d'un composant qui produirait un message d'erreur + utile lorsque quelque chose plante. Il serait utile de tester + que l'erreur correcte est renvoye, + mais le texte proprement dit risque d'tre plutt long. + Si vous testez le texte dans son ensemble alors + chaque modification de ce mme message + -- mme un point ou une virgule -- vous aurez + revenir sur la suite de test pour la modifier. +

+

+ Voici un cas concret, nous avons un service d'actualits + qui a chou dans sa tentative de connexion sa source distante. +class NewsService { + ... + function publish(&$writer) { + if (! $this->isConnected()) { + $writer->write('Cannot connect to news service "' . + $this->_name . '" at this time. ' . + 'Please try again later.'); + } + ... + } +} +]]> + L il envoie son contenu vers un classe Writer. + Nous pourrions tester ce comportement avec un MockWriter... + + $writer = &new MockWriter($this); + $writer->expectOnce('write', array( + 'Cannot connect to news service ' . + '"BBC News" at this time. ' . + 'Please try again later.')); + + $service = &new NewsService('BBC News'); + $service->publish($writer); + + $writer->tally(); + } +} +]]> + C'est un bon exemple d'un test fragile. + Si nous dcidons d'ajouter des instructions complmentaires, + par exemple proposer une source d'actualits alternative, + nous casserons nos tests par la mme occasion sans pourtant + avoir modifi une seule fonctionnalit. +

+

+ Pour contourner ce problme, nous voudrions utiliser + un test avec une expression rationnelle plutt + qu'une correspondance exacte. Nous pouvons y parvenir avec... + + $writer->expectOnce( + 'write', + array(new WantedPatternExpectation('/cannot connect/i'))); + + $service = &new NewsService('BBC News'); + $service->publish($writer); + + $writer->tally(); + } +} +]]> + Plutt que de transmettre le paramtre attendu au MockWriter, + nous envoyons une classe d'attente appele WantedPatternExpectation. + L'objet fantaisie est suffisamment lgant pour reconnatre + qu'il s'agit d'un truc spcial et pour le traiter diffremment. + Plutt que de comparer l'argument entrant cet objet, + il utilise l'objet attente lui-mme pour excuter le test. +

+

+ WantedPatternExpectation utilise + l'expression rationnelle pour la comparaison avec son constructeur. + A chaque fois qu'une comparaison est fait travers + MockWriter par rapport cette classe attente, + elle fera un preg_match() avec ce motif. + Dans notre scnario de test ci-dessus, aussi longtemps + que la chane "cannot connect" apparat dans le texte, + la fantaisie transmettra un succs au testeur unitaire. + Peu importe le reste du texte. +

+

+ Les classes attente possibles sont... + + + + + + + + + + +
EqualExpectationUne galit, plutt que la plus forte comparaison l'identique
NotEqualExpectationUne comparaison sur la non-galit
IndenticalExpectationLa vrification par dfaut de l'objet fantaisie qui doit correspondre exactement
NotIndenticalExpectationInverse la logique de l'objet fantaisie
WantedPatternExpectationUtilise une expression rationnelle Perl pour comparer une chane
NoUnwantedPatternExpectationPasse seulement si l'expression rationnelle Perl choue
IsAExpectationVrifie le type ou le nom de la classe uniquement
NotAExpectationL'oppos de IsAExpectation
MethodExistsExpectationVrifie si la mthode est disponible sur un objet
+ La plupart utilisent la valeur attendue dans le constructeur. + Les exceptions sont les vrifications sur motif, + qui utilisent une expression rationnelle, ainsi que + IsAExpectation et NotAExpectation, + qui prennent un type ou un nom de classe comme chane. +

+
+
+

+ Les classes attente peuvent servir autre chose + que l'envoi d'assertions depuis les objets fantaisie, + afin de choisir le comportement d'un + objet fantaisie + ou celui d'un bouchon serveur. + A chaque fois qu'une liste d'arguments est donne, + une liste d'objets d'attente peut tre insre la place. +

+

+ Mettons que nous voulons qu'un bouchon serveur + d'autorisation simule une connexion russie seulement + si il reoit un objet de session valide. + Nous pouvons y arriver avec ce qui suit... + +$authorisation = new StubAuthorisation(); +$authorisation->setReturnValue( + 'isAllowed', + true, + array(new IsAExpectation('Session', 'Must be a session'))); +$authorisation->setReturnValue('isAllowed', false); +]]> + Le comportement par dfaut du bouchon serveur + est dfini pour renvoyer false + quand isAllowed est appel. + Lorsque nous appelons cette mthode avec un unique paramtre + qui est un objet Session, il renverra true. + Nous avons aussi ajout un deuxime paramtre comme message. + Il sera affich dans le message d'erreur de l'objet fantaisie + si l'attente est la cause de l'chec. +

+

+ Ce niveau de sophistication est rarement utile : + il n'est inclut que pour tre complet. +

+
+
+

+ Les classes d'attentes ont une structure trs simple. + Tellement simple qu'il devient trs simple de crer + vos propres version de logique pour des tests utiliss couramment. +

+

+ Par exemple voici la cration d'une classe pour tester + la validit d'adresses IP. Pour fonctionner correctement + avec les bouchons serveurs et les objets fantaisie, + cette nouvelle classe d'attente devrait tendre + SimpleExpectation... +class ValidIp extends SimpleExpectation { + + function test($ip) { + return (ip2long($ip) != -1); + } + + function testMessage($ip) { + return "Address [$ip] should be a valid IP address"; + } +} +]]> + Il n'y a vritablement que deux mthodes mettre en place. + La mthode test() devrait renvoyer un true + si l'attente doit passer, et une erreur false + dans le cas contraire. La mthode testMessage() + ne devrait renvoyer que du texte utile la comprhension du test en lui-mme. +

+

+ Cette classe peut dsormais tre employe la place + des classes d'attente prcdentes. +

+
+
+

+ Le framework + de test unitaire SimpleTest utilise aussi dans son coeur + des classes d'attente pour + la classe UnitTestCase. + Nous pouvons aussi tirer parti de ces mcanismes pour rutiliser + nos propres classes attente l'intrieur mme des suites de test. +

+

+ La mthode la plus directe est d'utiliser la mthode + SimpleTest::assertExpectation() pour effectuer le test... +class TestOfNetworking extends UnitTestCase { + ... + function testGetValidIp() { + $server = &new Server(); + $this->assertExpectation( + new ValidIp(), + $server->getIp(), + 'Server IP address->%s'); + } +} +]]> + C'est plutt sale par rapport notre syntaxe habituelle + du type assert...(). +

+

+ Pour un cas aussi simple, nous crons d'ordinaire une mthode + d'assertion distincte en utilisant la classe d'attente. + Supposons un instant que notre attente soit un peu plus + complique et que par consquent nous souhaitions la rutiliser, + nous obtenons... + + function assertValidIp($ip, $message = '%s') { + $this->assertExpectation(new ValidIp(), $ip, $message); + } + + function testGetValidIp() { + $server = &new Server(); + $this->assertValidIp( + $server->getIp(), + 'Server IP address->%s'); + } +} +]]> + Il est peu probable que nous ayons besoin + de ce niveau de contrle sur la machinerie de test. + Il est assez rare que le besoin d'une attente dpasse + le stade de la reconnaissance d'un motif. + De plus, les classes d'attente complexes peuvent rendre + les tests difficiles lire et dboguer. + Ces mcanismes sont vritablement l pour les auteurs + de systme qui tendront le framework de test + pour leurs propres outils de test. +

+
+
+ + + Utiliser les attentes pour des tests + plus prcis avec des objets fantaisie + + + Changer le comportement d'un objet fantaisie + avec des attentes + + + Crer des attentes + + + Par dessous SimpleTest utilise des classes d'attente + + + + + La page du projet SimpleTest sur + SourceForge. + + + La page de tlchargement de SimpleTest sur + LastCraft. + + + Les attentes imitent les contraintes dans + JMock. + + + L'API complte pour SimpleTest + ralis avec PHPDoc. + + + + + objets fantaisie, + dveloppement pilot par les tests, + hritage des attentes, + contraintes d'objet fantaisie, + test unitaire avanc en PHP, + test en premier, + architecture de framework de test + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/extension_eclipse.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/extension_eclipse.xml new file mode 100644 index 0000000..ab9a5d0 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/extension_eclipse.xml @@ -0,0 +1,292 @@ + + + + + Documentation du plugin Eclipse pour Simpletest + +
+
    +
  • + Système d'exploitation - OS
    + Ce plugin devrait fonctionner sur toutes les plateformes qui font tourner Eclipse. + Il a été testé spécifiquement sur Linux, OS X et Windows. + Si le plugin ne marche pas sur l'une des ces plateformes, c'est qu'une nouvelle + incompatiblité est apparue : chose rare à priori. +
  • +
  • + Eclipse
    + Le plugin a été pensé et développé pour fonctionner avec les versions 3.1.X+ and 3.2.X+ d'Eclipse. + Eclipse en général nécessite une version 1.4.x ou supérieur de la JVM : + il n'y a pas d'autres pré-requis pour le plugin. +
  • +
  • + PHP
    + Le plugin a été testé pour fonctionner avec PHP 4.3.x+ (y compris PHP 5.1.x.). +
  • +
  • + Xdebug
    + Le plugin peut-être configuré pour fonctionnver avec Xdebug (version 2.0.0RC1 ou suivante). + Le fichier php.ini utilisé par le plugin (voir ci-dessous pour définir ce fichier) doit charger l'extension Xdebug. + Généralement on y arrive en ajoutant zend_extension_ts="Some Windows Path" ou zend_extension="Some Linux Path" + au fichier php.ini. + Des instructions spécifiques peuvent être trouvées à l'adresse : + http://xdebug.org/install.php + Pas la peine de se tracasser à propos des autres paramètres, le plugin se chargera d'initialiser + les paramètres nécessaires au besoin. +
  • +
  • + Simpletest
    + Le plugin est prévu pour tourner avec une version spécifique de SimpleTest. + Et même plus : il inclut la version associée de SimpleTest compatible. + Un plugin avec comme numéro de version 1.0.0_0.0.4 indiquerait que les plugin est compatible + avec la version 1.0.0 de SimpleTest and qu'il s'agit de la version 0.0.4 du plugin. + De légères modifications sont nécessaires sur le code de SimpleTest même pour + que le plugin fonctionne bien; ces modifications peuvent (ou pas) être comprise dans + la version de SimpleTest sans plugin. +
  • +
  • + PHPUnit2
    + A partir du plugin version 0.1.6 un support expérimental de la version CVS de PHPUnit2 + est disponible. Pour utiliser PHPUnit2, Choisisser un chemin vers PHPUnit2 et sélectionnez + les tests PHPUnit2 en lieu et place de SimpleTest. + Note: il s'agit du chemin vers le dossier qui contient le dosser PHPUnit2. PHPUnit 3 + n'est pas supporté mais devrait l'être plus tard. +
  • +
+
+
+
    +
  1. Télécharger et installer Eclipse (www.eclipse.org) – si vous n'êtes pas sûr quoi télécharger, prenez le SDK 3.1.0 d'Eclipse.
  2. +
  3. Télécharger le dernier fichier ZIP du plugin Eclipse pour SimpleTest (Simpletest Sourceforge)
  4. +
  5. Extgraire le contenu du fichier ZIP vers un répertoire temporaire {cette documentation y fera référence par $unzip}
  6. +
  7. Lancer Eclipse
  8. +
  9. Ouvrir "Install Wizard" en cliquant sur "Help > Software Updates > Find and Install" depuis la barre du menu.
  10. +
  11. Choisisser le deuxième bouton, "Search for new features to install" et cliquer sur "Next".
  12. +
  13. Cliquer sur le bouton du côté droit, "New Local Site".
  14. +
  15. Sélectionner le répertoire $unzip {le répertoire qui a servi pour l'extraction}.
  16. +
  17. Cliquer sur le bouton "OK".
  18. +
  19. Dans la fenêtre "Edit Local Site", cliquer sulick the "OK" button
  20. +
  21. Cliquer sur le bouton "Finish"
  22. +
  23. Dans la fenêtre "Search Results", chercher puis sélectionner "Simpletest plug-in 0.0.x"
  24. +
  25. Cliquer sur le bouton "Next"
  26. +
  27. Lire la licence et l'accepter en cliquant le bouton radio "I accept the terms in the license agreement" puis cliquer sur le bouton "Next"
  28. +
  29. Dans la fenêtre "Installation", vous pouvez changer le lieu d'installation -- la plupart des utilisateurs appuyeront juste sur le bouton "Finish"
  30. +
  31. Dans la fenêtre "Feature Verification", cliquer sur le bouton "Install"
  32. +
  33. Relancer Eclipse comme demandé
  34. +
  35. +

    Après avoir lancé Eclipse pour la première fois après l'installation, + vous aurez besoin de configurer le plugin SimpleTest. Pour y arriver : +

    +
      +
    1. + Sélectionner "Window > Preferences" dans la barre de menu +
    2. +
    3. + Sélectionner "Simpletest" dans les catégories sur la gauche de la boîte de dialogue. +
    4. +
    5. + Remplir ou choisir le répertoire contenant l'éxécutable PHP à utliser. +
    6. +
    7. + Laisser vierge le champ avec le fichier à inclure. +
    8. +
    9. + Remplir .php comme "Test File Suffix". + Bien sûr si vous utilisez ue autre extension pour vos fichiers de tests en PHP + (par exemple mon-test.tst.php) n'hésitez pas à remplir le champ avec ce qui va bien (dans notre exemple .tst.php). + Le plugin s'en sert pour trouver des tests à éxécuter. +
    10. +
    11. + Appuer sur le bouton "Ok" pour fermer la fenêtre des préférences. +
    12. +
    +
  36. +
+
+
+ Note: cette procédure ne fonctionnera que si vous avez installé le plugin via + le "installation wizard". Si vous n'aviez fait que copier des répertoires pour l'installation, + il est recommandé de fermer Eclipse, de supprimer les anciennes version et de suivre les instructions + d'installation ci-dessus (vous ne devriez pas avoir à refaire la configuration initiale). +
    +
  1. Sélectionner "Help > Software Updates > Manage Configuration" dans le menu
  2. +
  3. Trouver le plugin Simpletest dans la liste et le choisir
  4. +
  5. Dans la section de droite, cliquer sur le lien "Scan for Updates"
  6. +
  7. Si aucune mise à jour n'est détectée, naviguer vers "Window > Preferences > Install/Update > Valid Updates" dans les préférences d'Eclipse + et sélectionner "compatible", en lieu et place de "equivalent". Puis recommencer les étapes ci-dessus.
  8. +
  9. Sélectionner les versions à mettre à jour et cliquer sur "Next".
  10. +
  11. Relire les licences pour ces mises à jour : si elles sont acceptables, cocher "I accept the terms in the license agreements." + Si les termes de la licence ne vous paraissent pas acceptables, il est encore temps d'arrêter le téléchargement.
  12. +
  13. Cliquer sur "Install" pour permettre le téléchargement est l'installation.
  14. +
  15. Une fois que toutes les fonctionnalités et plugins ont été téléchargés avec succès + et que leurs fihciers ont été installés sur l'ordinateur local, + une nouvelle configuration qui incorpore les nouvelles fonctionnalités et nouveaux plugins sera créée. + Cliquer sur "Yes" quand on vous demander de quitter et relancher le "Workbench" pour les changements prennent effet.
  16. +
+
+
+ Note: ceci ne fonctionnera que si le plugin a été installé via la méthode "Feature Update". + Si l'installation a été effectué par une autre méthode alors le plugin peut être supprimé en effaçant + les répertoires qui avaient été ajoutés. +
    +
  1. Sélectionner "Help > Software Updates > Manage Configuration"
  2. +
  3. Choisir le plugin Simpletest dans la liste
  4. +
  5. Cliquer-droit sur le plugin Simpletest et sélectionner l'option "Disable"
  6. +
  7. Accepter le redémarrage d'Eclipse
  8. +
  9. Une fois Eclipse redémarré, sélectionner "Help > Software Updates > Manage Configuration" depuis le menu
  10. +
  11. Sélectionner l'option "Show Disabled Features" dans la barre d'outils
  12. +
  13. Choisir le plugin SimpleTest dans la liste
  14. +
  15. Cliquer-droit sur le plugin SimpleTest et sélectionner l'option "Uninstall"
  16. +
  17. Accepter le redémarrage d'Eclipse
  18. +
+
+
+

+ La suite présente quelques exemples d'utilsation du plugin. +

+
    +
  1. Créer une nouveau projet de test (un lieu pour grouper des fichiers similaires) +
      +
    1. Sélectionner "File > New > Project.." dans le menu
    2. +
    3. Agrandir le répertoire "General" et choisir "Project"
    4. +
    5. Cliquer sur le bouton "Next"
    6. +
    7. Sur le tab suivant, ajouter un nom de projet : "Test"
    8. +
    9. Utiliser le contenu de projet par défaut
    10. +
    11. Cliquer sur le bouton "Finish"
    12. +
    +
  2. +
  3. Créer un test unique avec un seul succès +
      +
    1. Dans l'explorateur de paquet cliquer-droit sur le projet "Test" et sélectionner "New > File".
    2. +
    3. Comme nom de fichier remplir : test1.php et cliquer sur "Finish"
    4. +
    5. Double-cliquer sur l'entrée test1.php dans l'explorateur de paquet : cela devrait ouvrir une nouvelle vue pour modifier ce fichier.
    6. +
    7. Remplir le fichier avec ces lignes : +assertEqual(3,$total, "This should pass"); + } +} +?> +]]> +
    8. +
    9. Sélectionner "File > Save" depuis le menu.
    10. +
    11. Cliquer-droit sur test1.php et sélectionner "Run > Run Simpletest".
    12. +
    13. La "Result View" devrait se remplir avec les informations sur le résultat du test + et la console SimpleTest devrait se remplir avec d'autres informations aussi.
    14. +
    +
  4. +
  5. Une seule classe de test, plusieurs tests +
      +
    1. dans l'explorateur de paquet, cliquer droit sur le projet "Test" et sélectionner "New > File".
    2. +
    3. En tant que nom de fichier, utiliser : test2.php et cliquer sur "Finish".
    4. +
    5. Double-cliquer sur l'entrée test2.php dans l'explorateur de paquet : une nouvelle vue s'ouvre, prête pour l'édition.
    6. +
    7. Remplir le contenu avec : +assertEqual(3,$total, "This should pass"); + } + function test_fail(){ + $x = 1; + $y = 2; + $total = $x + $y; + $this->assertEqual(4,$total,"This should fail"); + } +} +?> +]]> +
    8. +
    9. Sélectionner "File > save" dans la barre de menu.
    10. +
    11. Cliquer-droit sur grouptest.php et sélectionner "Run > Run Simpletest".
    12. +
    13. La "Result View" devrait se remplir avec les informations issus du test lancé, + idem pour pour la console SimpleTest.
    14. +
    +
  6. +
  7. Tests groupés (plusieurs fichiers de test en même temps) +
      +
    1. dans l'explorateur de paquet, cliquer droit sur le projet "Test" et sélectionner "New > File".
    2. +
    3. En tant que nom de fichier, utiliser : test2.php et cliquer sur "Finish".
    4. +
    5. Double-cliquer sur l'entrée test2.php dans l'explorateur de paquet : une nouvelle vue s'ouvre, prête pour l'édition.
    6. +
    7. Remplir le contenu avec : +addTestFile(dirname(__FILE__).'/test1.php'); + $this->addTestFile(dirname(__FILE__).'/test2.php'); + } +} +?> +]]> +
    8. +
    9. Sélectionner "File > Save" depuis le menu.
    10. +
    11. Cliquer-droit sur test1.php et sélectionner "Run > Run Simpletest".
    12. +
    13. La "Result View" devrait se remplir avec les informations sur le résultat du test + et la console SimpleTest devrait se remplir avec d'autres informations aussi.
    14. +
    +
  8. +
+
+
+
    +
  • + Si un constructeur est utilisé dans le scénario de test, + bien faire attention à ce que la dernière ligne de ce constructeur appelle + le constructeur parent (par exemple parent::UnitTestCase) +
  • +
  • + Ne pas mettre d'assertions dans le constructeur de la classe de test +
  • +
  • + Si vous obtenez une erreur indiquant qu'une classe ne pouvait pas être chargé, alors il faut + relancer Eclipse. Une fois qu'Eclipse a redémarré, ouvrir la "Result View" manuellement + en sélectionnant "Window > Show View > Other..." + Puis sélectionner la catégorie SimpleTest, puis la "Result View" et enfin cliquer sur "OK". +
  • +
+
+
+

Ci-dessous des fonctionnalités qui devrait arriver à un moment ou un autre dans ce plugin

+
    +
  • + Permettre différents fichiers d'inclustion pour chaque lanceur + (écraser l'include "master") +
  • +
  • + Mieux gérer les erreurs fatales +
  • +
+
+
+ + + + dévloppement logiciel, + plugin eclipse, + programmation en binôme, + programmation php, + outils de développement logiciel, + tutorial php, + scripts php gratuits, + architecture, + ressources php, + objets fantaisie, + junit, + php testing, + test unitaire, + test php automatisé, + explication test unitaire, + exemple test unitaire + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/first_test_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/first_test_tutorial.xml new file mode 100644 index 0000000..fc94905 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/first_test_tutorial.xml @@ -0,0 +1,462 @@ + + + + + Tutorial sur les tests unitaires en PHP - Crer un exemple de scnario de test en PHP + + +

+ Si vous dbutez avec les tests unitaires, + il est recommand d'essayer le code au fur et mesure. + Il n'y pas grand chose taper et vous sentirez + le rythme de la programmation pilote par les tests. +

+

+ Pour excuter les exemples tels quels, + vous aurez besoin de crer un nouveau rpertoire + et d'y installer trois dossiers : + classes, tests et temp. + Dzippez le framework SimpleTest + dans le dossier tests + et assurez vous que votre serveur web puisse atteindre ces endroits. +

+
+
+

+ L'exemple dans l'introduction rapide + comprenait les tests unitaires d'une simple classe de log. + Dans ce tutorial propos de Simple Test, je vais essayer + de raconter toute l'histoire du dveloppement de cette classe. + Cette classe PHP est courte et simple : + au cours de cette introduction, elle recevra beaucoup + plus d'attention que dans le cadre d'un dveloppement de production. + Nous verrons que derrire son apparente simplicit + se cachent des choix de conception tonnamment difficiles. +

+

+ Peut-tre que ces choix sont trop difficiles ? + Plutt que d'essayer de penser tout en amont, + je vais commencer par poser une exigence : + nous voulons crire des messages dans un fichier. + Ces messages doivent tre ajouts en fin de fichier s'il existe. + Plus tard nous aurons besoin de priorits, + de filtres et d'autres choses encore, + mais nous plaons l'criture dans un fichier + au coeur de nos proccupations. + Nous ne penserons rien d'autres par peur de confusion. + OK, commenons par crire un test... +run(new HtmlReporter()); +?> +]]> + Pas pas, voici ce qu'il veut dire. +

+

+ La constante SIMPLE_TEST contient + le chemin vers les classes de Simple Test partir de ce fichier. + Les classes pourraient tre places dans le path + du fichier php.ini mais si vous tes sur un serveur mutualis, + vous n'y aurez probablement pas accs. + Pour que tout le monde soit content, + le chemin est dclar explicitement dans le script de test. + Plus tard nous verrons comment tout finira au mme endroit. +

+

+ Qu'est-ce donc que ce fichier autorun.php ? + Les bibliothques de SimpleTest sont une bote outil + pour crer votre propre suite de tests standardiss. + Elles peuvent tre utilises "telles que" sans problme, + mais sont constitues par des composants qui doivent tre assembls. + autorun.php est un composant spcial : + il fournit les parties "testeur unitaire" et "affichage". + Il attrape les classes de test et les lance automagiquement. +

+

+ Il est probable que vous en viendrez crire votre propre affichage + et ajouter cette version par dfaut est optionnel. + SimpleTest inclut une classe d'affichage utilisable - et basique - + appele HtmlReporter. + Sur des tests, elle peut enregistrer dbuts, fins, erreurs, succs et chec. + Elle affiche ces informations au plus vite, au cas o le code + du test fait planter le script et masque la source d'chec. +

+

+ Les tests eux-mmes sont rassembls dans une classe de scnario de test. + Cette dernire est typiquement une extension de + la classe UnitTestCase. + Quand le test est excut, elle cherche les mthodes + commenant par "test" et les lancent. + Notre seule mthode de test pour l'instant est appelle + testCreatingNewFile() mais elle est encore vide. +

+

+ Une mthode vide ne fait rien. Nous avons besoin d'y placer du code. + La classe UnitTestCase gnre des vnements + de test son excution : + ces vnements sont envoys vers un observateur. +

+

+ Et pour ajouter du code de test... + + + class TestOfLogging extends UnitTestCase { + function testCreatingNewFile() { + @unlink('../temp/test.log'); + $log = new Log('../temp/test.log'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log')); + } + } + + $test = &new TestOfLogging(); + $test->run(new HtmlReporter()); +?> +]]> +

+

+ Vous pensez probablement que a reprsente beaucoup + de code pour un unique test et je suis d'accord avec vous. + Ne vous inquitez pas. Il s'agit d'un cot fixe et partir + de maintenant nous pouvons ajouter des tests : + une ligne ou presque chaque fois. + Parfois moins en utilisant des artefacts + de test que nous dcouvrirons plus tard. +

+

+ Nous devons maintenant prendre nos premires dcisions. + Notre fichier de test s'appelle log_test.php + (n'importe quel nom ferait l'affaire) : + nous le plaons dans un dossier appel tests + (partout ailleurs serait aussi bien). + Notre fichier de code s'appelle log.php : + c'est son contenu que nous allons tester. + Je l'ai plac dans notre dossier classes : + cela veut-il dire que nous construisons une classe ? +

+

+ Pour cet exemple, la rponse est oui, + mais le testeur unitaire n'est pas restreint aux tests de classe. + C'est juste que le code orient objet est plus facile + dpecer et remodeler. Ce n'est pas par hasard + si la conduite de tests fins via les tests unitaires + est apparue au sein de la communaut OO. +

+

+ Le test en lui-mme est minimal. Tout d'abord il limine + tout autre fichier de test qui serait encore prsent. + Les dcisions de conception arrivent ensuite en rafale. + Notre classe s'appelle Log : + elle passe le chemin du fichier au constructeur. + Nous crons le log et nous lui envoyons aussitt + un message en utilisant la mthode message(). + L'originalit dans le nommage n'est pas + une caractristique dsirable chez un dveloppeur informatique : + c'est triste mais c'est comme a. +

+

+ La plus petite unit d'un test mmm... heu... unitaire est l'assertion. + Ici nous voulons nous assurer que le fichier log + auquel nous venons d'envoyer un message a bel et bien t cr. + UnitTestCase::assertTrue() enverra + un vnement russite si la condition value est vraie + ou un chec dans le cas contraire. + Nous pouvons avoir un ensemble d'assertions diffrentes + et encore plus si nous tendons + nos scnarios de test classique. Voici la liste... + + + + + + + + + + + + + + + + +
assertTrue($x)Echoue si $x est faux
assertFalse($x)Echoue si $x est vrai
assertNull($x)Echoue si $x est initialis
assertNotNull($x)Echoue si $x n'est pas initialis
assertIsA($x, $t)Echoue si $x n'est pas de la classe ou du type $t
assertEqual($x, $y)Echoue si $x == $y est faux
assertNotEqual($x, $y)Echoue si $x == $y est vrai
assertIdentical($x, $y)Echoue si $x === $y est faux
assertNotIdentical($x, $y)Echoue si $x === $y est vrai
assertReference($x, $y)Echoue sauf si $x et $y sont la mme variable
assertCopy($x, $y)Echoue si $x et $y sont la mme variable
assertWantedPattern($p, $x)Echoue sauf si l'expression rationnelle $p capture $x
assertNoUnwantedPattern($p, $x)Echoue si l'expression rationnelle $p capture $x
assertNoErrors()Echoue si une erreur PHP arrive
assertError($x)Echoue si aucune erreur ou message incorrect de PHP n'arrive
+

+

+ Nous sommes dsormais prt lancer notre script de test + en le passant dans le navigateur. + Qu'est-ce qui devrait arriver ? + Il devrait planter... +

+ Fatal error: Failed opening required '../classes/log.php' (include_path='') in /home/marcus/projects/lastcraft/tutorial_tests/Log/tests/log_test.php on line 7 +
+ La raison ? Nous n'avons pas encore cr log.php. +

+

+ Mais attendez une minute, c'est idiot ! + Ne me dites pas qu'il faut crer + un test sans crire le code tester auparavant... +

+
+
+

+ Co-inventeur de + l'Extreme Programming, + Kent Beck a lanc un autre manifeste. + Le livre est appel + Test Driven Development + (Dveloppement Pilot par les Tests) + ou TDD et lve les tests unitaires une position leve de la conception. + En quelques mots, vous crivez d'abord un petit test + et seulement ensuite le code qui passe ce test. + N'importe quel bout de code. Juste pour qu'il passe. +

+

+ Vous crivez un autre test et puis de nouveau du code qui passe. + Vous aurez alors un peu de duplication et gnralement + du code pas trs propre. Vous remaniez (factorisez) + ce code-l en vous assurant que les tests continuent passer : + vous ne pouvez rien casser. + Une fois que le code est le plus propre possible + vous tes prt ajouter des nouvelles fonctionnalits. + Il suffit juste de rajouter des nouveaux tests et de recommencer + le cycle une nouvelle fois. + +

+

+ Il s'agit d'une approche assez radicale et + j'ai parfois l'impression qu'elle est incomplte. + Mais il s'agit d'un moyen efficace pour expliquer + un testeur unitaire ! + Il se trouve que nous avons un test qui choue, + pour ne pas dire qu'il plante : + l'heure est venue d'crire du code dans log.php... + +]]> + Il s'agit l du minimum que nous puissions + faire pour viter une erreur fatale de PHP. + Et maintenant la rponse devient... +

+

testoflogging

+ Fail: testcreatingnewfile->True assertion failed.
+
1/1 test cases complete. + 0 passes and 1 fails.
+
+ "testoflogging" a chou. + Parmi les dfauts de PHP on trouve cette fcheuse tendance + transformer intrieurement les noms de classes + et de mthodes en minuscules. + SimpleTest utilise ces noms par dfaut pour dcrire + les tests mais nous pouvons les remplacer par nos propres noms. +function TestOfLogging() { + $this->UnitTestCase('Log class test'); + } + function testCreatingNewFile() { + @unlink('../temp/test.log'); + $log = new Log('../temp/test.log'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + } +} +]]> + Ce qui donne... +
+

Log class test

+ Fail: testcreatingnewfile->File created.
+
1/1 test cases complete. + 0 passes and 1 fails.
+
+ Par contre pour le nom des mthodes il n'y a rien faire, dsol. +

+

+ Les messages d'un test comme ceux-ci ressemblent + bien des gards des commentaires de code. + Certains ne jurent que par eux, d'autres au contraire + les bannissent purement et simplement en les considrant + aussi encombrants qu'inutiles. + Pour ma part, je me situe quelque part au milieu. +

+

+ Pour que le test passe, nous pourrions nous contenter + de crer le fichier dans le constructeur de Log. + Cette technique "en faisant semblant" est trs utile + pour vrifier que le test fonctionne pendant les passages difficiles. + Elle le devient encore plus si vous sortez d'un passage + avec des tests ayant chous et que vous voulez juste vrifier + de ne pas avoir oubli un truc bte. + Nous n'allons pas aussi lentement donc... + + var $_file_path; + + function Log($file_path) { + $this->_file_path = $file_path; + } + + function message($message) { + $file = fopen($this->_file_path, 'a'); + fwrite($file, $message . "\n"); + fclose($file); + } + } +?> +]]> + Au total, pas moins de 4 checs ont t ncessaire + pour passer l'tape suivante. Je n'avais pas cr + le rpertoire temporaire, je ne lui avais pas donn + les droits d'criture, j'avais une coquille et + je n'avais pas non plus ajout ce nouveau rpertoire dans CVS. + N'importe laquelle de ces erreurs aurait pu m'occuper + pendant plusieurs heures si elle tait apparue plus tard + mais c'est bien pour ces cas l qu'on teste. + Avec les corrections adquates, a donne... +

+

Log class test

+
1/1 test cases complete. + 1 passes and 0 fails.
+
+ a marche! +

+

+ Peut-tre n'aimez-vous pas le style plutt minimal de l'affichage. + Les succs ne sont pas montrs par dfaut puisque + gnralement vous n'avez pas besoin de plus d'information + quand vous comprenez effectivement ce qui se passe. + Dans le cas contraire, pensez crire d'autres tests. +

+

+ D'accord, c'est assez strict. Si vous voulez aussi voir + les succs alors vous pouvez + crer une sous-classe + de HtmlReporter et l'utiliser pour les tests. + Mme moi j'aime bien ce confort parfois. +

+
+
+

+ Il y a une nuance ici. Nous ne voulons pas crer de fichier + avant d'avoir effectivement envoy de message. + Plutt que d'y rflchir trop longtemps, + nous allons juste ajouter un test pour a. +UnitTestCase('Log class test'); + } + function testCreatingNewFile() { + @unlink('../temp/test.log'); + $log = new Log('../temp/test.log'); + $this->assertFalse(file_exists('../temp/test.log'), 'No file created before first message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + } +} +]]> + ...et dcouvrir que a marche dj... +

+

Log class test

+
1/1 test cases complete. + 2 passes and 0 fails.
+
+ En fait je savais que a allait tre le cas. + J'ajoute ce test de confirmation tout d'abord pour + garder l'esprit tranquille, mais aussi pour documenter ce comportement. + Ce petit test supplmentaire dans son contexte + en dit plus long qu'un scnario utilisateur + d'une douzaine de lignes ou qu'un diagramme UML complet. + Que la suite de tests devienne une source de documentation + est un effet secondaire assez agrable. +

+

+ Devrions-nous supprimer le fichier temporaire la fin du test ? + Par habitude, je le fais une fois que j'en ai termin + avec la mthode de test et qu'elle marche. + Je n'ai pas envie de valider du code qui laisse + des restes de fichiers de test traner aprs un test. + Mais je ne le fais pas non plus pendant que j'cris le code. + Peut-tre devrais-je, mais parfois j'ai besoin de voir ce qui se passe : + on retrouve cet aspect confort voqu plus haut. +

+

+ Dans un vritable projet, + nous avons habituellement plus qu'un unique scnario de test : + c'est pourquoi nous allons regarder comment + grouper des tests dans des suites de tests. +

+
+
+ + + Crer un nouveau scnario de test. + + + Le Dveloppement Pilot par les Tests en PHP. + + + Les tests comme documentation + est un des nombreux effets secondaires. + + + + + La FAQ de JUnit contient plein de conseils judicieux sur les tests. + + + Ensuite vient "comment grouper des scnarios de tests ensemble". + + + Vous aurez besoin du framework de test SimpleTest pour ces exemples. + + + + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + architecture, + ressouces php, + objets fantaisie, + junit, + test php, + test unitaire, + test php automatis, + tutorial de scnarios de test, + explication d'un scnario de test unitaire, + exemple de test unitaire + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/form_testing_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/form_testing_documentation.xml new file mode 100644 index 0000000..89e4933 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/form_testing_documentation.xml @@ -0,0 +1,308 @@ + + + + + Documentation SimpleTest : tester des formulaires HTML + +
+

+ Lorsqu'une page est tlcharge par WebTestCase + en utilisant get() ou post() + le contenu de la page est automatiquement analys. + De cette analyse dcoule le fait que toutes les commandes + l'intrieur de la balise <form> sont disponibles + depuis l'intrieur du scnario de test. + Prenons par exemple cet extrait de code HTML... +


+    
+    
+
+]]>
+ Il ressemble ... +

+

+

+ + +
+

+

+ Nous pouvons naviguer vers ce code, via le site + LastCraft, + avec le test suivant... + + function testDefaultValue() { + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertField('a', 'A default'); + } +} +]]> + Directement aprs le chargement de la page toutes les commandes HTML + sont inities avec leur valeur par dfaut, comme elles apparatraient + dans un navigateur web. L'assertion teste qu'un objet HTML + avec le nom "a" existe dans la page + et qu'il contient la valeur "A default". +

+

+ Nous pourrions retourner le formulaire tout de suite, + mais d'abord nous allons changer la valeur du champ texte. + Ce n'est qu'aprs que nous le transmettrons... +get('http://www.my-site.com/'); + $this->assertField('a', 'A default'); + $this->setField('a', 'New value'); + $this->clickSubmit('Go'); + } +} +]]> + Parce que nous n'avons spcifi ni attribut "method" + sur la balise form, ni attribut "action", + le scnario de test suivra le comportement classique d'un navigateur : + transmission des donnes avec une requte GET + vers la mme page. SimpleTest essaie d'muler + le comportement typique d'un navigateur autant que possible, + plutt que d'essayer d'attraper des attributs manquants sur les balises. + La raison est simple : la cible d'un framework de test est + la logique d'une application PHP, pas les erreurs + -- de syntaxe ou autres -- du code HTML. + Pour les erreurs HTML, d'autres outils tel + HTMLTidy + devraient tre employs. +

+

+ Si un champ manque dans n'importe quel formulaire ou si + une option est indisponible alors WebTestCase::setField() + renverra false. Par exemple, supposons que + nous souhaitons vrifier qu'une option "Superuser" + n'est pas prsente dans ce formulaire... +

Select type of user to add:
+
+]]>
+ Qui ressemble ... +

+

+

+ Select type of user to add: + +
+

+

+ Le test suivant le confirmera... + + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertFalse($this->setField('type', 'Superuser')); + } +} +]]> + La slection ne sera pas change suite un chec d'initialisation + d'une valeur sur un objet. +

+

+ Voici la liste complte des objets supports aujourd'hui... +

    +
  • Champs texte, y compris les champs masqus (hidden) ou crypts (password).
  • +
  • Boutons submit, en incluant aussi la balise button, mais pas encore les boutons reset
  • +
  • Aires texte (textarea) avec leur gestion des retours la ligne (wrap).
  • +
  • Cases cocher, y compris les cases cocher multiples dans un mme formulaire.
  • +
  • Listes menu droulant, y compris celles slections multiples.
  • +
  • Boutons radio.
  • +
  • Images.
  • +
+

+

+ Le navigateur propos par SimpleTest mule les actions + qui peuvent tre ralises par un utilisateur sur + une page HTML standard. Javascript n'est pas support et + il y a peu de chance pour qu'il le soit prochainement. +

+

+ Une attention particulire doit tre port aux techniques Javascript + qui changent la valeur d'un champ cach : elles ne peuvent pas tre + ralises avec les commandes classiques de SimpleTest. + Une mthode alternative est propose plus loin. +

+
+
+

+ SimpleTest peut grer deux types de commandes valeur multiple : + les menus droulants slection multiple et les cases cocher + avec le mme nom l'intrieur mme d'un formulaire. + La nature de ceux-ci implique que leur initialisation + et leur test sont lgrement diffrents. + Voici un exemple avec des cases cocher... +


+    Create privileges allowed:
+    
+ Retrieve privileges allowed: +
+ Update privileges allowed: +
+ Destroy privileges allowed: +
+ + +]]>
+ Qui se traduit par... +

+

+

+ Create privileges allowed: +
+ Retrieve privileges allowed: +
+ Update privileges allowed: +
+ Destroy privileges allowed: +
+ +
+

+

+ Si nous souhaitons dsactiver tous les privilges sauf + ceux de tlchargement (Retrieve) et transmettre cette information, + nous pouvons y arriver par... + + function testDisableNastyPrivileges() { + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertField('crud', array('c', 'r', 'u', 'd')); + $this->setField('crud', array('r')); + $this->clickSubmit('Enable Privileges'); + } +} +]]> + Plutt que d'initier le champ une valeur unique, + nous lui donnons une liste de valeurs. + Nous faisons la mme chose pour tester les valeurs attendues. + Nous pouvons crire d'autres bouts de code de test + pour confirmer cet effet, peut-tre en nous connectant + comme utilisateur et en essayant d'effectuer une mise jour. +

+
+
+

+ Si vous souhaitez tester un formulaire dpendant de Javascript + pour la modification d'un champ cach, vous ne pouvez pas + simplement utiliser setField(). + Le code suivant ne fonctionnera pas : +// Ne fonctionne *pas* + $this->setField('un_champ_cach', '123'); + $this->clickSubmit('OK'); + } +} +]]> + A la place, vous aurez besoin d'ajouter le paramtre supplmentaire + du formulaire la mthode clickSubmit() : +$this->clickSubmit('OK', array('un_champ_cach'=>'123')); + } + +} +]]> +

+

+ N'oubliez pas que de la sorte, vous tes effectivement en train + de court-circuitez une partie de votre application (le code Javascript + dans le formulaire) et que peut-tre serait-il plus prudent + d'utiliser un outil comme + Selenium pour mettre sur pied + un test de recette complet. +

+
+
+

+ Si vous souhaitez tester un gestionnaire de formulaire + mais que vous ne l'avez pas crit ou que vous n'y avez + pas encore accs, vous pouvez crer un envoi de formulaire la main. + + function testAttemptedHack() { + $this->post( + 'http://www.my-site.com/add_user.php', + array('type' => 'superuser')); + $this->assertNoUnwantedPattern('/user created/i'); + } +} +]]> + En ajoutant des donnes la mthode WebTestCase::post(), + nous essayons de tlcharger la page via la transmission d'un formulaire. +

+
+
+ + + Modifier les valeurs d'un formulaire et + russir transmettre un simple formulaire + + + Grer des objets valeurs multiples + en initialisant des listes. + + + Le cas des formulaires utilisant Javascript pour + modifier un champ cach + + + Envoi brut quand il n'existe pas de bouton cliquer. + + + + + La page du projet SimpleTest sur + SourceForge. + + + La page de tlchargement de SimpleTest sur + LastCraft. + + + L'API du dveloppeur pour SimpleTest + donne tous les dtails sur les classes et les assertions disponibles. + + + + + dveloppement logiciel, + programmation php pour des clients, + php centr sur le client, + outils de dveloppement logiciel, + frameword de test de recette, + scripts php gratuits, + architecture, + ressources php, + HTMLUnit, + JWebUnit, + test php, + ressources de test unitaire, + test web + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/gain_control_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/gain_control_tutorial.xml new file mode 100644 index 0000000..5f13ea0 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/gain_control_tutorial.xml @@ -0,0 +1,324 @@ + + + + + Tutorial de test unitaire en PHP - Isoler les variables pendant le test + + +

+ Pour tester un module de code vous avez besoin + d'avoir un contrle trs prcis sur son environnement. + Si quelque chose change dans les coulisses, + par exemple dans un fichier de configuration, + alors les tests peuvent chouer de faon inattendue. + Il ne s'agirait plus d'un test de code sans quivoque + et pourrait vous faire perdre des heures prcieuses + la recherche d'erreurs dans un code qui fonctionne. + Alors qu'il s'agit d'un problme de configuration + qui plante le test en question. + Au mieux vos scnarios de test deviennent de plus en plus + compliqus afin de prendre en compte toutes les variations possibles. +

+
+
+

+ Il y a souvent beaucoup de variables videntes qui peuvent affecter + un scnario de test unitaire, d'autant plus dans un environnement + de dveloppement web dans lequel PHP a ses aises. + Parmi celles-ci, on trouve les paramtres de connexion + la base de donnes et ceux de configuration, + les droits de fichier et les ressources rseau, etc. + L'chec ou la mauvaise installation de l'un ou l'autre + de ces composants cassera la suite de test. + Est-ce que nous devons ajouter des tests pour valider + l'installation de ces composants ? + C'est une bonne ide mais si vous les placez + dans les tests du module de code vous aller commencer + encombrer votre code de test avec des dtails + hors de propos avec la tche en cours. + Ils doivent tre placs dans leur propre groupe de tests. +

+

+ Par contre un autre problme reste : + nos machines de dveloppement doivent aussi avoir + tous les composants systme d'installs avant l'excution + de la suite de test. Et vos tests s'excuteront plus lentement. +

+

+ Devant un tel dilemme, nous crerons souvent + des versions enveloppantes des classes qui grent ces ressources. + Les vilains dtails de ces ressources sont ensuite cods une seule fois. + J'aime bien appeler ces classes des "classes frontire" + tant donn qu'elles existent en bordure de l'application, + l'interface entre votre application et le reste du systme. + Ces classes frontire sont - dans le meilleur des cas - simules + pendant les tests par des versions de simulacre. + Elles s'excutent plus rapidement et sont souvent appeles + "bouchon serveur [Ndt : Server Stubs]" + ou dans leur forme plus gnrique "objet fantaisie + [Ndt : Mock Objects]". + Envelopper et bouchonner chacune de ces ressources + permet d'conomiser pas mal de temps. +

+

+ Un des facteurs souvent ngligs reste le temps. + Par exemple, pour tester l'expiration d'une session des codeurs + vont souvent temporairement en caler la dure + une valeur trs courte, disons 2 secondes, + et ensuite effectuer un sleep(3) : + ils estiment alors que la session a expire. + Sauf que cette opration ajoute 3 secondes la suite de test : + il s'agit souvent de beaucoup de code en plus + pour rendre la classe de session aussi mallable. + Plus simple serait d'avoir un moyen d'avancer l'horloge arbitrairement. + De contrler le temps. +

+
+
+

+ Une nouvelle fois, nous allons effectuer notre conception + d'une enveloppe d'horloge via l'criture de tests. + Premirement nous ajoutons un scnario de test d'horloge + dans notre suite de test tests/all_tests.php... + +require_once('clock_test.php'); + +$test = &new TestSuite('All tests'); +$test->addTestCase(new TestOfLogging()); +$test->addTestCase(new TestOfClock()); +$test->run(new HtmlReporter()); +?> +]]> + Ensuite nous crons le scnario de test + dans un nouveau fichier tests/clock_test.php... +UnitTestCase('Clock class test'); + } + function testClockTellsTime() { + $clock = new Clock(); + $this->assertEqual($clock->now(), time(), 'Now is the right time'); + } + function testClockAdvance() { + } + } +?> +]]> + Notre unique test pour le moment, c'est que + notre nouvelle class Clock se comporte + comme un simple substitut de la fonction time() en PHP. + L'autre mthode tient lieu d'emploi. + C'est notre chose faire en quelque sorte. + Nous ne lui avons pas donne de test parce que a casserait notre rythme. + Nous crirons cette fonctionnalit de dcalage + dans le temps une fois que nous serons au vert. + Pour le moment nous ne sommes videmment pas dans le vert... +

+
+ Fatal error: Failed opening required '../classes/clock.php' (include_path='') in + /home/marcus/projects/lastcraft/tutorial_tests/tests/clock_test.php on line 2 +
+
+ Nous crons un fichier classes/clock.php comme ceci... + +]]> + De la sorte nous reprenons le cours du code. +
+

All tests

+ Fail: Clock class test->testclocktellstime->[NULL: ] should be equal to [integer: 1050257362]
+
3/3 test cases complete. + 4 passes and 1 fails.
+
+ Facile corriger... + + return time(); + } +} +]]> + Et nous revoici dans le vert... +
+

All tests

+
3/3 test cases complete. + 5 passes and 0 fails.
+
+ Il y a juste un petit problme. + L'horloge pourrait basculer pendant l'assertion + et crer un cart d'une seconde. + Les probabilits sont assez faibles mais s'il devait + y avoir beaucoup de tests de chronomtrage + nous finirions avec une suite de test qui serait erratique + et forcment presque inutile. + Nous nous y attaquerons bientt + et pour l'instant nous l'ajoutons dans la liste des "choses faire". +

+

+ Le test d'avancement ressemble ... +UnitTestCase('Clock class test'); + } + function testClockTellsTime() { + $clock = new Clock(); + $this->assertEqual($clock->now(), time(), 'Now is the right time'); + } + function testClockAdvance() { + $clock = new Clock(); + $clock->advance(10); + $this->assertEqual($clock->now(), time() + 10, 'Advancement'); + } +} +]]> + Le code pour arriver au vert est direct : + il suffit d'ajouter un dcalage de temps. + + var $_offset; + + function Clock() { + $this->_offset = 0; + } + + function now() { + return time() + $this->_offset; + } + + function advance($offset) { + $this->_offset += $offset; + } +} +]]> +

+
+
+

+ Notre fichier all_tests.php contient des rptitions + dont nous pourrions nous dbarrasser. + Nous devons ajouter manuellement tous nos scnarios de test + depuis chaque fichier inclus. + C'est possible de les enlever mais avec les prcautions suivantes. + La classe GroupTest inclue une mthode bien pratique + appele addTestFile() qui prend un fichier PHP comme paramtre. + Ce mcanisme prend note de toutes les classes : + elle inclut le fichier et ensuite regarde toutes les classes + nouvellement cres. S'il y a des filles de TestCase + elles sont ajoutes au nouveau test de groupe. +

+

+ En outre, la bibliothque autorun lancera tous les scnarios + de test collects automagiquement aprs les avoir chargs. +

+

+ Voici notre suite de test remanie en appliquant cette mthode... + +require_once(SIMPLE_TEST . 'autorun.php'); + +class AllTests extends TestSuite { + function AllTests() { + $this->TestSuite('All tests'); + $this->addFile('log_test.php'); + $this->addFile('clock_test.php'); + } +} +?> +]]> + Les inconvniants sont les suivants... +

    +
  1. + Si le fichier de test a dj t inclus, + aucune nouvelle classe ne sera ajoute au groupe. +
  2. +
  3. + Si le fichier de test contient d'autres classes + relies TestCase alors celles-ci + aussi seront ajout au test de groupe. +
  4. +
+ Dans nos test nous n'avons que des scnarios dans les + fichiers de test et en plus nous avons supprim + leur inclusion du script all_tests.php : + nous sommes donc en rgle. C'est la situation la plus commune. +

+

+ Nous devrions corriger au plus vite le petit problme + de dcalage possible sur l'horloge : + c'est ce que nous faisons ensuite. +

+
+
+ + + Le temps est souvent une variable nglige dans les tests. + + + Une classe horloge + nous permet de modifier le temps. + + + Nettoyer le test de groupe. + + + + + La section prcdente : + grouper des tests unitaires. + + + La section suivante : + sous classer les scnarios de test. + + + Vous aurez besoin du + testeur unitaire SimpleTest pour les exemples. + + + + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + organisation de tests unitaires, + conseil de test, + astuce de dveloppement, + architecture logicielle pour des tests, + exemple de code php, + objets fantaisie, + junit, + test php, + outil de test unitaire, + suite de test php + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/group_test_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/group_test_documentation.xml new file mode 100644 index 0000000..80d9178 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/group_test_documentation.xml @@ -0,0 +1,353 @@ + + + + + Documentation SimpleTest : Grouper des tests + +
+

+ Pour lancer les scnarios de tests en tant que groupe, + ils devraient tre placs dans des fichiers sans le code du lanceur... + +]]> + Autant de scnarios que ncessaires peuvent tre + mis dans un fichier unique. Ils doivent contenir + tout le code ncessaire, entre autres la bibliothque teste, + mais aucune des bibliothques de SimpleTest. +

+

+ Si vous avez tendu l'un ou l'autre des scnarios de test, + vous pouvez aussi les inclure. + + class MyFileTestCase extends UnitTestCase { + ... + } + SimpleTestOptions::ignore('MyFileTestCase'); + + class FileTester extends MyFileTestCase { + ... + } + + class SocketTester extends UnitTestCase { + ... + } +?> +]]> + La classe FileTester ne contient aucun test vritable, + il s'agit d'une classe de base pour d'autres scnarios de test. + Pour cette raison nous utilisons la directive + SimpleTestOptions::ignore() pour indiquer + au prochain groupe de tests de l'ignorer. + Cette directive peut se placer n'importe o dans le fichier + et fonctionne quand un fichier complet des scnarios de test + est charg (cf. ci-dessous). + Nous l'appelons file_test.php. +

+

+ Ensuite nous crons un fichier de groupe de tests, + disons group_test.php. + Vous penserez un nom plus convaincant, j'en suis sr. + Nous lui ajoutons le fichier de test avec une mthode sans risque... + + require_once('file_test.php'); + + $test = &new GroupTest('All file tests'); + $test->addTestCase(new FileTestCase()); + $test->run(new HtmlReporter()); +?> +]]> + Ceci instancie le scnario de test avant que + la suite de test ne soit lance. + a pourrait devenir assez onreux avec + un grand nombre de scnarios de test : + il existe donc une autre mthode qui instancie + la classe uniquement quand elle devient ncessaire... + + $test->addTestClass('FileTestCase'); + $test->run(new HtmlReporter()); +?> +]]> + Le problme de cette technique est que pour + chaque scnario de test supplmentaire nous aurons importer + (via require_once()) le fichier de code de test + et instancier manuellement chaque scnario de test. + Nous pouvons nous pargner beaucoup de dactylographie avec... + + $test->addTestFile('file_test.php'); + $test->run(new HtmlReporter()); +?> +]]> + Voici ce qui vient de se passer : + la classe GroupTest a ralis le + require_once() pour nous. + Ensuite elle vrifie si de nouvelles classes de scnario + de test ont t cres par ce nouveau fichier + et les ajoute automatiquement au groupe de tests. + Dsormais tout ce qu'il nous reste faire, + c'est d'ajouter chaque nouveau fichier. +

+

+ Il y a deux choses qui peuvent planter + et qui demandent un minimum d'attention... +

    +
  1. + Le fichier peut dj avoir t analys par PHP + et dans ce cas aucune classe ne sera ajoute. + Pensez bien vrifier que les scnarios de test + ne sont inclus que dans ce fichier et dans aucun autre + (Note : avec la nouvelle fonctionnalit autorun, + ce problme a maintenant t rsolu). +
  2. +
  3. + Les nouvelles classes d'extension de scnario + de test qui sont incluses seront places + dans le groupe de tests et excutes par la mme occasion. + Vous aurez ajouter une directive + SimpleTestOptions::ignore() pour ces classes + ou alors pensez les ajouter avant la ligne + GroupTest::addTestFile(). +
  4. +
+

+
+
+

+ La technique ci-dessus place tous les scnarios de test + dans un unique et grand groupe. + Sauf que pour des projets plus consquents, + ce n'est probablement pas assez souple; + vous voudriez peut-tre grouper les tests tout fait diffremment. +

+

+ Pour obtenir un groupe de tests plus souple + nous pouvons sous classer GroupTest + et ensuite l'instancier au cas par cas... + + class FileGroupTest extends GroupTest { + function FileGroupTest() { + $this->GroupTest('All file tests'); + $this->addTestFile('file_test.php'); + } + } +?> +]]> + Ceci nomme le test dans le constructeur + et ensuite ajoute la fois nos scnarios + de test et un unique groupe en dessous. + Bien sr nous pouvons ajouter plus d'un groupe cet instant. + Nous pouvons maintenant invoquer les tests + partir d'un autre fichier d'excution... + + $test = &new FileGroupTest(); + $test->run(new HtmlReporter()); +?> +]]> + ...ou alors nous pouvons les grouper + dans un groupe de tests encore plus grand... + + $test = &new BigGroupTest('Big group'); + $test->addTestCase(new FileGroupTest()); + $test->addTestCase(...); + $test->run(new HtmlReporter()); +?> +]]> + Si nous souhaitons lancer le groupe de tests original + sans utiliser ses petits fichiers d'excution, + nous pouvons mettre le code du lanceur de test + derrire des barreaux quand nous crons chaque groupe. +GroupTest('All file tests'); + $test->addTestFile('file_test.php'); + } + } + + if (! defined('RUNNER')) { + define('RUNNER', true); + $test = &new FileGroupTest(); + $test->run(new HtmlReporter()); + } +?> +]]> + Cette approche exige aux barrires d'tre actives + l'inclusion du fichier de groupe de tests, + mais c'est quand mme moins de tracas que beaucoup + de fichiers de lancement parpills. + Reste inclure des barreaux identiques + au niveau suprieur afin de s'assurer que + le run() ne sera lanc qu'une seule fois + partir du script de haut niveau qui l'a invoqu. +addTestCase(new FileGroupTest()); + $test->addTestCase(...); + $test->run(new HtmlReporter()); +?> +]]> + Comme les scnarios de test normaux, + un GroupTest peut tre charg avec la mthode + GroupTest::addTestFile(). + + $test->addTestFile('file_group_test.php'); + $test->addTestFile(...); + $test->run(new HtmlReporter()); +?> +]]> +

+
+
+

+ Si vous avez dj des tests unitaires pour votre code + ou alors si vous tendez des classes externes + qui ont dj leurs propres tests, il y a peu de chances + pour que ceux-ci soient dj au format SimpleTest. + Heureusement il est possible d'incorporer ces scnarios + de test en provenance d'autres testeurs unitaires + directement dans des groupes de test SimpleTest. +

+

+ Par exemple, supposons que nous ayons + ce scnario de test prvu pour + PhpUnit + dans le fichier config_test.php... +class ConfigFileTest extends TestCase { + function ConfigFileTest() { + $this->TestCase('Config file test'); + } + + function testContents() { + $config = new ConfigFile('test.conf'); + $this->assertRegexp('/me/', $config->getValue('username')); + } +} +]]> + Le groupe de tests peut le reconnatre partir + du moment o nous mettons l'adaptateur appropri + avant d'ajouter le fichier de test... + + require_once('simpletest/adapters/phpunit_test_case.php'); + + $test = &new GroupTest('All file tests'); + $test->addTestFile('config_test.php'); + $test->run(new HtmlReporter()); +?> +]]> + Il n'y a que deux adaptateurs, + l'autre est pour le paquet testeur unitaire de + PEAR... + + require_once('simpletest/adapters/pear_test_case.php'); + + $test = &new GroupTest('All file tests'); + $test->addTestFile('some_pear_test_cases.php'); + $test->run(new HtmlReporter()); +?> +]]> + Les scnarios de test de PEAR peuvent tre + librement mlangs avec ceux de SimpleTest + mais vous ne pouvez pas utiliser les assertions + de SimpleTest au sein des versions hrites + des scnarios de test. La raison ? + Une simple vrification que vous ne rendez pas + par accident vos scnarios de test compltement + dpendants de SimpleTest. + Peut-tre que vous souhaitez publier + votre bibliothque sur PEAR par exemple : + a voudrait dire la livrer avec des scnarios de + test compatibles avec PEAR::PhpUnit. +

+
+
+ + + Plusieurs approches pour grouper des tests ensemble. + + + Combiner des groupes des tests dans des + groupes plus grands. + + + Intgrer des scnarios de test hrits + d'un autre type de PHPUnit. + + + + + La page du projet SimpleTest sur + SourceForge. + + + La page de tlchargement de SimpleTest sur + LastCraft. + + + + + test unitaire en php, + intgration de test, + documentation, + marcus baker, + perrick penet, + test simple, + documentation simpletest, + phpunit, + pear + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/group_test_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/group_test_tutorial.xml new file mode 100644 index 0000000..84f7016 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/group_test_tutorial.xml @@ -0,0 +1,247 @@ + + + + + + Tutorial de test unitaire PHP - Grouper des tests unitaires et exemples d'criture de scnarios de tests + + + +

+ Pour enchaner nous allons remplir des blancs et crer une suite de tests. +

+
+
+

+ Ajouter un autre test peut tre aussi simple + qu'ajouter une nouvelle mthode un scnario de test... +UnitTestCase('Log class test'); + } + function testCreatingNewFile() { + @unlink('../temp/test.log'); + $log = new Log('../temp/test.log'); + $this->assertFalse(file_exists('../temp/test.log'), 'Created before message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + @unlink('../temp/test.log'); + } + function testAppendingToFile() { + @unlink('../temp/test.log'); + $log = new Log('../temp/test.log'); + $log->message('Test line 1'); + $messages = file('../temp/test.log'); + $this->assertWantedPattern('/Test line 1/', $messages[0]); + $log->message('Test line 2'); + $messages = file('../temp/test.log'); + $this->assertWantedPattern('/Test line 2/', $messages[1]); + @unlink('../temp/test.log'); + } +} +]]> + La mthode du scnario de test assertWantedPattern() + utilise les expressions rationnelles Perl pour vrifier + qu'une chane respecte un certain motif. +

+

+ Tout ce que nous faisons dans ce nouveau test, + c'est crire une ligne dans un fichier, puis la lire, + le tout deux fois de suite. + Nous souhaitons simplement vrifier que le loggueur + ajoute le texte la fin plutt qu'craser + les donnes dj existantes. Quelque peu pdant, + mais aprs tout il s'agit d'un tutorial ! +

+

+ De toute faon ce test passe directement... +

+

Log class test

+
1/1 test cases complete. + 4 passes and 0 fails.
+
+ Notre code contient actuellement beaucoup de rptitions, + nous devons effacer le fichier de test avant et aprs chaque test. + De mme que JUnit, + SimpleTest utilise les mthodes + setUp() et tearDown() + qui sont excutes respectivement avant et aprs chaque test. + La suppression du fichier est commune tous les tests : + nous devrions donc y mettre cette opration. +

+

+ Nos tests sont verts donc nous pouvons faire un peu de remaniement... +UnitTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function testCreatingNewFile() { + $log = new Log('../temp/test.log'); + $this->assertFalse(file_exists('../temp/test.log'), 'Created before message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + } + function testAppendingToFile() { + $log = new Log('../temp/test.log'); + $log->message('Test line 1'); + $messages = file('../temp/test.log'); + $this->assertWantedPattern('/Test line 1/', $messages[0]); + $log->message('Test line 2'); + $messages = file('../temp/test.log'); + $this->assertWantedPattern('/Test line 2/', $messages[1]); + } +} +]]> + Le test reste vert. Nous pouvons continuer + ajouter des mthodes sans test au scnario, + il suffit que leur nom ne commence pas par + la chane "test". + Seules les mthodes commenant par "test" sont excutes. + Nous pouvons donc continuer le remaniement... +UnitTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function getFileLine($filename, $index) { + $messages = file($filename); + return $messages[$index]; + } + function testCreatingNewFile() { + $log = new Log('../temp/test.log'); + $this->assertFalse(file_exists('../temp/test.log'), 'Created before message'); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('../temp/test.log'), 'File created'); + } + function testAppendingToFile() { + $log = new Log('../temp/test.log'); + $log->message('Test line 1'); + $this->assertWantedPattern('/Test line 1/', $this->getFileLine('../temp/test.log', 0)); + $log->message('Test line 2'); + $this->assertWantedPattern('/Test line 2/', $this->getFileLine('../temp/test.log', 1)); + } +} +]]> + Que vous prfriez cette version ou la prcdente ne dpend + que de votre got personnel. + Il y a un peu plus de code dans cette dernire + mais la logique du test est plus claire. +

+
+
+

+ Un scnario de test ne fonctionne pas tout seul + pendant trs longtemps. + Quand on code pour de vrai nous souhaitons excuter + un maximum de tests aussi souvent + et aussi rapidement que possible. + a veut dire les grouper dans des suites de tests + qui incluent l'ensemble des tests de l'application. +

+

+ Premirement nous devons supprimer le code d'excution + des tests se trouvant dans notre scnario de test. + +require_once('../classes/log.php'); + +class TestOfLogging extends UnitTestCase { + ... +} +?> +]]> + Nous n'avons plus besoin de la constante + SIMPLE_TEST. + Ensuite nous crons un groupe de tests appel + all_tests.php dans le rpertoire tests... +addTestCase(new TestOfLogging()); + $test->run(new HtmlReporter()); +?> +]]> + Il n'y a presque de pas de diffrence tant que les choses marchent... +

+

All tests

+
1/1 test cases complete. + 4 passes and 0 fails.
+
+ Les tests du groupe s'ajoutent au compteur + des scnarios de test. Ajouter des nouveaux scnarios + de test est trs simple. + Il suffit d'inclure le fichier d'un scnario + et d'ajouter individuellement tous les scnarios autonomes. + Vous pouvez aussi emboter les groupes de test + les uns dans les autres (tout en faisant bien attention d'viter les boucles). +

+

+ Dans la page suivante + nous les ajouterons encore plus rapidement. +

+
+
+ + + Ajouter un autres test au scnario existant et remanier. + + + La technique brute pour grouper des tests unitaires. + + + + + Ensuite + vient le contrle de comment la classe sous le test interagit + avec le reste du systme. + + + Avant + il y a la cration du premier test. + + + Vous aurez besoin de SimpleTest + pour excuter ces exemples. + + + + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + pilotage par les tests, + architecture, + ressouces php, + objets fantaisie, + junit, + test php, + test unitaire, + phpunit, + test unitaire php + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/improving_design_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/improving_design_tutorial.xml new file mode 100644 index 0000000..b2e3686 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/improving_design_tutorial.xml @@ -0,0 +1,218 @@ + + + + + + tutoriel de test unitaire en PHP - Conception du haut vers le bas, tester d'abord avec des objets fantaisie + + +
+

+ J'ai menti. +

+

+ Je n'ai pas cr de test pour le scripteur, + uniquement l'interface FileWriter + que j'ai affich plus tt. + En fait je vais encore m'loigner d'un article fini + et prsumer l'existence un scripteur abstrait + dans classes/writer.php... +Writer { + + function Writer() { + } + + function write($message) { + } +} +?> +]]> + Les changements correspondant au niveau du test sont... + +Mock::generate('Writer'); + +class TestOfLogging extends UnitTestCase { + function TestOfLogging() { + $this->UnitTestCase('Log class test'); + } + function testWriting() { + $clock = &new MockClock($this); + $clock->setReturnValue('now', 'Timestamp'); + $writer = &new MockWriter($this); + $writer->expectOnce('write', array('[Timestamp] Test line')); + $log = &new Log($writer); + $log->message('Test line', &$clock); + $writer->tally(); + } +} +?> +]]> + Afin d'utiliser la classe de log, nous aurions besoin + de coder un scripteur de fichier - ou un autre type de scripteur - + mais pour le moment nous ne faisons que des tests + et nous n'en avons pas encore besoin. + En d'autres termes, en utilisant des objets fantaisie + nous pouvons dcaler la cration d'un objet + de niveau plus bas jusqu'au moment opportun. + Non seulement nous pouvons faire la conception du haut vers le bas, + mais en plus nous pouvons aussi tester du haut vers le bas. +

+
+
+

+ Imaginez pour un moment que nous ayons commenc la classe de log + partir d'une autre direction. + Simulez avoir crit juste assez du Log + pour avoir raliser le besoin d'un Writer. + Comme l'aurions-nous inclus ? +

+

+ Bon, l'hritage du scripteur ne nous aurait pas + permis de le simuler du point de vue des tests. + De celui de la conception nous aurions t restreint + un unique scripteur sans hritage multiple. +

+

+ Crer un scripteur interne, plutt qu'en le passant + au constructeur, en choisissant un nom de classe, + est possible, mais nous aurions moins de contrle + sur l'initialisation de l'objet fantaisie. + Du point de vue de la conception il aurait t + presque impossible de passer des paramtres + au scripteur dans tous les formats possibles + et envisageables. Vous auriez d restreindre + le scripteur un hash ou une chane complique + dcrivant tous les dtails de la cible. + Au mieux compliqu sans raison. +

+

+ Utiliser une mthode fabrique pour crer le scripteur + intrieurement serait possible, mais a voudrait + dire le sous classer pour les tests de manire + remplacer la mthode fabrique par une autre mthode + renvoyant un leurre. Plus de boulot du point de vue des tests, + quoique toujours possible. Du point de vue de la conception, + a voudrait dire crer une nouvelle sous-classe de + log pour chaque type de scripteur. + Cela s'appelle une hirarchie de classe parallle + et fait bien entendu de la duplication. + Beurk. +

+

+ A l'autre extrme, passer ou crer le scripteur + chaque message aurait t rptitif + et aurait rduit le code de la classe Log + une unique mthode, un signe certain + que toute la classe est devenue redondante. +

+

+ Cette tension entre la facilit du test + et le refus de la rptition nous a permis + de trouver une conception la fois flexible et propre. + Vous vous souvenez de notre bref envie de l'hritage multiple ? + Nous l'avons remplac par du polymorphisme + (plein de scripteurs) et spar la hirarchie du journal + de celle de l'criture. + Nous relions les deux par agrgation travers + le plus simple Log. + Cette astuce est en fait un design pattern + (modle de conception) appel "Pont" ou "Bridge". +

+

+ Donc nous avons t pouss par le code de test + (nous n'avons presque rien crit d'autre) vers un design pattern. + Pensez-y une seconde. Les tests amliorent + la qualit du code, coup sr dans mon cas, + mais il y a quelque chose de bien plus profond et plus puissant. +

+

+ Les tests ont amlior la conception. +

+
+
+

+ Crer un objet fantaisie est aussi simple + que de crer l'interface l'crit. + Si vous utilisez de l'UML ou d'autres outils + pour gnrer ces interfaces alors vous avez un chemin encore + plus flexible pour gnrer rapidement vos objets de test. + Mme sans, vous pouvez passer du dessin sur tableau blanc, + l'criture de l'objet fantaisie, + puis la gnration de l'interface qui nous renvoie + de nouveau au tableau blanc, le tout trs simplement. + Comme le remaniement, la conception, le code et les tests s'unifient. +

+

+ Parce que les objets fantaisie travaillent du haut vers le bas, + ils peuvent tre amens dans la conception plus rapidement + qu'un remaniement classique qui demande + quant lui du code fonctionnel avant de pourvoir s'installer. + a veut dire que le code de test interagit plus vite + avec la conception : par consquent la qualit + de la conception augmente elle aussi plus vite. +

+

+ Un testeur unitaire est un outil de code. + Un testeur unitaire avec objet fantaisie est un outil de conception. +

+
+
+ + + Simuler maintenant, coder plus tard. + + + Nous drivons vers le design pattern bridge. + + + Conception et test main dans la main. + + + + + Ce tutorial suit + les classes frontire. + + + Vous aurez besoin du + framework de test SimpleTest + pour essayer ces exemples. + + + Pour des discussions plus fournis sur + les objets fantaisie, voyez le + + Wiki des Extreme Tuesday + ou le Wiki C2 + (en anglais tous les deux). + + + + + dveloppement logiciel, + tutoriel de programmation php, + scnarios de test en php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + architecture, + exemple php, + exemple d'objet fantaisie, + test style junit, + architecture logicielle pour des tests, + framework de test en php, + test unitaire, + objet fantaisie en php + test php, + suite de test php + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/index.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/index.xml new file mode 100644 index 0000000..501897e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/index.xml @@ -0,0 +1,69 @@ + + + + + Les articles de :: onpk :: sur php / simpletest : traductions en franais des articles publis sur Lastcraft.com + + + +

+ Cette section rassemble l'ensemble des articles et documentations pour SimpleTest traduits en franais. +

+
+
+

+ J'ai commenc par dcouvrir l'Extreme Programming via le web. Ensuite j'ai gagn un livre en franais sur XP. Et dcouvrant la confiance supplmentaire gagne via les tests unitaires et de recette, je suis devenu "test-infected". +

+

+ Aprs avoir got aux joies de SimpleTest, j'ai contact Marcus Baker -- responsable du projet -- pour lui proposer de traduire en franais la page d'introduction, puis les tutoriaux et finalement toute la documentation. Un travail qui n'aurait pas t possible sans l'aide de quelques relecteurs bienveillants : Jrmie C., David B., Emmanuel G., Olivier L. et Cdric G. (dans le dsordre). +

+

+ Si vous lisez attentivement ces quelques pages et que vous y trouvez encore des fautes d'orthographe, pensez me les renvoyer : comme a le prochain ne pourra pas se dire la mme chose. +

+
+
+

+ J'ai un blog -- :: onpk ::, une entreprise -- No Parking dont le produit phare est openTIME. Dans la communaut je me ballade du ct de l'AFUP, des apros PHP et des praticiens XP. +

+
+
+

+

+
+
+ + + Comment en arrive-t-on au dveloppement pilot par les tests ? + + + Et en dehors des tests ? + + + Tous les articles + + + + + SimpleTest -- l'original en anglais. + + + + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + conseil de test, + architecture logicielle pour des tests, + exemple de code php, + junit, + test php, + outil de test unitaire, + suite de test php + + + Des articles (documentations et tutoriels) pour dcouvrir le dveloppement agile en PHP avec le framework de tests unitaires SimpleTest. + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/intro.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/intro.xml new file mode 100644 index 0000000..ceacc63 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/intro.xml @@ -0,0 +1,39 @@ + + + + + Les articles de :: onpk :: sur php / simpletest : traductions en franais des articles publis sur Lastcraft.com + + + +

+ Le testeur unitaire SimpleTest PHP a enfin atteint la dlicate version 1.0 : il est disponible au tlchargement chez votre SourceForge le plus proche. +

+

+ Il s'agit d'un testeur unitaire PHP et aussi d'un testeur web. Il est construit pour tre extensible de plusieurs manires. Les utilisateurs de JUnit seront familiers avec la plupart des interfaces. L'affichage des tests est largement modifiable tout comme le scnario de test de base. Par ailleurs les objets fantaisie peuvent tre utiliss avec d'autres testeurs unitaires. +

+

+ Les fonctionnalits -la-JWebUnit sont plus compltes aussi. Il y a le support pour SSL, les fentres, les proxies, l'authentification simple et un large choix de contrles HTML. L'ide est que les tches fastidieuses en PHP, se connecter un site par exemple, puissent tre testes facilement. +

+
+
+ + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + conseil de test, + architecture logicielle pour des tests, + exemple de code php, + junit, + test php, + outil de test unitaire, + suite de test php + + + Des articles (documentations et tutoriels) pour dcouvrir le dveloppement agile en PHP avec le framework de tests unitaires SimpleTest. + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/logiciels_utilisant_simpletest.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/logiciels_utilisant_simpletest.xml new file mode 100644 index 0000000..de0f9c1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/logiciels_utilisant_simpletest.xml @@ -0,0 +1,121 @@ + + + + Logiciels utilisant SimpleTest + +
+

+ Il y a un certain nombre de projets qui étendent les fonctionnalités + de SimpleTest : +

+
+
+ + SimpleTestXUL + +
+
+ + Limb Unit + +
+
+ + Stagehand_TestRunner + +
+
+ + Suite Tester + +
+ +
+
+
+

+ D'autres se servent de SimpleTest pour construire leurs projets : +

+
+
+ + Jelix - framework PHP5 + +
+
+ Jelix est un framework pour PHP5 qui permet de développer tout type + d'application. Performant, il est conçu pour les sites à forte charge; + entièrement objet, il est fortement modulaire et extensible. + En outre ils basé sur des modèles de conception connus dont MVC, DAO.. + et prend en charge de nombreux formats de sortie : + XHTML, XUL, RSS, ATOM, RDF, ZIP, XML, PDF, etc. +
+
+ + Copix, Framework PHP + +
+
+ Copix est un framework pour PHP qui existe depuis maintenant plus de 6 ans. + Copix est un projet libre (LGPL) mature utilisé sur de très nombreux sites. +
+
+ + CakePHP + +
+
+ + Web Application Component Toolkit + +
+
+ + Limb3 + +
+
+ + Drupal | SimpleTest + +
+
+ + WideImage + +
+
+ + Aperiplus + +
+
+ + Flux CMS + +
+
+ + Moodle + +
+
+
+
+ + + Projects extending SimpleTest + + + "Projects using SimpleTest + + + + + + + + + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/mock_objects_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/mock_objects_documentation.xml new file mode 100644 index 0000000..d4c5ee9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/mock_objects_documentation.xml @@ -0,0 +1,729 @@ + + + + + Documentation SimpleTest : les objets fantaise + +
+

+ Les objets fantaisie - ou "mock objects" en anglais - + ont deux rles pendant un scnario de test : acteur et critique. +

+

+ Le comportement d'acteur est celui de simuler + des objets difficiles initialiser ou trop consommateurs + en temps pendant un test. + Le cas classique est celui de la connexion une base de donnes. + Mettre sur pied une base de donnes de test au lancement + de chaque test ralentirait considrablement les tests + et en plus exigerait l'installation d'un moteur + de base de donnes ainsi que des donnes sur la machine de test. + Si nous pouvons simuler la connexion + et renvoyer des donnes notre guise + alors non seulement nous gagnons en pragmatisme + sur les tests mais en sus nous pouvons nourrir + notre base avec des donnes falsifies + et voir comment il rpond. Nous pouvons + simuler une base de donnes en suspens ou + d'autres cas extrmes sans avoir crer + une vritable panne de base de donnes. + En d'autres termes nous pouvons gagner + en contrle sur l'environnement de test. +

+

+ Si les objets fantaisie ne se comportaient que comme + des acteurs alors on les connatrait sous le nom de + bouchons serveur. +

+

+ Cependant non seulement les objets fantaisie jouent + un rle (en fournissant la demande les valeurs requises) + mais en plus ils sont aussi sensibles aux messages qui + leur sont envoys (par le biais d'attentes). + En posant les paramtres attendus d'une mthode + ils agissent comme des gardiens : + un appel sur eux doit tre ralis correctement. + Si les attentes ne sont pas atteintes ils nous pargnent + l'effort de l'criture d'une assertion de test avec + chec en ralisant cette tche notre place. + Dans le cas d'une connexion une base de donnes + imaginaire ils peuvent tester si la requte, disons SQL, + a bien t form par l'objet qui utilise cette connexion. + Mettez-les sur pied avec des attentes assez prcises + et vous verrez que vous n'aurez presque plus d'assertion crire manuellement. +

+
+
+

+ Comme pour la cration des bouchons serveur, tout ce dont + nous avons besoin c'est d'un classe existante. + La fameuse connexion une base de donnes qui ressemblerait ... +class DatabaseConnection { + function DatabaseConnection() { + } + + function query() { + } + + function selectQuery() { + } +} +]]> + Cette classe n'a pas encore besoin d'tre implmente. + Pour en crer sa version fantaisie nous devons juste + inclure la librairie d'objet fantaisie puis lancer le gnrateur... +require_once('simpletest/unit_tester.php'); +require_once('simpletest/mock_objects.php'); +require_once('database_connection.php'); + +Mock::generate('DatabaseConnection'); +]]> + Ceci gnre une classe clone appele MockDatabaseConnection. + Nous pouvons dsormais crer des instances de + cette nouvelle classe l'intrieur mme de notre scnario de test... + +class MyTestCase extends UnitTestCase { + + function testSomething() { + $connection = &new MockDatabaseConnection($this); + } +} +]]> + Contrairement aux bouchons, le constructeur + d'une classe fantaisie a besoin d'une rfrence au scnario + de test pour pouvoir transmettre les succs + et les checs pendant qu'il vrifie les attentes. + Concrtement a veut dire que les objets fantaisie + ne peuvent tre utiliss qu'au sein d'un scnario de test. + Malgr tout, cette puissance supplmentaire implique + que les bouchons ne sont que rarement utiliss + si des objets fantaisie sont disponibles. +

+
+
+

+ La version fantaisie d'une classe contient + toutes les mthodes de l'originale. + De la sorte une opration comme + query()]]> + est encore possible. + Tout comme avec les bouchons, nous pouvons remplacer + la valeur nulle renvoye par dfaut... +$connection->setReturnValue('query', 37); +]]> + Dsormais chaque appel de + query()]]> + nous recevons comme rsultat 37. + Tout comme avec les bouchons nous pouvons utiliser + des jokers et surcharger le paramtre joker. + Nous pouvons aussi ajouter des mthodes supplmentaires + l'objet fantaisie lors de sa gnration + et lui choisir un nom de classe qui lui soit propre... +Mock::generate('DatabaseConnection', 'MyMockDatabaseConnection', array('setOptions')); +]]> + Ici l'objet fantaisie se comportera comme + si setOptions() existait dans la classe originale. + C'est pratique si une classe a utilis le mcanisme + overload() de PHP pour ajouter des mthodes dynamiques. + Vous pouvez crer des fantaisies spciales pour simuler cette situation. +

+

+ Tous les modles disponibles avec les bouchons serveur + le sont galement avec les objets fantaisie... + + Une nouvelle fois, supposons que cet itrateur + ne retourne que du texte jusqu'au moment o il atteint + son terme, quand il renvoie false. + Nous pouvons le simuler avec... + + $iterator = &new MockIterator($this); + $iterator->setReturnValue('next', false); + $iterator->setReturnValueAt(0, 'next', 'First string'); + $iterator->setReturnValueAt(1, 'next', 'Second string'); + ... + } +} +]]> + Au moment du premier appel next() + sur l'itrateur fantaisie il renverra tout d'abord + "First string", puis ce sera au tour de + "Second string" au deuxime appel + et ensuite pour tout appel suivant false + sera renvoy. + Ces valeurs renvoyes successivement sont prioritaires + sur la valeur constante retourne. + Cette dernire est un genre de valeur par dfaut si vous voulez. +

+

+ Reprenons aussi le conteneur d'information bouchonn + avec des pairs clef / valeur... + + Il s'agit l d'une situation classique + d'utilisation d'objets fantaisie tant donn + que la configuration peut varier grandement de machine machine : + a contraint fortement la fiabilit de nos tests + si nous l'utilisons directement. + Le problme est que toutes les donnes nous parviennent + travers la mthode getValue() + et que nous voulons des rsultats diffrents pour des clefs diffrentes. + Heureusement les objets fantaisie ont un systme de filtrage... +$config = &new MockConfiguration($this); +$config->setReturnValue('getValue', 'primary', array('db_host')); +$config->setReturnValue('getValue', 'admin', array('db_user')); +$config->setReturnValue('getValue', 'secret', array('db_password')); +]]> + Le paramtre en plus est une liste d'arguments + faire correspondre. Dans ce cas nous essayons + de faire correspondre un unique argument : + en l'occurrence la clef recherche. + Maintenant que la mthode getValue() + est invoque sur l'objet fantaisie... +getValue('db_user') +]]> + ...elle renverra "admin". + Elle le trouve en essayant de faire correspondre + les arguments entrants dans sa liste + d'arguments sortants les uns aprs les autres + jusqu'au moment o une correspondance exacte est atteinte. +

+

+ Il y a des fois o vous souhaitez + qu'un objet spcifique soit servi par la fantaisie + plutt qu'une copie. + De nouveau c'est identique au mcanisme des bouchons serveur... + + Dans ce cas vous pouvez placer une rfrence + dans la liste renvoye par l'objet fantaisie... + +$vector = &new MockVector($this); +$vector->setReturnReference('get', $thing, array(12)); +]]> + Avec cet arrangement vous savez qu' chaque appel + de get(12)]]> + le mme $thing sera renvoy. +

+
+
+

+ Mme si les bouchons serveur vous isolent + du dsordre du monde rel, il ne s'agit l que + de la moiti du bnfice potentiel. + Vous pouvez avoir une classe de test recevant + les messages ad hoc, mais est-ce que votre nouvelle classe + renvoie bien les bons ? + Le tester peut devenir cafouillis sans une librairie d'objets fantaisie. +

+

+ Pour l'exemple, prenons une classe SessionPool + laquelle nous allons ajouter une fonction de log. + Plutt que de complexifier la classe originale, + nous souhaitons ajouter ce comportement avec un dcorateur (GOF). + Pour l'instant le code de SessionPool ressemble ... +class SessionPool { + function SessionPool() { + ... + } + + function &findSession($cookie) { + ... + } + ... +} + +class Session { + ... +} +]]> + + Alors que pour notre code de log, nous avons... + +class Log { + function Log() { + ... + } + + function message() { + ... + } +} + +class LoggingSessionPool { + function LoggingSessionPool(&$session_pool, &$log) { + ... + } + + function &findSession($cookie) { + ... + } + ... +} +]]> + Dans tout ceci, la seule classe tester est + LoggingSessionPool. En particulier, + nous voulons vrifier que la mthode findSession() + est appele avec le bon identifiant de session au sein du cookie + et qu'elle renvoie bien le message "Starting session $cookie" + au loggueur. +

+

+ Bien que nous ne testions que quelques lignes + de code de production, voici la liste des choses + faire dans un scnario de test conventionnel : +

    +
  1. Crer un objet de log.
  2. +
  3. Indiquer le rpertoire d'criture du fichier de log.
  4. +
  5. Modifier les droits sur le rpertoire pour pouvoir y crire le fichier.
  6. +
  7. Crer un objet SessionPool.
  8. +
  9. Lancer une session, ce qui demande probablement pas mal de choses.
  10. +
  11. Invoquer findSession().
  12. +
  13. Lire le nouvel identifiant de session (en esprant qu'il existe un accesseur !).
  14. +
  15. Lever une assertion de test pour vrifier que cet identifiant correspond bien au cookie.
  16. +
  17. Lire la dernire ligne du fichier de log.
  18. +
  19. Supprimer avec une (ou plusieurs) expression rationnelle les timestamps de log en trop, etc.
  20. +
  21. Vrifier que le message de session est bien dans le texte.
  22. +
+ Pas tonnant que les dveloppeurs dtestent + crire des tests quand ils sont aussi ingrats. + Pour rendre les choses encore pire, chaque fois que + le format de log change ou bien que la mthode de cration + des sessions change, nous devons rcrire une partie + des tests alors mme qu'ils ne testent pas ces parties + du systme. Nous sommes en train de prparer + le cauchemar pour les dveloppeurs de ces autres classes. +

+

+ A la place, voici la mthode complte pour le test + avec un peu de magie via les objets fantaisie... + + $session = &new MockSession($this); + $pool = &new MockSessionPool($this); + $pool->setReturnReference('findSession', $session); + $pool->expectOnce('findSession', array('abc')); + + $log = &new MockLog($this); + $log->expectOnce('message', array('Starting session abc')); + + $logging_pool = &new LoggingSessionPool($pool, $log); + $this->assertReference($logging_pool->findSession('abc'), $session); + $pool->tally(); + $log->tally(); + } +} +]]> + Commenons par crire une session simulacre. + Pas la peine d'tre trop pointilleux avec + celle-ci puisque la vrification de la session + dsire est effectue ailleurs. Nous avons + juste besoin de vrifier qu'il s'agit de + la mme que celle qui vient du groupe commun des sessions. +

+

+ findSession() est un mthode fabrique + dont la simulation est dcrite plus haut. + Le point de dpart vient avec le premier appel + expectOnce(). Cette ligne indique + qu' chaque fois que findSession() + est invoqu sur l'objet fantaisie, il vrifiera + les arguments entrant. S'il ne reoit + que la chane "abc" en tant qu'argument + alors un succs est envoy au testeur unitaire, + sinon c'est un chec qui est gnr. + Il s'agit l de la partie qui teste si nous avons bien + la bonne session. La liste des arguments suit + une format identique celui qui prcise les valeurs renvoyes. + Vous pouvez avoir des jokers et des squences + et l'ordre de l'valuation restera le mme. +

+

+ Si l'appel n'est jamais effectu alors n'est gnr + ni le succs, ni l'chec. Pour contourner cette limitation, + nous devons dire l'objet fantaisie que le test est termin : + il pourra alors dcider si les attentes ont t rpondues. + L'assertion du testeur unitaire de ceci est dclenche + par l'appel tally() la fin du test. +

+

+ Nous utilisons le mme modle pour mettre sur pied + le loggueur fantaisie. Nous lui indiquons que message() + devrait tre invoqu une fois et une fois seulement + avec l'argument "Starting session abc". + En testant les arguments d'appel, plutt que ceux de sortie du loggueur, + nous isolons le test de tout modification dans le loggueur. +

+

+ Nous commenons le lancement nos tests la cration + du nouveau LoggingSessionPool + et nous l'alimentons avec nos objets fantaisie juste crs. + Dsormais tout est sous contrle. Au final nous confirmons + que le $session donn au dcorateur est bien + celui reu et prions les objets fantaisie de lancer leurs + tests de comptage d'appel interne avec les appels tally(). +

+

+ Il y a encore pas mal de code de test, mais ce code est trs strict. + S'il vous semble encore terrifiant il l'est bien moins + que si nous avions essay sans les objets fantaisie + et ce test en particulier, interactions plutt que rsultat, + est toujours plus difficile mettre en place. + Le plus souvent vous aurez besoin de tester des situations + plus complexes sans ce niveau ni cette prcision. + En outre une partie peut tre remanie avec la mthode + de scnario de test setUp(). +

+

+ Voici la liste complte des attentes que vous pouvez + placer sur un objet fantaisie avec + SimpleTest... + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AttenteNcessite tally()
expectArguments($method, $args)Non
expectArgumentsAt($timing, $method, $args)Non
expectCallCount($method, $count)Oui
expectMaximumCallCount($method, $count)Non
expectMinimumCallCount($method, $count)Oui
expectNever($method)Non
expectOnce($method, $args)Oui
expectAtLeastOnce($method, $args)Oui
+ O les paramtres sont... +

+
$method
+
Le nom de la mthode, sous la forme d'une chane, + laquelle la condition doit tre applique.
+
$args
+
+ Les arguments sous la forme d'une liste. + Les jokers peuvent tre inclus de la mme manire + qu'avec setReturn(). + Cet argument est optionnel pour expectOnce() + et expectAtLeastOnce(). +
+
$timing
+
+ Le seul point dans le temps pour tester + la condition. Le premier appel commence zro. +
+
$count
+
Le nombre d'appels attendu.
+
+ La mthode expectMaximumCallCount() + est lgrement diffrente dans le sens o elle ne pourra + gnrer qu'un chec. Elle reste silencieuse + si la limite n'est jamais atteinte. +

+

+ Par ailleurs si vous avez just un appel dans votre test, + vrifiez bien que vous utiliser + expectOnce.
+ Utiliser $mocked->expectAt(0, 'method', 'args); + tout seul ne sera pas pris en compte : + la vrification des arguments et le comptage total + sont pour l'instant encore indpendant. +

+

+ Comme avec les assertions dans les scnarios de test, + toutes ces attentes peuvent accepter une surcharge de + message sous la forme d'un paramtre supplmentaire. + Par ailleurs le message d'chec original peut tre inclus + dans le rsultat avec "%s". +

+
+
+

+ Il existe trois approches pour crer des objets + fantaisie en comprenant celle utilise par SimpleTest. + Les coder la main en utilisant une classe de base, + les gnrer dans un fichier ou les gnrer dynamiquement la vole. +

+

+ Les objets fantaisie gnrs avec + SimpleTest sont dynamiques. + Ils sont crs l'excution dans la mmoire, + grce eval(), plutt qu'crits dans un fichier. + Cette opration les rend facile crer, + en une seule ligne, surtout par rapport leur cration + la main dans une hirarchie de classe parallle. + Le problme avec ce comportement tient gnralement + dans la mise en place des tests proprement dits. + Si les objets originaux changent les versions fantaisie + sur lesquels reposent les tests, une dsynchronisation peut subvenir. + Cela peut aussi arriver avec l'approche en hirarchie parallle, + mais c'est dtect beaucoup plus vite. +

+

+ Bien sr, la solution est d'ajouter de vritables tests d'intgration. + Vous n'en avez pas besoin de beaucoup + et le ct pratique des objets fantaisie fait plus + que compenser la petite dose de test supplmentaire. + Vous ne pouvez pas avoir confiance dans du code qui + ne serait test que par des objets fantaisie. +

+

+ Si vous restez dtermin de construire des librairies + statiques d'objets fantaisie parce que vous souhaitez + muler un comportement trs spcifique, + vous pouvez y parvenir grce au gnrateur de classe de SimpleTest. + Dans votre fichier librairie, par exemple + mocks/connection.php pour une connexion une base de donnes, + crer un objet fantaisie et provoquer l'hritage + pour hriter pour surcharger des mthodes spciales + ou ajouter des prrglages... + + Mock::generate('Connection', 'BasicMockConnection'); + class MockConnection extends BasicMockConnection { + function MockConnection(&$test, $wildcard = '*') { + $this->BasicMockConnection($test, $wildcard); + $this->setReturn('query', false); + } + } +?> +]]> + L'appel generate dit au gnrateur de classe + d'en crer une appele BasicMockConnection + plutt que la plus courante MockConnection. + Ensuite nous hritons partir de celle-ci pour obtenir + notre version de MockConnection. + En interceptant de cette manire nous pouvons ajouter + un comportement, ici transformer la valeur par dfaut de + query() en "false". + En utilisant le nom par dfaut nous garantissons + que le gnrateur de classe fantaisie n'en recrera + pas une autre diffrente si il est invoqu ailleurs + dans les tests. Il ne crera jamais de classe + si elle existe dj. Aussi longtemps que le fichier + ci-dessus est inclus avant alors tous les tests qui + gnraient MockConnection devraient + utiliser notre version prsent. Par contre si + nous avons une erreur dans l'ordre et que la librairie + de fantaisie en cre une d'abord alors la cration + de la classe chouera tout simplement. +

+

+ Utiliser cette astuce si vous vous trouvez avec beaucoup + de comportement en commun sur les objets fantaisie + ou si vous avez de frquents problmes d'intgration + plus tard dans les tapes de test. +

+
+
+

+ Mais au moment d'crire ces lignes c'est le seul + grer les objets fantaisie, donc vous tes bloqu avec lui ? +

+

+ Non, pas du tout. + SimpleTest est une bote outils + et parmi ceux-ci on trouve les objets fantaisie + qui peuvent tre utiliss indpendamment. + Supposons que vous avez votre propre testeur unitaire favori + et que tous vos tests actuels l'utilisent. + Prtendez que vous avez appel votre tester unitaire PHPUnit + (c'est ce que tout le monde a fait) et que la classe principale + de test ressemble ... + + La seule chose que la mthode assertion() ralise, + c'est de prparer une sortie embellie alors le paramtre boolien + de l'assertion sert dterminer s'il s'agit d'une erreur ou d'un succs. + Supposons qu'elle est utilise de la manire suivante... +assertion('I hope this file exists', file_exists('my_file')); +]]> + Comment utiliser les objets fantaisie avec ceci ? +

+

+ Il y a une mthode protge sur la classe de base + des objets fantaisie : elle s'appelle _assertTrue(). + En surchargeant cette mthode nous pouvons utiliser + notre propre format d'assertion. + Nous commenons avec une sous-classe, dans my_mock.php... +SimpleMock($test, $wildcard); + } + + function _assertTrue($assertion, $message) { + $test = &$this->getTest(); + $test->assertion($message, $assertion); + } + } +?> +]]> + Maintenant une instance de MyMock + crera un objet qui parle le mme langage que votre testeur. + Bien sr le truc c'est que nous crons jamais un tel objet : + le gnrateur s'en chargera. Nous avons juste besoin + d'une ligne de code supplmentaire pour dire au gnrateur + d'utiliser vos nouveaux objets fantaisie... +SimpleMock(&$test, $wildcard); + } + + function _assertTrue($assertion, $message , &$test) { + $test->assertion($message, $assertion); + } + } + SimpleTestOptions::setMockBaseClass('MyMock'); +?> +]]> + A partir de maintenant vous avez juste inclure + my_mock.php la place de la version par dfaut + simple_mock.php et vous pouvez introduire + des objets fantaisie dans votre suite de tests existants. +

+
+
+ + + Que sont les objets fantaisie ? + + + Crer des objets fantaisie. + + + L'objet fantaisie - acteur ou bouchon. + + + L'objet fantaisie - critique avec des attentes. + + + D'autres approches + y compris des librairies d'objets fantaisie. + + + Utiliser les objets fantaisie avec + d'autres testeurs unitaires. + + + + + L'article originel sur + les objets fantaisie. + + + La page du projet SimpleTest sur + SourceForge. + + + La page d'accueil de SimpleTest sur + LastCraft. + + + + + dveloppement logiciel, + programmation en php, + outils de dveloppement logiciel, + tutoriel php, + scripts php gratuits, + architecture, + ressources php, + mock objects, + objets fantaisie, + junit, + test php, + test unitaire, + tester en php + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/mock_objects_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/mock_objects_tutorial.xml new file mode 100644 index 0000000..b168d41 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/mock_objects_tutorial.xml @@ -0,0 +1,374 @@ + + + + + tutorial sur les tests unitaires en PHP - Utiliser les objets fantaisie en PHP + +
+

+ Avant d'ajouter de nouvelles fonctionnalits + il y a du remaniement faire. + Nous allons effectuer des tests chronomtrs + et la classe TimeTestCase a dfinitivement + besoin d'un fichier propre. + Appelons le tests/time_test_case.php... +UnitTestCase($test_name); + } + function assertSameTime($time1, $time2, $message = '') { + if (! $message) { + $message = "Time [$time1] should match time [$time2]"; + } + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } +} +?> +]]> + Nous pouvons lors utiliser require() + pour incorporer ce fichier dans le script all_tests.php. +

+
+
+

+ Je ne sais pas trop quel devrait tre + le format du message de log pour le test alors + pour vrifier le timestamp nous pourrions juste + faire la plus simple des choses possibles, + c'est dire rechercher une suite de chiffres. + +require_once('../classes/clock.php'); + +class TestOfLogging extends TimeTestCase { + function TestOfLogging() { + $this->TimeTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function getFileLine($filename, $index) { + $messages = file($filename); + return $messages[$index]; + } + function testCreatingNewFile() { + ... + } + function testAppendingToFile() { + ... + } + function testTimestamps() { + $log = new Log('../temp/test.log'); + $log->message('Test line'); + $this->assertTrue( + preg_match('/(\d+)/', $this->getFileLine('../temp/test.log', 0), $matches), + 'Found timestamp'); + $clock = new clock(); + $this->assertSameTime((integer)$matches[1], $clock->now(), 'Correct time'); + } +} +?> +]]> + Ce scnario de test cre un nouvel objet Log + et crit un message. Nous recherchons une suite de chiffres + et nous la comparons l'horloge prsente en utilisant + notre objet Clock. Bien sr a ne marche pas + avant d'avoir crit le code. +

+

All tests

+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 1/] in [Test line 1]
+ Pass: log_test.php->Log class test->testappendingtofile->Expecting [/Test line 2/] in [Test line 2]
+ Pass: log_test.php->Log class test->testcreatingnewfile->Created before message
+ Pass: log_test.php->Log class test->testcreatingnewfile->File created
+ Fail: log_test.php->Log class test->testtimestamps->Found timestamp
+
+ Notice: Undefined offset: 1 in /home/marcus/projects/lastcraft/tutorial_tests/tests/log_test.php on line 44
+ Fail: log_test.php->Log class test->testtimestamps->Correct time
+ Pass: clock_test.php->Clock class test->testclockadvance->Advancement
+ Pass: clock_test.php->Clock class test->testclocktellstime->Now is the right time
+
3/3 test cases complete. + 6 passes and 2 fails.
+
+ Cette suite de tests montre encore les succs + de notre modification prcdente. +

+

+ Nous pouvons faire passer les tests en ajoutant + simplement un timestamp l'criture dans le fichier. + Oui, bien sr, tout ceci est assez trivial et d'habitude + je ne le testerais pas aussi fanatiquement, + mais a va illustrer un problme plus gnral... + Le fichier log.php devient... + +require_once('../classes/clock.php'); + +class Log { + var $_file_path; + + function Log($file_path) { + $this->_file_path = $file_path; + } + + function message($message) { + $clock = new Clock(); + $file = fopen($this->_file_path, 'a'); + fwrite($file, "[" . $clock->now() . "] $message\n"); + fclose($file); + } +} +?> +]]> + Les tests devraient passer. +

+

+ Par contre notre nouveau test est plein de problmes. + Qu'est-ce qui se passe si notre format de temps change ? + Les choses vont devenir largement plus compliques + si a venait se produire. + Cela veut aussi dire que n'importe quel changement + du format de notre classe horloge causera aussi + un chec dans les tests de log. + Bilan : nos tests de log sont tout mlangs + avec les test d'horloge et par la mme trs fragiles. + Tester la fois des facettes de l'horloge + et d'autres du log manque de cohsion, + ou de focalisation tanche si vous prfrez. + Nos problmes sont causs en partie parce que + le rsultat de l'horloge est imprvisible alors que + l'unique chose tester est la prsence + du rsultat de Clock::now(). + Peu importe le contenu de l'appel de cette mthode. +

+

+ Pouvons-nous rendre cet appel prvisible ? + Oui si nous pouvons forcer le loggueur utiliser + une version factice de l'horloge lors du test. + Cette classe d'horloge factice devrait se comporter + exactement comme la classe Clock + part une sortie fixe dans la mthode now(). + Et au passage, a nous affranchirait mme + de la classe TimeTestCase ! +

+

+ Nous pourrions crire une telle classe assez + facilement mme s'il s'agit d'un boulot plutt fastidieux. + Nous devons juste crer une autre classe + d'horloge avec la mme interface sauf que + la mthode now() retourne une valeur modifiable + via une autre mthode d'initialisation. + C'est plutt pas mal de travail pour un test plutt mineur. +

+

+ Sauf que a se fait sans aucun effort. +

+
+
+

+ Pour atteindre le nirvana de l'horloge instantan + pour test nous n'avons besoin que de trois lignes de code supplmentaires... + + Cette instruction inclut le code de gnrateur + d'objet fantaisie. Le plus simple reste de le mettre + dans le script all_tests.php tant donn + qu'il est utilis assez frquemment. + + C'est la ligne qui fait le travail. + Le gnrateur de code scanne la classe, + en extrait toutes ses mthodes, cre le code + pour gnrer une classe avec une interface identique, + mais en ajoutant le nom "Mock" + et ensuite eval() le nouveau code pour crer la nouvelle classe. + + Cette ligne peut tre ajoute dans n'importe + quelle mthode de test qui nous intresserait. + Elle cre l'horloge fantaisie prte recevoir nos instructions. +

+

+ Notre scnario de test en est ses premiers pas + vers un nettoyage radical... + +Mock::generate('Clock'); + +class TestOfLogging extends UnitTestCase { + function TestOfLogging() { + $this->UnitTestCase('Log class test'); + } + function setUp() { + @unlink('../temp/test.log'); + } + function tearDown() { + @unlink('../temp/test.log'); + } + function getFileLine($filename, $index) { + $messages = file($filename); + return $messages[$index]; + } + function testCreatingNewFile() { + ... + } + function testAppendingToFile() { + ... + } + function testTimestamps() { + $clock = &new MockClock($this); + $clock->setReturnValue('now', 'Timestamp'); + $log = new Log('../temp/test.log'); + $log->message('Test line', &$clock); + $this->assertWantedPattern( + '/Timestamp/', + $this->getFileLine('../temp/test.log', 0), + 'Found timestamp'); + } +} +?> +]]> + Cette mthode de test cre un objet MockClock + puis dfinit la valeur retourn par la mthode + now() par la chane "Timestamp". + A chaque fois que nous appelons $clock->now(), + elle retournera cette mme chane. + a devrait tre quelque chose de facilement reprable. +

+

+ Ensuite nous crons notre loggueur et envoyons un message. + Nous incluons dans l'appel message() + l'horloge que nous souhaitons utiliser. + a veut dire que nous aurons ajouter un paramtre + optionnel la classe de log pour rendre ce test possible... +_file_path = $file_path; + } + + function message($message, $clock = false) { + if (!is_object($clock)) { + $clock = new Clock(); + } + $file = fopen($this->_file_path, 'a'); + fwrite($file, "[" . $clock->now() . "] $message\n"); + fclose($file); + } +} +]]> + Maintenant tous les tests passent et ils ne testent + que le code du loggueur. Nous pouvons nouveau respirer. +

+

+ Est-ce que ce paramtre supplmentaire dans la classe Log + vous gne ? Nous n'avons chang l'interface que + pour faciliter les tests aprs tout. + Les interfaces ne sont-elles pas la chose la plus importante ? + Avons nous souill notre classe avec du code de test ? +

+

+ Peut-tre, mais rflchissez ce qui suit. + A la prochaine occasion, + regardez une carte avec des circuits imprims, + peut-tre la carte mre de l'ordinateur que + ous regardez actuellement. Sur la plupart d'entre elles + vous trouverez un trou bizarre et vide + ou alors un point de soudure sans rien de fix + ou mme une pingle ou une prise sans aucune fonction vidente. + Peut-tre certains sont l en prvision d'une expansion + ou d'une variation future, mais la plupart n'y sont que pour les tests. +

+

+ Pensez-y. Les usines qui fabriquent ces cartes imprimes + par centaine de milliers gaspillent des matires premires + sur des pices qui n'ajoutent rien la fonction finale. + Si les ingnieurs matriel peuvent faire quelques sacrifices + l'lgance, je suis sr que nous pouvons aussi le faire. + Notre sacrifice ne gaspille pas de matriel aprs tout. +

+

+ a vous gne encore ? En fait moi aussi, mais pas tellement ici. + La priorit numro 1 reste du code qui marche, + pas un prix pour minimalisme. + Si a vous gne vraiment alors dplacez la cration + de l'horloge dans une autre mthode mre protge. + Ensuite sous classez l'horloge pour le test + et crasez la mthode mre avec une qui renvoie le leurre. + Vos tests sont bancals mais votre interface est intacte. +

+

+ Une nouvelle fois je vous laisse la dcision finale. +

+
+
+ + + Remanier les tests + dans le but de rutiliser notre nouveau test de temps. + + + Ajouter des timestamps de Log. + + + Crer une horloge fantaisie + pour rendre les tests cohsifs. + + + + + La section prcdente : + tutorial de test unitaire. + + + La section suivante : + les frontires de l'application. + + + Vous aurez besoin du + framework de test SimpleTest + pour essayer ces exemples. + + + Documents sur les objets fantaisie. + + + + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutoriel php, + scripts php gratuits, + architecture, + ressources php, + objet fantaisie, + junit, + phpunit, + simpletest, + test php, + outil de test unitaire, + suite de test php + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/overview.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/overview.xml new file mode 100644 index 0000000..52b4b20 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/overview.xml @@ -0,0 +1,297 @@ + + + + + + Aperu et liste des fonctionnalits des testeurs unitaires PHP et web de SimpleTest PHP + + +
+

+ Le coeur de SimpleTest est un framework de test construit autour de classes de scnarios de test. Celles-ci sont crites comme des extensions des classes premires de scnarios de test, chacune largie avec des mthodes qui contiennent le code de test effectif. Les scripts de test de haut niveau invoque la mthode run() chaque scnario de test successivement. Chaque mthode de test est crite pour appeler des assertions diverses que le dveloppeur suppose tre vraies, assertEqual() par exemple. Si l'assertion est correcte, alors un succs est expdi au rapporteur observant le test, mais toute erreur dclenche une alerte et une description de la dissension. +

+

+ Un scnario de test ressemble ... +MyTestCase extends UnitTestCase { + + function testLog() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +]]> +

+

+ Ces outils sont conus pour le dveloppeur. Les tests sont crits en PHP directement, plus ou moins simultanment avec la construction de l'application elle-mme. L'avantage d'utiliser PHP lui-mme comme langage de test est qu'il n'y a pas de nouveau langage apprendre, les tests peuvent commencer directement et le dveloppeur peut tester n'importe quelle partie du code. Plus simplement, toutes les parties qui peuvent tre accdes par le code de l'application peuvent aussi tre accdes par le code de test si ils sont tous les deux dans le mme langage. +

+

+ Le type de scnario de test le plus simple est le UnitTestCase. Cette classe de scnario de test inclut les tests standards pour l'galit, les rfrences et l'appariement de motifs (via les expressions rationnelles). Ceux-ci testent ce que vous seriez en droit d'attendre du rsultat d'une fonction ou d'une mthode. Il s'agit du type de test le plus commun pendant le quotidien du dveloppeur, peut-tre 95% des scnarios de test. +

+

+ La tche ultime d'une application web n'est cependant pas de produire une sortie correcte partir de mthodes ou d'objets, mais plutt de produire des pages web. La classe WebTestCase teste des pages web. Elle simule un navigateur web demandant une page, de faon exhaustive : cookies, proxies, connexions scurises, authentification, formulaires, cadres et la plupart des lments de navigation. Avec ce type de scnario de test, le dveloppeur peut garantir que telle ou telle information est prsente dans la page et que les formulaires ainsi que les sessions sont grs comme il faut. +

+

+ Un scnario de test web ressemble ... +MySiteTest extends WebTestCase { + + function testHomePage() { + $this->get('http://www.my-site.com/index.php'); + $this->assertTitle('My Home Page'); + $this->clickLink('Contact'); + $this->assertTitle('Contact me'); + $this->assertWantedPattern('/Email me at/'); + } +} +]]> +

+
+
+

+ Ci-dessous vous trouverez un canevas assez brut des fonctionnalits aujourd'hui et pour demain, sans oublier leur date approximative de publication. J'ai bien peur qu'il soit modifiable sans pr-avis tant donn que les jalons dpendent beaucoup sur le temps disponible. Les trucs en vert ont t cods, mais pas forcment dj rendus public. Si vous avez une besoin pressant pour une fonctionnalit verte mais pas encore publique alors vous devriez retirer le code directement sur le CVS chez SourceFourge. Une fonctionnalite publie est indiqu par "Fini". + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FonctionnalitDescriptionPublication
Scnariot de test unitaireLes classes de test et assertions de baseFini
Affichage HTMLL'affichage le plus simple possibleFini
Autochargement des scnarios de testLire un fichier avec des scnarios de test et les charger dans un groupe de tests automatiquementFini
Gnrateur de code d'objets fantaisieDes objets capable de simuler d'autres objets, supprimant les dpendances dans les testsFini
Bouchons serveurDes objets fantaisie sans rsultat attendu utiliser l'extrieur des scnarios de test, pour le prototypage par exemple.Fini
Intgration d'autres testeurs unitaires + La capacit de lire et simuler d'autres scnarios de test en provenance de PHPUnit et de PEAR::Phpunit.Fini
Scnario de test webAppariement basique de motifs dans une page tlcharge.Fini
Analyse de page HTMLPermet de suivre les liens et de trouver la balise de titreFini
Simulacre partielSimuler des parties d'une classe pour tester moins qu'une classe ou dans des cas complexes.Fini
Gestion des cookies WebGestion correcte des cookies au tlchargement d'une page.Fini
Suivi des redirectionsLe tlchargement d'une page suit automatiquement une redirection 300.Fini
Analyse d'un formulaireLa capacit de valider un formulaire simple et d'en lire les valeurs par dfaut.Fini
Interface en ligne de commandeAffiche le rsultat des tests sans navigateur web.Fini
Mise nu des attentes d'une classePeut crer des tests prcis avec des simulacres ainsi que des scnarios de test.Fini
Sortie et analyse XMLPermet de tester sur plusieurs htes et d'intgrer des extensions d'acceptation de test.Fini
Scnario de test en ligne de commandePermet de tester des outils ou scripts en ligne de commande et de manier des fichiers.Fini
Compatibilit avec PHP DocumentorGnration automatique et complte de la documentation au niveau des classes.Fini
Interface navigateurMise nu des niveaux bas de l'interface du navigateur web pour des scnarios de test plus prcis.Fini
Authentification HTTPTlchargement des pages web protges avec une authentification basique seulement.Fini
Boutons de navigation d'un navigateurArrire, avant et recommencerFini
Support de SSLPeut se connecter des pages de type https.Fini
Support de proxyPeut se connecter via des proxys communsFini
Support des cadresGre les cadres dans les scnarios de test web.Fini
Test de l'upload de fichierPeut simuler la balise input de type file1.0.1
Amlioration sur la machinerie des rapportsRetouche sur la transmission des messages pour une meilleur coopration avec les IDEs1.1
Amlioration de l'affichage des testsUne meilleure interface graphique web, avec un arbre des scnarios de test.1.1
LocalisationAbstraction des messages et gnration du code partir de fichiers XML.1.1
Simulation d'interfacePeut gnrer des objets fantaisie tant vers des interfaces que vers des classes.2.0
Test sur es exceptionsDans le mme esprit que sur les tests des erreurs PHP.2.0
Rercherche d'lments avec XPathPeut utiliser Tidy HTML pour un appariement plus rapide et plus souple.2.0
+ La migration vers PHP5 commencera juste aprs la srie des 1.0, partir de l PHP4 ne sera plus support. SimpleTest est actuellement compatible avec PHP5 mais n'utilisera aucune des nouvelles fonctionnalits avant la version 2. +

+
+
+

+ Le processus est au moins aussi important que les outils. Le type de procdure que fait un usage le plus intensif des outils de test pour dveloppeur est bien sr l'Extreme Programming. Il s'agit l d'une des mthodes agiles qui combinent plusieurs pratiques pour "lisser la courbe de cot" du dveloppement logiciel. La plus extrme reste le dveloppement pilot par les tests, o vous devez adhrer la rgle du pas de code avant d'avoir un test. Si vous tes plutt du genre planninficateur ou que vous estimez que l'exprience compte plus que l'volution, vous prfrerez peut-tre l'approche RUP. Je ne l'ai pas test mais je peux voir o vous aurez besoin d'outils de test (cf. illustration 9). +

+

+ La plupart des testeurs unitaires sont dans une certaine mesure un clone de JUnit, au moins dans l'interface. Il y a normment d'information sur le site de JUnit, commencer par la FAQ quie contient pas mal de conseils gnraux sur les tests. Une fois mordu par le bogue vous apprcierez srement la phrase infect par les tests trouve par Eric Gamma. Si vous tes encore en train de tergiverser sur un testeur unitaire, sachez que les choix principaux sont PHPUnit et Pear PHP::PHPUnit. De nombreuses fonctionnalits de SimpleTest leurs font dfaut, mais la version PEAR a d'ores et dj t mise jour pour PHP5. Elle est aussi recommande si vous portez des scnarios de test existant depuis JUnit. +

+

+ Les dveloppeurs de bibliothque n'ont pas l'air de livrer trs souvent des tests avec leur code : c'est bien dommage. Le code d'une bibliothque qui inclut des tests peut tre remani avec plus de scurit et le code de test sert de documentation additionnelle dans un format assez standard. Ceci peut pargner la pche aux indices dans le code source lorsque qu'un problme survient, en particulier lors de la mise jour d'une telle bibliothque. Parmi les bibliothques utilisant SimpleTest comme testeur unitaire on retrouve WACT et PEAR::XML_HTMLSax. +

+

+ Au jour d'aujourd'hui il manque tristement beaucoup de matire sur les objets fantaisie : dommage, surtout que tester unitairement sans eux reprsente pas mal de travail en plus. L'article original sur les objets fantaisie est trs orient Java, mais reste intressant lire. Etant donn qu'il s'agit d'une nouvelle technologie il y a beaucoup de discussions et de dbats sur comment les utiliser, souvent sur des wikis comme Extreme Tuesday ou www.mockobjects.comou the original C2 Wiki. Injecter des objets fantaisie dans une classe est un des champs principaux du dbat : cet article chez IBM en est un bon point de dpart. +

+

+ Il y a normement d'outils de test web mais la plupart sont crits en Java. De plus les tutoriels et autres conseils sont plutt rares. Votre seul espoir est de regarder directement la documentation pour HTTPUnit, HTMLUnit ou JWebUnit et d'esprer y trouver pour des indices. Il y a aussi des frameworks bass sur XML, mais de nouveau la plupart ont besoin de Java pour tourner. +

+
+
+ + + Rsum rapide de l'outil SimpleTest pour PHP. + + + La liste des fonctionnalites, la fois prsentes et venir. + + + Il y a beaucoup de ressources sur les tests unitaires sur le web. + + + + + Documentation pour SimpleTest. + + + Comment crire des scnarios de test en PHP est un tutoriel plutt avanc. + + + L'API de SimpleTest par phpdoc. + + + + + outils de dveloppement logiciel, + programmation php, + outils pour l'extreme programming, + liens pour des outils de test, + ressources pour test en php, + objets fantaise, + junit, + jwebunit, + htmlunit, + itc, + liens pour tests en php, + conseil et documentation pour test unitaire, + extreme programming en php + + + + + + Marcus Baker + + Dveloppeur principal{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packageur{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + Perrick Penet + + Traduction{@link mailto:perrick@onpk.net perrick@onpk.net} + + + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/partial_mocks_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/partial_mocks_documentation.xml new file mode 100644 index 0000000..7d15486 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/partial_mocks_documentation.xml @@ -0,0 +1,419 @@ + + + + + Documentation SimpleTest : les objets fantaisie partiels + + +

+ Un objet fantaisie partiel n'est ni plus ni moins + qu'un modle de conception pour soulager un problme spcifique + du test avec des objets fantaisie, celui de placer + des objets fantaisie dans des coins serrs. + Il s'agit d'un outil assez limit et peut-tre mme + une ide pas si bonne que a. Elle est incluse dans SimpleTest + pour la simple raison que je l'ai trouve utile + plus d'une occasion et qu'elle m'a pargne + pas mal de travail dans ces moments-l. +

+
+
+

+ Quand un objet en utilise un autre il est trs simple + d'y faire circuler une version fantaisie dj prte + avec ses attentes. Les choses deviennent un peu plus dlicates + si un objet en cre un autre et que le crateur est celui + que l'on souhaite tester. Cela revient dire que l'objet + cr devrait tre une fantaisie, mais nous pouvons + difficilement dire notre classe sous test de crer + un objet fantaisie plutt qu'un "vrai" objet. + La classe teste ne sait mme pas qu'elle travaille dans un environnement de test. +

+

+ Par exemple, supposons que nous sommes en train + de construire un client telnet et qu'il a besoin + de crer une socket rseau pour envoyer ses messages. + La mthode de connexion pourrait ressemble quelque chose comme... +read( ... ); + ... + } +} +?> +]]> + Nous voudrions vraiment avoir une version fantaisie + de l'objet socket, que pouvons nous faire ? +

+

+ La premire solution est de passer la socket en + tant que paramtre, ce qui force la cration + au niveau infrieur. Charger le client de cette tche + est effectivement une bonne approche si c'est possible + et devrait conduire un remaniement -- de la cration + partir de l'action. En fait, c'est l une des manires + avec lesquels tester en s'appuyant sur des objets fantaisie + vous force coder des solutions plus resserres sur leur objectif. + Ils amliorent votre programmation. +

+

+ Voici ce que a devrait tre... +function &connect(&$socket, $username, $password) { + $socket->read( ... ); + ... + } +} +?> +]]> + Sous-entendu, votre code de test est typique d'un cas + de test avec un objet fantaisie. + + $socket = &new MockSocket($this); + ... + $telnet = &new Telnet(); + $telnet->connect($socket, 'Me', 'Secret'); + ... + } +} +]]> + C'est assez vident que vous ne pouvez descendre que d'un niveau. + Vous ne voudriez pas que votre application de haut niveau + cre tous les fichiers de bas niveau, sockets et autres connexions + la base de donnes dont elle aurait besoin. + Elle ne connatrait pas les paramtres du constructeur de toute faon. +

+

+ La solution suivante est de passer l'objet cr sous la forme + d'un paramtre optionnel... + + function &connect($ip, $port, $username, $password, $socket = false) { + if (!$socket) { + $socket = &new Socket($ip, $port); + } + $socket->read( ... ); + ... + return $socket; + } +} +?> +]]> + Pour une solution rapide, c'est gnralement suffisant. + Ensuite le test est trs similaire : comme si le paramtre + tait transmis formellement... + + $socket = &new MockSocket($this); + ... + $telnet = &new Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret', &$socket); + ... + } +} +]]> + Le problme de cette approche tient dans son manque de nettet. + Il y a du code de test dans la classe principale et aussi + des paramtres transmis dans le scnario de test + qui ne sont jamais utiliss. Il s'agit l d'une approche + rapide et sale, mais qui ne reste pas moins efficace + dans la plupart des situations. +

+

+ Une autre solution encore est de laisser un objet fabrique + s'occuper de la cration... + + function Telnet(&$network) { + $this->_network = &$network; + } + ... + function &connect($ip, $port, $username, $password) { + $socket = &$this->_network->createSocket($ip, $port); + $socket->read( ... ); + ... + return $socket; + } +} +?> +]]> + Il s'agit l probablement de la rponse la plus travaille + tant donn que la cration est maintenant situe + dans une petite classe spcialise. La fabrique rseau + peut tre teste sparment et utilise en tant que fantaisie + quand nous testons la classe telnet... + + $socket = &new MockSocket($this); + ... + $network = &new MockNetwork($this); + $network->setReturnReference('createSocket', $socket); + $telnet = &new Telnet($network); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} +]]> + Le problme reste que nous ajoutons beaucoup de classes + la bibliothque. Et aussi que nous utilisons beaucoup + de fabriques ce qui rend notre code un peu moins intuitif. + La solution la plus flexible, mais aussi la plus complexe. +

+

+ Peut-on trouver un juste milieu ? +

+
+
+

+ Il existe une technique pour palier ce problme + sans crer de nouvelle classe dans l'application; + par contre elle induit la cration d'une sous-classe au moment du test. + Premirement nous dplaons la cration de la socket dans sa propre mthode... + + $socket = &$this->_createSocket($ip, $port); + $socket->read( ... ); + ... + } + + function &_createSocket($ip, $port) { + return new Socket($ip, $port); + } +} +?> +]]> + Il s'agit l de la seule modification dans le code de l'application. +

+

+ Pour le scnario de test, nous devons crer + une sous-classe de manire intercepter la cration de la socket... +class TelnetTestVersion extends Telnet { + var $_mock; + + function TelnetTestVersion(&$mock) { + $this->_mock = &$mock; + $this->Telnet(); + } + + function &_createSocket() { + return $this->_mock; + } +} +]]> + Ici j'ai dplac la fantaisie dans le constructeur, + mais un setter aurait fonctionn tout aussi bien. + Notez bien que la fantaisie est place dans une variable + d'objet avant que le constructeur ne soit attach. + C'est ncessaire dans le cas o le constructeur appelle + connect(). + Autrement il pourrait donner un valeur nulle partir de + _createSocket(). +

+

+ Aprs la ralisation de tout ce travail supplmentaire + le scnario de test est assez simple. + Nous avons juste besoin de tester notre nouvelle classe la place... + + $socket = &new MockSocket($this); + ... + $telnet = &new TelnetTestVersion($socket); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} +]]> + Cette nouvelle classe est trs simple bien sr. + Elle ne fait qu'initier une valeur renvoye, la manire + d'une fantaisie. Ce serait pas mal non plus si elle pouvait + vrifier les paramtres entrants. + Exactement comme un objet fantaisie. + Il se pourrait bien que nous ayons raliser cette astuce rgulirement : + serait-il possible d'automatiser la cration de cette sous-classe ? +

+
+
+

+ Bien sr la rponse est "oui" + ou alors j'aurais arrt d'crire depuis quelques temps dj ! + Le test prcdent a reprsent beaucoup de travail, + mais nous pouvons gnrer la sous-classe en utilisant + une approche celle des objets fantaisie. +

+

+ Voici donc une version avec objet fantaisie partiel du test... +Mock::generatePartial( + 'Telnet', + 'TelnetTestVersion', + array('_createSocket')); + +class TelnetTest extends UnitTestCase { + ... + function testConnection() { + $socket = &new MockSocket($this); + ... + $telnet = &new TelnetTestVersion($this); + $telnet->setReturnReference('_createSocket', $socket); + $telnet->Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} +]]> + La fantaisie partielle est une sous-classe de l'original + dont on aurait "remplac" les mthodes slectionnes + avec des versions de test. L'appel generatePartial() + ncessite trois paramtres : la classe sous classer, + le nom de la nouvelle classe et une liste des mthodes simuler. +

+

+ Instancier les objets qui en rsultent est plutt dlicat. + L'unique paramtre du constructeur d'un objet fantaisie partiel + est la rfrence du testeur unitaire. + Comme avec les objets fantaisie classiques c'est ncessaire + pour l'envoi des rsultats de test en rponse la vrification des attentes. +

+

+ Une nouvelle fois le constructeur original n'est pas lanc. + Indispensable dans le cas o le constructeur aurait besoin + des mthodes fantaisie : elles n'ont pas encore t inities ! + Nous initions les valeurs retournes cet instant et + ensuite lanons le constructeur avec ses paramtres normaux. + Cette construction en trois tapes de "new", + suivie par la mise en place des mthodes et ensuite + par la lancement du constructeur proprement dit est + ce qui distingue le code d'un objet fantaisie partiel. +

+

+ A part pour leur construction, toutes ces mthodes + fantaisie ont les mmes fonctionnalits que dans + le cas des objets fantaisie et toutes les mthodes + non fantaisie se comportent comme avant. + Nous pouvons mettre en place des attentes trs facilement... +setReturnReference('_createSocket', $socket); + $telnet->expectOnce('_createSocket', array('127.0.0.1', 21)); + $telnet->Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + $telnet->tally(); + } +} +]]> +

+
+
+

+ Les mthodes issues d'un objet fantaisie n'ont pas + besoin d'tre des mthodes fabrique, Il peut s'agir + de n'importe quelle sorte de mthode. + Ainsi les objets fantaisie partiels nous permettent + de prendre le contrle de n'importe quelle partie d'une classe, + le constructeur except. Nous pourrions mme aller jusqu' + crer des fantaisies sur toutes les mthodes part celle + que nous voulons effectivement tester. +

+

+ Cette situation est assez hypothtique, tant donn + que je ne l'ai jamais essaye. Je suis ouvert cette possibilit, + mais je crains qu'en forant la granularit d'un objet + on n'obtienne pas forcment un code de meilleur qualit. + Personnellement j'utilise les objets fantaisie partiels + comme moyen de passer outre la cration ou alors + de temps en temps pour tester le modle de conception TemplateMethod. +

+

+ Pour choisir le mcanisme utiliser, on en revient + toujours aux standards de code de votre projet. +

+
+
+ + + Le problme de l'injection d'un objet fantaisie. + + + Dplacer la cration vers une mthode fabrique protge. + + + L'objet fantaisie partiel gnre une sous-classe. + + + Les objets fantaisie partiels testent moins qu'une classe. + + + + + La page du projet SimpleTest sur + SourceForge. + + + L'API complte pour SimpleTest + partir de PHPDoc. + + + La mthode fabrique protge est dcrite dans + + cet article d'IBM. Il s'agit de l'unique papier + formel que j'ai vu sur ce problme. + + + + + dveloppement logiciel en php, + dvelopement d'un scnario de test en php, + programmation php avec base de donnes, + outils de dveloppement logiciel, + tutoriel avanc en php, + scripts la manire de phpunit, + architecture, + ressources php, + objets fantaisie, + junit, + framework de test en php, + test unitaire, + test en php + + +
+ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/reporter_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/reporter_documentation.xml new file mode 100644 index 0000000..e91adf1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/reporter_documentation.xml @@ -0,0 +1,488 @@ + + + + + Documentation SimpleTest : le rapporteur de test + + +

+ SimpleTest suit plutt plus que moins le modle MVC (Modle-Vue-Contrleur). + Les classes "reporter" sont les vues et les modles + sont vos scnarios de test et leur hirarchie. + Le contrleur est le plus souvent masqu l'utilisateur + de SimpleTest moins de vouloir changer la faon + dont les tests sont effectivement excuts, + auquel cas il est possible de surcharger les objets + "runner" (ceux de l'excuteur) depuis l'intrieur + d'un scnario de test. Comme d'habitude avec MVC, + le contrleur est plutt indfini et il existe d'autres endroits + pour contrler l'excution des tests. +

+
+
+

+ L'affichage par dfaut est minimal l'extrme. + Il renvoie le succs ou l'chec avec les barres conventionnelles + - rouge et verte - et affichent une trace d'arborescence + des groupes de test pour chaque assertion errone. Voici un tel chec... +

+

File test

+ Fail: createnewfile->True assertion failed.
+
1/1 test cases complete. + 0 passes, 1 fails and 0 exceptions.
+
+ Alors qu'ici tous les tests passent... +
+

File test

+
1/1 test cases complete. + 1 passes, 0 fails and 0 exceptions.
+
+ La bonne nouvelle, c'est qu'il existe pas mal de points + dans la hirarchie de l'affichage pour crer des sous-classes. +

+

+ Pour l'affichage bas sur des pages web, + il y a la classe HtmlReporter avec la signature suivante... + + Voici ce que certaines de ces mthodes veulent dire. + Premirement les mthodes d'affichage que vous voudrez probablement surcharger... +

    +
  • + HtmlReporter(string $encoding)
    + est le constructeur. Notez que le test unitaire initie + le lien l'affichage plutt que l'oppos. + L'affichage est principalement un receveur passif + des vnements de tests. Cela permet d'adapter + facilement l'affichage pour d'autres systmes + en dehors des tests unitaires, tel le suivi + de la charge de serveurs. + L'"encoding" est le type d'encodage + que vous souhaitez utiliser pour l'affichage du test. + Pour pouvoir effectuer un rendu correct de la sortie + de dbogage quand on utilise le testeur web, + il doit correspondre l'encodage du site test. + Les chanes de caractres disponibles + sont indiques dans la fonction PHP + html_entities(). +
  • +
  • + void paintHeader(string $test_name)
    + est appel une fois, au dbut du test quand l'vnement + de dmarrage survient. Le premier vnement de dmarrage + est souvent dlivr par le groupe de tests du niveau + le plus haut et donc c'est de l que le + $test_name arrive. + Il peint les titres de la page, CSS, la balise "body", etc. + Il ne renvoie rien du tout (void). +
  • +
  • + void paintFooter(string $test_name)
    + est appel la toute fin du test pour fermer + les balises ouvertes par l'entte de la page. + Par dfaut il affiche aussi la barre rouge ou verte + et le dcompte final des rsultats. + En fait la fin des tests arrive quand l'vnement + de fin de test arrive avec le mme nom + que celui qui l'a initi au mme niveau. + Le nid des tests en quelque sorte. + Fermer le dernier test finit l'affichage. +
  • +
  • + void paintMethodStart(string $test_name)
    + est appel au dbut de chaque mthode de test. + Normalement le nom vient de celui de la mthode. + Les autres vnements de dpart de test + se comportent de la mme manire sauf que + celui du groupe de tests indique au rapporteur + le nombre de scnarios de test qu'il contient. + De la sorte le rapporteur peut afficher une barre + de progrs au fur et mesure que l'excuteur + passe en revue les scnarios de test. +
  • +
  • + void paintMethodEnd(string $test_name)
    + clt le test lanc avec le mme nom. +
  • +
  • + void paintFail(string $message)
    + peint un chec. Par dfaut il ne fait qu'afficher + le mot "fail", une trace d'arborescence + affichant la position du test en cours + et le message transmis par l'assertion. +
  • +
  • + void paintPass(string $message)
    + ne fait rien, par dfaut. +
  • +
  • + string getCss()
    + renvoie les styles CSS sous la forme d'une chane + l'attention de la mthode d'enttes d'une page. + Des styles additionnels peuvent tre ajouts ici + si vous ne surchargez pas les enttes de la page. + Vous ne voudrez pas utiliser cette mthode dans + des enttes d'une page surcharge si vous souhaitez + inclure le feuille de style CSS d'origine. +
  • +
+ Il y a aussi des accesseurs pour aller chercher l'information + sur l'tat courant de la suite de test. Vous les utiliserez + pour enrichir l'affichage... +
    +
  • + array getTestList()
    + est la premire mthode trs commode pour les sous-classes. + Elle liste l'arborescence courante des tests + sous la forme d'une liste de noms de tests. + Le premier test -- celui le plus proche du coeur -- + sera le premier dans la liste et la mthode de test + en cours sera la dernire. +
  • +
  • + integer getPassCount()
    + renvoie le nombre de succs atteint. Il est ncessaire + pour l'affichage la fin. +
  • +
  • + integer getFailCount()
    + renvoie de la mme manire le nombre d'checs. +
  • +
  • + integer getExceptionCount()
    + renvoie quant lui le nombre d'erreurs. +
  • +
  • + integer getTestCaseCount()
    + est le nombre total de scnarios lors de l'excution des tests. + Il comprend aussi les tests groups. +
  • +
  • + integer getTestCaseProgress()
    + est le nombre de scnarios raliss jusqu' prsent. +
  • +
+ Une modification simple : demander l'HtmlReporter d'afficher + aussi bien les succs que les checs et les erreurs... + +class ShowPasses extends HtmlReporter { + + function paintPass($message) { + parent::paintPass($message); + print "&Pass: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("->", $breadcrumb); + print "->$message
\n"; + } + + protected function getCss() { + return parent::getCss() . ' .pass { color: green; }'; + } +} +]]>
+

+

+ Une mthode qui a beaucoup fait jaser reste la mthode makeDry(). + Si vous lancez cette mthode, sans paramtre, + sur le rapporteur avant que la suite de test + ne soit excute alors aucune mthode de test + ne sera appele. Vous continuerez avoir + les vnements entrants et sortants des mthodes + et scnarios de test, mais aucun succs ni chec ou erreur, + parce que le code de test ne sera pas excut. +

+

+ La raison ? Pour permettre un affichage complexe + d'une IHM (ou GUI) qui permettrait la slection + de scnarios de test individuels. + Afin de construire une liste de tests possibles, + ils ont besoin d'un rapport sur la structure du test + pour l'affichage, par exemple, d'une vue en arbre + de la suite de test. Avec un rapporteur lanc + sur une excution sche qui ne renverrait + que les vnements d'affichage, cela devient + facilement ralisable. +

+
+
+

+ Plutt que de modifier l'affichage existant, + vous voudrez peut-tre produire une prsentation HTML + compltement diffrente, ou mme gnrer une version texte ou XML. + Plutt que de surcharger chaque mthode dans + HtmlReporter nous pouvons nous rendre + une tape plus haut dans la hirarchie de classe vers + SimpleReporter dans le fichier source simple_test.php. +

+

+ Un affichage sans rien, un canevas vierge + pour votre propre cration, serait... + +require_once('simpletest/simple_test.php'); + +class MyDisplay extends SimpleReporter { + + function paintHeader($test_name) { + } + + function paintFooter($test_name) { + } + + function paintStart($test_name, $size) { + parent::paintStart($test_name, $size); + } + + function paintEnd($test_name, $size) { + parent::paintEnd($test_name, $size); + } + + function paintPass($message) { + parent::paintPass($message); + } + + function paintFail($message) { + parent::paintFail($message); + } +} +]]> + Aucune sortie ne viendrait de cette classe jusqu' un ajout de votre part. +

+
+
+

+ SimpleTest est aussi livr avec un rapporteur + en ligne de commande, minime lui aussi. + L'interface imite celle de JUnit, + sauf qu'elle envoie les messages d'erreur au fur + et mesure de leur arrive. + Pour utiliser le rapporteur en ligne de commande, + il suffit de l'intervertir avec celui de la version HTML... +addTestFile('tests/file_test.php'); +$test->run(new TextReporter()); +?> +]]> + Et ensuite d'invoquer la suite de test partir d'une ligne de commande... +

+php file_test.php
+
+ Bien sr vous aurez besoin d'installer PHP + en ligne de commande. Une suite de test qui + passerait toutes ses assertions ressemble ... +
+File test
+OK
+Test cases run: 1/1, Failures: 0, Exceptions: 0
+
+ Un chec dclenche un affichage comme... +
+File test
+1) True assertion failed.
+    in createnewfile
+FAILURES!!!
+Test cases run: 1/1, Failures: 1, Exceptions: 0
+
+

+

+ Une des principales raisons pour utiliser + une suite de test en ligne de commande tient + dans l'utilisation possible du testeur avec + un processus automatis. Pour fonctionner comme + il faut dans des scripts shell le script de test + devrait renvoyer un code de sortie non-nul suite un chec. + Si une suite de test choue la valeur false + est renvoye par la mthode SimpleTest::run(). + Nous pouvons utiliser ce rsultat pour terminer le script + avec la bonne valeur renvoye... +addTestFile('tests/file_test.php'); +exit ($test->run(new TextReporter()) ? 0 : 1); +?> +]]> + Bien sr l'objectif n'est pas de crer deux scripts de test, + l'un en ligne de commande et l'autre pour un navigateur web, + pour chaque suite de test. + Le rapporteur en ligne de commande inclut + une mthode pour dterminer l'environnement d'excution... +addTestFile('tests/file_test.php'); +if (TextReporter::inCli()) { + exit ($test->run(new TextReporter()) ? 0 : 1); +} +$test->run(new HtmlReporter()); +?> +]]> + Il s'agit l de la forme utilise par SimpleTest lui-mme. +

+
+
+

+ SimpleTest est livr avec une classe XmlReporter + utilise pour de la communication interne. + Lors de son excution, le rsultat ressemble ... +


+
+  
+    Remote tests
+    
+      Visual test with 48 passes, 48 fails and 4 exceptions
+      
+        testofunittestcaseoutput
+        
+          testofresults
+          This assertion passed
+          This assertion failed
+        
+        
+          ...
+        
+      
+    
+  
+
+]]>
+ Vous pouvez utiliser ce format avec le parseur + fourni dans SimpleTest lui-mme. + Il s'agit de SimpleTestXmlParser + et se trouve xml.php l'intrieur du paquet SimpleTest... +parse($test_output); +?> +]]> + $test_output devrait tre au format XML, + partir du rapporteur XML, et pourrait venir + d'une excution en ligne de commande d'un scnario de test. + Le parseur envoie des vnements au rapporteur exactement + comme tout autre excution de test. + Il y a des occasions bizarres dans lesquelles c'est en fait trs utile. +

+

+ Un problme des trs grandes suites de test, + c'est qu'elles peuvent venir bout de la limite de mmoire + par dfaut d'un process PHP - 8Mb. + En plaant la sortie des groupes de test dans du XML + et leur excution dans des process diffrents, + le rsultat peut tre pars nouveau pour agrger + les rsultats avec moins d'impact sur le test au premier niveau. +

+

+ Parce que la sortie XML peut venir de n'importe o, + a ouvre des possibilits d'agrgation d'excutions de test + depuis des serveur distants. + Un scnario de test pour le raliser existe dj + l'intrieur du framework SimpleTest, mais il est encore exprimental... + +require_once('../remote.php'); +require_once('../reporter.php'); + +$test_url = ...; +$dry_url = ...; + +$test = &new GroupTest('Remote tests'); +$test->addTestCase(new RemoteTestCase($test_url, $dry_url)); +$test->run(new HtmlReporter()); +?> +]]> + RemoteTestCase prend la localisation relle + du lanceur de test, tout simplement un page web au format XML. + Il prend aussi l'URL d'un rapporteur initi + pour effectuer une excution sche. + Cette technique est employe pour que les progrs + soient correctement rapports vers le haut. + RemoteTestCase peut tre ajout + une suite de test comme n'importe quel autre groupe de tests. +

+
+
+ + + Afficher les rsultats en HTML + + + Afficher et rapporter les rsultats + dans d'autres formats + + + Utilis SimpleTest depuis la ligne de commande + + + Utiliser XML pour des tests distants + + + + + La page du projet SimpleTest sur + SourceForge. + + + La page de tlchargement de SimpleTest sur + LastCraft. + + + L'API pour dveloppeur de SimpleTest + donne tous les dtails sur les classes et les assertions disponibles. + + + + + test unitaire en php, + documentation, + marcus baker, + perrick penet + test simple, + simpletest, + test distant, + tests xml, + test automatis + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/simple_test.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/simple_test.xml new file mode 100644 index 0000000..68d5629 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/simple_test.xml @@ -0,0 +1,556 @@ + + + + + + Prise en main rapide de SimpleTest pour PHP - + Tests unitaire et objets fantaisie pour PHP + + + +

+ Le prsent article prsuppose que vous soyez familier avec + le concept de tests unitaires ainsi que celui de dveloppement + web avec le langage PHP. Il s'agit d'un guide pour le nouvel + et impatient utilisateur de + SimpleTest. + Pour une documentation plus complte, particulirement si + vous dcouvrez les tests unitaires, consultez la + documentation + en cours, et pour des exemples de scnarios de test, + consultez le + tutorial + sur les tests unitaires. +

+
+
+

+ Parmi les outils de test pour logiciel, le testeur unitaire + est le plus proche du dveloppeur. Dans un contexte de + dveloppement agile, le code de test se place juste ct + du code source tant donn que tous les deux sont crits + simultanment. Dans ce contexte, SimpleTest aspire tre + une solution complte de test pour un dveloppeur PHP et + s'appelle "Simple" parce qu'elle devrait tre simple + utiliser et tendre. Ce nom n'tait pas vraiment un bon + choix. Non seulement cette solution inclut toutes les + fonctions classiques qu'on est en droit d'attendre de la + part des portages de JUnit et des PHPUnit, + mais elle inclut aussi les objets fantaisie ou + "mock objects". +

+

+ Ce qui rend cet outil immdiatement utile pour un dveloppeur PHP, + c'est son navigateur web interne. + Il permet des tests qui parcourent des sites web, remplissent + des formulaires et testent le contenu des pages. + Etre capable d'crire ces tests en PHP veut dire qu'il devient + facile d'crire des tests de recette (ou d'intgration). + Un exemple serait de confirmer qu'un utilisateur a bien t ajout + dans une base de donnes aprs s'tre enregistr sur une site web. +

+

+ La dmonstration la plus rapide : l'exemple +

+

+ Supposons que nous sommes en train de tester une simple + classe de log dans un fichier : elle s'appelle + Log dans classes/Log.php. Commenons + par crer un script de test, appel + tests/log_test.php. Son contenu est le suivant... +require_once('simpletest/autorun.php'); +require_once('../classes/log.php'); + +class TestOfLogging extends UnitTestCase { +} +?> +]]> + Ici le rpertoire simpletest est soit dans le + dossier courant, soit dans les dossiers pour fichiers + inclus. Vous auriez diter ces arborescences suivant + l'endroit o vous avez install SimpleTest. + Le fichier "autorun.php" fait plus que juste inclure + les lments de SimpleTest : il lance aussi les tests pour nous. +

+

+ TestOfLogging est notre premier scnario de test + et il est pour l'instant vide. + Chaque scnario de test est une classe qui tend une des classes + de base de SimpleTest. Nous pouvons avoir autant de classes de ce type + que nous voulons. +

+

+ Avec ces trois lignes d'chafaudage + l'inclusion de notre classe Log, nous avons une suite + de tests. Mais pas encore de test ! +

+

+ Pour notre premier test, supposons que la classe Log + prenne le nom du fichier crire au sein du constructeur, + et que nous avons un rpertoire temporaire dans lequel placer + ce fichier. +testLogCreatesNewFileOnFirstMessage() { + @unlink('/temp/test.log'); + $log = new Log('/temp/test.log'); + $this->assertFalse(file_exists('/temp/test.log')); + $log->message('Should write this to a file'); + $this->assertTrue(file_exists('/temp/test.log')); + } +} +?> +]]> + Au lancement du scnario de test, toutes les mthodes qui + commencent avec la chane test sont + identifies puis excutes. + Si la mthode commence par test, c'est un test. + Remarquez bien le nom trs long de notre exemple : + testLogCreatesNewFileOnFirstMessage(). + C'est bel et bien dlibr : ce style est considr dsirable + et il rend la sortie du test plus lisible. +

+

+ D'ordinaire nous avons bien plusieurs mthodes de tests. + Mais ce sera pour plus tard. +

+

+ Les assertions dans les + mthodes de test envoient des messages vers le framework de + test qui affiche immdiatement le rsultat. Cette rponse + immdiate est importante, non seulement lors d'un crash + caus par le code, mais aussi de manire rapprocher + l'affichage de l'erreur au plus prs du scnario de test + concern via un appel printcode>. +

+

+ Pour voir ces rsultats lanons effectivement les tests. + Aucun autre code n'est ncessaire, il suffit d'ouvrir + la page dans un navigateur. +

+

+ En cas chec, l'affichage ressemble ... +

+

TestOfLogging

+ Fail: testcreatingnewfile->True assertion failed.
+
1/1 test cases complete. + 1 passes and 1 fails.
+
+ ...et si a passe, on obtient... +
+

TestOfLogging

+
1/1 test cases complete. + 2 passes and 0 fails.
+
+ Et si vous obtenez a... +
+ Fatal error: Failed opening required '../classes/log.php' (include_path='') in /home/marcus/projects/lastcraft/tutorial_tests/Log/tests/log_test.php on line 7 +
+ c'est qu'il vous manque le fichier classes/Log.php + qui pourrait ressembler : + +class Log { + function Log($file_path) { + } + + function message() { + } +} +?> +]]> + C'est largement plus sympathique d'crire le code aprs le test. + Plus que sympatique mme - cette technique s'appelle + "Dveloppement Pilot par les Tests" ou + "Test Driven Development" en anglais. +

+

+ Pour plus de renseignements sur le testeur, voyez la + documentation pour les tests de rgression. +

+
+
+

+ Il est peu probable que dans une vritable application on + ait uniquement besoin de passer un seul scnario de test. + Cela veut dire que nous avons besoin de grouper les + scnarios dans un script de test qui peut, si ncessaire, + lancer tous les tests de l'application. +

+

+ Notre premire tape est de crer un nouveau fichier appel + tests/all_tests.php et d'y inclure le code suivant... +require_once('simpletest/autorun.php'); + +class AllTests extends TestSuite { + function AllTests() { + $this->TestSuite('All tests'); + $this->addFile('log_test.php'); + } +} +?> +]]> + L'inclusion de "autorun" permettra notre future suite + de tests d'tre lance juste en invoquant ce script. +

+

+ La sous-classe TestSuite doit chaner + son constructeur. Cette limitation sera supprime dans + les versions venir. +

+

+ The method TestSuite::addFile() + will include the test case file and read any new classes + that are descended from SimpleTestCase. + + Cette mthode TestSuite::addTestFile() va + inclure le fichier de scnarios de test et lire parmi + toutes les nouvelles classes cres celles qui sont issues + de SimpleTestCase. + UnitTestCase est juste un exemple de classe drive + depuis SimpleTestCase et vous pouvez crer les vtres. + TestSuite::addFile() peut aussi inclure d'autres suites. +

+

+ La classe ne sera pas encore instancie. + Quand la suite de tests est lance, elle construira chaque instance + une fois le test atteint, et le dtuira juste ensuite. + Cela veut dire que le constructeur n'est lanc qu'une fois avant + chaque initialisation de ce scnario de test et que le destructeur + est lui aussi lanc avant que le test suivant ne commence. +

+

+ Il est commun de grouper des scnarios de test dans des super-classes + qui ne sont pas senses tre lances, mais qui deviennent une classe de base + pour d'autres tests. + Pour que "autorun" fonctionne proprement les fichiers + des scnarios de test ne devraient pas lancer aveuglement + d'autres extensions de scnarios de test qui ne lanceraient pas + effectivement des tests. + Cela pourrait aboutir un mauvais comptages des scnarios de test + pendant la procdure. + Pas vraiement un problme majeure, mais pour viter cet inconvnient + il suffit de marquer vos classes de base comme abstract. + SimpleTest ne lance pas les classes abstraites. Et si vous utilisez encore + PHP4 alors une directive SimpleTestOptions::ignore() + dans votre fichier de scnario de test aura le mme effet. +

+

+ Par ailleurs, le fichier avec le scnario de test ne devrait pas + avoir t inclus ailleurs. Sinon aucun scnario de test + ne sera inclus ce groupe. + Ceci pourrait se transformer en un problme plus grave : + si des fichiers ont dj t inclus par PHP alors la mthode + TestSuite::addFile() ne les dtectera pas. +

+

+ Pour afficher les rsultats, il est seulement ncessaire + d'invoquer tests/all_tests.php partir du serveur + web. +

+

+ Pour plus de renseignements des groupes de tests, voyez le + documentation sur le groupement des tests. +

+
+
+

+ Avanons un peu plus dans le futur. +

+

+ Supposons que notre class logging soit teste et termine. + Supposons aussi que nous testons une autre classe qui ait + besoin d'crire des messages de log, disons + SessionPool. Nous voulons tester une mthode + qui ressemblera probablement quelque chose comme... + +class SessionPool { + ... + function logIn($username) { + ... + $this->_log->message('User $username logged in.'); + ... + } + ... +} + +]]> + Avec le concept de "rutilisation de code" comme fil + conducteur, nous utilisons notre class Log. Un + scnario de test classique ressemblera peut-tre ... +require_once('../classes/session_pool.php'); + +class TestOfSessionLogging extends UnitTestCase { + + function setUp() { + @unlink('/temp/test.log'); + } + + function tearDown() { + @unlink('/temp/test.log'); + } + + function testLoggingInIsLogged() { + $log = new Log('/temp/test.log'); + $session_pool = &new SessionPool($log); + $session_pool->logIn('fred'); + $messages = file('/temp/test.log'); + $this->assertEqual($messages[0], "User fred logged in.\n"); + } +} +?> +]]> + Nous expliquerons les mthodes setUp() + et tearDown() plus tard. +

+

+ Le design de ce scnario de test n'est pas compltement + mauvais, mais on peut l'amliorer. Nous passons du temps + tripoter les fichiers de log qui ne font pas partie de + notre test. + Pire, nous avons cr des liens de proximit + entre la classe Log et ce test. Que se + passerait-il si nous n'utilisions plus de fichiers, mais la + bibliothque syslog la place ? + + Cela veut dire que notre test TestOfSessionLogging + enverra un chec alors mme qu'il ne teste pas Logging. +

+

+ Il est aussi fragile sur des petites retouches. Avez-vous + remarqu le retour chariot supplmentaire la fin du + message ? A-t-il t ajout par le loggueur ? Et si il + ajoutait aussi un timestamp ou d'autres donnes ? +

+

+ L'unique partie tester rellement est l'envoi d'un + message prcis au loggueur. + Nous pouvons rduire le couplage en + crant une fausse classe de logging : elle ne fait + qu'enregistrer le message pour le test, mais ne produit + aucun rsultat. Sauf qu'elle doit ressembler exactement + l'original. +

+

+ Si l'objet fantaisie n'crit pas dans un fichier alors nous + nous pargnons la suppression du fichier avant et aprs le + test. Nous pourrions mme nous pargner quelques lignes de + code supplmentaires si l'objet fantaisie pouvait excuter + l'assertion. +

+

+ Trop beau pour tre vrai ? Pas vraiement on peut crer un tel + objet trs facilement... +Mock::generate('Log'); + +class TestOfSessionLogging extends UnitTestCase { + + function testLoggingInIsLogged() { + $log = &new MockLog(); + $log->expectOnce('message', array('User fred logged in.')); + $session_pool = &new SessionPool($log); + $session_pool->logIn('fred'); + } +} +?> +]]> + L'appel Mock::generate() a gnr + une nouvelle classe appel MockLog. + Cela ressemble un clone identique, sauf que nous pouvons + y adjoindre du code de test. + C'est ce que fait expectOnce(). + Cela dit que si message() m'est appel, + il a intrt l'tre avec le paramtre + "User fred logged in.". +

+

+ L'appel tally() est ncessaire pour annoncer + l'objet fantaisie qu'il n'y aura plus d'appels ultrieurs. + Sans a l'objet fantaisie pourrait attendre pendant une + ternit l'appel de la mthode sans jamais prvenir le + scnario de test. Les autres tests sont dclenchs + automatiquement quand l'appel message() est + invoqu sur l'objet MockLog par le code + SessionPool::logIn(). + L'appel mock va dclencher une comparaison des + paramtres et ensuite envoyer le message "pass" ou "fail" + au test pour l'affichage. Des jokers peuvent tre inclus + pour ne pas avoir tester tous les paramtres d'un appel + alors que vous ne souhaitez qu'en tester un. +

+

+ Les objets fantaisie dans la suite SimpleTest peuvent avoir + un ensemble de valeurs de sortie arbitraires, des squences + de sorties, des valeurs de sortie slectionnes partir + des arguments d'entre, des squences de paramtres + attendus et des limites sur le nombre de fois qu'une + mthode peut tre invoque. +

+

+ Pour que ce test fonctionne la librairie avec les objets + fantaisie doit tre incluse dans la suite de tests, par + exemple dans all_tests.php. +

+

+ Pour plus de renseignements sur les objets fantaisie, voyez le + documentation sur les objets fantaisie. +

+
+
+

+ Une des exigences des sites web, c'est qu'ils produisent + des pages web. Si vous construisez un projet de A Z et + que vous voulez intgrer des tests au fur et mesure alors + vous voulez un outil qui puisse effectuer une navigation + automatique et en examiner le rsultat. C'est le boulot + d'un testeur web. +

+

+ Effectuer un test web via SimpleTest reste assez primitif : + il n'y a pas de javascript par exemple. + La plupart des autres oprations d'un navigateur sont simules. +

+

+ Pour vous donner une ide, voici un exemple assez trivial : + aller chercher une page web, + partir de l naviguer vers la page "about" + et finalement tester un contenu dtermin par le client. +require_once('simpletest/web_tester.php'); + +class TestOfAbout extends WebTestCase { + function testOurAboutPageGivesFreeReignToOurEgo() { + $this->get('http://test-server/index.php'); + $this->click('About'); + $this->assertTitle('About why we are so great'); + $this->assertText('We are really great'); + } +} +?> +]]> + Avec ce code comme test de recette, vous pouvez vous + assurer que le contenu corresponde toujours aux + spcifications la fois des dveloppeurs et des autres + parties prenantes au projet. +

+

+ Vous pouvez aussi naviguer travers des formulaires... +get('http://google.com/'); + $this->setField('q', 'simpletest'); + $this->click("I'm Feeling Lucky"); + $this->assertTitle('SimpleTest - Unit Testing for PHP'); + } +} +?> +]]> + ...mme si cela pourrait constituer une violation + des documents juridiques de Google(tm). +

+

+ Pour plus de renseignements sur comment tester une page web, voyez la + documentation sur tester des scripts web. +

+

+ SourceForge.net Logo +

+
+
+ + + Utiliser le testeur rapidement + avec un exemple. + + + Groupes de tests + pour tester en un seul clic. + + + Utiliser les objets fantaisie + pour faciliter les tests et gagner en contrle. + + + Tester des pages web + au niveau de l'HTML. + + + + + Tlcharger PHP Simple Test + depuis SourceForge. + + + L'API de SimpleTest pour dveloppeur + donne tous les dtails sur les classes et assertions existantes. + + + + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + architecture, + ressources php, + objets fantaise, + junit, + php testing, + php unit, + mthodologie, + dveloppement pilot par les tests, + sourceforge, + open source, + unit test, + web tester, + web testing, + outils tests html, + tester des web pages, + php objets fantaise, + naviguer automatiquement sur des sites web, + test automatis, + scripting web, + wget, + test curl, + jmock pour php, + jwebunit, + phpunit, + php unit testing, + php web testing, + jason sweat, + marcus baker, + perrick penet, + topstyle plug in, + phpedit plug in + + +
diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/subclass_tutorial.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/subclass_tutorial.xml new file mode 100644 index 0000000..d730c8c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/subclass_tutorial.xml @@ -0,0 +1,261 @@ + + + + + Tutorial de test unitaire en PHP - Sous classer un scnario de test + +
+

+ Nous avions laiss notre test d'horloge avec un trou. + Si la fonction time() de PHP avanait pendant cette comparaison... +assertEqual($clock->now(), time(), 'Now is the right time'); +} +]]> + ...notre test aurait un cart d'une seconde + et entranerait un faux chec. + Un comportement erratique de notre suite de test + n'est vraiment pas ce que nous souhaitons : + nous pourrions la lancer une centaine de fois par jour. +

+

+ Nous pourrions r-crire notre test... + + $time1 = $clock->now(); + $time2 = time(); + $this->assertTrue(($time1 == $time2) || ($time1 + 1 == $time2), 'Now is the right time'); +} +]]> + Sauf que la conception n'est pas plus claire + et que nous devrons le rpter pour chaque test de chronomtrage. + Les rptitions sont un ennemi public n1 + et donc un trs bon stimulant pour le remaniement de notre code de test. +UnitTestCase('Clock class test'); + } + function assertSameTime($time1, $time2, $message) { + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } + function testClockTellsTime() { + $clock = new Clock(); + $this->assertSameTime($clock->now(), time(), 'Now is the right time'); + } + function testClockAdvance() { + $clock = new Clock(); + $clock->advance(10); + $this->assertSameTime($clock->now(), time() + 10, 'Advancement'); + } +} +]]> + Bien entendu chaque modification je relance + les tests pour bien vrifier que nous sommes dans les clous. + Remaniement au vert. C'est beaucoup plus sr. +

+
+
+

+ Peut-tre voulons nous ajouter d'autres tests + sensibles au temps. Peut-tre lisons nous des timestamps + - en provenance d'une entre dans une base de donnes ou d'ailleurs + - qui tiendraient compte d'une simple seconde pour basculer. + Pour que ces nouvelles classes de test profitent + de notre nouvelle assertion nous avons besoin + de la placer dans une "super classe". +

+

+ Voici notre fichier clock_test.php + au complet aprs la promotion de notre mthode + assertSameTime() dans sa propre "super classe"... + + class TimeTestCase extends UnitTestCase { + function TimeTestCase($test_name) { + $this->UnitTestCase($test_name); + } + function assertSameTime($time1, $time2, $message) { + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } + } + + class TestOfClock extends TimeTestCase { + function TestOfClock() { + $this->TimeTestCase('Clock class test'); + } + function testClockTellsTime() { + $clock = new Clock(); + $this->assertSameTime($clock->now(), time(), 'Now is the right time'); + } + function testClockAdvance() { + $clock = new Clock(); + $clock->advance(10); + $this->assertSameTime($clock->now(), time() + 10, 'Advancement'); + } + } +?> +]]> + Dsormais nous bnficions de notre nouvelle assertion + chaque fois que nous hritons de notre propre classe + TimeTestCase plutt que de la classe + par dfaut UnitTestCase. + Nous retrouvons la conception de l'outil JUnit + et SimpleTest est un portage en PHP de cette interface. + Il s'agit d'un framework de test partir duquel + votre propre systme de test peut s'agrandir. +

+

+ Si nous lanons les tests maintenant + une lgre broutille survient... +

+ Warning: Missing argument 1 for timetestcase() + in /home/marcus/projects/lastcraft/tutorial_tests/tests/clock_test.php on line 5
+

All tests

+
3/3 test cases complete. + 6 passes and 0 fails.
+
+ La raison est assez dlicate. +

+

+ Notre sous-classe exige un paramtre + dans le constructeur qui n'a pas t fourni + et pourtant il semblerait que nous l'ayons + bel et bien fourni. Quand nous avons hrit + de notre nouvelle casse nous lui avons pass + notre propre constructeur. C'est juste l... +TimeTestCase('Clock class test'); +} +]]> + En fait nous avons raison, + l n'est pas le problme. +

+

+ Vous vous souvenez de quand nous avons construit + le test de groupe all_tests.php + en utilisant la mthode addTestFile(). + Cette mthode recherche les classes de scnario de test, + les instancie si elles sont nouvelles puis excute + tous nos tests. Ce qui s'est pass ? + Elle a aussi trouv notre extension de scnario de test. + C'est sans consquence puisque qu'il n'y a pas + de mthode de test l'intrieur - comprendre pas + de mthode commenant par "test". + Aucun test supplmentaire n'est excut. +

+

+ Le problme vient du fait qu'il instancie la classe + et le fait sans le paramtre $test_name + qui dclenche l'avertissement. + Ce paramtre n'est gnralement ncessaire + ni pour un scnario de test, ni pour son assertion. + Pour que notre scnario de test tendu corresponde + l'interface de UnitTestCase, + nous avons besoin de le rendre optionnel... +$test_name = false) { + $this->UnitTestCase($test_name); + } + function assertSameTime($time1, $time2, $message = false) { + if (! $message) { + $message = "Time [$time1] should match time [$time2]"; + } + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } +} +]]> + Bien sr, que cette classe soit instancie + sans raison par la suite de test devrait + continuer vous ennuyer. + Voici une modification pour l'empcher de s'excuter... +SimpleTestOptions::ignore('TimeTestCase'); +class TimeTestCase extends UnitTestCase { + function TimeTestCase($test_name = false) { + $this->UnitTestCase($test_name); + } + function assertSameTime($time1, $time2, $message = '') { + if (!$message) { + $message = "Time [$time1] should match time [$time2]"; + } + $this->assertTrue( + ($time1 == $time2) || ($time1 + 1 == $time2), + $message); + } +} +]]> + Cette ligne ne fait que demander SimpleTest + d'ignorer cette classe lors de la construction + des suites de test. Elle peut tre ajoute n'importe + o dans le fichier de scnario de test. +

+

+ Les six succs ont l'air bien mais ne disent + pas un observateur peu attentif ce qui a t test. + Pour cela il faut regarder dans le code. + Si cela vous parat trop de boulot et que vous + prfreriez lire ces informations directement + alors vous devriez aller lire comment + afficher les succs. +

+
+
+ + + Une assertion insensible au chronomtre + qui permet de gagner une seconde. + + + Sous classer un scnario de test + afin de rutiliser la mthode de test. + + + + + Section prcdente : + contrler les variables de test. + + + Section suivante : + changer l'affichage des tests. + + + Vous aurez besoin du + testeur unitaire SimpleTest + pour les exemples. + + + + + dveloppement logiciel, + programmation php, + outils de dveloppement logiciel, + tutorial php, + scripts php gratuits, + organisation de tests unitaires, + cration de sous-classe, + conseil de test, + astuce de dveloppement, + exemple de code php, + objets fantaisie, + junit, + test php, + outil de test unitaire, + suite de test php + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/support_website.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/support_website.xml new file mode 100644 index 0000000..0494f65 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/support_website.xml @@ -0,0 +1,60 @@ + + + + + Mailing-list de support + + +

+ La mailing-list simpletest-support est probablement l'endroit + le plus actif autour de SimpleTest : aide, conseil, bugs et détours, c'est là + que tout se passe la plupart du temps. Attention tout de même : les échanges + ont lieu en anglais. +

+
+
+

+ C'est vraiment + + simple de s'y abonner et en plus, on peut aussi + + l'utiliser pour ses recherches. +

+

+ Au dernier pointage, il y avait 114 abonnés et 1908 messages envoyés. + Cela fait de 1 à 4 messages par jour en moyenne. +

+
+
+ + + Pour s'abonner. + + + + + S'inscrire à la + + mailing list "Support". + + + Lire les + + archives. + + + + + SimpleTest, + download, + source code, + stable release, + eclipse release, + eclipse plugin, + debian package, + drupal module, + pear channel, + pearified package + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/unit_test_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/unit_test_documentation.xml new file mode 100644 index 0000000..2ee95ef --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/unit_test_documentation.xml @@ -0,0 +1,330 @@ + + + + + Documentation SimpleTest pour les tests de rgression en PHP + +
+

+ Le coeur du systme est un framework de tests de rgression + construit autour des scnarios de test. + Un exemple de scnario de test ressemble ... +class FileTestCase extends UnitTestCase { +} +]]> + Si aucun nom de test n'est fourni au moment + de la liaison avec le constructeur alors + le nom de la classe sera utilis. + Il s'agit du nom qui sera affich dans les rsultats du test. +

+

+ Les vritables tests sont ajouts en tant que mthode + dans le scnario de test dont le nom par dfaut + commence par la chane "test" + et quand le scnario de test est appel toutes les mthodes + de ce type sont excutes dans l'ordre utilis + par l'introspection de PHP pour les trouver. + Peuvent tre ajoutes autant de mthodes de test que ncessaires. + Par exemple... +UnitTestCase('File test'); + } + + function setUp() { + @unlink('../temp/test.txt'); + } + + function tearDown() { + @unlink('../temp/test.txt'); + } + + function testCreation() { + $writer = &new FileWriter('../temp/test.txt'); + $writer->write('Hello'); + $this->assertTrue(file_exists('../temp/test.txt'), 'File created'); + } +} +]]> + Le constructeur est optionnel et souvent omis. Sans nom, + le nom de la classe est utilis comme nom pour le scnario de test. +

+

+ Notre unique mthode de test pour le moment est + testCreation() o nous vrifions + qu'un fichier a bien t cr par notre objet + Writer. Nous pourrions avoir mis + le code unlink() dans cette mthode, + mais en la plaant dans setUp() + et tearDown() nous pouvons l'utiliser + pour nos autres mthodes de test que nous ajouterons. +

+

+ La mthode setUp() est lanc + juste avant chaque mthode de test. + tearDown() est lanc aprs chaque mthode de test. +

+

+ Vous pouvez placer une initialisation de + scnario de test dans le constructeur afin qu'elle soit lance + pour toutes les mthodes dans le scnario de test + mais dans un tel cas vous vous exposeriez des interfrences. + Cette faon de faire est lgrement moins rapide, + mais elle est plus sre. + Notez que si vous arrivez avec des notions de JUnit, + il ne s'agit pas du comportement auquel vous tes habitus. + Bizarrement JUnit re-instancie le scnario de test + pour chaque mthode de test pour se prvenir + d'une telle interfrence. + SimpleTest demande l'utilisateur final d'utiliser + setUp(), mais fournit aux codeurs de bibliothque d'autres crochets. +

+

+ Pour rapporter les rsultats de test, + le passage par une classe d'affichage - notifie par + les diffrentes mthodes de type assert...() - + est utilise. En voici la liste complte pour + la classe UnitTestCase, + celle par dfaut dans SimpleTest... + + + + + + + + + + + + + + + + +
assertTrue($x)Echoue si $x est faux
assertFalse($x)Echoue si $x est vrai
assertNull($x)Echoue si $x est initialis
assertNotNull($x)Echoue si $x n'est pas initialis
assertIsA($x, $t)Echoue si $x n'est pas de la classe ou du type $t
assertEqual($x, $y)Echoue si $x == $y est faux
assertNotEqual($x, $y)Echoue si $x == $y est vrai
assertIdentical($x, $y)Echoue si $x === $y est faux
assertNotIdentical($x, $y)Echoue si $x === $y est vrai
assertReference($x, $y)Echoue sauf si $x et $y sont la mme variable
assertCopy($x, $y)Echoue si $x et $y sont la mme variable
assertWantedPattern($p, $x)Echoue sauf si l'expression rationnelle $p capture $x
assertNoUnwantedPattern($p, $x)Echoue si l'expression rationnelle $p capture $x
assertNoErrors()Echoue si une erreur PHP arrive
assertError($x)Echoue si aucune erreur ou message incorrect de PHP n'arrive
+ Toutes les mthodes d'assertion peuvent recevoir + une description optionnelle : + cette description sert pour tiqueter le rsultat. + Sans elle, une message par dfaut est envoye la place : + il est gnralement suffisant. + Ce message par dfaut peut encore tre encadr + dans votre propre message si vous incluez "%s" + dans la chane. + Toutes les assertions renvoient vrai / true en cas de succs + et faux / false en cas d'chec. +

+

+ D'autres exemples... +$variable = null; +$this->assertNull($variable, 'Should be cleared'); +]]> + ...passera et normalement n'affichera aucun message. + Si vous avez + configur le testeur pour afficher aussi les succs + alors le message sera affich comme tel. +$this->assertIdentical(0, false, 'Zero is not false [%s]'); +]]> + Ceci chouera tant donn qu'il effectue une vrification + sur le type en plus d'une comparaison sur les deux valeurs. + La partie "%s" est remplace par le message d'erreur + par dfaut qui aurait t affich si nous n'avions pas fourni le ntre. + Cela nous permet d'emboter les messages de test. +$a = 1; +$b = $a; +$this->assertReference($a, $b); +]]> + chouera tant donn que la variable $b + est une copie de $a. +$this->assertWantedPattern('/hello/i', 'Hello world'); +]]> + L, a passe puisque la recherche est insensible + la casse et que donc hello + est bien reprable dans Hello world. +trigger_error('Disaster'); +trigger_error('Catastrophe'); +$this->assertError(); +$this->assertError('Catastrophe'); +$this->assertNoErrors(); +]]> + Ici, il y a besoin d'une petite explication : + toutes passent ! +

+

+ Les erreurs PHP dans SimpleTest sont piges et + places dans une queue. Ici la premire vrification + d'erreur attrape le message "Disaster" + sans vrifier le texte et passe. Rsultat : + l'erreur est supprime de la queue. + La vrification suivante teste non seulement l'existence + de l'erreur mais aussi le texte qui correspond : + un autre succs. Dsormais la queue est vide + et le dernier test passe aussi. + Si une autre erreur non vrifie est encore + dans la queue la fin de notre mthode de test + alors une exception sera rapporte dans le test. + Notez que SimpleTest ne peut pas attraper les erreurs PHP la compilation. +

+

+ Les scnarios de test peuvent utiliser des mthodes + bien pratiques pour dboguer le code ou pour tendre la suite... + + + + + + + + + + +
setUp()Est lance avant chaque mthode de test
tearDown()Est lance aprs chaque mthode de test
pass()Envoie un succs
fail()Envoie un chec
error()Envoi un vnement exception
sendMessage()Envoie un message d'tat aux systmes d'affichage qui le supporte
signal($type, $payload)Envoie un message dfini par l'utilisateur au rapporteur du test
dump($var)Effectue un print_r() format pour du dboguage rapide et grossier
swallowErrors()Vide les erreurs de la queue
+

+
+
+

+ Bien sr des mthodes supplmentaires de test + peuvent tre ajoutes pour crer d'autres types + de scnario de test afin d'tendre le framework... + +class FileTester extends UnitTestCase { + function FileTester($name = false) { + $this->UnitTestCase($name); + } + + function assertFileExists($filename, $message = '%s') { + $this->assertTrue( + file_exists($filename), + sprintf($message, 'File [$filename] existence check')); + } +} +]]> + Ici la bibliothque SimpleTest est localise + dans un rpertoire local appel simpletest. + Pensez le modifier pour votre propre environnement. +

+

+ Alternativement vous pourriez utiliser dans votre code + un directive SimpleTestOptions::ignore('FileTester');. +

+

+ Ce nouveau scnario peut tre hrit exactement + comme un scnario de test classique... +FileTester { + + function setUp() { + @unlink('../temp/test.txt'); + } + + function tearDown() { + @unlink('../temp/test.txt'); + } + + function testCreation() { + $writer = &new FileWriter('../temp/test.txt'); + $writer->write('Hello'); + $this->assertFileExists('../temp/test.txt'); + } +} +]]> +

+

+ Si vous souhaitez un scnario de test sans + toutes les assertions de UnitTestCase + mais uniquement avec les vtres propres, + vous aurez besoin d'tendre la classe + SimpleTestCase la place. + Elle se trouve dans simple_test.php + en lieu et place de unit_tester.php. + A consulter plus tard + si vous souhaitez incorporer les scnarios + d'autres testeurs unitaires dans votre suite de test. +

+
+
+

+ Ce n'est pas souvent qu'il faille lancer des scnarios + avec un unique test. Sauf lorsqu'il s'agit de s'arracher + les cheveux sur un module problme sans pour + autant dsorganiser la suite de test principale. + Avec autorun aucun chafaudage particulier + n'est ncessaire, il suffit de lancer votre test et + vous y tes. +

+

+ Vous pouvez mme dcider quel rapporteur + (par exemple, TextReporter ou HtmlReporter) + vous prfrez pour un fichier spcifique quand il est lanc + tout seul... + +SimpleTest :: prefer(new TextReporter()); +require_once('../classes/writer.php'); + +class FileTestCase extends UnitTestCase { + ... +} +?> +]]> + Ce script sera lanc tel que mais il n'y aura + aucun succs ou chec avant que des mthodes de test soient ajoutes. +

+
+
+ + + Scnarios de test unitaire + et oprations basiques. + + + tendre des scnarios de test + pour les personnaliser votre propre projet. + + + Lancer un scnario seul + comme un script unique. + + + + + La page de SimpleTest sur + SourceForge. + + + La page de tlchargement de SimpleTest sur + LastCraft. + + + L'API complte de SimpleTest + partir de PHPDoc. + + + + + test unitaire php, + test d'intgration, + documentation, + marcus baker, + perrick penet + simple test, + documentation simpletest, + phpunit, + junit, + xunit + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/web_tester_documentation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/web_tester_documentation.xml new file mode 100644 index 0000000..289ce5c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/docs/source/fr/web_tester_documentation.xml @@ -0,0 +1,377 @@ + + + + + Documentation SimpleTest : tester des scripts web + +
+

+ Tester des classes c'est trs bien. + Reste que PHP est avant tout un langage + pour crer des fonctionnalits l'intrieur de pages web. + Comment pouvons tester la partie de devant + -- celle de l'interface -- dans nos applications en PHP ? + Etant donn qu'une page web n'est constitue que de texte, + nous devrions pouvoir les examiner exactement + comme n'importe quelle autre donne de test. +

+

+ Cela nous amne une situation dlicate. + Si nous testons dans un niveau trop bas, + vrifier des balises avec un motif ad hoc par exemple, + nos tests seront trop fragiles. Le moindre changement + dans la prsentation pourrait casser un grand nombre de test. + Si nos tests sont situs trop haut, en utilisant + une version fantaisie du moteur de template pour + donner un cas prcis, alors nous perdons compltement + la capacit automatiser certaines classes de test. + Par exemple, l'interaction entre des formulaires + et la navigation devra tre test manuellement. + Ces types de test sont extrmement fastidieux + et plutt sensibles aux erreurs. +

+

+ SimpleTest comprend une forme spciale de scnario + de test pour tester les actions d'une page web. + WebTestCase inclut des facilits pour la navigation, + des vrifications sur le contenu + et les cookies ainsi que la gestion des formulaires. + Utiliser ces scnarios de test ressemble + fortement UnitTestCase... +class TestOfLastcraft extends WebTestCase { +} +]]> + Ici nous sommes sur le point de tester + le site de Last Craft. + Si ce scnario de test est situ dans un fichier appel + lastcraft_test.php alors il peut tre charg + dans un script de lancement tout comme des tests unitaires... + +require_once('simpletest/web_tester.php'); +SimpleTest::prefer(new TextReporter()); + +class WebTests extends TestSuite { + function WebTests() { + $this->TestSuite('Web site tests'); + $this->addFile('lastcraft_test.php'); + } +} +?> +]]> + J'utilise ici le rapporteur en mode texte + pour mieux distinguer le contenu au format HTML + du rsultat du test proprement dit. +

+

+ Rien n'est encore test. Nous pouvons tlcharger + la page d'accueil en utilisant la mthode get()... + + function testHomepage() { + $this->assertTrue($this->get('http://www.lastcraft.com/')); + } +} +]]> + La mthode get() renverra "true" + uniquement si le contenu de la page a bien t tlcharg. + C'est un moyen simple, mais efficace pour vrifier + qu'une page web a bien t dlivr par le serveur web. + Cependant le contenu peut rvler tre une erreur 404 + et dans ce cas notre mthode get() renverrait encore un succs. +

+

+ En supposant que le serveur web pour le site Last Craft + soit oprationnel (malheureusement ce n'est pas toujours le cas), + nous devrions voir... +

+Web site tests
+OK
+Test cases run: 1/1, Failures: 0, Exceptions: 0
+
+ Nous avons vrifi qu'une page, de n'importe quel type, + a bien t renvoye. Nous ne savons pas encore + s'il s'agit de celle que nous souhaitions. +

+
+
+

+ Pour obtenir la confirmation que la page tlcharge + est bien celle que nous attendions, + nous devons vrifier son contenu. + + $this->get('http://www.lastcraft.com/'); + $this->assertWantedPattern('/why the last craft/i'); + } +} +]]> + La page obtenue par le dernier tlchargement est + place dans un buffer au sein mme du scnario de test. + Il n'est donc pas ncessaire de s'y rfrer directement. + La correspondance du motif est toujours effectue + par rapport ce buffer. +

+

+ Voici une liste possible d'assertions sur le contenu... + + + + + + + + + + + + + + + + + + + +
assertWantedPattern($pattern)Vrifier une correspondance sur le contenu via une expression rationnelle Perl
assertNoUnwantedPattern($pattern)Une expression rationnelle Perl pour vrifier une absence
assertTitle($title)Passe si le titre de la page correspond exactement
assertLink($label)Passe si un lien avec ce texte est prsent
assertNoLink($label)Passe si aucun lien avec ce texte est prsent
assertLinkById($id)Passe si un lien avec cet attribut d'identification est prsent
assertField($name, $value)Passe si une balise input avec ce nom contient cette valeur
assertFieldById($id, $value)Passe si une balise input avec cet identifiant contient cette valeur
assertResponse($codes)Passe si la rponse HTTP trouve une correspondance dans la liste
assertMime($types)Passe si le type MIME se retrouve dans cette liste
assertAuthentication($protocol)Passe si l'authentification provoque est de ce type de protocole
assertNoAuthentication()Passe s'il n'y pas d'authentification provoque en cours
assertRealm($name)Passe si le domaine provoqu correspond
assertHeader($header, $content)Passe si une entte tlcharge correspond cette valeur
assertNoUnwantedHeader($header)Passe si une entte n'a pas t tlcharg
assertHeaderPattern($header, $pattern)Passe si une entte tlcharge correspond cette expression rationnelle Perl
assertCookie($name, $value)Passe s'il existe un cookie correspondant
assertNoCookie($name)Passe s'il n'y a pas de cookie avec un tel nom
+ Comme d'habitude avec les assertions de SimpleTest, + elles renvoient toutes "false" en cas d'chec + et "true" si c'est un succs. + Elles renvoient aussi un message de test optionnel : + vous pouvez l'ajouter dans votre propre message en utilisant "%s". +

+

+ A prsent nous pourrions effectu le test sur le titre uniquement... +$this->assertTitle('The Last Craft?'); +]]> + En plus d'une simple vrification sur le contenu HTML, + nous pouvons aussi vrifier que le type MIME est bien d'un type acceptable... +$this->assertMime(array('text/plain', 'text/html')); +]]> + Plus intressant encore est la vrification sur + le code de la rponse HTTP. Pareillement au type MIME, + nous pouvons nous assurer que le code renvoy se trouve + bien dans un liste de valeurs possibles... +get('http://simpletest.sourceforge.net/'); + $this->assertResponse(200); + } +} +]]> + Ici nous vrifions que le tlchargement s'est + bien termin en ne permettant qu'une rponse HTTP 200. + Ce test passera, mais ce n'est pas la meilleure faon de procder. + Il n'existe aucune page sur http://simpletest.sourceforge.net/, + la place le serveur renverra une redirection vers + http://www.lastcraft.com/simple_test.php. + WebTestCase suit automatiquement trois + de ces redirections. Les tests sont quelque peu plus + robustes de la sorte. Surtout qu'on est souvent plus intress + par l'interaction entre les pages que de leur simple livraison. + Si les redirections se rvlent tre digne d'intrt, + il reste possible de les supprimer... + + $this->setMaximumRedirects(0); + $this->get('http://simpletest.sourceforge.net/'); + $this->assertResponse(200); + } +} +]]> + Alors l'assertion choue comme prvue... +

+Web site tests
+1) Expecting response in [200] got [302]
+    in testhomepage
+    in testoflastcraft
+    in lastcraft_test.php
+FAILURES!!!
+Test cases run: 1/1, Failures: 1, Exceptions: 0
+
+ Nous pouvons modifier le test pour accepter les redirections... +setMaximumRedirects(0); + $this->get('http://simpletest.sourceforge.net/'); + $this->assertResponse(array(301, 302, 303, 307)); + } +} +]]> + Maitenant a passe. +

+
+
+

+ Les utilisateurs ne naviguent pas souvent en tapant les URLs, + mais surtout en cliquant sur des liens et des boutons. + Ici nous confirmons que les informations sur le contact + peuvent tre atteintes depuis la page d'accueil... +get('http://www.lastcraft.com/'); + $this->clickLink('About'); + $this->assertTitle('About Last Craft'); + } +} +]]> + Le paramtre est le texte du lien. +

+

+ Il l'objectif est un bouton plutt qu'une balise ancre, + alors clickSubmit() doit tre utilis avec + le titre du bouton... +$this->clickSubmit('Go!'); +]]> +

+

+ La liste des mthodes de navigation est... + + + + + + + + + + + + + + + + + + + + + +
get($url, $parameters)Envoie une requte GET avec ces paramtres
post($url, $parameters)Envoie une requte POST avec ces paramtres
head($url, $parameters)Envoie une requte HEAD sans remplacer le contenu de la page
retry()Relance la dernire requte
back()Identique au bouton "Prcdent" du navigateur
forward()Identique au bouton "Suivant" du navigateur
authenticate($name, $password)Re-essaye avec une tentative d'authentification
getFrameFocus()Le nom de la fentre en cours d'utilisation
setFrameFocusByIndex($choice)Change le focus d'une fentre en commenant par 1
setFrameFocus($name)Change le focus d'une fentre en utilisant son nom
clearFrameFocus()Revient un traitement de toutes les fentres comme une seule
clickSubmit($label)Clique sur le premier bouton avec cette tiquette
clickSubmitByName($name)Clique sur le bouton avec cet attribut de nom
clickSubmitById($id)Clique sur le bouton avec cet attribut d'identification
clickImage($label, $x, $y)Clique sur une balise input de type image par son titre (title="*") our son texte alternatif (alt="*")
clickImageByName($name, $x, $y)Clique sur une balise input de type image par son attribut (name="*")
clickImageById($id, $x, $y)Clique sur une balise input de type image par son identifiant (id="*")
submitFormById($id)Soumet un formulaire sans valeur de soumission
clickLink($label, $index)Clique sur une ancre avec ce texte d'tiquette visible
clickLinkById($id)Clique sur une ancre avec cet attribut d'identification
+

+

+ Les paramtres dans les mthodes get(), + post() et head() sont optionnels. + Le tlchargement via HTTP HEAD ne modifie pas + le contexte du navigateur, il se limite au chargement des cookies. + Cela peut tre utilise lorsqu'une image ou une feuille de style + initie un cookie pour bloquer un robot trop entreprenant. +

+

+ Les commandes retry(), back() + et forward() fonctionnent exactement comme + dans un navigateur. Elles utilisent l'historique pour + relancer les pages. Une technique bien pratique pour + vrifier les effets d'un bouton retour sur vos formulaires. +

+

+ Les mthodes sur les fentres mritent une petite explication. + Par dfaut, une page avec des fentres est traite comme toutes + les autres. Le contenu sera vrifi travers l'ensemble de + la "frameset", par consquent un lien fonctionnera, + peu importe la fentre qui contient la balise ancre. + Vous pouvez outrepass ce comportement en exigeant + le focus sur une unique fentre. Si vous ralisez cela, + toutes les recherches et toutes les actions se limiteront + cette unique fentre, y compris les demandes d'authentification. + Si un lien ou un bouton n'est pas dans la fentre en focus alors + il ne peut pas tre cliqu. +

+

+ Tester la navigation sur des pages fixes ne vous alerte que + quand vous avez cass un script entier. + Pour des pages fortement dynamiques, + un forum de discussion par exemple, + a peut tre crucial pour vrifier l'tat de l'application. + Pour la plupart des applications cependant, + la logique vraiment dlicate se situe dans la gestion + des formulaires et des sessions. + Heureusement SimpleTest aussi inclut + + des outils pour tester des formulaires web. +

+
+
+

+ Bien que SimpleTest n'ait pas comme objectif + de contrler des erreurs rseau, il contient quand mme + des mthodes pour modifier et dboguer les requtes qu'il lance. + Voici une autre liste de mthode... + + + + + + + + + + + + +
getTransportError()La dernire erreur de socket
getUrl()La localisation courante
showRequest()Dverse la requte sortante
showHeaders()Dverse les enttes d'entre
showSource()Dverse le contenu brut de la page HTML
ignoreFrames()Ne recharge pas les framesets
setCookie($name, $value)Initie un cookie partir de maintenant
addHeader($header)Ajoute toujours cette entte la requte
setMaximumRedirects($max)S'arrte aprs autant de redirections
setConnectionTimeout($timeout)Termine la connexion aprs autant de temps entre les bytes
useProxy($proxy, $name, $password)Effectue les requtes travers ce proxy d'URL
+

+
+
+ + + Russir tlcharger une page web + + + Tester le contenu de la page + + + Naviguer sur un site web pendant le test + + + Mthodes pour modifier une requte et pour dboguer + + + + + La page du projet SimpleTest sur + SourceForge. + + + La page de tlchargement de SimpleTest sur + LastCraft. + + + L'API du dveloppeur pour SimpleTest + donne tous les dtails sur les classes et les assertions disponibles. + + + + + dveloppement logiciel, + programmation php pour des clients, + php orient client, + outils de dveloppement logiciel, + framework de test de recette, + scripts php gratuits, + architecture, + ressources php, + HTMLUnit, + JWebUnit, + test php, + ressource de test unitaire, + test web + + +
\ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/dumper.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/dumper.php new file mode 100644 index 0000000..ef2662d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/dumper.php @@ -0,0 +1,359 @@ +getType($value); + switch($type) { + case "Null": + return "NULL"; + case "Boolean": + return "Boolean: " . ($value ? "true" : "false"); + case "Array": + return "Array: " . count($value) . " items"; + case "Object": + return "Object: of " . get_class($value); + case "String": + return "String: " . $this->clipString($value, 200); + default: + return "$type: $value"; + } + return "Unknown"; + } + + /** + * Gets the string representation of a type. + * @param mixed $value Variable to check against. + * @return string Type. + * @access public + */ + function getType($value) { + if (! isset($value)) { + return "Null"; + } elseif (is_bool($value)) { + return "Boolean"; + } elseif (is_string($value)) { + return "String"; + } elseif (is_integer($value)) { + return "Integer"; + } elseif (is_float($value)) { + return "Float"; + } elseif (is_array($value)) { + return "Array"; + } elseif (is_resource($value)) { + return "Resource"; + } elseif (is_object($value)) { + return "Object"; + } + return "Unknown"; + } + + /** + * Creates a human readable description of the + * difference between two variables. Uses a + * dynamic call. + * @param mixed $first First variable. + * @param mixed $second Value to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Description of difference. + * @access public + */ + function describeDifference($first, $second, $identical = false) { + if ($identical) { + if (! $this->isTypeMatch($first, $second)) { + return "with type mismatch as [" . $this->describeValue($first) . + "] does not match [" . $this->describeValue($second) . "]"; + } + } + $type = $this->getType($first); + if ($type == "Unknown") { + return "with unknown type"; + } + $method = 'describe' . $type . 'Difference'; + return $this->$method($first, $second, $identical); + } + + /** + * Tests to see if types match. + * @param mixed $first First variable. + * @param mixed $second Value to compare with. + * @return boolean True if matches. + * @access private + */ + protected function isTypeMatch($first, $second) { + return ($this->getType($first) == $this->getType($second)); + } + + /** + * Clips a string to a maximum length. + * @param string $value String to truncate. + * @param integer $size Minimum string size to show. + * @param integer $position Centre of string section. + * @return string Shortened version. + * @access public + */ + function clipString($value, $size, $position = 0) { + $length = strlen($value); + if ($length <= $size) { + return $value; + } + $position = min($position, $length); + $start = ($size/2 > $position ? 0 : $position - $size/2); + if ($start + $size > $length) { + $start = $length - $size; + } + $value = substr($value, $start, $size); + return ($start > 0 ? "..." : "") . $value . ($start + $size < $length ? "..." : ""); + } + + /** + * Creates a human readable description of the + * difference between two variables. The minimal + * version. + * @param null $first First value. + * @param mixed $second Value to compare with. + * @return string Human readable description. + * @access private + */ + protected function describeGenericDifference($first, $second) { + return "as [" . $this->describeValue($first) . + "] does not match [" . + $this->describeValue($second) . "]"; + } + + /** + * Creates a human readable description of the + * difference between a null and another variable. + * @param null $first First null. + * @param mixed $second Null to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Human readable description. + * @access private + */ + protected function describeNullDifference($first, $second, $identical) { + return $this->describeGenericDifference($first, $second); + } + + /** + * Creates a human readable description of the + * difference between a boolean and another variable. + * @param boolean $first First boolean. + * @param mixed $second Boolean to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Human readable description. + * @access private + */ + protected function describeBooleanDifference($first, $second, $identical) { + return $this->describeGenericDifference($first, $second); + } + + /** + * Creates a human readable description of the + * difference between a string and another variable. + * @param string $first First string. + * @param mixed $second String to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Human readable description. + * @access private + */ + protected function describeStringDifference($first, $second, $identical) { + if (is_object($second) || is_array($second)) { + return $this->describeGenericDifference($first, $second); + } + $position = $this->stringDiffersAt($first, $second); + $message = "at character $position"; + $message .= " with [" . + $this->clipString($first, 200, $position) . "] and [" . + $this->clipString($second, 200, $position) . "]"; + return $message; + } + + /** + * Creates a human readable description of the + * difference between an integer and another variable. + * @param integer $first First number. + * @param mixed $second Number to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Human readable description. + * @access private + */ + protected function describeIntegerDifference($first, $second, $identical) { + if (is_object($second) || is_array($second)) { + return $this->describeGenericDifference($first, $second); + } + return "because [" . $this->describeValue($first) . + "] differs from [" . + $this->describeValue($second) . "] by " . + abs($first - $second); + } + + /** + * Creates a human readable description of the + * difference between two floating point numbers. + * @param float $first First float. + * @param mixed $second Float to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Human readable description. + * @access private + */ + protected function describeFloatDifference($first, $second, $identical) { + if (is_object($second) || is_array($second)) { + return $this->describeGenericDifference($first, $second); + } + return "because [" . $this->describeValue($first) . + "] differs from [" . + $this->describeValue($second) . "] by " . + abs($first - $second); + } + + /** + * Creates a human readable description of the + * difference between two arrays. + * @param array $first First array. + * @param mixed $second Array to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Human readable description. + * @access private + */ + protected function describeArrayDifference($first, $second, $identical) { + if (! is_array($second)) { + return $this->describeGenericDifference($first, $second); + } + if (! $this->isMatchingKeys($first, $second, $identical)) { + return "as key list [" . + implode(", ", array_keys($first)) . "] does not match key list [" . + implode(", ", array_keys($second)) . "]"; + } + foreach (array_keys($first) as $key) { + if ($identical && ($first[$key] === $second[$key])) { + continue; + } + if (! $identical && ($first[$key] == $second[$key])) { + continue; + } + return "with member [$key] " . $this->describeDifference( + $first[$key], + $second[$key], + $identical); + } + return ""; + } + + /** + * Compares two arrays to see if their key lists match. + * For an identical match, the ordering and types of the keys + * is significant. + * @param array $first First array. + * @param array $second Array to compare with. + * @param boolean $identical If true then type anomolies count. + * @return boolean True if matching. + * @access private + */ + protected function isMatchingKeys($first, $second, $identical) { + $first_keys = array_keys($first); + $second_keys = array_keys($second); + if ($identical) { + return ($first_keys === $second_keys); + } + sort($first_keys); + sort($second_keys); + return ($first_keys == $second_keys); + } + + /** + * Creates a human readable description of the + * difference between a resource and another variable. + * @param resource $first First resource. + * @param mixed $second Resource to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Human readable description. + * @access private + */ + protected function describeResourceDifference($first, $second, $identical) { + return $this->describeGenericDifference($first, $second); + } + + /** + * Creates a human readable description of the + * difference between two objects. + * @param object $first First object. + * @param mixed $second Object to compare with. + * @param boolean $identical If true then type anomolies count. + * @return string Human readable description. + * @access private + */ + protected function describeObjectDifference($first, $second, $identical) { + if (! is_object($second)) { + return $this->describeGenericDifference($first, $second); + } + return $this->describeArrayDifference( + get_object_vars($first), + get_object_vars($second), + $identical); + } + + /** + * Find the first character position that differs + * in two strings by binary chop. + * @param string $first First string. + * @param string $second String to compare with. + * @return integer Position of first differing + * character. + * @access private + */ + protected function stringDiffersAt($first, $second) { + if (! $first || ! $second) { + return 0; + } + if (strlen($first) < strlen($second)) { + list($first, $second) = array($second, $first); + } + $position = 0; + $step = strlen($first); + while ($step > 1) { + $step = (integer)(($step + 1) / 2); + if (strncmp($first, $second, $position + $step) == 0) { + $position += $step; + } + } + return $position; + } + + /** + * Sends a formatted dump of a variable to a string. + * @param mixed $variable Variable to display. + * @return string Output from print_r(). + * @access public + */ + function dump($variable) { + ob_start(); + print_r($variable); + $formatted = ob_get_contents(); + ob_end_clean(); + return $formatted; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/eclipse.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/eclipse.php new file mode 100644 index 0000000..bd0349a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/eclipse.php @@ -0,0 +1,307 @@ +listener = &$listener; + $this->SimpleScorer(); + $this->case = ""; + $this->group = ""; + $this->method = ""; + $this->cc = $cc; + $this->error = false; + $this->fail = false; + } + + /** + * Means to display human readable object comparisons. + * @return SimpleDumper Visual comparer. + */ + function getDumper() { + return new SimpleDumper(); + } + + /** + * Localhost connection from Eclipse. + * @param integer $port Port to connect to Eclipse. + * @param string $host Normally localhost. + * @return SimpleSocket Connection to Eclipse. + */ + function &createListener($port, $host="127.0.0.1"){ + $tmplistener = &new SimpleSocket($host, $port, 5); + return $tmplistener; + } + + /** + * Wraps the test in an output buffer. + * @param SimpleInvoker $invoker Current test runner. + * @return EclipseInvoker Decorator with output buffering. + * @access public + */ + function &createInvoker(&$invoker){ + $eclinvoker = &new EclipseInvoker($invoker, $this->listener); + return $eclinvoker; + } + + /** + * C style escaping. + * @param string $raw String with backslashes, quotes and whitespace. + * @return string Replaced with C backslashed tokens. + */ + function escapeVal($raw){ + $needle = array("\\","\"","/","\b","\f","\n","\r","\t"); + $replace = array('\\\\','\"','\/','\b','\f','\n','\r','\t'); + return str_replace($needle, $replace, $raw); + } + + /** + * Stash the first passing item. Clicking the test + * item goes to first pass. + * @param string $message Test message, but we only wnat the first. + * @access public + */ + function paintPass($message){ + if (! $this->pass){ + $this->message = $this->escapeVal($message); + } + $this->pass = true; + } + + /** + * Stash the first failing item. Clicking the test + * item goes to first fail. + * @param string $message Test message, but we only wnat the first. + * @access public + */ + function paintFail($message){ + //only get the first failure or error + if (! $this->fail && ! $this->error){ + $this->fail = true; + $this->message = $this->escapeVal($message); + $this->listener->write('{status:"fail",message:"'.$this->message.'",group:"'.$this->group.'",case:"'.$this->case.'",method:"'.$this->method.'"}'); + } + } + + /** + * Stash the first error. Clicking the test + * item goes to first error. + * @param string $message Test message, but we only wnat the first. + * @access public + */ + function paintError($message){ + if (! $this->fail && ! $this->error){ + $this->error = true; + $this->message = $this->escapeVal($message); + $this->listener->write('{status:"error",message:"'.$this->message.'",group:"'.$this->group.'",case:"'.$this->case.'",method:"'.$this->method.'"}'); + } + } + + + /** + * Stash the first exception. Clicking the test + * item goes to first message. + * @param string $message Test message, but we only wnat the first. + * @access public + */ + function paintException($exception){ + if (! $this->fail && ! $this->error){ + $this->error = true; + $message = 'Unexpected exception of type[' . get_class($exception) . + '] with message [' . $exception->getMessage() . '] in [' . + $exception->getFile() .' line '. $exception->getLine() . ']'; + $this->message = $this->escapeVal($message); + $this->listener->write( + '{status:"error",message:"' . $this->message . '",group:"' . + $this->group . '",case:"' . $this->case . '",method:"' . $this->method + . '"}'); + } + } + + + /** + * We don't display any special header. + * @param string $test_name First test top level + * to start. + * @access public + */ + function paintHeader($test_name) { + } + + /** + * We don't display any special footer. + * @param string $test_name The top level test. + * @access public + */ + function paintFooter($test_name) { + } + + /** + * Paints nothing at the start of a test method, but stash + * the method name for later. + * @param string $test_name Name of test that is starting. + * @access public + */ + function paintMethodStart($method) { + $this->pass = false; + $this->fail = false; + $this->error = false; + $this->method = $this->escapeVal($method); + } + + /** + * Only send one message if the test passes, after that + * suppress the message. + * @param string $test_name Name of test that is ending. + * @access public + */ + function paintMethodEnd($method){ + if ($this->fail || $this->error || ! $this->pass){ + } else { + $this->listener->write( + '{status:"pass",message:"' . $this->message . '",group:"' . + $this->group . '",case:"' . $this->case . '",method:"' . + $this->method . '"}'); + } + } + + /** + * Stashes the test case name for the later failure message. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintCaseStart($case){ + $this->case = $this->escapeVal($case); + } + + /** + * Drops the name. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintCaseEnd($case){ + $this->case = ""; + } + + /** + * Stashes the name of the test suite. Starts test coverage + * if enabled. + * @param string $group Name of test or other label. + * @param integer $size Number of test cases starting. + * @access public + */ + function paintGroupStart($group, $size){ + $this->group = $this->escapeVal($group); + if ($this->cc){ + if (extension_loaded('xdebug')){ + xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE); + } + } + } + + /** + * Paints coverage report if enabled. + * @param string $group Name of test or other label. + * @access public + */ + function paintGroupEnd($group){ + $this->group = ""; + $cc = ""; + if ($this->cc){ + if (extension_loaded('xdebug')){ + $arrfiles = xdebug_get_code_coverage(); + xdebug_stop_code_coverage(); + $thisdir = dirname(__FILE__); + $thisdirlen = strlen($thisdir); + foreach ($arrfiles as $index=>$file){ + if (substr($index, 0, $thisdirlen)===$thisdir){ + continue; + } + $lcnt = 0; + $ccnt = 0; + foreach ($file as $line){ + if ($line == -2){ + continue; + } + $lcnt++; + if ($line==1){ + $ccnt++; + } + } + if ($lcnt > 0){ + $cc .= round(($ccnt/$lcnt) * 100, 2) . '%'; + }else{ + $cc .= "0.00%"; + } + $cc.= "\t". $index . "\n"; + } + } + } + $this->listener->write('{status:"coverage",message:"' . + EclipseReporter::escapeVal($cc) . '"}'); + } +} + +/** + * Invoker decorator for Eclipse. Captures output until + * the end of the test. + * @package SimpleTest + * @subpackage Eclipse + */ +class EclipseInvoker extends SimpleInvokerDecorator{ + function __construct(&$invoker, &$listener) { + $this->listener = &$listener; + $this->SimpleInvokerDecorator($invoker); + } + + /** + * Starts output buffering. + * @param string $method Test method to call. + * @access public + */ + function before($method){ + ob_start(); + $this->invoker->before($method); + } + + /** + * Stops output buffering and send the captured output + * to the listener. + * @param string $method Test method to call. + * @access public + */ + function after($method) { + $this->invoker->after($method); + $output = ob_get_contents(); + ob_end_clean(); + if ($output !== ""){ + $result = $this->listener->write('{status:"info",message:"' . + EclipseReporter::escapeVal($output) . '"}'); + } + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/encoding.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/encoding.php new file mode 100644 index 0000000..e44964d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/encoding.php @@ -0,0 +1,552 @@ +key = $key; + $this->value = $value; + } + + /** + * The pair as a single string. + * @return string Encoded pair. + * @access public + */ + function asRequest() { + return urlencode($this->key) . '=' . urlencode($this->value); + } + + /** + * The MIME part as a string. + * @return string MIME part encoding. + * @access public + */ + function asMime() { + $part = 'Content-Disposition: form-data; '; + $part .= "name=\"" . $this->key . "\"\r\n"; + $part .= "\r\n" . $this->value; + return $part; + } + + /** + * Is this the value we are looking for? + * @param string $key Identifier. + * @return boolean True if matched. + * @access public + */ + function isKey($key) { + return $key == $this->key; + } + + /** + * Is this the value we are looking for? + * @return string Identifier. + * @access public + */ + function getKey() { + return $this->key; + } + + /** + * Is this the value we are looking for? + * @return string Content. + * @access public + */ + function getValue() { + return $this->value; + } +} + +/** + * Single post parameter. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleAttachment { + private $key; + private $content; + private $filename; + + /** + * Stashes the data for rendering later. + * @param string $key Key to add value to. + * @param string $content Raw data. + * @param hash $filename Original filename. + */ + function __construct($key, $content, $filename) { + $this->key = $key; + $this->content = $content; + $this->filename = $filename; + } + + /** + * The pair as a single string. + * @return string Encoded pair. + * @access public + */ + function asRequest() { + return ''; + } + + /** + * The MIME part as a string. + * @return string MIME part encoding. + * @access public + */ + function asMime() { + $part = 'Content-Disposition: form-data; '; + $part .= 'name="' . $this->key . '"; '; + $part .= 'filename="' . $this->filename . '"'; + $part .= "\r\nContent-Type: " . $this->deduceMimeType(); + $part .= "\r\n\r\n" . $this->content; + return $part; + } + + /** + * Attempts to figure out the MIME type from the + * file extension and the content. + * @return string MIME type. + * @access private + */ + protected function deduceMimeType() { + if ($this->isOnlyAscii($this->content)) { + return 'text/plain'; + } + return 'application/octet-stream'; + } + + /** + * Tests each character is in the range 0-127. + * @param string $ascii String to test. + * @access private + */ + protected function isOnlyAscii($ascii) { + for ($i = 0, $length = strlen($ascii); $i < $length; $i++) { + if (ord($ascii[$i]) > 127) { + return false; + } + } + return true; + } + + /** + * Is this the value we are looking for? + * @param string $key Identifier. + * @return boolean True if matched. + * @access public + */ + function isKey($key) { + return $key == $this->key; + } + + /** + * Is this the value we are looking for? + * @return string Identifier. + * @access public + */ + function getKey() { + return $this->key; + } + + /** + * Is this the value we are looking for? + * @return string Content. + * @access public + */ + function getValue() { + return $this->filename; + } +} + +/** + * Bundle of GET/POST parameters. Can include + * repeated parameters. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleEncoding { + private $request; + + /** + * Starts empty. + * @param array $query Hash of parameters. + * Multiple values are + * as lists on a single key. + * @access public + */ + function __construct($query = false) { + if (! $query) { + $query = array(); + } + $this->clear(); + $this->merge($query); + } + + /** + * Empties the request of parameters. + * @access public + */ + function clear() { + $this->request = array(); + } + + /** + * Adds a parameter to the query. + * @param string $key Key to add value to. + * @param string/array $value New data. + * @access public + */ + function add($key, $value) { + if ($value === false) { + return; + } + if (is_array($value)) { + foreach ($value as $item) { + $this->addPair($key, $item); + } + } else { + $this->addPair($key, $value); + } + } + + /** + * Adds a new value into the request. + * @param string $key Key to add value to. + * @param string/array $value New data. + * @access private + */ + protected function addPair($key, $value) { + $this->request[] = new SimpleEncodedPair($key, $value); + } + + /** + * Adds a MIME part to the query. Does nothing for a + * form encoded packet. + * @param string $key Key to add value to. + * @param string $content Raw data. + * @param hash $filename Original filename. + * @access public + */ + function attach($key, $content, $filename) { + $this->request[] = new SimpleAttachment($key, $content, $filename); + } + + /** + * Adds a set of parameters to this query. + * @param array/SimpleQueryString $query Multiple values are + * as lists on a single key. + * @access public + */ + function merge($query) { + if (is_object($query)) { + $this->request = array_merge($this->request, $query->getAll()); + } elseif (is_array($query)) { + foreach ($query as $key => $value) { + $this->add($key, $value); + } + } + } + + /** + * Accessor for single value. + * @return string/array False if missing, string + * if present and array if + * multiple entries. + * @access public + */ + function getValue($key) { + $values = array(); + foreach ($this->request as $pair) { + if ($pair->isKey($key)) { + $values[] = $pair->getValue(); + } + } + if (count($values) == 0) { + return false; + } elseif (count($values) == 1) { + return $values[0]; + } else { + return $values; + } + } + + /** + * Accessor for listing of pairs. + * @return array All pair objects. + * @access public + */ + function getAll() { + return $this->request; + } + + /** + * Renders the query string as a URL encoded + * request part. + * @return string Part of URL. + * @access protected + */ + protected function encode() { + $statements = array(); + foreach ($this->request as $pair) { + if ($statement = $pair->asRequest()) { + $statements[] = $statement; + } + } + return implode('&', $statements); + } +} + +/** + * Bundle of GET parameters. Can include + * repeated parameters. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleGetEncoding extends SimpleEncoding { + + /** + * Starts empty. + * @param array $query Hash of parameters. + * Multiple values are + * as lists on a single key. + * @access public + */ + function __construct($query = false) { + parent::__construct($query); + } + + /** + * HTTP request method. + * @return string Always GET. + * @access public + */ + function getMethod() { + return 'GET'; + } + + /** + * Writes no extra headers. + * @param SimpleSocket $socket Socket to write to. + * @access public + */ + function writeHeadersTo(&$socket) { + } + + /** + * No data is sent to the socket as the data is encoded into + * the URL. + * @param SimpleSocket $socket Socket to write to. + * @access public + */ + function writeTo(&$socket) { + } + + /** + * Renders the query string as a URL encoded + * request part for attaching to a URL. + * @return string Part of URL. + * @access public + */ + function asUrlRequest() { + return $this->encode(); + } +} + +/** + * Bundle of URL parameters for a HEAD request. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleHeadEncoding extends SimpleGetEncoding { + + /** + * Starts empty. + * @param array $query Hash of parameters. + * Multiple values are + * as lists on a single key. + * @access public + */ + function SimpleHeadEncoding($query = false) { + $this->SimpleGetEncoding($query); + } + + /** + * HTTP request method. + * @return string Always HEAD. + * @access public + */ + function getMethod() { + return 'HEAD'; + } +} + +/** + * Bundle of POST parameters. Can include + * repeated parameters. + * @package SimpleTest + * @subpackage WebTester + */ +class SimplePostEncoding extends SimpleEncoding { + + /** + * Starts empty. + * @param array $query Hash of parameters. + * Multiple values are + * as lists on a single key. + * @access public + */ + function __construct($query = false) { + if (is_array($query) and $this->hasMoreThanOneLevel($query)) { + $query = $this->rewriteArrayWithMultipleLevels($query); + } + parent::__construct($query); + } + + function hasMoreThanOneLevel($query) { + foreach ($query as $key => $value) { + if (is_array($value)) { + return true; + } + } + return false; + } + + function rewriteArrayWithMultipleLevels($query) { + $query_ = array(); + foreach ($query as $key => $value) { + if (is_array($value)) { + foreach ($value as $sub_key => $sub_value) { + $query_[$key."[".$sub_key."]"] = $sub_value; + } + } else { + $query_[$key] = $value; + } + } + if ($this->hasMoreThanOneLevel($query_)) { + $query_ = $this->rewriteArrayWithMultipleLevels($query_); + } + + return $query_; + } + + + /** + * HTTP request method. + * @return string Always POST. + * @access public + */ + function getMethod() { + return 'POST'; + } + + /** + * Dispatches the form headers down the socket. + * @param SimpleSocket $socket Socket to write to. + * @access public + */ + function writeHeadersTo(&$socket) { + $socket->write("Content-Length: " . (integer)strlen($this->encode()) . "\r\n"); + $socket->write("Content-Type: application/x-www-form-urlencoded\r\n"); + } + + /** + * Dispatches the form data down the socket. + * @param SimpleSocket $socket Socket to write to. + * @access public + */ + function writeTo(&$socket) { + $socket->write($this->encode()); + } + + /** + * Renders the query string as a URL encoded + * request part for attaching to a URL. + * @return string Part of URL. + * @access public + */ + function asUrlRequest() { + return ''; + } +} + +/** + * Bundle of POST parameters in the multipart + * format. Can include file uploads. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleMultipartEncoding extends SimplePostEncoding { + private $boundary; + + /** + * Starts empty. + * @param array $query Hash of parameters. + * Multiple values are + * as lists on a single key. + * @access public + */ + function __construct($query = false, $boundary = false) { + parent::__construct($query); + $this->boundary = ($boundary === false ? uniqid('st') : $boundary); + } + + /** + * Dispatches the form headers down the socket. + * @param SimpleSocket $socket Socket to write to. + * @access public + */ + function writeHeadersTo(&$socket) { + $socket->write("Content-Length: " . (integer)strlen($this->encode()) . "\r\n"); + $socket->write("Content-Type: multipart/form-data, boundary=" . $this->boundary . "\r\n"); + } + + /** + * Dispatches the form data down the socket. + * @param SimpleSocket $socket Socket to write to. + * @access public + */ + function writeTo(&$socket) { + $socket->write($this->encode()); + } + + /** + * Renders the query string as a URL encoded + * request part. + * @return string Part of URL. + * @access public + */ + function encode() { + $stream = ''; + foreach ($this->getAll() as $pair) { + $stream .= "--" . $this->boundary . "\r\n"; + $stream .= $pair->asMime() . "\r\n"; + } + $stream .= "--" . $this->boundary . "--\r\n"; + return $stream; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/errors.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/errors.php new file mode 100644 index 0000000..52385ee --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/errors.php @@ -0,0 +1,257 @@ +createErrorQueue(); + set_error_handler('SimpleTestErrorHandler'); + parent::invoke($method); + restore_error_handler(); + $queue->tally(); + } + + /** + * Wires up the error queue for a single test. + * @return SimpleErrorQueue Queue connected to the test. + * @access private + */ + protected function createErrorQueue() { + $context = SimpleTest::getContext(); + $test = $this->getTestCase(); + $queue = $context->get('SimpleErrorQueue'); + $queue->setTestCase($test); + return $queue; + } +} + +/** + * Error queue used to record trapped + * errors. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleErrorQueue { + private $queue; + private $expectation_queue; + private $test; + private $using_expect_style = false; + + /** + * Starts with an empty queue. + */ + function __construct() { + $this->clear(); + } + + /** + * Discards the contents of the error queue. + * @access public + */ + function clear() { + $this->queue = array(); + $this->expectation_queue = array(); + } + + /** + * Sets the currently running test case. + * @param SimpleTestCase $test Test case to send messages to. + * @access public + */ + function setTestCase($test) { + $this->test = $test; + } + + /** + * Sets up an expectation of an error. If this is + * not fulfilled at the end of the test, a failure + * will occour. If the error does happen, then this + * will cancel it out and send a pass message. + * @param SimpleExpectation $expected Expected error match. + * @param string $message Message to display. + * @access public + */ + function expectError($expected, $message) { + array_push($this->expectation_queue, array($expected, $message)); + } + + /** + * Adds an error to the front of the queue. + * @param integer $severity PHP error code. + * @param string $content Text of error. + * @param string $filename File error occoured in. + * @param integer $line Line number of error. + * @access public + */ + function add($severity, $content, $filename, $line) { + $content = str_replace('%', '%%', $content); + $this->testLatestError($severity, $content, $filename, $line); + } + + /** + * Any errors still in the queue are sent to the test + * case. Any unfulfilled expectations trigger failures. + * @access public + */ + function tally() { + while (list($severity, $message, $file, $line) = $this->extract()) { + $severity = $this->getSeverityAsString($severity); + $this->test->error($severity, $message, $file, $line); + } + while (list($expected, $message) = $this->extractExpectation()) { + $this->test->assert($expected, false, "%s -> Expected error not caught"); + } + } + + /** + * Tests the error against the most recent expected + * error. + * @param integer $severity PHP error code. + * @param string $content Text of error. + * @param string $filename File error occoured in. + * @param integer $line Line number of error. + * @access private + */ + protected function testLatestError($severity, $content, $filename, $line) { + if ($expectation = $this->extractExpectation()) { + list($expected, $message) = $expectation; + $this->test->assert($expected, $content, sprintf( + $message, + "%s -> PHP error [$content] severity [" . + $this->getSeverityAsString($severity) . + "] in [$filename] line [$line]")); + } else { + $this->test->error($severity, $content, $filename, $line); + } + } + + /** + * Pulls the earliest error from the queue. + * @return mixed False if none, or a list of error + * information. Elements are: severity + * as the PHP error code, the error message, + * the file with the error, the line number + * and a list of PHP super global arrays. + * @access public + */ + function extract() { + if (count($this->queue)) { + return array_shift($this->queue); + } + return false; + } + + /** + * Pulls the earliest expectation from the queue. + * @return SimpleExpectation False if none. + * @access private + */ + protected function extractExpectation() { + if (count($this->expectation_queue)) { + return array_shift($this->expectation_queue); + } + return false; + } + + /** + * Converts an error code into it's string + * representation. + * @param $severity PHP integer error code. + * @return String version of error code. + * @access public + */ + static function getSeverityAsString($severity) { + static $map = array( + E_STRICT => 'E_STRICT', + E_ERROR => 'E_ERROR', + E_WARNING => 'E_WARNING', + E_PARSE => 'E_PARSE', + E_NOTICE => 'E_NOTICE', + E_CORE_ERROR => 'E_CORE_ERROR', + E_CORE_WARNING => 'E_CORE_WARNING', + E_COMPILE_ERROR => 'E_COMPILE_ERROR', + E_COMPILE_WARNING => 'E_COMPILE_WARNING', + E_USER_ERROR => 'E_USER_ERROR', + E_USER_WARNING => 'E_USER_WARNING', + E_USER_NOTICE => 'E_USER_NOTICE'); + if (defined('E_RECOVERABLE_ERROR')) { + $map[E_RECOVERABLE_ERROR] = 'E_RECOVERABLE_ERROR'; + } + if (defined('E_DEPRECATED')) { + $map[E_DEPRECATED] = 'E_DEPRECATED'; + } + return $map[$severity]; + } +} + +/** + * Error handler that simply stashes any errors into the global + * error queue. Simulates the existing behaviour with respect to + * logging errors, but this feature may be removed in future. + * @param $severity PHP error code. + * @param $message Text of error. + * @param $filename File error occoured in. + * @param $line Line number of error. + * @param $super_globals Hash of PHP super global arrays. + * @access public + */ +function SimpleTestErrorHandler($severity, $message, $filename = null, $line = null, $super_globals = null, $mask = null) { + $severity = $severity & error_reporting(); + if ($severity) { + restore_error_handler(); + if (IsNotCausedBySimpleTest($message)) { + if (ini_get('log_errors')) { + $label = SimpleErrorQueue::getSeverityAsString($severity); + error_log("$label: $message in $filename on line $line"); + } + $queue = SimpleTest::getContext()->get('SimpleErrorQueue'); + $queue->add($severity, $message, $filename, $line); + } + set_error_handler('SimpleTestErrorHandler'); + } + return true; +} + +/** + * Certain messages can be caused by the unit tester itself. + * These have to be filtered. + * @param string $message Message to filter. + * @return boolean True if genuine failure. + */ +function IsNotCausedBySimpleTest($message) { + return ! preg_match('/returned by reference/', $message); +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/exceptions.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/exceptions.php new file mode 100644 index 0000000..984015d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/exceptions.php @@ -0,0 +1,198 @@ +get('SimpleExceptionTrap'); + $trap->clear(); + try { + $has_thrown = false; + parent::invoke($method); + } catch (Exception $exception) { + $has_thrown = true; + if (! $trap->isExpected($this->getTestCase(), $exception)) { + $this->getTestCase()->exception($exception); + } + $trap->clear(); + } + if ($message = $trap->getOutstanding()) { + $this->getTestCase()->fail($message); + } + if ($has_thrown) { + try { + parent::getTestCase()->tearDown(); + } catch (Exception $e) { } + } + } +} + +/** + * Tests exceptions either by type or the exact + * exception. This could be improved to accept + * a pattern expectation to test the error + * message, but that will have to come later. + * @package SimpleTest + * @subpackage UnitTester + */ +class ExceptionExpectation extends SimpleExpectation { + private $expected; + + /** + * Sets up the conditions to test against. + * If the expected value is a string, then + * it will act as a test of the class name. + * An exception as the comparison will + * trigger an identical match. Writing this + * down now makes it look doubly dumb. I hope + * come up with a better scheme later. + * @param mixed $expected A class name or an actual + * exception to compare with. + * @param string $message Message to display. + */ + function __construct($expected, $message = '%s') { + $this->expected = $expected; + parent::__construct($message); + } + + /** + * Carry out the test. + * @param Exception $compare Value to check. + * @return boolean True if matched. + */ + function test($compare) { + if (is_string($this->expected)) { + return ($compare instanceof $this->expected); + } + if (get_class($compare) != get_class($this->expected)) { + return false; + } + return $compare->getMessage() == $this->expected->getMessage(); + } + + /** + * Create the message to display describing the test. + * @param Exception $compare Exception to match. + * @return string Final message. + */ + function testMessage($compare) { + if (is_string($this->expected)) { + return "Exception [" . $this->describeException($compare) . + "] should be type [" . $this->expected . "]"; + } + return "Exception [" . $this->describeException($compare) . + "] should match [" . + $this->describeException($this->expected) . "]"; + } + + /** + * Summary of an Exception object. + * @param Exception $compare Exception to describe. + * @return string Text description. + */ + protected function describeException($exception) { + return get_class($exception) . ": " . $exception->getMessage(); + } +} + +/** + * Stores expected exceptions for when they + * get thrown. Saves the irritating try...catch + * block. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleExceptionTrap { + private $expected; + private $message; + + /** + * Clears down the queue ready for action. + */ + function __construct() { + $this->clear(); + } + + /** + * Sets up an expectation of an exception. + * This has the effect of intercepting an + * exception that matches. + * @param SimpleExpectation $expected Expected exception to match. + * @param string $message Message to display. + * @access public + */ + function expectException($expected = false, $message = '%s') { + if ($expected === false) { + $expected = new AnythingExpectation(); + } + if (! SimpleExpectation::isExpectation($expected)) { + $expected = new ExceptionExpectation($expected); + } + $this->expected = $expected; + $this->message = $message; + } + + /** + * Compares the expected exception with any + * in the queue. Issues a pass or fail and + * returns the state of the test. + * @param SimpleTestCase $test Test case to send messages to. + * @param Exception $exception Exception to compare. + * @return boolean False on no match. + */ + function isExpected($test, $exception) { + if ($this->expected) { + return $test->assert($this->expected, $exception, $this->message); + } + return false; + } + + /** + * Tests for any left over exception. + * @return string/false The failure message or false if none. + */ + function getOutstanding() { + return sprintf($this->message, 'Failed to trap exception'); + } + + /** + * Discards the contents of the error queue. + */ + function clear() { + $this->expected = false; + $this->message = false; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/expectation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/expectation.php new file mode 100644 index 0000000..97daa97 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/expectation.php @@ -0,0 +1,901 @@ +message = $message; + } + + /** + * Tests the expectation. True if correct. + * @param mixed $compare Comparison value. + * @return boolean True if correct. + * @access public + * @abstract + */ + function test($compare) { + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + * @abstract + */ + function testMessage($compare) { + } + + /** + * Overlays the generated message onto the stored user + * message. An additional message can be interjected. + * @param mixed $compare Comparison value. + * @param SimpleDumper $dumper For formatting the results. + * @return string Description of success + * or failure. + * @access public + */ + function overlayMessage($compare, $dumper) { + $this->dumper = $dumper; + return sprintf($this->message, $this->testMessage($compare)); + } + + /** + * Accessor for the dumper. + * @return SimpleDumper Current value dumper. + * @access protected + */ + protected function getDumper() { + if (! $this->dumper) { + $dumper = new SimpleDumper(); + return $dumper; + } + return $this->dumper; + } + + /** + * Test to see if a value is an expectation object. + * A useful utility method. + * @param mixed $expectation Hopefully an Expectation + * class. + * @return boolean True if descended from + * this class. + * @access public + */ + static function isExpectation($expectation) { + return is_object($expectation) && + SimpleTestCompatibility::isA($expectation, 'SimpleExpectation'); + } +} + +/** + * A wildcard expectation always matches. + * @package SimpleTest + * @subpackage MockObjects + */ +class AnythingExpectation extends SimpleExpectation { + + /** + * Tests the expectation. Always true. + * @param mixed $compare Ignored. + * @return boolean True. + * @access public + */ + function test($compare) { + return true; + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + return 'Anything always matches [' . $dumper->describeValue($compare) . ']'; + } +} + +/** + * An expectation that never matches. + * @package SimpleTest + * @subpackage MockObjects + */ +class FailedExpectation extends SimpleExpectation { + + /** + * Tests the expectation. Always false. + * @param mixed $compare Ignored. + * @return boolean True. + * @access public + */ + function test($compare) { + return false; + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + return 'Failed expectation never matches [' . $dumper->describeValue($compare) . ']'; + } +} + +/** + * An expectation that passes on boolean true. + * @package SimpleTest + * @subpackage MockObjects + */ +class TrueExpectation extends SimpleExpectation { + + /** + * Tests the expectation. + * @param mixed $compare Should be true. + * @return boolean True on match. + * @access public + */ + function test($compare) { + return (boolean)$compare; + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + return 'Expected true, got [' . $dumper->describeValue($compare) . ']'; + } +} + +/** + * An expectation that passes on boolean false. + * @package SimpleTest + * @subpackage MockObjects + */ +class FalseExpectation extends SimpleExpectation { + + /** + * Tests the expectation. + * @param mixed $compare Should be false. + * @return boolean True on match. + * @access public + */ + function test($compare) { + return ! (boolean)$compare; + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + return 'Expected false, got [' . $dumper->describeValue($compare) . ']'; + } +} + +/** + * Test for equality. + * @package SimpleTest + * @subpackage UnitTester + */ +class EqualExpectation extends SimpleExpectation { + private $value; + + /** + * Sets the value to compare against. + * @param mixed $value Test value to match. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($value, $message = '%s') { + parent::__construct($message); + $this->value = $value; + } + + /** + * Tests the expectation. True if it matches the + * held value. + * @param mixed $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return (($this->value == $compare) && ($compare == $this->value)); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if ($this->test($compare)) { + return "Equal expectation [" . $this->dumper->describeValue($this->value) . "]"; + } else { + return "Equal expectation fails " . + $this->dumper->describeDifference($this->value, $compare); + } + } + + /** + * Accessor for comparison value. + * @return mixed Held value to compare with. + * @access protected + */ + protected function getValue() { + return $this->value; + } +} + +/** + * Test for inequality. + * @package SimpleTest + * @subpackage UnitTester + */ +class NotEqualExpectation extends EqualExpectation { + + /** + * Sets the value to compare against. + * @param mixed $value Test value to match. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($value, $message = '%s') { + parent::__construct($value, $message); + } + + /** + * Tests the expectation. True if it differs from the + * held value. + * @param mixed $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return ! parent::test($compare); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + if ($this->test($compare)) { + return "Not equal expectation passes " . + $dumper->describeDifference($this->getValue(), $compare); + } else { + return "Not equal expectation fails [" . + $dumper->describeValue($this->getValue()) . + "] matches"; + } + } +} + +/** + * Test for being within a range. + * @package SimpleTest + * @subpackage UnitTester + */ +class WithinMarginExpectation extends SimpleExpectation { + private $upper; + private $lower; + + /** + * Sets the value to compare against and the fuzziness of + * the match. Used for comparing floating point values. + * @param mixed $value Test value to match. + * @param mixed $margin Fuzziness of match. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($value, $margin, $message = '%s') { + parent::__construct($message); + $this->upper = $value + $margin; + $this->lower = $value - $margin; + } + + /** + * Tests the expectation. True if it matches the + * held value. + * @param mixed $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return (($compare <= $this->upper) && ($compare >= $this->lower)); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if ($this->test($compare)) { + return $this->withinMessage($compare); + } else { + return $this->outsideMessage($compare); + } + } + + /** + * Creates a the message for being within the range. + * @param mixed $compare Value being tested. + * @access private + */ + protected function withinMessage($compare) { + return "Within expectation [" . $this->dumper->describeValue($this->lower) . "] and [" . + $this->dumper->describeValue($this->upper) . "]"; + } + + /** + * Creates a the message for being within the range. + * @param mixed $compare Value being tested. + * @access private + */ + protected function outsideMessage($compare) { + if ($compare > $this->upper) { + return "Outside expectation " . + $this->dumper->describeDifference($compare, $this->upper); + } else { + return "Outside expectation " . + $this->dumper->describeDifference($compare, $this->lower); + } + } +} + +/** + * Test for being outside of a range. + * @package SimpleTest + * @subpackage UnitTester + */ +class OutsideMarginExpectation extends WithinMarginExpectation { + + /** + * Sets the value to compare against and the fuzziness of + * the match. Used for comparing floating point values. + * @param mixed $value Test value to not match. + * @param mixed $margin Fuzziness of match. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($value, $margin, $message = '%s') { + parent::__construct($value, $margin, $message); + } + + /** + * Tests the expectation. True if it matches the + * held value. + * @param mixed $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return ! parent::test($compare); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if (! $this->test($compare)) { + return $this->withinMessage($compare); + } else { + return $this->outsideMessage($compare); + } + } +} + +/** + * Test for reference. + * @package SimpleTest + * @subpackage UnitTester + */ +class ReferenceExpectation { + private $value; + + /** + * Sets the reference value to compare against. + * @param mixed $value Test reference to match. + * @param string $message Customised message on failure. + * @access public + */ + function __construct(&$value, $message = '%s') { + $this->message = $message; + $this->value = &$value; + } + + /** + * Tests the expectation. True if it exactly + * references the held value. + * @param mixed $compare Comparison reference. + * @return boolean True if correct. + * @access public + */ + function test(&$compare) { + return SimpleTestCompatibility::isReference($this->value, $compare); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if ($this->test($compare)) { + return "Reference expectation [" . $this->dumper->describeValue($this->value) . "]"; + } else { + return "Reference expectation fails " . + $this->dumper->describeDifference($this->value, $compare); + } + } + + /** + * Overlays the generated message onto the stored user + * message. An additional message can be interjected. + * @param mixed $compare Comparison value. + * @param SimpleDumper $dumper For formatting the results. + * @return string Description of success + * or failure. + * @access public + */ + function overlayMessage($compare, $dumper) { + $this->dumper = $dumper; + return sprintf($this->message, $this->testMessage($compare)); + } + + /** + * Accessor for the dumper. + * @return SimpleDumper Current value dumper. + * @access protected + */ + protected function getDumper() { + if (! $this->dumper) { + $dumper = new SimpleDumper(); + return $dumper; + } + return $this->dumper; + } +} + +/** + * Test for identity. + * @package SimpleTest + * @subpackage UnitTester + */ +class IdenticalExpectation extends EqualExpectation { + + /** + * Sets the value to compare against. + * @param mixed $value Test value to match. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($value, $message = '%s') { + parent::__construct($value, $message); + } + + /** + * Tests the expectation. True if it exactly + * matches the held value. + * @param mixed $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return SimpleTestCompatibility::isIdentical($this->getValue(), $compare); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + if ($this->test($compare)) { + return "Identical expectation [" . $dumper->describeValue($this->getValue()) . "]"; + } else { + return "Identical expectation [" . $dumper->describeValue($this->getValue()) . + "] fails with [" . + $dumper->describeValue($compare) . "] " . + $dumper->describeDifference($this->getValue(), $compare, TYPE_MATTERS); + } + } +} + +/** + * Test for non-identity. + * @package SimpleTest + * @subpackage UnitTester + */ +class NotIdenticalExpectation extends IdenticalExpectation { + + /** + * Sets the value to compare against. + * @param mixed $value Test value to match. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($value, $message = '%s') { + parent::__construct($value, $message); + } + + /** + * Tests the expectation. True if it differs from the + * held value. + * @param mixed $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return ! parent::test($compare); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + if ($this->test($compare)) { + return "Not identical expectation passes " . + $dumper->describeDifference($this->getValue(), $compare, TYPE_MATTERS); + } else { + return "Not identical expectation [" . $dumper->describeValue($this->getValue()) . "] matches"; + } + } +} + +/** + * Test for a pattern using Perl regex rules. + * @package SimpleTest + * @subpackage UnitTester + */ +class PatternExpectation extends SimpleExpectation { + private $pattern; + + /** + * Sets the value to compare against. + * @param string $pattern Pattern to search for. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($pattern, $message = '%s') { + parent::__construct($message); + $this->pattern = $pattern; + } + + /** + * Accessor for the pattern. + * @return string Perl regex as string. + * @access protected + */ + protected function getPattern() { + return $this->pattern; + } + + /** + * Tests the expectation. True if the Perl regex + * matches the comparison value. + * @param string $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return (boolean)preg_match($this->getPattern(), $compare); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if ($this->test($compare)) { + return $this->describePatternMatch($this->getPattern(), $compare); + } else { + $dumper = $this->getDumper(); + return "Pattern [" . $this->getPattern() . + "] not detected in [" . + $dumper->describeValue($compare) . "]"; + } + } + + /** + * Describes a pattern match including the string + * found and it's position. + * @param string $pattern Regex to match against. + * @param string $subject Subject to search. + * @access protected + */ + protected function describePatternMatch($pattern, $subject) { + preg_match($pattern, $subject, $matches); + $position = strpos($subject, $matches[0]); + $dumper = $this->getDumper(); + return "Pattern [$pattern] detected at character [$position] in [" . + $dumper->describeValue($subject) . "] as [" . + $matches[0] . "] in region [" . + $dumper->clipString($subject, 100, $position) . "]"; + } +} + +/** + * Fail if a pattern is detected within the + * comparison. + * @package SimpleTest + * @subpackage UnitTester + */ +class NoPatternExpectation extends PatternExpectation { + + /** + * Sets the reject pattern + * @param string $pattern Pattern to search for. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($pattern, $message = '%s') { + parent::__construct($pattern, $message); + } + + /** + * Tests the expectation. False if the Perl regex + * matches the comparison value. + * @param string $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return ! parent::test($compare); + } + + /** + * Returns a human readable test message. + * @param string $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if ($this->test($compare)) { + $dumper = $this->getDumper(); + return "Pattern [" . $this->getPattern() . + "] not detected in [" . + $dumper->describeValue($compare) . "]"; + } else { + return $this->describePatternMatch($this->getPattern(), $compare); + } + } +} + +/** + * Tests either type or class name if it's an object. + * @package SimpleTest + * @subpackage UnitTester + */ +class IsAExpectation extends SimpleExpectation { + private $type; + + /** + * Sets the type to compare with. + * @param string $type Type or class name. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($type, $message = '%s') { + parent::__construct($message); + $this->type = $type; + } + + /** + * Accessor for type to check against. + * @return string Type or class name. + * @access protected + */ + protected function getType() { + return $this->type; + } + + /** + * Tests the expectation. True if the type or + * class matches the string value. + * @param string $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + if (is_object($compare)) { + return SimpleTestCompatibility::isA($compare, $this->type); + } else { + return (strtolower(gettype($compare)) == $this->canonicalType($this->type)); + } + } + + /** + * Coerces type name into a gettype() match. + * @param string $type User type. + * @return string Simpler type. + * @access private + */ + protected function canonicalType($type) { + $type = strtolower($type); + $map = array( + 'bool' => 'boolean', + 'float' => 'double', + 'real' => 'double', + 'int' => 'integer'); + if (isset($map[$type])) { + $type = $map[$type]; + } + return $type; + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + return "Value [" . $dumper->describeValue($compare) . + "] should be type [" . $this->type . "]"; + } +} + +/** + * Tests either type or class name if it's an object. + * Will succeed if the type does not match. + * @package SimpleTest + * @subpackage UnitTester + */ +class NotAExpectation extends IsAExpectation { + private $type; + + /** + * Sets the type to compare with. + * @param string $type Type or class name. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($type, $message = '%s') { + parent::__construct($type, $message); + } + + /** + * Tests the expectation. False if the type or + * class matches the string value. + * @param string $compare Comparison value. + * @return boolean True if different. + * @access public + */ + function test($compare) { + return ! parent::test($compare); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + return "Value [" . $dumper->describeValue($compare) . + "] should not be type [" . $this->getType() . "]"; + } +} + +/** + * Tests for existance of a method in an object + * @package SimpleTest + * @subpackage UnitTester + */ +class MethodExistsExpectation extends SimpleExpectation { + private $method; + + /** + * Sets the value to compare against. + * @param string $method Method to check. + * @param string $message Customised message on failure. + * @access public + * @return void + */ + function __construct($method, $message = '%s') { + parent::__construct($message); + $this->method = &$method; + } + + /** + * Tests the expectation. True if the method exists in the test object. + * @param string $compare Comparison method name. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return (boolean)(is_object($compare) && method_exists($compare, $this->method)); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + if (! is_object($compare)) { + return 'No method on non-object [' . $dumper->describeValue($compare) . ']'; + } + $method = $this->method; + return "Object [" . $dumper->describeValue($compare) . + "] should contain method [$method]"; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/colortext_reporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/colortext_reporter.php new file mode 100644 index 0000000..a265226 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/colortext_reporter.php @@ -0,0 +1,86 @@ + + * @package SimpleTest + * @subpackage Extensions + */ +class ColorTextReporter extends TextReporter { + var $_failColor = 41; + var $_passColor = 42; + + /** + * Handle initialization + * + * @param {@link TextReporter} + */ + function __construct() { + parent::__construct(); + } + + /** + * Capture the attempt to display the final test results and insert the + * ANSI-color codes in place. + * + * @param string + * @see TextReporter + * @access public + */ + function paintFooter($test_name) { + ob_start(); + parent::paintFooter($test_name); + $output = trim(ob_get_clean()); + if ($output) { + if (($this->getFailCount() + $this->getExceptionCount()) == 0) { + $color = $this->_passColor; + } else { + $color = $this->_failColor; + } + + $this->_setColor($color); + echo $output; + $this->_resetColor(); + } + } + + + /** + * Sets the terminal to an ANSI-standard $color + * + * @param int + * @access protected + */ + function _setColor($color) { + printf("%s[%sm\n", chr(27), $color); + } + + + /** + * Resets the color back to normal. + * + * @access protected + */ + function _resetColor() { + $this->_setColor(0); + } +} + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/css/webunit.css b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/css/webunit.css new file mode 100644 index 0000000..49da468 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/css/webunit.css @@ -0,0 +1,78 @@ +html { + font-face: Verdana, Arial, Helvetica, sans-serif; + font-weight: bold; + color: black; + } + +.pass { color: green; } +.fail { color: red; } +.activetab { + position: relative; + background: white; + border-color: black; + border-style: solid; + border-weight: 1; + border-top-color: white; + border-style: solid; + border-weight: 1; +} +.inactivetab{ + position: relative; + background: silver; + border-color: black; + border-style: solid; + border-weight: 1; +} +span.inactivetab a:link , +span.activetab a:link { + text-decoration: none; + color: black; +} +pre { background-color: lightgray; } +#wait { + background: #B7B8DD; + position: absolute; + visibility: hidden; + text-align: center; + border-color: blue; + border-style: solid; + border-weight: 2; + } +#webunit { + position: absolute; + visibility: hidden; + background: silver; + border-color: black; + border-style: solid; + border-weight: 2; + } +#visible_tab { + position: relative; + visibility: hidden; + overflow: auto; + background: white; + width: 100%; + height: 100%; + border-color: black; + border-style: solid; + border-weight: 1; + } +#visible_tab a:link { + text-decoration: none; + color: inherit; +} +#msg { + position: absolute; + visibility: hidden; + overflow: auto; + background: white; + border-color: black; + border-style: solid; + border-weight: 1; + } +#fail, +#tree { + position: absolute; + visibility: hidden; +} + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester.php new file mode 100644 index 0000000..72b6a51 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester.php @@ -0,0 +1,117 @@ + + * @version $Id: dom_tester.php 1804 2008-09-08 13:16:44Z pp11 $ + */ + +/**#@+ + * include SimpleTest files + */ +require_once dirname(__FILE__).'/../web_tester.php'; +require_once dirname(__FILE__).'/dom_tester/css_selector.php'; +/**#@-*/ + +/** + * CssSelectorExpectation + * + * Create a CSS Selector expectactation + * + * @param DomDocument $_dom + * @param string $_selector + * @param array $_value + * + */ +class CssSelectorExpectation extends SimpleExpectation { + var $_dom; + var $_selector; + var $_value; + + /** + * Sets the dom tree and the css selector to compare against + * @param mixed $dom Dom tree to search into. + * @param mixed $selector Css selector to match element. + * @param string $message Customised message on failure. + * @access public + */ + function CssSelectorExpectation($dom, $selector, $message = '%s') { + $this->SimpleExpectation($message); + $this->_dom = $dom; + $this->_selector = $selector; + + $css_selector = new CssSelector($this->_dom); + $this->_value = $css_selector->getTexts($this->_selector); + } + + /** + * Tests the expectation. True if it matches the + * held value. + * @param mixed $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return (($this->_value == $compare) && ($compare == $this->_value)); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = &$this->_getDumper(); + if (is_array($compare)) { + sort($compare); + } + if ($this->test($compare)) { + return "CSS selector expectation [" . $dumper->describeValue($this->_value) . "]". + " using [" . $dumper->describeValue($this->_selector) . "]"; + } else { + return "CSS selector expectation [" . $dumper->describeValue($this->_value) . "]". + " using [" . $dumper->describeValue($this->_selector) . "]". + " fails with [" . + $dumper->describeValue($compare) . "] " . + $dumper->describeDifference($this->_value, $compare); + } + } +} + +/** + * DomTestCase + * + * Extend Web test case with DOM related assertions, + * CSS selectors in particular + * + * @param DomDocument $dom + * + */ +class DomTestCase extends WebTestCase { + var $dom; + + function assertElementsBySelector($selector, $elements, $message = '%s') { + $this->dom = new DomDocument('1.0', 'utf-8'); + $this->dom->validateOnParse = true; + $this->dom->loadHTML($this->_browser->getContent()); + + return $this->assert( + new CssSelectorExpectation($this->dom, $selector), + $elements, + $message); + } + + function getElementsBySelector($selector) { + $this->dom = new DomDocument('1.0', 'utf-8'); + $this->dom->validateOnParse = true; + $this->dom->loadHTML($this->_browser->getContent()); + + $css_selector = new CssSelectorExpectation($this->dom, $selector); + return $css_selector->_value; + } +} + +?> diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/css_selector.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/css_selector.php new file mode 100644 index 0000000..1e9e244 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/css_selector.php @@ -0,0 +1,539 @@ + + * @version $Id: css_selector.php 1802 2008-09-08 10:43:58Z maetl_ $ + */ + +/** + * CssSelector + * + * Allow to navigate a DOM with CSS selector. + * + * based on getElementsBySelector version 0.4 - Simon Willison, 2003-03-25 + * http://simon.incutio.com/archive/2003/03/25/getElementsBySelector + * + * derived from sfDomCssSelector Id 3053 - Fabien Potencier, 2006-12-16 + * http://www.symfony-project.com/api/symfony/util/sfDomCssSelector.html + * + * @package SimpleTest + * @subpackage Extensions + * @param DomDocument $dom + */ +class CssSelector +{ + public $nodes = array(); + + public function __construct($nodes) + { + if (!is_array($nodes)) + { + $nodes = array($nodes); + } + + $this->nodes = $nodes; + } + + public function getNodes() + { + return $this->nodes; + } + + public function getNode() + { + return $this->nodes ? $this->nodes[0] : null; + } + + public function getValue() + { + return $this->nodes[0]->nodeValue; + } + + public function getValues() + { + $values = array(); + foreach ($this->nodes as $node) + { + $values[] = $node->nodeValue; + } + + return $values; + } + + public function matchSingle($selector) + { + $nodes = $this->getElements($selector); + + return $nodes ? new CssSelector($nodes[0]) : new CssSelector(array()); + } + + public function matchAll($selector) + { + $nodes = $this->getElements($selector); + + return $nodes ? new CssSelector($nodes) : new CssSelector(array()); + } + + /* DEPRECATED */ + public function getTexts($selector) + { + $texts = array(); + foreach ($this->getElements($selector) as $element) + { + $texts[] = $element->nodeValue; + } + + return $texts; + } + + /* DEPRECATED */ + public function getElements($selector) + { + $nodes = array(); + foreach ($this->nodes as $node) + { + $result_nodes = $this->getElementsForNode($selector, $node); + if ($result_nodes) + { + $nodes = array_merge($nodes, $result_nodes); + } + } + + foreach ($nodes as $node) + { + $node->removeAttribute('sf_matched'); + } + + return $nodes; + } + + protected function getElementsForNode($selector, $root_node) + { + $all_nodes = array(); + foreach ($this->tokenize_selectors($selector) as $selector) + { + $nodes = array($root_node); + foreach ($this->tokenize($selector) as $token) + { + $combinator = $token['combinator']; + $selector = $token['selector']; + + $token = trim($token['name']); + + $pos = strpos($token, '#'); + if (false !== $pos && preg_match('/^[A-Za-z0-9]*$/', substr($token, 0, $pos))) + { + // Token is an ID selector + $tagName = substr($token, 0, $pos); + $id = substr($token, $pos + 1); + $xpath = new DomXPath($root_node); + $element = $xpath->query(sprintf("//*[@id = '%s']", $id))->item(0); + if (!$element || ($tagName && strtolower($element->nodeName) != $tagName)) + { + // tag with that ID not found + return array(); + } + + // Set nodes to contain just this element + $nodes = array($element); + $nodes = $this->matchCustomSelector($nodes, $selector); + + continue; // Skip to next token + } + + $pos = strpos($token, '.'); + if (false !== $pos && preg_match('/^[A-Za-z0-9\*]*$/', substr($token, 0, $pos))) + { + // Token contains a class selector + $tagName = substr($token, 0, $pos); + if (!$tagName) + { + $tagName = '*'; + } + $className = substr($token, $pos + 1); + + // Get elements matching tag, filter them for class selector + $founds = $this->getElementsByTagName($nodes, $tagName, $combinator); + $nodes = array(); + foreach ($founds as $found) + { + if (preg_match('/\b'.$className.'\b/', $found->getAttribute('class'))) + { + $nodes[] = $found; + } + } + + $nodes = $this->matchCustomSelector($nodes, $selector); + + continue; // Skip to next token + } + + // Code to deal with attribute selectors + if (preg_match('/^(\w+|\*)(\[.+\])$/', $token, $matches)) + { + $tagName = $matches[1] ? $matches[1] : '*'; + preg_match_all('/ + \[ + (\w+) # attribute + ([=~\|\^\$\*]?) # modifier (optional) + =? # equal (optional) + ( + "([^"]*)" # quoted value (optional) + | + ([^\]]*) # non quoted value (optional) + ) + \] + /x', $matches[2], $matches, PREG_SET_ORDER); + + // Grab all of the tagName elements within current node + $founds = $this->getElementsByTagName($nodes, $tagName, $combinator); + $nodes = array(); + foreach ($founds as $found) + { + $ok = false; + foreach ($matches as $match) + { + $attrName = $match[1]; + $attrOperator = $match[2]; + $attrValue = $match[4]; + + switch ($attrOperator) + { + case '=': // Equality + $ok = $found->getAttribute($attrName) == $attrValue; + break; + case '~': // Match one of space seperated words + $ok = preg_match('/\b'.preg_quote($attrValue, '/').'\b/', $found->getAttribute($attrName)); + break; + case '|': // Match start with value followed by optional hyphen + $ok = preg_match('/^'.preg_quote($attrValue, '/').'-?/', $found->getAttribute($attrName)); + break; + case '^': // Match starts with value + $ok = 0 === strpos($found->getAttribute($attrName), $attrValue); + break; + case '$': // Match ends with value + $ok = $attrValue == substr($found->getAttribute($attrName), -strlen($attrValue)); + break; + case '*': // Match ends with value + $ok = false !== strpos($found->getAttribute($attrName), $attrValue); + break; + default : + // Just test for existence of attribute + $ok = $found->hasAttribute($attrName); + } + + if (false == $ok) + { + break; + } + } + + if ($ok) + { + $nodes[] = $found; + } + } + + continue; // Skip to next token + } + + // If we get here, token is JUST an element (not a class or ID selector) + $nodes = $this->getElementsByTagName($nodes, $token, $combinator); + + $nodes = $this->matchCustomSelector($nodes, $selector); + } + + foreach ($nodes as $node) + { + if (!$node->getAttribute('sf_matched')) + { + $node->setAttribute('sf_matched', true); + $all_nodes[] = $node; + } + } + } + + return $all_nodes; + } + + protected function getElementsByTagName($nodes, $tagName, $combinator = ' ') + { + $founds = array(); + foreach ($nodes as $node) + { + switch ($combinator) + { + case ' ': + // Descendant selector + foreach ($node->getElementsByTagName($tagName) as $element) + { + $founds[] = $element; + } + break; + case '>': + // Child selector + foreach ($node->childNodes as $element) + { + if ($tagName == $element->nodeName) + { + $founds[] = $element; + } + } + break; + case '+': + // Adjacent selector + $element = $node->nextSibling; + if ($element && '#text' == $element->nodeName) + { + $element = $element->nextSibling; + } + + if ($element && $tagName == $element->nodeName) + { + $founds[] = $element; + } + break; + default: + throw new Exception(sprintf('Unrecognized combinator "%s".', $combinator)); + } + } + + return $founds; + } + + protected function tokenize_selectors($selector) + { + // split tokens by , except in an attribute selector + $tokens = array(); + $quoted = false; + $token = ''; + for ($i = 0, $max = strlen($selector); $i < $max; $i++) + { + if (',' == $selector[$i] && !$quoted) + { + $tokens[] = trim($token); + $token = ''; + } + else if ('"' == $selector[$i]) + { + $token .= $selector[$i]; + $quoted = $quoted ? false : true; + } + else + { + $token .= $selector[$i]; + } + } + if ($token) + { + $tokens[] = trim($token); + } + + return $tokens; + } + + protected function tokenize($selector) + { + // split tokens by space except if space is in an attribute selector + $tokens = array(); + $combinators = array(' ', '>', '+'); + $quoted = false; + $token = array('combinator' => ' ', 'name' => ''); + for ($i = 0, $max = strlen($selector); $i < $max; $i++) + { + if (in_array($selector[$i], $combinators) && !$quoted) + { + // remove all whitespaces around the combinator + $combinator = $selector[$i]; + while (in_array($selector[$i + 1], $combinators)) + { + if (' ' != $selector[++$i]) + { + $combinator = $selector[$i]; + } + } + + $tokens[] = $token; + $token = array('combinator' => $combinator, 'name' => ''); + } + else if ('"' == $selector[$i]) + { + $token['name'] .= $selector[$i]; + $quoted = $quoted ? false : true; + } + else + { + $token['name'] .= $selector[$i]; + } + } + if ($token['name']) + { + $tokens[] = $token; + } + + foreach ($tokens as &$token) + { + list($token['name'], $token['selector']) = $this->tokenize_selector_name($token['name']); + } + + return $tokens; + } + + protected function tokenize_selector_name($token_name) + { + // split custom selector + $quoted = false; + $name = ''; + $selector = ''; + $in_selector = false; + for ($i = 0, $max = strlen($token_name); $i < $max; $i++) + { + if ('"' == $token_name[$i]) + { + $quoted = $quoted ? false : true; + } + + if (!$quoted && ':' == $token_name[$i]) + { + $in_selector = true; + } + + if ($in_selector) + { + $selector .= $token_name[$i]; + } + else + { + $name .= $token_name[$i]; + } + } + + return array($name, $selector); + } + + protected function matchCustomSelector($nodes, $selector) + { + if (!$selector) + { + return $nodes; + } + + $selector = $this->tokenize_custom_selector($selector); + $matchingNodes = array(); + for ($i = 0, $max = count($nodes); $i < $max; $i++) + { + switch ($selector['selector']) + { + case 'contains': + if (false !== strpos($nodes[$i]->textContent, $selector['parameter'])) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'nth-child': + if ($nodes[$i] === $this->nth($nodes[$i]->parentNode->firstChild, (integer) $selector['parameter'])) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'first-child': + if ($nodes[$i] === $this->nth($nodes[$i]->parentNode->firstChild)) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'last-child': + if ($nodes[$i] === $this->nth($nodes[$i]->parentNode->lastChild, 1, 'previousSibling')) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'lt': + if ($i < (integer) $selector['parameter']) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'gt': + if ($i > (integer) $selector['parameter']) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'odd': + if ($i % 2) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'even': + if (0 == $i % 2) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'nth': + case 'eq': + if ($i == (integer) $selector['parameter']) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'first': + if ($i == 0) + { + $matchingNodes[] = $nodes[$i]; + } + break; + case 'last': + if ($i == $max - 1) + { + $matchingNodes[] = $nodes[$i]; + } + break; + default: + throw new Exception(sprintf('Unrecognized selector "%s".', $selector['selector'])); + } + } + + return $matchingNodes; + } + + protected function tokenize_custom_selector($selector) + { + if (!preg_match('/ + ([a-zA-Z0-9\-]+) + (?: + \( + (?: + ("|\')(.*)?\2 + | + (.*?) + ) + \) + )? + /x', substr($selector, 1), $matches)) + { + throw new Exception(sprintf('Unable to parse custom selector "%s".', $selector)); + } + return array('selector' => $matches[1], 'parameter' => isset($matches[3]) ? ($matches[3] ? $matches[3] : $matches[4]) : ''); + } + + protected function nth($cur, $result = 1, $dir = 'nextSibling') + { + $num = 0; + for (; $cur; $cur = $cur->$dir) + { + if (1 == $cur->nodeType) + { + ++$num; + } + + if ($num == $result) + { + return $cur; + } + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/dom_tester_doc_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/dom_tester_doc_test.php new file mode 100644 index 0000000..da624bb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/dom_tester_doc_test.php @@ -0,0 +1,24 @@ +addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testGet() { + $url = 'http://simpletest.org/'; + $this->assertTrue($this->get($url)); + $this->assertEqual($this->getUrl(), $url); + $this->assertElementsBySelector('h2', array('Screenshots', 'Documentation', 'Contributing')); + $this->assertElementsBySelector('a[href="http://simpletest.org/api/"]', array('the complete API', 'documented API')); + $this->assertElementsBySelector('div#content > p > strong', array('SimpleTest PHP unit tester')); + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/dom_tester_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/dom_tester_test.php new file mode 100644 index 0000000..38f5efd --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/dom_tester_test.php @@ -0,0 +1,223 @@ +addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testGet() { + $url = 'file://'.dirname(__FILE__).'/support/dom_tester.html'; + $this->assertTrue($this->get($url)); + $this->assertElementsBySelector('h1', array('Test page')); + $this->assertElementsBySelector('ul#list li a[href]', array('link')); + $this->assertElementsBySelector('body h1', array('Test page')); + $this->assertElementsBySelector('#mybar', array('myfoo bis')); + } +} + +class TestOfCssSelectors extends UnitTestCase { + + function TestOfCssSelectors() { + $html = file_get_contents(dirname(__FILE__) . '/support/dom_tester.html'); + $this->dom = new DomDocument('1.0', 'utf-8'); + $this->dom->validateOnParse = true; + $this->dom->loadHTML($html); + } + + function testBasicSelector() { + $expectation = new CssSelectorExpectation($this->dom, 'h1'); + $this->assertTrue($expectation->test(array('Test page'))); + + $expectation = new CssSelectorExpectation($this->dom, 'h2'); + $this->assertTrue($expectation->test(array('Title 1', 'Title 2'))); + + $expectation = new CssSelectorExpectation($this->dom, '#footer'); + $this->assertTrue($expectation->test(array('footer'))); + + $expectation = new CssSelectorExpectation($this->dom, 'div#footer'); + $this->assertTrue($expectation->test(array('footer'))); + + $expectation = new CssSelectorExpectation($this->dom, '.header'); + $this->assertTrue($expectation->test(array('header'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p.header'); + $this->assertTrue($expectation->test(array('header'))); + + $expectation = new CssSelectorExpectation($this->dom, 'div.header'); + $this->assertTrue($expectation->test(array())); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#mylist ul li'); + $this->assertTrue($expectation->test(array('element 3', 'element 4'))); + + $expectation = new CssSelectorExpectation($this->dom, '#nonexistant'); + $this->assertTrue($expectation->test(array())); + } + + function testAttributeSelectors() { + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[href]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[class~="foo1"]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[class~="bar1"]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[class~="foobar1"]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[class^="foo1"]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[class$="foobar1"]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[class*="oba"]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[href="http://www.google.com/"]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#anotherlist li a[class|="bar1"]'); + $this->assertTrue($expectation->test(array('another link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'ul#list li a[class*="oba"][class*="ba"]'); + $this->assertTrue($expectation->test(array('link'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p[class="myfoo"][id="mybar"]'); + $this->assertTrue($expectation->test(array('myfoo bis'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p[onclick*="a . and a #"]'); + $this->assertTrue($expectation->test(array('works great'))); + } + + function testCombinators() { + $expectation = new CssSelectorExpectation($this->dom, 'body h1'); + $this->assertTrue($expectation->test(array('Test page'))); + + $expectation = new CssSelectorExpectation($this->dom, 'div#combinators > ul > li'); + $this->assertTrue($expectation->test(array('test 1', 'test 2'))); + + $expectation = new CssSelectorExpectation($this->dom, 'div#combinators>ul>li'); + $this->assertTrue($expectation->test(array('test 1', 'test 2'))); + + $expectation = new CssSelectorExpectation($this->dom, 'div#combinators li + li'); + $this->assertTrue($expectation->test(array('test 2', 'test 4'))); + + $expectation = new CssSelectorExpectation($this->dom, 'div#combinators li+li'); + $this->assertTrue($expectation->test(array('test 2', 'test 4'))); + + $expectation = new CssSelectorExpectation($this->dom, 'h1, h2'); + $this->assertTrue($expectation->test(array('Test page', 'Title 1', 'Title 2'))); + + $expectation = new CssSelectorExpectation($this->dom, 'h1,h2'); + $this->assertTrue($expectation->test(array('Test page', 'Title 1', 'Title 2'))); + + $expectation = new CssSelectorExpectation($this->dom, 'h1 , h2'); + $this->assertTrue($expectation->test(array('Test page', 'Title 1', 'Title 2'))); + + $expectation = new CssSelectorExpectation($this->dom, 'h1, h1,h1'); + $this->assertTrue($expectation->test(array('Test page'))); + + $expectation = new CssSelectorExpectation($this->dom, 'h1,h2,h1'); + $this->assertTrue($expectation->test(array('Test page', 'Title 1', 'Title 2'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p[onclick*="a . and a #"], div#combinators > ul li + li'); + $this->assertTrue($expectation->test(array('works great', 'test 2', 'test 4'))); + } + + function testChildSelectors() { + $expectation = new CssSelectorExpectation($this->dom, '.myfoo:contains("bis")'); + $this->assertTrue($expectation->test(array('myfoo bis'))); + + $expectation = new CssSelectorExpectation($this->dom, '.myfoo:eq(1)'); + $this->assertTrue($expectation->test(array('myfoo bis'))); + + $expectation = new CssSelectorExpectation($this->dom, '.myfoo:last'); + $this->assertTrue($expectation->test(array('myfoo bis'))); + + $expectation = new CssSelectorExpectation($this->dom, '.myfoo:first'); + $this->assertTrue($expectation->test(array('myfoo'))); + + $expectation = new CssSelectorExpectation($this->dom, 'h2:first'); + $this->assertTrue($expectation->test(array('Title 1'))); + + $expectation = new CssSelectorExpectation($this->dom, 'h2:first'); + $this->assertTrue($expectation->test(array('Title 1'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p.myfoo:first'); + $this->assertTrue($expectation->test(array('myfoo'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p:lt(2)'); + $this->assertTrue($expectation->test(array('header', 'multi-classes'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p:gt(2)'); + $this->assertTrue($expectation->test(array('myfoo bis', 'works great', 'First paragraph', 'Second paragraph', 'Third paragraph'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p:odd'); + $this->assertTrue($expectation->test(array('multi-classes', 'myfoo bis', 'First paragraph', 'Third paragraph'))); + + $expectation = new CssSelectorExpectation($this->dom, 'p:even'); + $this->assertTrue($expectation->test(array('header', 'myfoo', 'works great', 'Second paragraph'))); + + $expectation = new CssSelectorExpectation($this->dom, '#simplelist li:first-child'); + $this->assertTrue($expectation->test(array('First', 'First'))); + + $expectation = new CssSelectorExpectation($this->dom, '#simplelist li:nth-child(1)'); + $this->assertTrue($expectation->test(array('First', 'First'))); + + $expectation = new CssSelectorExpectation($this->dom, '#simplelist li:nth-child(2)'); + $this->assertTrue($expectation->test(array('Second with a link', 'Second'))); + + $expectation = new CssSelectorExpectation($this->dom, '#simplelist li:nth-child(3)'); + $this->assertTrue($expectation->test(array('Third with another link'))); + + $expectation = new CssSelectorExpectation($this->dom, '#simplelist li:last-child'); + $this->assertTrue($expectation->test(array('Second with a link', 'Third with another link'))); + } +} + +class TestsOfChildAndAdjacentSelectors extends DomTestCase { + function TestsOfChildAndAdjacentSelectors() { + $html = file_get_contents(dirname(__FILE__) . '/support/child_adjacent.html'); + $this->dom = new DomDocument('1.0', 'utf-8'); + $this->dom->validateOnParse = true; + $this->dom->loadHTML($html); + } + + function testFirstChild() { + $expectation = new CssSelectorExpectation($this->dom, 'p:first-child'); + $this->assertTrue($expectation->test(array('First paragraph'))); + + $expectation = new CssSelectorExpectation($this->dom, 'body > p:first-child'); + $this->assertTrue($expectation->test(array('First paragraph'))); + + $expectation = new CssSelectorExpectation($this->dom, 'body > p > a:first-child'); + $this->assertTrue($expectation->test(array('paragraph'))); + } + + function testChildren() { + $expectation = new CssSelectorExpectation($this->dom, 'body > p'); + $this->assertTrue($expectation->test(array('First paragraph', 'Second paragraph', 'Third paragraph'))); + + $expectation = new CssSelectorExpectation($this->dom, 'body > p > a'); + $this->assertTrue($expectation->test(array('paragraph'))); + } + + function testAdjacents() { + $expectation = new CssSelectorExpectation($this->dom, 'p + p'); + $this->assertTrue($expectation->test(array('Second paragraph', 'Third paragraph'))); + + $expectation = new CssSelectorExpectation($this->dom, 'body > p + p'); + $this->assertTrue($expectation->test(array('Second paragraph', 'Third paragraph'))); + + $expectation = new CssSelectorExpectation($this->dom, 'body > p + p > a'); + $this->assertTrue($expectation->test(array('paragraph'))); + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/support/child_adjacent.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/support/child_adjacent.html new file mode 100644 index 0000000..51bf72f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/support/child_adjacent.html @@ -0,0 +1,24 @@ + + + Foo! + + + +

First paragraph

+

Second paragraph

+

Third paragraph

+ + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/support/dom_tester.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/support/dom_tester.html new file mode 100644 index 0000000..666126e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/dom_tester/test/support/dom_tester.html @@ -0,0 +1,59 @@ + + + + +

Test page

+ +

Title 1

+

header

+

multi-classes

+

myfoo

+

myfoo bis

+ +

works great

+ +
+
    +
  • First
  • +
  • Second with a link
  • +
+ + +
+ +

Title 2

+
    +
  • element 1
  • +
  • element 2
  • +
  • +
      +
    • element 3
    • +
    • element 4
    • +
    +
  • +
+ +
+
    +
  • test 1
  • +
  • test 2
  • +
      +
    • test 3
    • +
    • test 4
    • +
    +
+
+ +
+

First paragraph

+

Second paragraph

+

Third paragraph

+
+ + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/img/wait.gif b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/img/wait.gif new file mode 100644 index 0000000000000000000000000000000000000000..3ec7cec3f08e799bef2d237a62db22ac19f58220 GIT binary patch literal 1426 zcmZ?wbhEHbJi#Esa8-^$*1lfOu1?XmR>7`L*|tX2wpz`mO2xKD$EsZ4vP{paOw+nj z%eq3trpnqh-^wiC)+E=|yvW?V(9FEZ*rM3Lvc$-u#KfZ5!mJ=#J2p}$E?z4-Rx8F| zKZSvT!NDZQ)hN@;FwNH>)x#(wNG~ZsKP6N*Awe@r+P*=?zJbA^fyKR-&8>&uxt-Is zo5QV}+qIL+wTs84gU_Wyz`0Gxsa4FeS=6yb#HmHnp;5x2Ny?#df}C5MqWAy*|AAI0 z{^#~{4GDI33~)8lGhk)}3H@YY|HP7_lQ~xNFRUo> zS{t?g#+tI(v1=pNOxI?cd@^mV*xInecXP~Q^V+=_nHn1#3N$2mxVU+EI5@aCMMcF# zw0iscCrq3)dCJsj(`U?_HG8_NcFcl>ixw~O(wet)<*LDF_Zp}@%8#?B|>(C}fQQU||+ zMdqCo8y6q<`QX$g<5}b_faG||jv2A~L=pTktB&o3MX`rKz}2?xmMFGWtj4ci*D z{swng-}&oBLTBq%O?85Ym*?;@y_g(be738{07{-x0|Q zX$EEnaRxr16%ueOkOMa&TL2LgMx-eABt>xoDT>QUQQSw0;-#c0-UC$32@W~|)Sx@2 zfCw@cBonbEUX<_!MTQ>OL?v7){q)n*WcWCq9A>X|P*84CR8(q{RaNOy>rs>Hmz0!|kycli17+$tbLY(mWokL? zCCgWUGWFWEb{jSVGqv5abvt$fGxg%F`?qf2d-%xFWAhK3+-P(B?78zhPMxy7aP`{t zxtC7fxO4aXtpoQSJ>K(R|C1LlS3TSM>fQSjZ#IAU^7Yf_uRmXX-}LL>lRrs+rElme P=rnPxmHZ;e!e9*mEx8gm literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/tests/TestOfWebunit.js.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/tests/TestOfWebunit.js.html new file mode 100644 index 0000000..08f6249 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/tests/TestOfWebunit.js.html @@ -0,0 +1,34 @@ + + + +JsUnit Tests of webunit.js + + + + + + + + +

JsUnit Tests of webunit.js

+ +

This page contains tests for the webunit.js file functions.

+
+
+ + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/webunit.js b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/webunit.js new file mode 100644 index 0000000..1c6acbb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/webunit.js @@ -0,0 +1,194 @@ +// jsreporter.js +// Script to support JsReporter class +// Relies heavily on the X library in x.js +// X v3.14.1, Cross-Browser DHTML Library from Cross-Browser.com +// Copyright (c) 2004 Jason E. Sweat (jsweat_php@yahoo.com) +// +// SimpleTest - http://simpletest.sf.net/ +// Copyright (c) 2003,2004 Marcus Baker (marcus@lastcraft.com) +// $Id: webunit.js 506 2004-02-14 18:24:13Z jsweat $ + + +// Variables: +min_x=500; +min_y=400; +groups = new Array(); +cases = new Array(); +methods = new Array(); +current_group=0; +current_case=0; +current_method=0; + +Hash = { + Set : function(foo,bar) {this[foo] = bar;}, + Get : function(foo) {return this[foo];} +} + +// Functions: +function wait_start() { + var wait_x; + var wait_y; + + wait_x = xWidth('wait'); + wait_y = xHeight('wait'); + xMoveTo('wait', (xClientWidth()-wait_x)/2, (xClientHeight()-wait_y)/2); + xShow('wait'); +} + +function layout() { + xResizeTo('webunit', max(xClientWidth()-30,min_x), max(xClientHeight()-20,min_y)); + xMoveTo('webunit', 5, 5); + xResizeTo('tabs', xWidth('webunit')-10, xHeight('webunit')/3); + xLeft('tabs', 5); + xShow('webunit'); + xShow('tabs'); + activate_tab('fail'); + xShow('visible_tab'); + xZIndex('visible_tab', 2) + xResizeTo('msg', xWidth('webunit')-17, xHeight('webunit')/3-20); + xLeft('msg', 2); + xTop('msg',2*xHeight('webunit')/3); + xShow('msg'); +} + +function set_div_content(div, content) { + xGetElementById(div).innerHTML = content; +} + +function copy_div_content(divsrc, divtrgt) { + xGetElementById(divtrgt).innerHTML = xGetElementById(divsrc).innerHTML; +} + +function activate_tab(tab) { + if (tab == 'fail') { + copy_div_content('fail', 'visible_tab'); + xGetElementById('failtab').className = 'activetab'; + xZIndex('failtab', 3) + xGetElementById('treetab').className = 'inactivetab'; + xZIndex('treetab', 1) + } + if (tab == 'tree') { + copy_div_content('tree', 'visible_tab'); + xGetElementById('failtab').className = 'inactivetab'; + xZIndex('failtab', 1) + xGetElementById('treetab').className = 'activetab'; + xZIndex('treetab', 3) + } +} + +function add_group(group_name) { + var add; + + add = { + Set : function(foo,bar) {this[foo] = bar;}, + Get : function(foo) {return this[foo];} + } + add.Set('desc', group_name); + add.Set('pass', true); + groups[groups.length] = add; + current_group = groups.length - 1; + cases[current_group] = new Array(); + methods[current_group] = new Array(); +} + +function add_case(case_name) { + var curgroup; + var add; + + add = { + Set : function(foo,bar) {this[foo] = bar;}, + Get : function(foo) {return this[foo];} + } + add.Set('desc', case_name); + add.Set('pass', true); + curgroup = cases[current_group]; + cases[current_group][curgroup.length] = add; + current_case = curgroup.length - 1; + methods[current_group][current_case] = new Array(); +} + +function add_method(method_name) { + var curcase; + var add; + + add = { + Set : function(foo,bar) {this[foo] = bar;}, + Get : function(foo) {return this[foo];} + } + add.Set('desc', method_name); + add.Set('pass', true); + add.Set('msg',''); + curcase = methods[current_group][current_case]; + methods[current_group][current_case][curcase.length] = add; + current_method = curcase.length - 1; +} + +function add_fail(msg) { + var oldmsg; + add_log(msg); + groups[current_group].Set('pass', false); + cases[current_group][current_case].Set('pass', false); + methods[current_group][current_case][current_method].Set('pass', false); + oldmsg = methods[current_group][current_case][current_method].Get('msg'); + methods[current_group][current_case][current_method].Set('msg', oldmsg+msg); +} + +function add_log(msg) { + var faildiv; + faildiv = xGetElementById('fail'); + faildiv.innerHTML = faildiv.innerHTML + msg; +} + +function set_msg(gid, cid, mid) { + var passfail; + var msg=methods[gid][cid][mid].Get('msg'); + if ('' == msg) { + passfail = (methods[gid][cid][mid].Get('pass')) ? 'pass' : 'fail'; + msg = 'No output for ' + + groups[gid].Get('desc') + '->' + + cases[gid][cid].Get('desc') + '->' + + methods[gid][cid][mid].Get('desc') + '
'; + } + xGetElementById('msg').innerHTML = msg; +} + +function make_tree() { + var content; + var passfail; + content = '
    '; + for (x in groups) { + passfail = (groups[x].Get('pass')) ? 'pass' : 'fail'; + content += '
  • '+groups[x].Get('desc')+'
      '; + for (y in cases[x]) { + passfail = (cases[x][y].Get('pass')) ? 'pass' : 'fail'; + content += '
    • '+cases[x][y].Get('desc')+'
        '; + for (z in methods[x][y]) { + passfail = (methods[x][y][z].Get('pass')) ? 'pass' : 'fail'; + content += '
      • '+methods[x][y][z].Get('desc')+'
      • '; + } + content += '
    • '; + } + content += '
  • '; + } + content += '
'; + xGetElementById('tree').innerHTML = content; + if (xGetElementById('treetab').className == 'activetab') { + activate_tab('tree'); + } else { + activate_tab('fail'); + } +} + +function make_output(data) { +} + +function make_fail_msg(id, msg) { +} + +function max(n1, n2) { + if (n1 > n2) { + return n1; + } else { + return n2; + } +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/x.js b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/x.js new file mode 100644 index 0000000..78edb02 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/js/x.js @@ -0,0 +1,423 @@ +// x.js +// X v3.14.1, Cross-Browser DHTML Library from Cross-Browser.com +// Copyright (c) 2002,2003 Michael Foster (mike@cross-browser.com) +// This library is distributed under the terms of the LGPL (gnu.org) + +// Variables: +var xVersion='3.14.1',xOp7=false,xOp5or6=false,xIE4Up=false,xNN4=false,xUA=navigator.userAgent.toLowerCase(); +if(window.opera){ + xOp7=(xUA.indexOf('opera 7')!=-1 || xUA.indexOf('opera/7')!=-1); + if (!xOp7) xOp5or6=(xUA.indexOf('opera 5')!=-1 || xUA.indexOf('opera/5')!=-1 || xUA.indexOf('opera 6')!=-1 || xUA.indexOf('opera/6')!=-1); +} +else if(document.layers) {xNN4=true;} +else {xIE4Up=document.all && xUA.indexOf('msie')!=-1 && parseInt(navigator.appVersion)>=4;} +// Object: +function xGetElementById(e) { + if(typeof(e)!='string') return e; + if(document.getElementById) e=document.getElementById(e); + else if(document.all) e=document.all[e]; + else if(document.layers) e=xLayer(e); + else e=null; + return e; +} +function xParent(e,bNode){ + if (!(e=xGetElementById(e))) return null; + var p=null; + if (!bNode && xDef(e.offsetParent)) p=e.offsetParent; + else if (xDef(e.parentNode)) p=e.parentNode; + else if (xDef(e.parentElement)) p=e.parentElement; + else if (xDef(e.parentLayer)){if (e.parentLayer!=window) p=e.parentLayer;} + return p; +} +function xDef() { + for(var i=0; iwindow.innerHeight) w-=16; + } + return w; +} +function xClientHeight() { + var h=0; + if(xOp5or6) h=window.innerHeight; + else if(!window.opera && document.documentElement && document.documentElement.clientHeight) // v3.12 + h=document.documentElement.clientHeight; + else if(document.body && document.body.clientHeight) + h=document.body.clientHeight; + else if(xDef(window.innerWidth,window.innerHeight,document.width)) { + h=window.innerHeight; + if(document.width>window.innerWidth) h-=16; + } + return h; +} +// Animation: +function xSlideTo(e,x,y,uTime) { + if (!(e=xGetElementById(e))) return; + if (!e.timeout) e.timeout = 25; + e.xTarget = x; e.yTarget = y; e.slideTime = uTime; e.stop = false; + e.yA = e.yTarget - xTop(e); e.xA = e.xTarget - xLeft(e); // A = distance + e.B = Math.PI / (2 * e.slideTime); // B = period + e.yD = xTop(e); e.xD = xLeft(e); // D = initial position + var d = new Date(); e.C = d.getTime(); + if (!e.moving) xSlide(e); +} +function xSlide(e) { + if (!(e=xGetElementById(e))) return; + var now, s, t, newY, newX; + now = new Date(); + t = now.getTime() - e.C; + if (e.stop) { e.moving = false; } + else if (t < e.slideTime) { + setTimeout("xSlide('"+e.id+"')", e.timeout); + s = Math.sin(e.B * t); + newX = Math.round(e.xA * s + e.xD); + newY = Math.round(e.yA * s + e.yD); + xMoveTo(e, newX, newY); + e.moving = true; + } + else { + xMoveTo(e, e.xTarget, e.yTarget); + e.moving = false; + } +} +// Event: +function xAddEventListener(e,eventType,eventListener,useCapture) { + if(!(e=xGetElementById(e))) return; + eventType=eventType.toLowerCase(); + if((!xIE4Up && !xOp7) && e==window) { + if(eventType=='resize') { window.xPCW=xClientWidth(); window.xPCH=xClientHeight(); window.xREL=eventListener; xResizeEvent(); return; } + if(eventType=='scroll') { window.xPSL=xScrollLeft(); window.xPST=xScrollTop(); window.xSEL=eventListener; xScrollEvent(); return; } + } + var eh='e.on'+eventType+'=eventListener'; + if(e.addEventListener) e.addEventListener(eventType,eventListener,useCapture); + else if(e.attachEvent) e.attachEvent('on'+eventType,eventListener); + else if(e.captureEvents) { + if(useCapture||(eventType.indexOf('mousemove')!=-1)) { e.captureEvents(eval('Event.'+eventType.toUpperCase())); } + eval(eh); + } + else eval(eh); +} +function xRemoveEventListener(e,eventType,eventListener,useCapture) { + if(!(e=xGetElementById(e))) return; + eventType=eventType.toLowerCase(); + if((!xIE4Up && !xOp7) && e==window) { + if(eventType=='resize') { window.xREL=null; return; } + if(eventType=='scroll') { window.xSEL=null; return; } + } + var eh='e.on'+eventType+'=null'; + if(e.removeEventListener) e.removeEventListener(eventType,eventListener,useCapture); + else if(e.detachEvent) e.detachEvent('on'+eventType,eventListener); + else if(e.releaseEvents) { + if(useCapture||(eventType.indexOf('mousemove')!=-1)) { e.releaseEvents(eval('Event.'+eventType.toUpperCase())); } + eval(eh); + } + else eval(eh); +} +function xEvent(evt) { // cross-browser event object prototype + this.type = ''; + this.target = null; + this.pageX = 0; + this.pageY = 0; + this.offsetX = 0; + this.offsetY = 0; + this.keyCode = 0; + var e = evt ? evt : window.event; + if(!e) return; + if(e.type) this.type = e.type; + if(e.target) this.target = e.target; + else if(e.srcElement) this.target = e.srcElement; + else if(xNN4) this.target = xLayerFromPoint(e.pageX, e.pageY); + if(xOp5or6) { this.pageX = e.clientX; this.pageY = e.clientY; } + else if(xDef(e.pageX,e.pageY)) { this.pageX = e.pageX; this.pageY = e.pageY; } // v3.14 + else if(xDef(e.clientX,e.clientY)) { this.pageX = e.clientX + xScrollLeft(); this.pageY = e.clientY + xScrollTop(); } + if(xDef(e.offsetX,e.offsetY)) { this.offsetX = e.offsetX; this.offsetY = e.offsetY; } + else if(xDef(e.layerX,e.layerY)) { this.offsetX = e.layerX; this.offsetY = e.layerY; } + else { this.offsetX = this.pageX - xPageX(this.target); this.offsetY = this.pageY - xPageY(this.target); } + if (e.keyCode) { this.keyCode = e.keyCode; } // for moz/fb, if keyCode==0 use which + else if (xDef(e.which)) { this.keyCode = e.which; } +} +function xResizeEvent() { // window resize event simulation + if (window.xREL) setTimeout('xResizeEvent()', 250); + var cw = xClientWidth(), ch = xClientHeight(); + if (window.xPCW != cw || window.xPCH != ch) { window.xPCW = cw; window.xPCH = ch; if (window.xREL) window.xREL(); } +} +function xScrollEvent() { // window scroll event simulation + if (window.xSEL) setTimeout('xScrollEvent()', 250); + var sl = xScrollLeft(), st = xScrollTop(); + if (window.xPSL != sl || window.xPST != st) { window.xPSL = sl; window.xPST = st; if (window.xSEL) window.xSEL(); } +} +// end x.js diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/junit_xml_reporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/junit_xml_reporter.php new file mode 100644 index 0000000..3bb3892 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/junit_xml_reporter.php @@ -0,0 +1,118 @@ +SimpleReporter(); + + $this->doc = new DOMDocument(); + $this->doc->loadXML(''); + $this->root = $this->doc->documentElement; + } + + function paintHeader($test_name) { + $this->testsStart = microtime(true); + + $this->root->setAttribute('name', $test_name); + $this->root->setAttribute('timestamp', date('c')); + $this->root->setAttribute('hostname', 'localhost'); + + echo "\n"; + echo "\n"; + + $duration = microtime(true) - $this->testsStart; + + $this->root->setAttribute('tests', $this->getPassCount() + $this->getFailCount() + $this->getExceptionCount()); + $this->root->setAttribute('failures', $this->getFailCount()); + $this->root->setAttribute('errors', $this->getExceptionCount()); + $this->root->setAttribute('time', $duration); + + $this->doc->formatOutput = true; + $xml = $this->doc->saveXML(); + // Cut out XML declaration + echo preg_replace('/<\?[^>]*\?>/', "", $xml); + echo "\n"; + } + + function paintCaseStart($case) { + echo "- case start $case\n"; + $this->currentCaseName = $case; + } + + function paintCaseEnd($case) { + // No output here + } + + function paintMethodStart($test) { + echo " - test start: $test\n"; + + $this->methodStart = microtime(true); + $this->currCase = $this->doc->createElement('testcase'); + } + + function paintMethodEnd($test) { + $duration = microtime(true) - $this->methodStart; + + $this->currCase->setAttribute('name', $test); + $this->currCase->setAttribute('classname', $this->currentCaseName); + $this->currCase->setAttribute('time', $duration); + $this->root->appendChild($this->currCase); + } + + function paintFail($message) { + parent::paintFail($message); + + error_log("Failure: " . $message); + $this->terminateAbnormally($message); + } + + function paintException($exception) { + parent::paintException($exception); + + error_log("Exception: " . $exception); + $this->terminateAbnormally($exception); + } + + function terminateAbnormally($message) { + if (!$this->currCase) { + error_log("!! currCase was not set."); + return; + } + + $ch = $this->doc->createElement('failure'); + $breadcrumb = $this->getTestList(); + $ch->setAttribute('message', $breadcrumb[count($breadcrumb)-1]); + $ch->setAttribute('type', $breadcrumb[count($breadcrumb)-1]); + + $message = implode(' -> ', $breadcrumb) . "\n\n\n" . $message; + $content = $this->doc->createTextNode($message); + $ch->appendChild($content); + + $this->currCase->appendChild($ch); + } +} +?> + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/pear_test_case.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/pear_test_case.php new file mode 100644 index 0000000..4fc34f5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/pear_test_case.php @@ -0,0 +1,196 @@ +_loosely_typed = false; + } + + /** + * Will test straight equality if set to loose + * typing, or identity if not. + * @param $first First value. + * @param $second Comparison value. + * @param $message Message to display. + * @public + */ + function assertEquals($first, $second, $message = "%s", $delta = 0) { + if ($this->_loosely_typed) { + $expectation = new EqualExpectation($first); + } else { + $expectation = new IdenticalExpectation($first); + } + $this->assert($expectation, $second, $message); + } + + /** + * Passes if the value tested is not null. + * @param $value Value to test against. + * @param $message Message to display. + * @public + */ + function assertNotNull($value, $message = "%s") { + parent::assert(new TrueExpectation(), isset($value), $message); + } + + /** + * Passes if the value tested is null. + * @param $value Value to test against. + * @param $message Message to display. + * @public + */ + function assertNull($value, $message = "%s") { + parent::assert(new TrueExpectation(), !isset($value), $message); + } + + /** + * Identity test tests for the same object. + * @param $first First object handle. + * @param $second Hopefully the same handle. + * @param $message Message to display. + * @public + */ + function assertSame($first, $second, $message = "%s") { + $dumper = new SimpleDumper(); + $message = sprintf( + $message, + "[" . $dumper->describeValue($first) . + "] and [" . $dumper->describeValue($second) . + "] should reference the same object"); + return $this->assert( + new TrueExpectation(), + SimpleTestCompatibility::isReference($first, $second), + $message); + } + + /** + * Inverted identity test. + * @param $first First object handle. + * @param $second Hopefully a different handle. + * @param $message Message to display. + * @public + */ + function assertNotSame($first, $second, $message = "%s") { + $dumper = new SimpleDumper(); + $message = sprintf( + $message, + "[" . $dumper->describeValue($first) . + "] and [" . $dumper->describeValue($second) . + "] should not be the same object"); + return $this->assert( + new falseExpectation(), + SimpleTestCompatibility::isReference($first, $second), + $message); + } + + /** + * Sends pass if the test condition resolves true, + * a fail otherwise. + * @param $condition Condition to test true. + * @param $message Message to display. + * @public + */ + function assertTrue($condition, $message = "%s") { + parent::assert(new TrueExpectation(), $condition, $message); + } + + /** + * Sends pass if the test condition resolves false, + * a fail otherwise. + * @param $condition Condition to test false. + * @param $message Message to display. + * @public + */ + function assertFalse($condition, $message = "%s") { + parent::assert(new FalseExpectation(), $condition, $message); + } + + /** + * Tests a regex match. Needs refactoring. + * @param $pattern Regex to match. + * @param $subject String to search in. + * @param $message Message to display. + * @public + */ + function assertRegExp($pattern, $subject, $message = "%s") { + $this->assert(new PatternExpectation($pattern), $subject, $message); + } + + /** + * Tests the type of a value. + * @param $value Value to take type of. + * @param $type Hoped for type. + * @param $message Message to display. + * @public + */ + function assertType($value, $type, $message = "%s") { + parent::assert(new TrueExpectation(), gettype($value) == strtolower($type), $message); + } + + /** + * Sets equality operation to act as a simple equal + * comparison only, allowing a broader range of + * matches. + * @param $loosely_typed True for broader comparison. + * @public + */ + function setLooselyTyped($loosely_typed) { + $this->_loosely_typed = $loosely_typed; + } + + /** + * For progress indication during + * a test amongst other things. + * @return Usually one. + * @public + */ + function countTestCases() { + return $this->getSize(); + } + + /** + * Accessor for name, normally just the class + * name. + * @public + */ + function getName() { + return $this->getLabel(); + } + + /** + * Does nothing. For compatibility only. + * @param $name Dummy + * @public + */ + function setName($name) { + } + } +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder.php new file mode 100644 index 0000000..80ea861 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder.php @@ -0,0 +1,62 @@ +SimpleReporter(); + $this->results = array(); + } + + function paintPass($message) { + parent::paintPass($message); + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + $test = implode("->", $breadcrumb); + + $result["time"] = time(); + $result["status"] = "Passed"; + $result["test"] = $test; + $result["message"] = $message; + $this->results[] = $result; + } + + function paintFail($message) { + parent::paintFail($message); + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + $test = implode("->", $breadcrumb); + + $result["time"] = time(); + $result["status"] = "Failed"; + $result["test"] = $test; + $result["message"] = $message; + $this->results[] = $result; + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/sample.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/sample.php new file mode 100755 index 0000000..4848c48 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/sample.php @@ -0,0 +1,14 @@ +assertTrue(true); + } + + function testFalseIsTrue() { + $this->assertFalse(true); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/test.php new file mode 100755 index 0000000..ec72cdb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/recorder/test/test.php @@ -0,0 +1,28 @@ +addTestFile(dirname(__FILE__) . '/sample.php'); + $recorder = new Recorder(); + $test->run($recorder); + $this->assertEqual(count($recorder->results), 2); + + $this->assertEqual(count($recorder->results[0]), 4); + $this->assertPattern("/".substr(time(), 9)."/", $recorder->results[0]['time']); + $this->assertEqual($recorder->results[0]['status'], "Passed"); + $this->assertPattern("/sample\.php->SampleTestForRecorder->testTrueIsTrue/i", $recorder->results[0]['test']); + $this->assertPattern("/ at \[.*recorder\/test\/sample\.php line 7\]/", $recorder->results[0]['message']); + + $this->assertEqual(count($recorder->results[1]), 4); + $this->assertPattern("/".substr(time(), 9)."/", $recorder->results[1]['time']); + $this->assertEqual($recorder->results[1]['status'], "Failed"); + $this->assertPattern("/sample\.php->SampleTestForRecorder->testFalseIsTrue/i", $recorder->results[1]['test']); + $this->assertPattern("/Expected false, got \[Boolean: true\] at \[.*recorder\/test\/sample\.php line 11\]/", $recorder->results[1]['message']); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenese_tester.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenese_tester.php new file mode 100644 index 0000000..9ae2d9c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenese_tester.php @@ -0,0 +1,393 @@ + + * @param simpleSelenium $selenium + * @param string $html + * @param string $testFile + * @param array $parsed_table + * @param string $logMessages + * @param array $_commandMap + * + */ +class SeleneseTestCase extends UnitTestCase { + var $selenium; + var $html; + var $testFile; + var $parsed_table; + var $logMessages; + var $_commandMap = array("verify", + "verifyErrorOnNext", + "verifyNotErrorOnNext", + "verifyFailureOnNext", + "verifyNotFailureOnNext", + "verifySelected", + "verifyNotSelected", + "verifyAlert", + "verifyNotAlert", + "verifyAllButtons", + "verifyNotAllButtons", + "verifyAllFields", + "verifyNotAllFields", + "verifyAllLinks", + "verifyNotAllLinks", + "verifyAllWindowIds", + "verifyNotAllWindowIds", + "verifyAllWindowNames", + "verifyNotAllWindowNames", + "verifyAllWindowTitles", + "verifyNotAllWindowTitles", + "verifyAttribute", + "verifyNotAttribute", + "verifyAttributeFromAllWindows", + "verifyNotAttributeFromAllWindows", + "verifyBodyText", + "verifyNotBodyText", + "verifyConfirmation", + "verifyNotConfirmation", + "verifyCookie", + "verifyNotCookie", + "verifyCursorPosition", + "verifyNotCursorPosition", + "verifyElementHeight", + "verifyNotElementHeight", + "verifyElementIndex", + "verifyNotElementIndex", + "verifyElementPositionLeft", + "verifyNotElementPositionLeft", + "verifyElementPositionTop", + "verifyNotElementPositionTop", + "verifyElementWidth", + "verifyNotElementWidth", + "verifyEval", + "verifyNotEval", + "verifyExpression", + "verifyNotExpression", + "verifyHtmlSource", + "verifyNotHtmlSource", + "verifyLocation", + "verifyNotLocation", + "verifyLogMessages", + "verifyNotLogMessages", + "verifyMouseSpeed", + "verifyNotMouseSpeed", + "verifyPrompt", + "verifyNotPrompt", + "verifySelectedId", + "verifyNotSelectedId", + "verifySelectedIds", + "verifyNotSelectedIds", + "verifySelectedIndex", + "verifyNotSelectedIndex", + "verifySelectedIndexes", + "verifyNotSelectedIndexes", + "verifySelectedLabel", + "verifyNotSelectedLabel", + "verifySelectedLabels", + "verifyNotSelectedLabels", + "verifySelectedValue", + "verifyNotSelectedValue", + "verifySelectedValues", + "verifyNotSelectedValues", + "verifySelectOptions", + "verifyNotSelectOptions", + "verifyTable", + "verifyNotTable", + "verifyText", + "verifyNotText", + "verifyTitle", + "verifyNotTitle", + "verifyValue", + "verifyNotValue", + "verifyWhetherThisFrameMatchFrameExpression", + "verifyNotWhetherThisFrameMatchFrameExpression", + "verifyWhetherThisWindowMatchWindowExpression", + "verifyNotWhetherThisWindowMatchWindowExpression", + "verifyAlertPresent", + "verifyAlertNotPresent", + "verifyChecked", + "verifyNotChecked", + "verifyConfirmationPresent", + "verifyConfirmationNotPresent", + "verifyEditable", + "verifyNotEditable", + "verifyElementPresent", + "verifyElementNotPresent", + "verifyOrdered", + "verifyNotOrdered", + "verifyPromptPresent", + "verifyPromptNotPresent", + "verifySomethingSelected", + "verifyNotSomethingSelected", + "verifyTextPresent", + "verifyTextNotPresent", + "verifyVisible", + "verifyNotVisible", + "assert", + "assertErrorOnNext", + "assertNotErrorOnNext", + "assertFailureOnNext", + "assertNotFailureOnNext", + "assertSelected", + "assertNotSelected", + "assertAlert", + "assertNotAlert", + "assertAllButtons", + "assertNotAllButtons", + "assertAllFields", + "assertNotAllFields", + "assertAllLinks", + "assertNotAllLinks", + "assertAllWindowIds", + "assertNotAllWindowIds", + "assertAllWindowNames", + "assertNotAllWindowNames", + "assertAllWindowTitles", + "assertNotAllWindowTitles", + "assertAttribute", + "assertNotAttribute", + "assertAttributeFromAllWindows", + "assertNotAttributeFromAllWindows", + "assertBodyText", + "assertNotBodyText", + "assertConfirmation", + "assertNotConfirmation", + "assertCookie", + "assertNotCookie", + "assertCursorPosition", + "assertNotCursorPosition", + "assertElementHeight", + "assertNotElementHeight", + "assertElementIndex", + "assertNotElementIndex", + "assertElementPositionLeft", + "assertNotElementPositionLeft", + "assertElementPositionTop", + "assertNotElementPositionTop", + "assertElementWidth", + "assertNotElementWidth", + "assertEval", + "assertNotEval", + "assertExpression", + "assertNotExpression", + "assertHtmlSource", + "assertNotHtmlSource", + "assertLocation", + "assertNotLocation", + "assertLogMessages", + "assertNotLogMessages", + "assertMouseSpeed", + "assertNotMouseSpeed", + "assertPrompt", + "assertNotPrompt", + "assertSelectedId", + "assertNotSelectedId", + "assertSelectedIds", + "assertNotSelectedIds", + "assertSelectedIndex", + "assertNotSelectedIndex", + "assertSelectedIndexes", + "assertNotSelectedIndexes", + "assertSelectedLabel", + "assertNotSelectedLabel", + "assertSelectedLabels", + "assertNotSelectedLabels", + "assertSelectedValue", + "assertNotSelectedValue", + "assertSelectedValues", + "assertNotSelectedValues", + "assertSelectOptions", + "assertNotSelectOptions", + "assertTable", + "assertNotTable", + "assertText", + "assertNotText", + "assertTitle", + "assertNotTitle", + "assertValue", + "assertNotValue", + "assertWhetherThisFrameMatchFrameExpression", + "assertNotWhetherThisFrameMatchFrameExpression", + "assertWhetherThisWindowMatchWindowExpression", + "assertNotWhetherThisWindowMatchWindowExpression", + "assertAlertPresent", + "assertAlertNotPresent", + "assertChecked", + "assertNotChecked", + "assertConfirmationPresent", + "assertConfirmationNotPresent", + "assertEditable", + "assertNotEditable", + "assertElementPresent", + "assertElementNotPresent", + "assertOrdered", + "assertNotOrdered", + "assertPromptPresent", + "assertPromptNotPresent", + "assertSomethingSelected", + "assertNotSomethingSelected", + "assertTextPresent", + "assertTextNotPresent", + "assertVisible", + "assertNotVisible"); + + /** + * constructor + * + * Construct the object with the specified browser and url + * + * @param string $browser + * @param string $url + */ + function __construct($browser, $url) { + $this->selenium = new SimpleSeleniumRemoteControl($browser, $url); + $this->parsed_table = array(); + } + + /** + * tidy + * + * Reformat the selenium-IDE html test suites + */ + function tidy() { + $tmp = $this->html; + preg_match('//', $tmp, $matche); + $matche[0] = str_replace("/>", ">", $matche[0]); + $matche[0] = str_replace(">", "/>", $matche[0]); + $tmp = preg_replace('//', $matche[0], $tmp); + $this->html = $tmp; + } + + /** + * parse + * + * Extract the called selenium fonction from the html suite + */ + function parse() { + $parsedTab = array(); + $key1 = 0; + + $contenthtml = new DOMDocument; + @$contenthtml->loadHtml($this->html); + $content = simplexml_import_dom($contenthtml); + foreach ($content->body->table->tbody->tr as $tr){ + $key2 = 0; + foreach ($tr->td as $td){ + $parsedTab[$key1][$key2] = $td; + $key2++; + } + $key1++; + } + + $this->parsed_table = $parsedTab; + } + + /** + * assertFunction + * + * Integrate selenium fonctions in simpletest + * + * @param string $function + * @param string $param1 + * @param string $param2 + * + */ + function assertFunction($function, $param1, $param2) { + $_verifyMap = array('verify', 'verifyTextPresent', 'verifyTextNotPresent', 'verifyValue'); + + $reponse = $this->selenium->__call($function, array($param1, $param2)); + + $message = $reponse; + $message .= " using command '".$function ."' with target '".$param1."'"; + if (!empty($param2)) { + $message .= " and value '".$param2."'"; + } + $message .= " in file '".$this->testFile."'"; + + if (!in_array($function, $_verifyMap)) { + $reponse = substr($reponse, 0, 2) == 'OK' ? true : false; + } + + $this->assertTrue($reponse, $message); + } + + /** + * launch + * + * Launch the html test suite from a PHP variable on the url declared wihle + * constructing the object. The filename is used to localize the error. + * + * @param string $testFile + * @param string $filename + * + */ + function launch($html="") { + $this->html = $html; + $this->tidy(); + $this->parse(); + + $this->selenium->start(); + foreach ($this->parsed_table as $test) { + if (in_array($test[0], $this->_commandMap)) { + $this->assertFunction($test[0], $test[1], $test[2]); + } else { + $this->selenium->__call($test[0], array($test[1], $test[2])); + } + } + $this->selenium->stop(); + } + + /** + * launchPhpFile + * + * Parse the PHP file then launch the computed test suite + * + * @param string $file + * + */ + function launchPhpFile($file) { + ob_start(); + require($file); + $data = ob_get_contents(); + ob_end_clean(); + + $this->testFile = $file; + $this->html = $data; + $this->launch($this->html); + } + + /** + * launchFile + * + * Launch the html test suite file on the url declared wihle constructing the object + * + * @param string $testFile + * + */ + function launchFile($testFile) { + $this->testFile = $testFile; + $this->html = file_get_contents($testFile); + $this->launch($this->html); + } +} + +?> diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium.php new file mode 100644 index 0000000..2efaeb4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium.php @@ -0,0 +1,136 @@ +browser)) { + trigger_error('browser property must be set in ' . get_class($this)); + exit; + } + + if (empty($this->browserUrl)) { + trigger_error('browserUrl property must be set in ' . get_class($this)); + exit; + } + } + + public function setUp() { + parent::setUp(); + + if (is_null($this->selenium)) { + $this->selenium = new SimpleSeleniumRemoteControl( + $this->browser, + $this->browserUrl, + $this->host, + $this->port, + $this->timeout + ); + $this->selenium->start(); + } + } + + public function tearDown() { + parent::tearDown(); + + if ($this->newInstanceEachTest) { + $this->selenium->stop(); + $this->selenium = null; + } + } + + public function __call($method, $arguments) { + if (substr($method, 0, 6) == 'verify') { + return $this->assertTrue( + call_user_func_array( + array($this->selenium, $method), + $arguments + ), + sprintf('%s failed', $method) + ); + } + + return call_user_func_array( + array($this->selenium, $method), + $arguments + ); + } + + public function verifyText($text) { + return $this->assertTrue( + $this->selenium->verifyText($text), + sprintf( + 'verifyText failed when on [%s]', + $text + ) + ); + } + + public function verifyTextPresent($text) { + return $this->assertTrue( + $this->selenium->verifyTextPresent($text), + sprintf( + 'verifyTextPresent failed when on [%s]', + $text + ) + ); + } + + public function verifyTextNotPresent($text) { + return $this->assertTrue( + $this->selenium->verifyTextNotPresent($text), + sprintf( + 'verifyTextNotPresent failed on [%s]', + $text + ) + ); + } + + public function verifyValue($selector, $value) { + return $this->assertTrue( + $this->selenium->verifyValue($selector, $value), + sprintf( + 'verifyValue failed on [%s] == [%s]', + $selector, + $value + ) + ); + } + + public function verifyTitle($pattern) { + return $this->assertTrue( + $this->selenium->verifyTitle($pattern), + sprintf( + 'verifyTitle failed on [%s]', + $pattern + ) + ); + } +} + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium/remote-control.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium/remote-control.php new file mode 100644 index 0000000..3227715 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium/remote-control.php @@ -0,0 +1,128 @@ + + * + */ +class SimpleSeleniumRemoteControl +{ + private $_browser = ''; + private $_browserUrl = ''; + private $_host = 'localhost'; + private $_port = 4444; + private $_timeout = 30000; + private $_sessionId = null; + + private $_commandMap = array( + 'bool' => array( + 'verify', + 'verifyTextPresent', + 'verifyTextNotPresent', + 'verifyValue' + ), + 'string' => array( + 'getNewBrowserSession', + ), + ); + + public function __construct($browser, $browserUrl, $host = 'localhost', $port = 4444, $timeout = 30000) { + $this->_browser = $browser; + $this->_browserUrl = $browserUrl; + $this->_host = $host; + $this->_port = $port; + $this->_timeout = $timeout; + } + + public function sessionIdParser($response) { + return substr($response, 3); + } + + public function start() { + $response = $this->cmd('getNewBrowserSession', array($this->_browser, $this->_browserUrl)); + $this->_sessionId = $this->sessionIdParser($response); + } + + public function stop() { + $this->cmd('testComplete'); + $this->_sessionId = null; + } + + public function __call($method, $arguments) { + $response = $this->cmd($method, $arguments); + + foreach ($this->_commandMap as $type => $commands) { + if (!in_array($method, $commands)) { + continue; + $type = null; + } + break; + } + + switch ($type) { + case 'bool' : + return substr($response, 0, 2) == 'OK' ? true : false; + break; + + case 'string' : + default: + return $response; + } + } + + private function _server() { + return "http://{$this->_host}:{$this->_port}/selenium-server/driver/"; + } + + public function buildUrlCmd($method, $arguments = array()) { + $params = array( + 'cmd=' . urlencode($method), + ); + $i = 1; + foreach ($arguments as $param) { + $params[] = $i++ . '=' . urlencode(trim($param)); + } + if (isset($this->_sessionId)) { + $params[] = 'sessionId=' . $this->_sessionId; + } + + return $this->_server()."?".implode('&', $params); + } + + public function cmd($method, $arguments = array()) { + $url = $this->buildUrlCmd($method, $arguments); + $response = $this->_sendRequest($url); + return $response; + } + + public function isUp() { + return (bool)@fsockopen($this->_host, $this->_port, $errno, $errstr, 30); + } + + private function _initCurl($url) { + if (!function_exists('curl_init')) { + throw new Exception('this code currently requires the curl extension'); + } + if (!$ch = curl_init($url)) { + throw new Exception('Unable to setup curl'); + } + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_TIMEOUT, floor($this->_timeout)); + return $ch; + } + + private function _sendRequest($url) { + $ch = $this->_initCurl($url); + $result = curl_exec($ch); + if (($errno = curl_errno($ch)) != 0) { + throw new Exception('Curl returned non-null errno ' . $errno . ':' . curl_error($ch)); + } + curl_close($ch); + return $result; + } +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium/test/remote-control_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium/test/remote-control_test.php new file mode 100644 index 0000000..b705b6a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/selenium/test/remote-control_test.php @@ -0,0 +1,36 @@ +assertEqual($remote_control->sessionIdParser('OK,123456789123456789'), '123456789123456789'); + } + + function testIsUpReturnsFalseWhenDirectedToLocalhostDown() { + $remote_control = new SimpleSeleniumRemoteControl("tester", "http://simpletest.org/", "localhost-down");; + $this->assertFalse($remote_control->isUp()); + } + + function testIsUpReturnsTrueWhenDirectedToLocalhostOnPort80() { + $remote_control = new SimpleSeleniumRemoteControl("tester", "http://simpletest.org/", "localhost", "80"); + $this->assertTrue($remote_control->isUp()); + } +} + +class TestOfSimpleSeleniumRemoteControlWhenItIsUp extends UnitTestCase { + function skip() { + $remote_control = new SimpleSeleniumRemoteControl("*custom opera -nosession", "http://simpletest.org/"); + $this->skipUnless($remote_control->isUp(), 'Remote control tests desperatly need a working Selenium Server.'); + } + + function testOfCommandCreation() { + $remote_control = new SimpleSeleniumRemoteControl("tester", "http://simpletest.org/"); + $this->assertEqual($remote_control->buildUrlCmd("test"), 'http://localhost:4444/selenium-server/driver/?cmd=test'); + $this->assertEqual($remote_control->buildUrlCmd("test", array("next")), 'http://localhost:4444/selenium-server/driver/?cmd=test&1=next'); + $this->assertEqual($remote_control->buildUrlCmd("test", array("t")), 'http://localhost:4444/selenium-server/driver/?cmd=test&1=%C3%A9t%C3%A9'); + $this->assertEqual($remote_control->buildUrlCmd("test", array("next", "then")), 'http://localhost:4444/selenium-server/driver/?cmd=test&1=next&2=then'); + } +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/testdox.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/testdox.php new file mode 100644 index 0000000..dd9c61d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/testdox.php @@ -0,0 +1,55 @@ +_test_case_pattern = empty($test_case_pattern) ? '/^(.*)$/' : $test_case_pattern; + } + + function paintCaseStart($test_name) { + preg_match($this->_test_case_pattern, $test_name, $matches); + if (!empty($matches[1])) { + echo $matches[1] . "\n"; + } else { + echo $test_name . "\n"; + } + } + + function paintCaseEnd($test_name) { + echo "\n"; + } + + function paintMethodStart($test_name) { + if (!preg_match('/^test(.*)$/i', $test_name, $matches)) { + return; + } + $test_name = $matches[1]; + + $test_name = preg_replace('/([A-Z])([A-Z])/', '$1 $2', $test_name); + echo '- ' . strtolower(preg_replace('/([a-zA-Z])([A-Z0-9])/', '$1 $2', $test_name)); + } + + function paintMethodEnd($test_name) { + echo "\n"; + } + + function paintFail($message) { + echo " [FAILED]"; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/testdox/test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/testdox/test.php new file mode 100644 index 0000000..b03abe5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/testdox/test.php @@ -0,0 +1,107 @@ +assertIsA($dox, 'SimpleScorer'); + $this->assertIsA($dox, 'SimpleReporter'); + } + + function testOutputsNameOfTestCase() { + $dox = new TestDoxReporter(); + ob_start(); + $dox->paintCaseStart('TestOfTestDoxReporter'); + $buffer = ob_get_clean(); + $this->assertPattern('/^TestDoxReporter/', $buffer); + } + + function testOutputOfTestCaseNameFilteredByConstructParameter() { + $dox = new TestDoxReporter('/^(.*)Test$/'); + ob_start(); + $dox->paintCaseStart('SomeGreatWidgetTest'); + $buffer = ob_get_clean(); + $this->assertPattern('/^SomeGreatWidget/', $buffer); + } + + function testIfTest_case_patternIsEmptyAssumeEverythingMatches() { + $dox = new TestDoxReporter(''); + ob_start(); + $dox->paintCaseStart('TestOfTestDoxReporter'); + $buffer = ob_get_clean(); + $this->assertPattern('/^TestOfTestDoxReporter/', $buffer); + } + + function testEmptyLineInsertedWhenCaseEnds() { + $dox = new TestDoxReporter(); + ob_start(); + $dox->paintCaseEnd('TestOfTestDoxReporter'); + $buffer = ob_get_clean(); + $this->assertEqual("\n", $buffer); + } + + function testPaintsTestMethodInTestDoxFormat() { + $dox = new TestDoxReporter(); + ob_start(); + $dox->paintMethodStart('testSomeGreatTestCase'); + $buffer = ob_get_clean(); + $this->assertEqual("- some great test case", $buffer); + unset($buffer); + + $random = rand(100, 200); + ob_start(); + $dox->paintMethodStart("testRandomNumberIs{$random}"); + $buffer = ob_get_clean(); + $this->assertEqual("- random number is {$random}", $buffer); + } + + function testDoesNotOutputAnythingOnNoneTestMethods() { + $dox = new TestDoxReporter(); + ob_start(); + $dox->paintMethodStart('nonMatchingMethod'); + $buffer = ob_get_clean(); + $this->assertEqual('', $buffer); + } + + function testPaintMethodAddLineBreak() { + $dox = new TestDoxReporter(); + ob_start(); + $dox->paintMethodEnd('someMethod'); + $buffer = ob_get_clean(); + $this->assertEqual("\n", $buffer); + } + + function testProperlySpacesSingleLettersInMethodName() { + $dox = new TestDoxReporter(); + ob_start(); + $dox->paintMethodStart('testAVerySimpleAgainAVerySimpleMethod'); + $buffer = ob_get_clean(); + $this->assertEqual('- a very simple again a very simple method', $buffer); + } + + function testOnFailureThisPrintsFailureNotice() { + $dox = new TestDoxReporter(); + ob_start(); + $dox->paintFail(''); + $buffer = ob_get_clean(); + $this->assertEqual(' [FAILED]', $buffer); + } + + function testWhenMatchingMethodNamesTestPrefixIsCaseInsensitive() { + $dox = new TestDoxReporter(); + ob_start(); + $dox->paintMethodStart('TESTSupportsAllUppercaseTestPrefixEvenThoughIDoNotKnowWhyYouWouldDoThat'); + $buffer = ob_get_clean(); + $this->assertEqual( + '- supports all uppercase test prefix even though i do not know why you would do that', + $buffer + ); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter.php new file mode 100644 index 0000000..0dfacb4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter.php @@ -0,0 +1,126 @@ +SimpleReporterDecorator(new TreemapRecorder()); + } + + /** + * basic CSS for floating nested divs + * @todo checkout some weird border bugs + */ + function _getCss() { + $css = ".pass{background-color:green;}.fail{background-color:red;}"; + $css .= "body {background-color:white;margin:0;padding:1em;}"; + $css .= "div{float:right;margin:0;color:black;}"; + $css .= "div{border-left:1px solid white;border-bottom:1px solid white;}"; + $css .= "h1 {font:normal 1.8em Arial;color:black;margin:0 0 0.3em 0.1em;}"; + $css .= ".clear { clear:both; }"; + return $css; + } + + /** + * paints the HTML header and sets up results + */ + function paintResultsHeader() { + $title = $this->_reporter->getTitle(); + echo ""; + echo "{$title}"; + echo ""; + echo ""; + echo "

{$title}

"; + } + + /** + * places a clearing break below the end of the test nodes + */ + function paintResultsFooter() { + echo "
"; + echo ""; + } + + /** + * paints start tag for div representing a test node + */ + function paintRectangleStart($node, $horiz, $vert) { + $name = $node->getName(); + $description = $node->getDescription(); + $status = $node->getStatus(); + echo "
"; + } + + /** + * paints end tag for test node div + */ + function paintRectangleEnd() { + echo "
"; + } + + /** + * paints wrapping treemap divs + * @todo how to configure aspect and other parameters? + */ + function paintFooter($group) { + $aspect = 1; + $this->paintResultsHeader(); + $this->paintRectangleStart($this->_reporter->getGraph(), 100, 100); + $this->divideMapNodes($this->_reporter->getGraph(), $aspect); + $this->paintRectangleEnd(); + $this->paintResultsFooter(); + } + + /** + * divides the test results based on a slice and dice algorithm + * + * @param TreemapNode $map sorted + * @param boolean $aspect flips the aspect between horizontal and vertical + * @private + */ + function divideMapNodes($map, $aspect) { + $aspect = !$aspect; + $divisions = $map->getSize(); + $total = $map->getTotalSize(); + foreach($map->getChildren() as $node) { + if (!$node->isLeaf()) { + $dist = $node->getTotalSize() / $total * 100; + } else { + $dist = 1 / $total * 100; + } + if ($aspect) { + $horiz = $dist; + $vert = 100; + } else { + $horiz = 100; + $vert = $dist; + } + $this->paintRectangleStart($node, $horiz, $vert); + $this->divideMapNodes($node, $aspect); + $this->paintRectangleEnd(); + } + } + + function paintGroupEnd($group) { + $this->_reporter->paintGroupEnd($group); + if ($this->_reporter->isComplete()) { + $this->paintFooter($group); + } + } + +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/jquery.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/jquery.php new file mode 100644 index 0000000..7de0e1e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/jquery.php @@ -0,0 +1,75 @@ + representing treemap of test report, + * and attaches jQuery Treemap to render results. + * + * @package SimpleTest + * @subpackage Extensions + */ +class JqueryTreemapReporter extends TreemapReporter { + + function _getCss() { + $css = ".treemapView { color:white; } + .treemapCell {background-color:green;font-size:10px;font-family:Arial;} + .treemapHead {cursor:pointer;background-color:#B34700} + .treemapCell.selected, .treemapCell.selected .treemapCell.selected {background-color:#FFCC80} + .treemapCell.selected .treemapCell {background-color:#FF9900} + .treemapCell.selected .treemapHead {background-color:#B36B00} + .transfer {border:1px solid black}"; + return $css; + } + + function paintResultsHeader() { + $title = $this->_reporter->getTitle(); + echo ""; + echo "{$title}"; + echo ""; + echo ""; + echo ""; + echo ""; + echo "
    "; + } + + function paintRectangleStart($node) { + echo "
  • ". basename($node->getDescription()) . ""; + echo "" . $node->getTotalSize() . ""; + } + + function paintRectangleEnd() {} + + function paintResultsFooter() { + echo "
"; + echo ""; + } + + function divideMapNodes($map) { + foreach($map->getChildren() as $node) { + if (!$node->isLeaf()) { + $this->paintRectangleStart($node); + $this->divideMapNodes($node); + } + } + } + +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/test/treemap_node_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/test/treemap_node_test.php new file mode 100644 index 0000000..f3c6a23 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/test/treemap_node_test.php @@ -0,0 +1,69 @@ +assertEqual($node->getSize(), 0); + $this->assertEqual($node->getTotalSize(), 0); + } + + function testChildNodeDepth() { + $root = new TreemapNode("root", "test"); + $root->putChild(new TreemapNode("child", "test")); + $childOne = new TreemapNode("child1", "test"); + $childTwo = new TreemapNode("child2", "test"); + $childTwo->putChild(new TreemapNode("child3", "test")); + $childOne->putChild($childTwo); + $root->putChild($childOne); + $this->assertEqual($root->getSize(), 2); + $this->assertEqual($root->getTotalSize(), 4); + } + + function testGraphDepthSpread() { + $root = new TreemapNode("root", "test"); + $root->putChild(new TreemapNode("child", "test")); + $childOne = new TreemapNode("child1", "test"); + $childTwo = new TreemapNode("child2", "test"); + $childThree = new TreemapNode("child3", "test"); + $childFour = new TreemapNode("child4", "test"); + $childFive = new TreemapNode("child5", "test"); + $childSix = new TreemapNode("child6", "test"); + $childFour->putChild($childFive); + $childFour->putChild($childSix); + $this->assertEqual($childFour->getSize(), 2); + $this->assertEqual($childFour->getTotalSize(), 2); + $childThree->putChild($childFour); + $this->assertEqual($childThree->getSize(), 1); + $this->assertEqual($childThree->getTotalSize(), 3); + $childTwo->putChild($childThree); + $this->assertEqual($childTwo->getSize(), 1); + $this->assertEqual($childTwo->getTotalSize(), 4); + $childOne->putChild($childTwo); + $root->putChild($childOne); + $this->assertEqual($root->getSize(), 2); + $this->assertEqual($root->getTotalSize(), 7); + } + + function testMutableStack() { + $stack = new TreemapStack(); + $this->assertEqual($stack->size(), 0); + $stack->push(new TreemapNode("a", "one")); + $this->assertEqual($stack->size(), 1); + $stack->push(new TreemapNode("b", "one")); + $this->assertIdentical($stack->peek(), new TreemapNode("b", "one")); + $stack->push(new TreemapNode("c", "three")); + $stack->push(new TreemapNode("d", "four")); + $this->assertEqual($stack->size(), 4); + $this->assertIdentical($stack->pop(), new TreemapNode("d", "four")); + $this->assertEqual($stack->size(), 3); + $this->assertIdentical($stack->pop(), new TreemapNode("c", "three")); + $this->assertEqual($stack->size(), 2); + } + +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/treemap_recorder.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/treemap_recorder.php new file mode 100644 index 0000000..0136e49 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/treemap_reporter/treemap_recorder.php @@ -0,0 +1,310 @@ +SimpleReporter(); + $this->_stack = new TreemapStack(); + $this->_graph = null; + } + + /** + * returns a reference to the root node of the + * collected treemap graph + */ + function getGraph() { + return $this->_graph; + } + + /** + * is this test run finished? + */ + function isComplete() { + return ($this->_graph != null); + } + + /** + * returns the title of the test + */ + function getTitle() { + return $this->_title; + } + + /** + * stashes the title of the test + */ + function paintHeader($title) { + $this->_title = $title; + } + + function paintFormattedMessage() { + } + + /** + * acceptor for start of test group node + */ + function paintGroupStart($message, $size) { + parent::paintGroupStart($message, $size); + $node = new TreemapNode("Group", $message); + $this->_stack->push($node); + } + + /** + * acceptor for start of test case node + */ + function paintCaseStart($message) { + parent::paintCaseStart($message); + $node = new TreemapNode("TestCase", $message); + $this->_stack->push($node); + } + + /** + * acceptor for start of test method node + */ + function paintMethodStart($message) { + parent::paintMethodStart($message); + $node = new TreemapNode("Method", $message); + $this->_stack->push($node); + } + + /** + * acceptor for passing assertion node + */ + function paintPass($message) { + parent::paintPass($message); + $node = new TreemapNode("Assertion", $message, true); + $current = $this->_stack->peek(); + if ($current) { + $current->putChild($node); + } else { + echo "no current node"; + } + } + + + /** + * acceptor for failing assertion node + */ + + function paintFail($message) { + parent::paintFail($message); + $node = new TreemapNode("Assertion", $message, false); + $current = $this->_stack->peek(); + $current->putChild($node); + $current->fail(); + } + + /** + * acceptor for end of method node + */ + function paintMethodEnd($message) { + parent::paintCaseEnd($message); + $node = $this->_stack->pop(); + $current = $this->_stack->peek(); + if ($node->isFailed()) $current->fail(); + $current->putChild($node); + } + + /** + * acceptor for end of test case + */ + function paintCaseEnd($message) { + parent::paintCaseEnd($message); + $node = $this->_stack->pop(); + $current = $this->_stack->peek(); + if ($node->isFailed()) $current->fail(); + $current->putChild($node); + } + + /** + * acceptor for end of test group. final group + * pops the collected treemap nodes and assigns + * it to the internal graph property. + */ + function paintGroupEnd($message) { + $node = $this->_stack->pop(); + $current = $this->_stack->peek(); + if ($current) { + if ($node->isFailed()) $current->fail(); + $current->putChild($node); + } else { + $this->_graph = $node; + } + parent::paintGroupEnd($message); + } + +} + +/** + * Creates a treemap graph, representing + * each node in a test visualization. + * + * @package SimpleTest + * @subpackage Extensions + */ +class TreemapNode { + var $_name; + var $_description; + var $_status; + var $_parent; + var $_size; + + function TreemapNode($name, $description, $status=true) { + $this->_name = $name; + $this->_description = $description; + $this->_status = $status; + $this->_children = array(); + } + + /** + * @return string label of this node + */ + function getName() { + return $this->_name; + } + + /** + * @return string description of this node + */ + function getDescription() { + return $this->_description; + } + + /** + * @return string status class string + */ + function getStatus() { + return ($this->_status) ? "pass" : "fail"; + } + + /** + * Return list of child nodes from direct edges. + */ + function getChildren() { + uksort($this->_children, array($this, 'compareChildren')); + return $this->_children; + } + + /** + * Comparator method to rank child nodes by total weight. + */ + function compareChildren($a, $b) { + if ($this->_children[$a]->getTotalSize() > $this->_children[$b]->getTotalSize()) { + $node_a = $this->_children[$a]; + $node_b = $this->_children[$b]; + $this->_children[$a] = $node_b; + $this->_children[$b] = $node_a; + } + } + + /** + * Gets the number of immediate child edges from this node. + */ + function getSize() { + return count($this->_children); + } + + /** + * depth first search to get the total number of nodes + * that are descendants of this node. + */ + function getTotalSize() { + if (!isset($this->_size)) { + $size = $this->getSize(); + if (!$this->isLeaf()) { + foreach($this->getChildren() as $child) { + $size += $child->getTotalSize(); + } + } + $this->_size = $size; + } + return $this->_size; + } + + /** + * Fail this node. + * @return void + */ + function fail() { + $this->_status = false; + } + + /** Is this node failed? */ + function isFailed() { + return ($this->_status == false); + } + + /** Add an edge to a child node */ + function putChild($node) { + $this->_children[] = $node; + } + + /** Is this node a leaf node? */ + function isLeaf() { + return (count($this->_children) == 0); + } + +} + +/** + * provides LIFO stack semantics + * + * @package SimpleTest + * @subpackage Extensions + */ +class TreemapStack { + var $_list; + + function TreemapStack() { + $this->_list = array(); + } + + /** + * Push an element onto the stack. + */ + function push($node) { + $this->_list[] = $node; + } + + /** + * Number of elements in the stack. + */ + function size() { + return count($this->_list); + } + + /** + * Take a peek at the top element on the + * stack. + */ + function peek() { + return end($this->_list); + } + + /** + * Pops an element off the stack. + */ + function pop() { + return array_pop($this->_list); + } + +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/webunit_reporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/webunit_reporter.php new file mode 100644 index 0000000..52d25eb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/extensions/webunit_reporter.php @@ -0,0 +1,285 @@ + + +%s + + + + + + +
+

 Running %s 

+ Please wait...
+
  +
+ +
+

+
+
visible tab content
+     Fail   +   Tree   +
+
Click on a failed test case method in the tree tab to view output here.
+
+
+
+ +'.$this->outputScript("xHide('wait');"); + $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green"); + $content = "

$test_name

\n"; + $content .= "
"; + $content .= $this->getTestCaseProgress() . "/" . $this->getTestCaseCount(); + $content .= " test cases complete:\n"; + $content .= "" . $this->getPassCount() . " passes, "; + $content .= "" . $this->getFailCount() . " fails and "; + $content .= "" . $this->getExceptionCount() . " exceptions."; + $content .= "
\n"; + + echo $this->outputScript('foo = "'.$this->toJsString($content).'";'."\nset_div_content('run', foo);"); + echo "\n\n\n"; + } + + + /** + * Paints formatted text such as dumped variables. + * @param string $message Text to show. + * @access public + */ + function paintFormattedMessage($message) { + echo "add_log(\"".$this->toJsString("
$message
", true)."\");\n"; + } + + /** + * Paints the start of a group test. Will also paint + * the page header and footer if this is the + * first test. Will stash the size if the first + * start. + * @param string $test_name Name of test that is starting. + * @param integer $size Number of test cases starting. + * @access public + */ + function paintGroupStart($test_name, $size) { + Parent::paintGroupStart($test_name, $size); + echo "add_group('$test_name');\n"; + } + + /** + * Paints the start of a test case. Will also paint + * the page header and footer if this is the + * first test. Will stash the size if the first + * start. + * @param string $test_name Name of test that is starting. + * @access public + */ + function paintCaseStart($test_name) { + Parent::paintCaseStart($test_name); + echo "add_case('$test_name');\n"; + } + + + /** + * Paints the start of a test method. + * @param string $test_name Name of test that is starting. + * @access public + */ + function paintMethodStart($test_name) { + Parent::paintMethodStart($test_name); + echo "add_method('$test_name');\n"; + } + + /** + * Paints the end of a test method. + * @param string $test_name Name of test that is ending. + * @access public + */ + function paintMethodEnd($test_name) { + Parent::paintMethodEnd($test_name); + } + + /** + * Paints the test failure with a breadcrumbs + * trail of the nesting test suites below the + * top level test. + * @param string $message Failure message displayed in + * the context of the other tests. + * @access public + */ + function paintFail($message) { + parent::paintFail($message); + $msg = "Fail: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + $msg .= implode("->", $breadcrumb); + $msg .= "->" . htmlentities($message) . "
"; + echo "add_fail('$msg');\n"; + } + + /** + * Paints a PHP error or exception. + * @param string $message Message is ignored. + * @access public + * @abstract + */ + function paintException($message) { + parent::paintException($message); + $msg = "Exception: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + $msg .= implode("->", $breadcrumb); + $msg .= "->" . htmlentities($message) . "
"; + echo "add_fail('$msg');\n"; + } + + /** + * Returns the script passed in wrapped in script tags. + * + * @param string $script the script to output + * @return string the script wrapped with script tags + */ + function outputScript($script) + { + return "\n"; + } + + + /** + * Transform a string into a format acceptable to JavaScript + * @param string $str the string to transform + * @return string + */ + function toJsString($str, $preserveCr=false) { + $cr = ($preserveCr) ? '\\n' : ''; + return str_replace( + array('"' + ,"\n") + ,array('\"' + ,"$cr\"\n\t+\"") + ,$str + ); + } + } + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/form.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/form.php new file mode 100644 index 0000000..d14f0f7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/form.php @@ -0,0 +1,355 @@ +method = $tag->getAttribute('method'); + $this->action = $this->createAction($tag->getAttribute('action'), $page); + $this->encoding = $this->setEncodingClass($tag); + $this->default_target = false; + $this->id = $tag->getAttribute('id'); + $this->buttons = array(); + $this->images = array(); + $this->widgets = array(); + $this->radios = array(); + $this->checkboxes = array(); + } + + /** + * Creates the request packet to be sent by the form. + * @param SimpleTag $tag Form tag to read. + * @return string Packet class. + * @access private + */ + protected function setEncodingClass($tag) { + if (strtolower($tag->getAttribute('method')) == 'post') { + if (strtolower($tag->getAttribute('enctype')) == 'multipart/form-data') { + return 'SimpleMultipartEncoding'; + } + return 'SimplePostEncoding'; + } + return 'SimpleGetEncoding'; + } + + /** + * Sets the frame target within a frameset. + * @param string $frame Name of frame. + * @access public + */ + function setDefaultTarget($frame) { + $this->default_target = $frame; + } + + /** + * Accessor for method of form submission. + * @return string Either get or post. + * @access public + */ + function getMethod() { + return ($this->method ? strtolower($this->method) : 'get'); + } + + /** + * Combined action attribute with current location + * to get an absolute form target. + * @param string $action Action attribute from form tag. + * @param SimpleUrl $base Page location. + * @return SimpleUrl Absolute form target. + */ + protected function createAction($action, $page) { + if (($action === '') || ($action === false)) { + return $page->expandUrl($page->getUrl()); + } + return $page->expandUrl(new SimpleUrl($action));; + } + + /** + * Absolute URL of the target. + * @return SimpleUrl URL target. + * @access public + */ + function getAction() { + $url = $this->action; + if ($this->default_target && ! $url->getTarget()) { + $url->setTarget($this->default_target); + } + return $url; + } + + /** + * Creates the encoding for the current values in the + * form. + * @return SimpleFormEncoding Request to submit. + * @access private + */ + protected function encode() { + $class = $this->encoding; + $encoding = new $class(); + for ($i = 0, $count = count($this->widgets); $i < $count; $i++) { + $this->widgets[$i]->write($encoding); + } + return $encoding; + } + + /** + * ID field of form for unique identification. + * @return string Unique tag ID. + * @access public + */ + function getId() { + return $this->id; + } + + /** + * Adds a tag contents to the form. + * @param SimpleWidget $tag Input tag to add. + * @access public + */ + function addWidget($tag) { + if (strtolower($tag->getAttribute('type')) == 'submit') { + $this->buttons[] = $tag; + } elseif (strtolower($tag->getAttribute('type')) == 'image') { + $this->images[] = $tag; + } elseif ($tag->getName()) { + $this->setWidget($tag); + } + } + + /** + * Sets the widget into the form, grouping radio + * buttons if any. + * @param SimpleWidget $tag Incoming form control. + * @access private + */ + protected function setWidget($tag) { + if (strtolower($tag->getAttribute('type')) == 'radio') { + $this->addRadioButton($tag); + } elseif (strtolower($tag->getAttribute('type')) == 'checkbox') { + $this->addCheckbox($tag); + } else { + $this->widgets[] = &$tag; + } + } + + /** + * Adds a radio button, building a group if necessary. + * @param SimpleRadioButtonTag $tag Incoming form control. + * @access private + */ + protected function addRadioButton($tag) { + if (! isset($this->radios[$tag->getName()])) { + $this->widgets[] = new SimpleRadioGroup(); + $this->radios[$tag->getName()] = count($this->widgets) - 1; + } + $this->widgets[$this->radios[$tag->getName()]]->addWidget($tag); + } + + /** + * Adds a checkbox, making it a group on a repeated name. + * @param SimpleCheckboxTag $tag Incoming form control. + * @access private + */ + protected function addCheckbox($tag) { + if (! isset($this->checkboxes[$tag->getName()])) { + $this->widgets[] = $tag; + $this->checkboxes[$tag->getName()] = count($this->widgets) - 1; + } else { + $index = $this->checkboxes[$tag->getName()]; + if (! SimpleTestCompatibility::isA($this->widgets[$index], 'SimpleCheckboxGroup')) { + $previous = $this->widgets[$index]; + $this->widgets[$index] = new SimpleCheckboxGroup(); + $this->widgets[$index]->addWidget($previous); + } + $this->widgets[$index]->addWidget($tag); + } + } + + /** + * Extracts current value from form. + * @param SimpleSelector $selector Criteria to apply. + * @return string/array Value(s) as string or null + * if not set. + * @access public + */ + function getValue($selector) { + for ($i = 0, $count = count($this->widgets); $i < $count; $i++) { + if ($selector->isMatch($this->widgets[$i])) { + return $this->widgets[$i]->getValue(); + } + } + foreach ($this->buttons as $button) { + if ($selector->isMatch($button)) { + return $button->getValue(); + } + } + return null; + } + + /** + * Sets a widget value within the form. + * @param SimpleSelector $selector Criteria to apply. + * @param string $value Value to input into the widget. + * @return boolean True if value is legal, false + * otherwise. If the field is not + * present, nothing will be set. + * @access public + */ + function setField($selector, $value, $position=false) { + $success = false; + $_position = 0; + for ($i = 0, $count = count($this->widgets); $i < $count; $i++) { + if ($selector->isMatch($this->widgets[$i])) { + $_position++; + if ($position === false or $_position === (int)$position) { + if ($this->widgets[$i]->setValue($value)) { + $success = true; + } + } + } + } + return $success; + } + + /** + * Used by the page object to set widgets labels to + * external label tags. + * @param SimpleSelector $selector Criteria to apply. + * @access public + */ + function attachLabelBySelector($selector, $label) { + for ($i = 0, $count = count($this->widgets); $i < $count; $i++) { + if ($selector->isMatch($this->widgets[$i])) { + if (method_exists($this->widgets[$i], 'setLabel')) { + $this->widgets[$i]->setLabel($label); + return; + } + } + } + } + + /** + * Test to see if a form has a submit button. + * @param SimpleSelector $selector Criteria to apply. + * @return boolean True if present. + * @access public + */ + function hasSubmit($selector) { + foreach ($this->buttons as $button) { + if ($selector->isMatch($button)) { + return true; + } + } + return false; + } + + /** + * Test to see if a form has an image control. + * @param SimpleSelector $selector Criteria to apply. + * @return boolean True if present. + * @access public + */ + function hasImage($selector) { + foreach ($this->images as $image) { + if ($selector->isMatch($image)) { + return true; + } + } + return false; + } + + /** + * Gets the submit values for a selected button. + * @param SimpleSelector $selector Criteria to apply. + * @param hash $additional Additional data for the form. + * @return SimpleEncoding Submitted values or false + * if there is no such button + * in the form. + * @access public + */ + function submitButton($selector, $additional = false) { + $additional = $additional ? $additional : array(); + foreach ($this->buttons as $button) { + if ($selector->isMatch($button)) { + $encoding = $this->encode(); + $button->write($encoding); + if ($additional) { + $encoding->merge($additional); + } + return $encoding; + } + } + return false; + } + + /** + * Gets the submit values for an image. + * @param SimpleSelector $selector Criteria to apply. + * @param integer $x X-coordinate of click. + * @param integer $y Y-coordinate of click. + * @param hash $additional Additional data for the form. + * @return SimpleEncoding Submitted values or false + * if there is no such button in the + * form. + * @access public + */ + function submitImage($selector, $x, $y, $additional = false) { + $additional = $additional ? $additional : array(); + foreach ($this->images as $image) { + if ($selector->isMatch($image)) { + $encoding = $this->encode(); + $image->write($encoding, $x, $y); + if ($additional) { + $encoding->merge($additional); + } + return $encoding; + } + } + return false; + } + + /** + * Simply submits the form without the submit button + * value. Used when there is only one button or it + * is unimportant. + * @return hash Submitted values. + * @access public + */ + function submit() { + return $this->encode(); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/frames.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/frames.php new file mode 100644 index 0000000..d6d8e96 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/frames.php @@ -0,0 +1,592 @@ +frameset = $page; + $this->frames = array(); + $this->focus = false; + $this->names = array(); + } + + /** + * Adds a parsed page to the frameset. + * @param SimplePage $page Frame page. + * @param string $name Name of frame in frameset. + * @access public + */ + function addFrame($page, $name = false) { + $this->frames[] = $page; + if ($name) { + $this->names[$name] = count($this->frames) - 1; + } + } + + /** + * Replaces existing frame with another. If the + * frame is nested, then the call is passed down + * one level. + * @param array $path Path of frame in frameset. + * @param SimplePage $page Frame source. + * @access public + */ + function setFrame($path, $page) { + $name = array_shift($path); + if (isset($this->names[$name])) { + $index = $this->names[$name]; + } else { + $index = $name - 1; + } + if (count($path) == 0) { + $this->frames[$index] = &$page; + return; + } + $this->frames[$index]->setFrame($path, $page); + } + + /** + * Accessor for current frame focus. Will be + * false if no frame has focus. Will have the nested + * frame focus if any. + * @return array Labels or indexes of nested frames. + * @access public + */ + function getFrameFocus() { + if ($this->focus === false) { + return array(); + } + return array_merge( + array($this->getPublicNameFromIndex($this->focus)), + $this->frames[$this->focus]->getFrameFocus()); + } + + /** + * Turns an internal array index into the frames list + * into a public name, or if none, then a one offset + * index. + * @param integer $subject Internal index. + * @return integer/string Public name. + * @access private + */ + protected function getPublicNameFromIndex($subject) { + foreach ($this->names as $name => $index) { + if ($subject == $index) { + return $name; + } + } + return $subject + 1; + } + + /** + * Sets the focus by index. The integer index starts from 1. + * If already focused and the target frame also has frames, + * then the nested frame will be focused. + * @param integer $choice Chosen frame. + * @return boolean True if frame exists. + * @access public + */ + function setFrameFocusByIndex($choice) { + if (is_integer($this->focus)) { + if ($this->frames[$this->focus]->hasFrames()) { + return $this->frames[$this->focus]->setFrameFocusByIndex($choice); + } + } + if (($choice < 1) || ($choice > count($this->frames))) { + return false; + } + $this->focus = $choice - 1; + return true; + } + + /** + * Sets the focus by name. If already focused and the + * target frame also has frames, then the nested frame + * will be focused. + * @param string $name Chosen frame. + * @return boolean True if frame exists. + * @access public + */ + function setFrameFocus($name) { + if (is_integer($this->focus)) { + if ($this->frames[$this->focus]->hasFrames()) { + return $this->frames[$this->focus]->setFrameFocus($name); + } + } + if (in_array($name, array_keys($this->names))) { + $this->focus = $this->names[$name]; + return true; + } + return false; + } + + /** + * Clears the frame focus. + * @access public + */ + function clearFrameFocus() { + $this->focus = false; + $this->clearNestedFramesFocus(); + } + + /** + * Clears the frame focus for any nested frames. + * @access private + */ + protected function clearNestedFramesFocus() { + for ($i = 0; $i < count($this->frames); $i++) { + $this->frames[$i]->clearFrameFocus(); + } + } + + /** + * Test for the presence of a frameset. + * @return boolean Always true. + * @access public + */ + function hasFrames() { + return true; + } + + /** + * Accessor for frames information. + * @return array/string Recursive hash of frame URL strings. + * The key is either a numerical + * index or the name attribute. + * @access public + */ + function getFrames() { + $report = array(); + for ($i = 0; $i < count($this->frames); $i++) { + $report[$this->getPublicNameFromIndex($i)] = + $this->frames[$i]->getFrames(); + } + return $report; + } + + /** + * Accessor for raw text of either all the pages or + * the frame in focus. + * @return string Raw unparsed content. + * @access public + */ + function getRaw() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getRaw(); + } + $raw = ''; + for ($i = 0; $i < count($this->frames); $i++) { + $raw .= $this->frames[$i]->getRaw(); + } + return $raw; + } + + /** + * Accessor for plain text of either all the pages or + * the frame in focus. + * @return string Plain text content. + * @access public + */ + function getText() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getText(); + } + $raw = ''; + for ($i = 0; $i < count($this->frames); $i++) { + $raw .= ' ' . $this->frames[$i]->getText(); + } + return trim($raw); + } + + /** + * Accessor for last error. + * @return string Error from last response. + * @access public + */ + function getTransportError() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getTransportError(); + } + return $this->frameset->getTransportError(); + } + + /** + * Request method used to fetch this frame. + * @return string GET, POST or HEAD. + * @access public + */ + function getMethod() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getMethod(); + } + return $this->frameset->getMethod(); + } + + /** + * Original resource name. + * @return SimpleUrl Current url. + * @access public + */ + function getUrl() { + if (is_integer($this->focus)) { + $url = $this->frames[$this->focus]->getUrl(); + $url->setTarget($this->getPublicNameFromIndex($this->focus)); + } else { + $url = $this->frameset->getUrl(); + } + return $url; + } + + /** + * Page base URL. + * @return SimpleUrl Current url. + * @access public + */ + function getBaseUrl() { + if (is_integer($this->focus)) { + $url = $this->frames[$this->focus]->getBaseUrl(); + } else { + $url = $this->frameset->getBaseUrl(); + } + return $url; + } + + /** + * Expands expandomatic URLs into fully qualified + * URLs for the frameset page. + * @param SimpleUrl $url Relative URL. + * @return SimpleUrl Absolute URL. + * @access public + */ + function expandUrl($url) { + return $this->frameset->expandUrl($url); + } + + /** + * Original request data. + * @return mixed Sent content. + * @access public + */ + function getRequestData() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getRequestData(); + } + return $this->frameset->getRequestData(); + } + + /** + * Accessor for current MIME type. + * @return string MIME type as string; e.g. 'text/html' + * @access public + */ + function getMimeType() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getMimeType(); + } + return $this->frameset->getMimeType(); + } + + /** + * Accessor for last response code. + * @return integer Last HTTP response code received. + * @access public + */ + function getResponseCode() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getResponseCode(); + } + return $this->frameset->getResponseCode(); + } + + /** + * Accessor for last Authentication type. Only valid + * straight after a challenge (401). + * @return string Description of challenge type. + * @access public + */ + function getAuthentication() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getAuthentication(); + } + return $this->frameset->getAuthentication(); + } + + /** + * Accessor for last Authentication realm. Only valid + * straight after a challenge (401). + * @return string Name of security realm. + * @access public + */ + function getRealm() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getRealm(); + } + return $this->frameset->getRealm(); + } + + /** + * Accessor for outgoing header information. + * @return string Header block. + * @access public + */ + function getRequest() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getRequest(); + } + return $this->frameset->getRequest(); + } + + /** + * Accessor for raw header information. + * @return string Header block. + * @access public + */ + function getHeaders() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getHeaders(); + } + return $this->frameset->getHeaders(); + } + + /** + * Accessor for parsed title. + * @return string Title or false if no title is present. + * @access public + */ + function getTitle() { + return $this->frameset->getTitle(); + } + + /** + * Accessor for a list of all fixed links. + * @return array List of urls as strings. + * @access public + */ + function getUrls() { + if (is_integer($this->focus)) { + return $this->frames[$this->focus]->getUrls(); + } + $urls = array(); + foreach ($this->frames as $frame) { + $urls = array_merge($urls, $frame->getUrls()); + } + return array_values(array_unique($urls)); + } + + /** + * Accessor for URLs by the link label. Label will match + * regardess of whitespace issues and case. + * @param string $label Text of link. + * @return array List of links with that label. + * @access public + */ + function getUrlsByLabel($label) { + if (is_integer($this->focus)) { + return $this->tagUrlsWithFrame( + $this->frames[$this->focus]->getUrlsByLabel($label), + $this->focus); + } + $urls = array(); + foreach ($this->frames as $index => $frame) { + $urls = array_merge( + $urls, + $this->tagUrlsWithFrame( + $frame->getUrlsByLabel($label), + $index)); + } + return $urls; + } + + /** + * Accessor for a URL by the id attribute. If in a frameset + * then the first link found with that ID attribute is + * returned only. Focus on a frame if you want one from + * a specific part of the frameset. + * @param string $id Id attribute of link. + * @return string URL with that id. + * @access public + */ + function getUrlById($id) { + foreach ($this->frames as $index => $frame) { + if ($url = $frame->getUrlById($id)) { + if (! $url->gettarget()) { + $url->setTarget($this->getPublicNameFromIndex($index)); + } + return $url; + } + } + return false; + } + + /** + * Attaches the intended frame index to a list of URLs. + * @param array $urls List of SimpleUrls. + * @param string $frame Name of frame or index. + * @return array List of tagged URLs. + * @access private + */ + protected function tagUrlsWithFrame($urls, $frame) { + $tagged = array(); + foreach ($urls as $url) { + if (! $url->getTarget()) { + $url->setTarget($this->getPublicNameFromIndex($frame)); + } + $tagged[] = $url; + } + return $tagged; + } + + /** + * Finds a held form by button label. Will only + * search correctly built forms. + * @param SimpleSelector $selector Button finder. + * @return SimpleForm Form object containing + * the button. + * @access public + */ + function getFormBySubmit($selector) { + return $this->findForm('getFormBySubmit', $selector); + } + + /** + * Finds a held form by image using a selector. + * Will only search correctly built forms. The first + * form found either within the focused frame, or + * across frames, will be the one returned. + * @param SimpleSelector $selector Image finder. + * @return SimpleForm Form object containing + * the image. + * @access public + */ + function getFormByImage($selector) { + return $this->findForm('getFormByImage', $selector); + } + + /** + * Finds a held form by the form ID. A way of + * identifying a specific form when we have control + * of the HTML code. The first form found + * either within the focused frame, or across frames, + * will be the one returned. + * @param string $id Form label. + * @return SimpleForm Form object containing the matching ID. + * @access public + */ + function getFormById($id) { + return $this->findForm('getFormById', $id); + } + + /** + * General form finder. Will search all the frames or + * just the one in focus. + * @param string $method Method to use to find in a page. + * @param string $attribute Label, name or ID. + * @return SimpleForm Form object containing the matching ID. + * @access private + */ + protected function findForm($method, $attribute) { + if (is_integer($this->focus)) { + return $this->findFormInFrame( + $this->frames[$this->focus], + $this->focus, + $method, + $attribute); + } + for ($i = 0; $i < count($this->frames); $i++) { + $form = $this->findFormInFrame( + $this->frames[$i], + $i, + $method, + $attribute); + if ($form) { + return $form; + } + } + $null = null; + return $null; + } + + /** + * Finds a form in a page using a form finding method. Will + * also tag the form with the frame name it belongs in. + * @param SimplePage $page Page content of frame. + * @param integer $index Internal frame representation. + * @param string $method Method to use to find in a page. + * @param string $attribute Label, name or ID. + * @return SimpleForm Form object containing the matching ID. + * @access private + */ + protected function findFormInFrame($page, $index, $method, $attribute) { + $form = $this->frames[$index]->$method($attribute); + if (isset($form)) { + $form->setDefaultTarget($this->getPublicNameFromIndex($index)); + } + return $form; + } + + /** + * Sets a field on each form in which the field is + * available. + * @param SimpleSelector $selector Field finder. + * @param string $value Value to set field to. + * @return boolean True if value is valid. + * @access public + */ + function setField($selector, $value) { + if (is_integer($this->focus)) { + $this->frames[$this->focus]->setField($selector, $value); + } else { + for ($i = 0; $i < count($this->frames); $i++) { + $this->frames[$i]->setField($selector, $value); + } + } + } + + /** + * Accessor for a form element value within a page. + * @param SimpleSelector $selector Field finder. + * @return string/boolean A string if the field is + * present, false if unchecked + * and null if missing. + * @access public + */ + function getField($selector) { + for ($i = 0; $i < count($this->frames); $i++) { + $value = $this->frames[$i]->getField($selector); + if (isset($value)) { + return $value; + } + } + return null; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/http.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/http.php new file mode 100644 index 0000000..15b555c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/http.php @@ -0,0 +1,628 @@ +url = $url; + } + + /** + * Resource name. + * @return SimpleUrl Current url. + * @access protected + */ + function getUrl() { + return $this->url; + } + + /** + * Creates the first line which is the actual request. + * @param string $method HTTP request method, usually GET. + * @return string Request line content. + * @access protected + */ + protected function getRequestLine($method) { + return $method . ' ' . $this->url->getPath() . + $this->url->getEncodedRequest() . ' HTTP/1.0'; + } + + /** + * Creates the host part of the request. + * @return string Host line content. + * @access protected + */ + protected function getHostLine() { + $line = 'Host: ' . $this->url->getHost(); + if ($this->url->getPort()) { + $line .= ':' . $this->url->getPort(); + } + return $line; + } + + /** + * Opens a socket to the route. + * @param string $method HTTP request method, usually GET. + * @param integer $timeout Connection timeout. + * @return SimpleSocket New socket. + * @access public + */ + function createConnection($method, $timeout) { + $default_port = ('https' == $this->url->getScheme()) ? 443 : 80; + $socket = $this->createSocket( + $this->url->getScheme() ? $this->url->getScheme() : 'http', + $this->url->getHost(), + $this->url->getPort() ? $this->url->getPort() : $default_port, + $timeout); + if (! $socket->isError()) { + $socket->write($this->getRequestLine($method) . "\r\n"); + $socket->write($this->getHostLine() . "\r\n"); + $socket->write("Connection: close\r\n"); + } + return $socket; + } + + /** + * Factory for socket. + * @param string $scheme Protocol to use. + * @param string $host Hostname to connect to. + * @param integer $port Remote port. + * @param integer $timeout Connection timeout. + * @return SimpleSocket/SimpleSecureSocket New socket. + * @access protected + */ + protected function createSocket($scheme, $host, $port, $timeout) { + if (in_array($scheme, array('file'))) { + return new SimpleFileSocket($this->url); + } elseif (in_array($scheme, array('https'))) { + return new SimpleSecureSocket($host, $port, $timeout); + } else { + return new SimpleSocket($host, $port, $timeout); + } + } +} + +/** + * Creates HTTP headers for the end point of + * a HTTP request via a proxy server. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleProxyRoute extends SimpleRoute { + private $proxy; + private $username; + private $password; + + /** + * Stashes the proxy address. + * @param SimpleUrl $url URL as object. + * @param string $proxy Proxy URL. + * @param string $username Username for autentication. + * @param string $password Password for autentication. + * @access public + */ + function __construct($url, $proxy, $username = false, $password = false) { + parent::__construct($url); + $this->proxy = $proxy; + $this->username = $username; + $this->password = $password; + } + + /** + * Creates the first line which is the actual request. + * @param string $method HTTP request method, usually GET. + * @param SimpleUrl $url URL as object. + * @return string Request line content. + * @access protected + */ + function getRequestLine($method) { + $url = $this->getUrl(); + $scheme = $url->getScheme() ? $url->getScheme() : 'http'; + $port = $url->getPort() ? ':' . $url->getPort() : ''; + return $method . ' ' . $scheme . '://' . $url->getHost() . $port . + $url->getPath() . $url->getEncodedRequest() . ' HTTP/1.0'; + } + + /** + * Creates the host part of the request. + * @param SimpleUrl $url URL as object. + * @return string Host line content. + * @access protected + */ + function getHostLine() { + $host = 'Host: ' . $this->proxy->getHost(); + $port = $this->proxy->getPort() ? $this->proxy->getPort() : 8080; + return "$host:$port"; + } + + /** + * Opens a socket to the route. + * @param string $method HTTP request method, usually GET. + * @param integer $timeout Connection timeout. + * @return SimpleSocket New socket. + * @access public + */ + function createConnection($method, $timeout) { + $socket = $this->createSocket( + $this->proxy->getScheme() ? $this->proxy->getScheme() : 'http', + $this->proxy->getHost(), + $this->proxy->getPort() ? $this->proxy->getPort() : 8080, + $timeout); + if ($socket->isError()) { + return $socket; + } + $socket->write($this->getRequestLine($method) . "\r\n"); + $socket->write($this->getHostLine() . "\r\n"); + if ($this->username && $this->password) { + $socket->write('Proxy-Authorization: Basic ' . + base64_encode($this->username . ':' . $this->password) . + "\r\n"); + } + $socket->write("Connection: close\r\n"); + return $socket; + } +} + +/** + * HTTP request for a web page. Factory for + * HttpResponse object. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleHttpRequest { + private $route; + private $encoding; + private $headers; + private $cookies; + + /** + * Builds the socket request from the different pieces. + * These include proxy information, URL, cookies, headers, + * request method and choice of encoding. + * @param SimpleRoute $route Request route. + * @param SimpleFormEncoding $encoding Content to send with + * request. + * @access public + */ + function __construct($route, $encoding) { + $this->route = $route; + $this->encoding = $encoding; + $this->headers = array(); + $this->cookies = array(); + } + + /** + * Dispatches the content to the route's socket. + * @param integer $timeout Connection timeout. + * @return SimpleHttpResponse A response which may only have + * an error, but hopefully has a + * complete web page. + * @access public + */ + function fetch($timeout) { + $socket = $this->route->createConnection($this->encoding->getMethod(), $timeout); + if (! $socket->isError()) { + $this->dispatchRequest($socket, $this->encoding); + } + return $this->createResponse($socket); + } + + /** + * Sends the headers. + * @param SimpleSocket $socket Open socket. + * @param string $method HTTP request method, + * usually GET. + * @param SimpleFormEncoding $encoding Content to send with request. + * @access private + */ + protected function dispatchRequest($socket, $encoding) { + foreach ($this->headers as $header_line) { + $socket->write($header_line . "\r\n"); + } + if (count($this->cookies) > 0) { + $socket->write("Cookie: " . implode(";", $this->cookies) . "\r\n"); + } + $encoding->writeHeadersTo($socket); + $socket->write("\r\n"); + $encoding->writeTo($socket); + } + + /** + * Adds a header line to the request. + * @param string $header_line Text of full header line. + * @access public + */ + function addHeaderLine($header_line) { + $this->headers[] = $header_line; + } + + /** + * Reads all the relevant cookies from the + * cookie jar. + * @param SimpleCookieJar $jar Jar to read + * @param SimpleUrl $url Url to use for scope. + * @access public + */ + function readCookiesFromJar($jar, $url) { + $this->cookies = $jar->selectAsPairs($url); + } + + /** + * Wraps the socket in a response parser. + * @param SimpleSocket $socket Responding socket. + * @return SimpleHttpResponse Parsed response object. + * @access protected + */ + protected function createResponse($socket) { + $response = new SimpleHttpResponse( + $socket, + $this->route->getUrl(), + $this->encoding); + $socket->close(); + return $response; + } +} + +/** + * Collection of header lines in the response. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleHttpHeaders { + private $raw_headers; + private $response_code; + private $http_version; + private $mime_type; + private $location; + private $cookies; + private $authentication; + private $realm; + + /** + * Parses the incoming header block. + * @param string $headers Header block. + * @access public + */ + function __construct($headers) { + $this->raw_headers = $headers; + $this->response_code = false; + $this->http_version = false; + $this->mime_type = ''; + $this->location = false; + $this->cookies = array(); + $this->authentication = false; + $this->realm = false; + foreach (split("\r\n", $headers) as $header_line) { + $this->parseHeaderLine($header_line); + } + } + + /** + * Accessor for parsed HTTP protocol version. + * @return integer HTTP error code. + * @access public + */ + function getHttpVersion() { + return $this->http_version; + } + + /** + * Accessor for raw header block. + * @return string All headers as raw string. + * @access public + */ + function getRaw() { + return $this->raw_headers; + } + + /** + * Accessor for parsed HTTP error code. + * @return integer HTTP error code. + * @access public + */ + function getResponseCode() { + return (integer)$this->response_code; + } + + /** + * Returns the redirected URL or false if + * no redirection. + * @return string URL or false for none. + * @access public + */ + function getLocation() { + return $this->location; + } + + /** + * Test to see if the response is a valid redirect. + * @return boolean True if valid redirect. + * @access public + */ + function isRedirect() { + return in_array($this->response_code, array(301, 302, 303, 307)) && + (boolean)$this->getLocation(); + } + + /** + * Test to see if the response is an authentication + * challenge. + * @return boolean True if challenge. + * @access public + */ + function isChallenge() { + return ($this->response_code == 401) && + (boolean)$this->authentication && + (boolean)$this->realm; + } + + /** + * Accessor for MIME type header information. + * @return string MIME type. + * @access public + */ + function getMimeType() { + return $this->mime_type; + } + + /** + * Accessor for authentication type. + * @return string Type. + * @access public + */ + function getAuthentication() { + return $this->authentication; + } + + /** + * Accessor for security realm. + * @return string Realm. + * @access public + */ + function getRealm() { + return $this->realm; + } + + /** + * Writes new cookies to the cookie jar. + * @param SimpleCookieJar $jar Jar to write to. + * @param SimpleUrl $url Host and path to write under. + * @access public + */ + function writeCookiesToJar($jar, $url) { + foreach ($this->cookies as $cookie) { + $jar->setCookie( + $cookie->getName(), + $cookie->getValue(), + $url->getHost(), + $cookie->getPath(), + $cookie->getExpiry()); + } + } + + /** + * Called on each header line to accumulate the held + * data within the class. + * @param string $header_line One line of header. + * @access protected + */ + protected function parseHeaderLine($header_line) { + if (preg_match('/HTTP\/(\d+\.\d+)\s+(\d+)/i', $header_line, $matches)) { + $this->http_version = $matches[1]; + $this->response_code = $matches[2]; + } + if (preg_match('/Content-type:\s*(.*)/i', $header_line, $matches)) { + $this->mime_type = trim($matches[1]); + } + if (preg_match('/Location:\s*(.*)/i', $header_line, $matches)) { + $this->location = trim($matches[1]); + } + if (preg_match('/Set-cookie:(.*)/i', $header_line, $matches)) { + $this->cookies[] = $this->parseCookie($matches[1]); + } + if (preg_match('/WWW-Authenticate:\s+(\S+)\s+realm=\"(.*?)\"/i', $header_line, $matches)) { + $this->authentication = $matches[1]; + $this->realm = trim($matches[2]); + } + } + + /** + * Parse the Set-cookie content. + * @param string $cookie_line Text after "Set-cookie:" + * @return SimpleCookie New cookie object. + * @access private + */ + protected function parseCookie($cookie_line) { + $parts = split(";", $cookie_line); + $cookie = array(); + preg_match('/\s*(.*?)\s*=(.*)/', array_shift($parts), $cookie); + foreach ($parts as $part) { + if (preg_match('/\s*(.*?)\s*=(.*)/', $part, $matches)) { + $cookie[$matches[1]] = trim($matches[2]); + } + } + return new SimpleCookie( + $cookie[1], + trim($cookie[2]), + isset($cookie["path"]) ? $cookie["path"] : "", + isset($cookie["expires"]) ? $cookie["expires"] : false); + } +} + +/** + * Basic HTTP response. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleHttpResponse extends SimpleStickyError { + private $url; + private $encoding; + private $sent; + private $content; + private $headers; + + /** + * Constructor. Reads and parses the incoming + * content and headers. + * @param SimpleSocket $socket Network connection to fetch + * response text from. + * @param SimpleUrl $url Resource name. + * @param mixed $encoding Record of content sent. + * @access public + */ + function __construct($socket, $url, $encoding) { + parent::__construct(); + $this->url = $url; + $this->encoding = $encoding; + $this->sent = $socket->getSent(); + $this->content = false; + $raw = $this->readAll($socket); + if ($socket->isError()) { + $this->setError('Error reading socket [' . $socket->getError() . ']'); + return; + } + $this->parse($raw); + } + + /** + * Splits up the headers and the rest of the content. + * @param string $raw Content to parse. + * @access private + */ + protected function parse($raw) { + if (! $raw) { + $this->setError('Nothing fetched'); + $this->headers = new SimpleHttpHeaders(''); + } elseif ('file' == $this->url->getScheme()) { + $this->headers = new SimpleHttpHeaders(''); + $this->content = $raw; + } elseif (! strstr($raw, "\r\n\r\n")) { + $this->setError('Could not split headers from content'); + $this->headers = new SimpleHttpHeaders($raw); + } else { + list($headers, $this->content) = split("\r\n\r\n", $raw, 2); + $this->headers = new SimpleHttpHeaders($headers); + } + } + + /** + * Original request method. + * @return string GET, POST or HEAD. + * @access public + */ + function getMethod() { + return $this->encoding->getMethod(); + } + + /** + * Resource name. + * @return SimpleUrl Current url. + * @access public + */ + function getUrl() { + return $this->url; + } + + /** + * Original request data. + * @return mixed Sent content. + * @access public + */ + function getRequestData() { + return $this->encoding; + } + + /** + * Raw request that was sent down the wire. + * @return string Bytes actually sent. + * @access public + */ + function getSent() { + return $this->sent; + } + + /** + * Accessor for the content after the last + * header line. + * @return string All content. + * @access public + */ + function getContent() { + return $this->content; + } + + /** + * Accessor for header block. The response is the + * combination of this and the content. + * @return SimpleHeaders Wrapped header block. + * @access public + */ + function getHeaders() { + return $this->headers; + } + + /** + * Accessor for any new cookies. + * @return array List of new cookies. + * @access public + */ + function getNewCookies() { + return $this->headers->getNewCookies(); + } + + /** + * Reads the whole of the socket output into a + * single string. + * @param SimpleSocket $socket Unread socket. + * @return string Raw output if successful + * else false. + * @access private + */ + protected function readAll($socket) { + $all = ''; + while (! $this->isLastPacket($next = $socket->read())) { + $all .= $next; + } + return $all; + } + + /** + * Test to see if the packet from the socket is the + * last one. + * @param string $packet Chunk to interpret. + * @return boolean True if empty or EOF. + * @access private + */ + protected function isLastPacket($packet) { + if (is_string($packet)) { + return $packet === ''; + } + return ! $packet; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/invoker.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/invoker.php new file mode 100644 index 0000000..ee31034 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/invoker.php @@ -0,0 +1,139 @@ +test_case = $test_case; + } + + /** + * Accessor for test case being run. + * @return SimpleTestCase Test case. + * @access public + */ + function getTestCase() { + return $this->test_case; + } + + /** + * Runs test level set up. Used for changing + * the mechanics of base test cases. + * @param string $method Test method to call. + * @access public + */ + function before($method) { + $this->test_case->before($method); + } + + /** + * Invokes a test method and buffered with setUp() + * and tearDown() calls. + * @param string $method Test method to call. + * @access public + */ + function invoke($method) { + $this->test_case->setUp(); + $this->test_case->$method(); + $this->test_case->tearDown(); + } + + /** + * Runs test level clean up. Used for changing + * the mechanics of base test cases. + * @param string $method Test method to call. + * @access public + */ + function after($method) { + $this->test_case->after($method); + } +} + +/** + * Do nothing decorator. Just passes the invocation + * straight through. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleInvokerDecorator { + private $invoker; + + /** + * Stores the invoker to wrap. + * @param SimpleInvoker $invoker Test method runner. + */ + function __construct($invoker) { + $this->invoker = $invoker; + } + + /** + * Accessor for test case being run. + * @return SimpleTestCase Test case. + * @access public + */ + function getTestCase() { + return $this->invoker->getTestCase(); + } + + /** + * Runs test level set up. Used for changing + * the mechanics of base test cases. + * @param string $method Test method to call. + * @access public + */ + function before($method) { + $this->invoker->before($method); + } + + /** + * Invokes a test method and buffered with setUp() + * and tearDown() calls. + * @param string $method Test method to call. + * @access public + */ + function invoke($method) { + $this->invoker->invoke($method); + } + + /** + * Runs test level clean up. Used for changing + * the mechanics of base test cases. + * @param string $method Test method to call. + * @access public + */ + function after($method) { + $this->invoker->after($method); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/mock_objects.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/mock_objects.php new file mode 100644 index 0000000..c3ed38b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/mock_objects.php @@ -0,0 +1,1630 @@ +expected = $expected; + } + + /** + * Tests the assertion. True if correct. + * @param array $parameters Comparison values. + * @return boolean True if correct. + * @access public + */ + function test($parameters) { + if (! is_array($this->expected)) { + return true; + } + if (count($this->expected) != count($parameters)) { + return false; + } + for ($i = 0; $i < count($this->expected); $i++) { + if (! $this->testParameter($parameters[$i], $this->expected[$i])) { + return false; + } + } + return true; + } + + /** + * Tests an individual parameter. + * @param mixed $parameter Value to test. + * @param mixed $expected Comparison value. + * @return boolean True if expectation + * fulfilled. + * @access private + */ + protected function testParameter($parameter, $expected) { + $comparison = $this->coerceToExpectation($expected); + return $comparison->test($parameter); + } + + /** + * Returns a human readable test message. + * @param array $comparison Incoming parameter list. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($parameters) { + if ($this->test($parameters)) { + return "Expectation of " . count($this->expected) . + " arguments of [" . $this->renderArguments($this->expected) . + "] is correct"; + } else { + return $this->describeDifference($this->expected, $parameters); + } + } + + /** + * Message to display if expectation differs from + * the parameters actually received. + * @param array $expected Expected parameters as list. + * @param array $parameters Actual parameters received. + * @return string Description of difference. + * @access private + */ + protected function describeDifference($expected, $parameters) { + if (count($expected) != count($parameters)) { + return "Expected " . count($expected) . + " arguments of [" . $this->renderArguments($expected) . + "] but got " . count($parameters) . + " arguments of [" . $this->renderArguments($parameters) . "]"; + } + $messages = array(); + for ($i = 0; $i < count($expected); $i++) { + $comparison = $this->coerceToExpectation($expected[$i]); + if (! $comparison->test($parameters[$i])) { + $messages[] = "parameter " . ($i + 1) . " with [" . + $comparison->overlayMessage($parameters[$i], $this->getDumper()) . "]"; + } + } + return "Parameter expectation differs at " . implode(" and ", $messages); + } + + /** + * Creates an identical expectation if the + * object/value is not already some type + * of expectation. + * @param mixed $expected Expected value. + * @return SimpleExpectation Expectation object. + * @access private + */ + protected function coerceToExpectation($expected) { + if (SimpleExpectation::isExpectation($expected)) { + return $expected; + } + return new IdenticalExpectation($expected); + } + + /** + * Renders the argument list as a string for + * messages. + * @param array $args Incoming arguments. + * @return string Simple description of type and value. + * @access private + */ + protected function renderArguments($args) { + $descriptions = array(); + if (is_array($args)) { + foreach ($args as $arg) { + $dumper = new SimpleDumper(); + $descriptions[] = $dumper->describeValue($arg); + } + } + return implode(', ', $descriptions); + } +} + +/** + * Confirms that the number of calls on a method is as expected. + * @package SimpleTest + * @subpackage MockObjects + */ +class CallCountExpectation extends SimpleExpectation { + private $method; + private $count; + + /** + * Stashes the method and expected count for later + * reporting. + * @param string $method Name of method to confirm against. + * @param integer $count Expected number of calls. + * @param string $message Custom error message. + */ + function __construct($method, $count, $message = '%s') { + $this->method = $method; + $this->count = $count; + parent::__construct($message); + } + + /** + * Tests the assertion. True if correct. + * @param integer $compare Measured call count. + * @return boolean True if expected. + * @access public + */ + function test($compare) { + return ($this->count == $compare); + } + + /** + * Reports the comparison. + * @param integer $compare Measured call count. + * @return string Message to show. + * @access public + */ + function testMessage($compare) { + return 'Expected call count for [' . $this->method . + '] was [' . $this->count . + '] got [' . $compare . ']'; + } +} + +/** + * Confirms that the number of calls on a method is as expected. + * @package SimpleTest + * @subpackage MockObjects + */ +class MinimumCallCountExpectation extends SimpleExpectation { + private $method; + private $count; + + /** + * Stashes the method and expected count for later + * reporting. + * @param string $method Name of method to confirm against. + * @param integer $count Minimum number of calls. + * @param string $message Custom error message. + */ + function __construct($method, $count, $message = '%s') { + $this->method = $method; + $this->count = $count; + parent::__construct($message); + } + + /** + * Tests the assertion. True if correct. + * @param integer $compare Measured call count. + * @return boolean True if enough. + * @access public + */ + function test($compare) { + return ($this->count <= $compare); + } + + /** + * Reports the comparison. + * @param integer $compare Measured call count. + * @return string Message to show. + * @access public + */ + function testMessage($compare) { + return 'Minimum call count for [' . $this->method . + '] was [' . $this->count . + '] got [' . $compare . ']'; + } +} + +/** + * Confirms that the number of calls on a method is as expected. + * @package SimpleTest + * @subpackage MockObjects + */ +class MaximumCallCountExpectation extends SimpleExpectation { + private $method; + private $count; + + /** + * Stashes the method and expected count for later + * reporting. + * @param string $method Name of method to confirm against. + * @param integer $count Minimum number of calls. + * @param string $message Custom error message. + */ + function __construct($method, $count, $message = '%s') { + $this->method = $method; + $this->count = $count; + parent::__construct($message); + } + + /** + * Tests the assertion. True if correct. + * @param integer $compare Measured call count. + * @return boolean True if not over. + * @access public + */ + function test($compare) { + return ($this->count >= $compare); + } + + /** + * Reports the comparison. + * @param integer $compare Measured call count. + * @return string Message to show. + * @access public + */ + function testMessage($compare) { + return 'Maximum call count for [' . $this->method . + '] was [' . $this->count . + '] got [' . $compare . ']'; + } +} + +/** + * Retrieves method actions by searching the + * parameter lists until an expected match is found. + * @package SimpleTest + * @subpackage MockObjects + */ +class SimpleSignatureMap { + private $map; + + /** + * Creates an empty call map. + * @access public + */ + function __construct() { + $this->map = array(); + } + + /** + * Stashes a reference against a method call. + * @param array $parameters Array of arguments (including wildcards). + * @param mixed $action Reference placed in the map. + * @access public + */ + function add($parameters, $action) { + $place = count($this->map); + $this->map[$place] = array(); + $this->map[$place]['params'] = new ParametersExpectation($parameters); + $this->map[$place]['content'] = $action; + } + + /** + * Searches the call list for a matching parameter + * set. Returned by reference. + * @param array $parameters Parameters to search by + * without wildcards. + * @return object Object held in the first matching + * slot, otherwise null. + * @access public + */ + function &findFirstAction($parameters) { + $slot = $this->findFirstSlot($parameters); + if (isset($slot) && isset($slot['content'])) { + return $slot['content']; + } + $null = null; + return $null; + } + + /** + * Searches the call list for a matching parameter + * set. True if successful. + * @param array $parameters Parameters to search by + * without wildcards. + * @return boolean True if a match is present. + * @access public + */ + function isMatch($parameters) { + return ($this->findFirstSlot($parameters) != null); + } + + /** + * Compares the incoming parameters with the + * internal expectation. Uses the incoming $test + * to dispatch the test message. + * @param SimpleTestCase $test Test to dispatch to. + * @param array $parameters The actual calling arguments. + * @param string $message The message to overlay. + * @access public + */ + function test($test, $parameters, $message) { + } + + /** + * Searches the map for a matching item. + * @param array $parameters Parameters to search by + * without wildcards. + * @return array Reference to slot or null. + * @access private + */ + function &findFirstSlot($parameters) { + $count = count($this->map); + for ($i = 0; $i < $count; $i++) { + if ($this->map[$i]["params"]->test($parameters)) { + return $this->map[$i]; + } + } + $null = null; + return $null; + } +} + +/** + * Allows setting of actions against call signatures either + * at a specific time, or always. Specific time settings + * trump lasting ones, otherwise the most recently added + * will mask an earlier match. + * @package SimpleTest + * @subpackage MockObjects + */ +class SimpleCallSchedule { + private $wildcard = MOCK_ANYTHING; + private $always; + private $at; + + /** + * Sets up an empty response schedule. + * Creates an empty call map. + */ + function __construct() { + $this->always = array(); + $this->at = array(); + } + + /** + * Stores an action against a signature that + * will always fire unless masked by a time + * specific one. + * @param string $method Method name. + * @param array $args Calling parameters. + * @param SimpleAction $action Actually simpleByValue, etc. + * @access public + */ + function register($method, $args, $action) { + $args = $this->replaceWildcards($args); + $method = strtolower($method); + if (! isset($this->always[$method])) { + $this->always[$method] = new SimpleSignatureMap(); + } + $this->always[$method]->add($args, $action); + } + + /** + * Stores an action against a signature that + * will fire at a specific time in the future. + * @param integer $step delay of calls to this method, + * 0 is next. + * @param string $method Method name. + * @param array $args Calling parameters. + * @param SimpleAction $action Actually SimpleByValue, etc. + * @access public + */ + function registerAt($step, $method, $args, $action) { + $args = $this->replaceWildcards($args); + $method = strtolower($method); + if (! isset($this->at[$method])) { + $this->at[$method] = array(); + } + if (! isset($this->at[$method][$step])) { + $this->at[$method][$step] = new SimpleSignatureMap(); + } + $this->at[$method][$step]->add($args, $action); + } + + /** + * Sets up an expectation on the argument list. + * @param string $method Method to test. + * @param array $args Bare arguments or list of + * expectation objects. + * @param string $message Failure message. + */ + function expectArguments($method, $args, $message) { + $args = $this->replaceWildcards($args); + $message .= Mock::getExpectationLine(); + $this->expected_args[strtolower($method)] = + new ParametersExpectation($args, $message); + + } + + /** + * Actually carry out the action stored previously, + * if the parameters match. + * @param integer $step Time of call. + * @param string $method Method name. + * @param array $args The parameters making up the + * rest of the call. + * @return mixed The result of the action. + * @access public. + */ + function &respond($step, $method, $args) { + $method = strtolower($method); + if (isset($this->at[$method][$step])) { + if ($this->at[$method][$step]->isMatch($args)) { + $action = $this->at[$method][$step]->findFirstAction($args); + if (isset($action)) { + return $action->act(); + } + } + } + if (isset($this->always[$method])) { + $action = $this->always[$method]->findFirstAction($args); + if (isset($action)) { + return $action->act(); + } + } + $null = null; + return $null; + } + + /** + * Replaces wildcard matches with wildcard + * expectations in the argument list. + * @param array $args Raw argument list. + * @return array Argument list with + * expectations. + * @access private + */ + protected function replaceWildcards($args) { + if ($args === false) { + return false; + } + for ($i = 0; $i < count($args); $i++) { + if ($args[$i] === $this->wildcard) { + $args[$i] = new AnythingExpectation(); + } + } + return $args; + } +} + +/** + * A type of SimpleMethodAction. + * Stashes a value for returning later. Follows usual + * PHP5 semantics of objects being returned by reference. + * @package SimpleTest + * @subpackage MockObjects + */ +class SimpleReturn { + private $value; + + /** + * Stashes it for later. + * @param mixed $value You need to clone objects + * if you want copy semantics + * for these. + * @access public + */ + function __construct($value) { + $this->value = $value; + } + + /** + * Returns the value stored earlier. + * @return mixed Whatever was stashed. + * @access public + */ + function act() { + return $this->value; + } +} + +/** + * A type of SimpleMethodAction. + * Stashes a reference for returning later. + * @package SimpleTest + * @subpackage MockObjects + */ +class SimpleByReference { + private $reference; + + /** + * Stashes it for later. + * @param mixed $reference Actual PHP4 style reference. + * @access public + */ + function __construct(&$reference) { + $this->reference = &$reference; + } + + /** + * Returns the reference stored earlier. + * @return mixed Whatever was stashed. + * @access public + */ + function &act() { + return $this->reference; + } +} + +/** + * A type of SimpleMethodAction. + * Stashes a value for returning later. + * @package SimpleTest + * @subpackage MockObjects + */ +class SimpleByValue { + private $value; + + /** + * Stashes it for later. + * @param mixed $value You need to clone objects + * if you want copy semantics + * for these. + * @access public + */ + function __construct($value) { + $this->value = $value; + } + + /** + * Returns the value stored earlier. + * @return mixed Whatever was stashed. + * @access public + */ + function &act() { + $dummy = $this->value; + return $dummy; + } +} + +/** + * A type of SimpleMethodAction. + * Stashes an exception for throwing later. + * @package SimpleTest + * @subpackage MockObjects + */ +class SimpleThrower { + private $exception; + + /** + * Stashes it for later. + * @param Exception $exception The exception object to throw. + * @access public + */ + function __construct($exception) { + $this->exception = $exception; + } + + /** + * Throws the exceptins stashed earlier. + * @access public + */ + function act() { + throw $this->exception; + } +} + +/** + * A type of SimpleMethodAction. + * Stashes an error for emitting later. + * @package SimpleTest + * @subpackage MockObjects + */ +class SimpleErrorThrower { + private $error; + private $severity; + + /** + * Stashes an error to throw later. + * @param string $error Error message. + * @param integer $severity PHP error constant, e.g E_USER_ERROR. + * @access public + */ + function __construct($error, $severity) { + $this->error = $error; + $this->severity = $severity; + } + + /** + * Triggers the stashed error. + * @access public + */ + function &act() { + trigger_error($this->error, $this->severity); + $null = null; + return $null; + } +} + +/** + * A base class or delegate that extends an + * empty collection of methods that can have their + * return values set and expectations made of the + * calls upon them. The mock will assert the + * expectations against it's attached test case in + * addition to the server stub behaviour or returning + * preprogrammed responses. + * @package SimpleTest + * @subpackage MockObjects + */ +class SimpleMock { + private $actions; + private $expectations; + private $wildcard = MOCK_ANYTHING; + private $is_strict = true; + private $call_counts; + private $expected_counts; + private $max_counts; + private $expected_args; + private $expected_args_at; + + /** + * Creates an empty action list and expectation list. + * All call counts are set to zero. + * @access public + */ + function SimpleMock() { + $this->actions = new SimpleCallSchedule(); + $this->expectations = new SimpleCallSchedule(); + $this->call_counts = array(); + $this->expected_counts = array(); + $this->max_counts = array(); + $this->expected_args = array(); + $this->expected_args_at = array(); + $this->getCurrentTestCase()->tell($this); + } + + /** + * Disables a name check when setting expectations. + * This hack is needed for the partial mocks. + * @access public + */ + function disableExpectationNameChecks() { + $this->is_strict = false; + } + + /** + * Finds currently running test. + * @return SimpeTestCase Current test case. + * @access protected + */ + protected function getCurrentTestCase() { + return SimpleTest::getContext()->getTest(); + } + + /** + * Die if bad arguments array is passed. + * @param mixed $args The arguments value to be checked. + * @param string $task Description of task attempt. + * @return boolean Valid arguments + * @access private + */ + protected function checkArgumentsIsArray($args, $task) { + if (! is_array($args)) { + trigger_error( + "Cannot $task as \$args parameter is not an array", + E_USER_ERROR); + } + } + + /** + * Triggers a PHP error if the method is not part + * of this object. + * @param string $method Name of method. + * @param string $task Description of task attempt. + * @access protected + */ + protected function dieOnNoMethod($method, $task) { + if ($this->is_strict && ! method_exists($this, $method)) { + trigger_error( + "Cannot $task as no ${method}() in class " . get_class($this), + E_USER_ERROR); + } + } + + /** + * Replaces wildcard matches with wildcard + * expectations in the argument list. + * @param array $args Raw argument list. + * @return array Argument list with + * expectations. + * @access private + */ + function replaceWildcards($args) { + if ($args === false) { + return false; + } + for ($i = 0; $i < count($args); $i++) { + if ($args[$i] === $this->wildcard) { + $args[$i] = new AnythingExpectation(); + } + } + return $args; + } + + /** + * Adds one to the call count of a method. + * @param string $method Method called. + * @param array $args Arguments as an array. + * @access protected + */ + protected function addCall($method, $args) { + if (! isset($this->call_counts[$method])) { + $this->call_counts[$method] = 0; + } + $this->call_counts[$method]++; + } + + /** + * Fetches the call count of a method so far. + * @param string $method Method name called. + * @return integer Number of calls so far. + * @access public + */ + function getCallCount($method) { + $this->dieOnNoMethod($method, "get call count"); + $method = strtolower($method); + if (! isset($this->call_counts[$method])) { + return 0; + } + return $this->call_counts[$method]; + } + + /** + * Sets a return for a parameter list that will + * be passed on by all calls to this method that match. + * @param string $method Method name. + * @param mixed $value Result of call by value/handle. + * @param array $args List of parameters to match + * including wildcards. + * @access public + */ + function returns($method, $value, $args = false) { + $this->dieOnNoMethod($method, "set return"); + $this->actions->register($method, $args, new SimpleReturn($value)); + } + + /** + * Sets a return for a parameter list that will + * be passed only when the required call count + * is reached. + * @param integer $timing Number of calls in the future + * to which the result applies. If + * not set then all calls will return + * the value. + * @param string $method Method name. + * @param mixed $value Result of call passed. + * @param array $args List of parameters to match + * including wildcards. + * @access public + */ + function returnsAt($timing, $method, $value, $args = false) { + $this->dieOnNoMethod($method, "set return value sequence"); + $this->actions->registerAt($timing, $method, $args, new SimpleReturn($value)); + } + + /** + * Sets a return for a parameter list that will + * be passed by value for all calls to this method. + * @param string $method Method name. + * @param mixed $value Result of call passed by value. + * @param array $args List of parameters to match + * including wildcards. + * @access public + */ + function setReturnValue($method, $value, $args = false) { + $this->dieOnNoMethod($method, "set return value"); + $this->actions->register($method, $args, new SimpleByValue($value)); + } + + /** + * Sets a return for a parameter list that will + * be passed by value only when the required call count + * is reached. + * @param integer $timing Number of calls in the future + * to which the result applies. If + * not set then all calls will return + * the value. + * @param string $method Method name. + * @param mixed $value Result of call passed by value. + * @param array $args List of parameters to match + * including wildcards. + * @access public + */ + function setReturnValueAt($timing, $method, $value, $args = false) { + $this->dieOnNoMethod($method, "set return value sequence"); + $this->actions->registerAt($timing, $method, $args, new SimpleByValue($value)); + } + + /** + * Sets a return for a parameter list that will + * be passed by reference for all calls. + * @param string $method Method name. + * @param mixed $reference Result of the call will be this object. + * @param array $args List of parameters to match + * including wildcards. + * @access public + */ + function setReturnReference($method, &$reference, $args = false) { + $this->dieOnNoMethod($method, "set return reference"); + $this->actions->register($method, $args, new SimpleByReference($reference)); + } + + /** + * Sets a return for a parameter list that will + * be passed by value only when the required call count + * is reached. + * @param integer $timing Number of calls in the future + * to which the result applies. If + * not set then all calls will return + * the value. + * @param string $method Method name. + * @param mixed $reference Result of the call will be this object. + * @param array $args List of parameters to match + * including wildcards. + * @access public + */ + function setReturnReferenceAt($timing, $method, &$reference, $args = false) { + $this->dieOnNoMethod($method, "set return reference sequence"); + $this->actions->registerAt($timing, $method, $args, new SimpleByReference($reference)); + } + + /** + * Sets up an expected call with a set of + * expected parameters in that call. All + * calls will be compared to these expectations + * regardless of when the call is made. + * @param string $method Method call to test. + * @param array $args Expected parameters for the call + * including wildcards. + * @param string $message Overridden message. + * @access public + */ + function expect($method, $args, $message = '%s') { + $this->dieOnNoMethod($method, 'set expected arguments'); + $this->checkArgumentsIsArray($args, 'set expected arguments'); + $this->expectations->expectArguments($method, $args, $message); + $args = $this->replaceWildcards($args); + $message .= Mock::getExpectationLine(); + $this->expected_args[strtolower($method)] = + new ParametersExpectation($args, $message); + } + + /** + * Sets up an expected call with a set of + * expected parameters in that call. The + * expected call count will be adjusted if it + * is set too low to reach this call. + * @param integer $timing Number of calls in the future at + * which to test. Next call is 0. + * @param string $method Method call to test. + * @param array $args Expected parameters for the call + * including wildcards. + * @param string $message Overridden message. + * @access public + */ + function expectAt($timing, $method, $args, $message = '%s') { + $this->dieOnNoMethod($method, 'set expected arguments at time'); + $this->checkArgumentsIsArray($args, 'set expected arguments at time'); + $args = $this->replaceWildcards($args); + if (! isset($this->expected_args_at[$timing])) { + $this->expected_args_at[$timing] = array(); + } + $method = strtolower($method); + $message .= Mock::getExpectationLine(); + $this->expected_args_at[$timing][$method] = + new ParametersExpectation($args, $message); + } + + /** + * Sets an expectation for the number of times + * a method will be called. The tally method + * is used to check this. + * @param string $method Method call to test. + * @param integer $count Number of times it should + * have been called at tally. + * @param string $message Overridden message. + * @access public + */ + function expectCallCount($method, $count, $message = '%s') { + $this->dieOnNoMethod($method, 'set expected call count'); + $message .= Mock::getExpectationLine(); + $this->expected_counts[strtolower($method)] = + new CallCountExpectation($method, $count, $message); + } + + /** + * Sets the number of times a method may be called + * before a test failure is triggered. + * @param string $method Method call to test. + * @param integer $count Most number of times it should + * have been called. + * @param string $message Overridden message. + * @access public + */ + function expectMaximumCallCount($method, $count, $message = '%s') { + $this->dieOnNoMethod($method, 'set maximum call count'); + $message .= Mock::getExpectationLine(); + $this->max_counts[strtolower($method)] = + new MaximumCallCountExpectation($method, $count, $message); + } + + /** + * Sets the number of times to call a method to prevent + * a failure on the tally. + * @param string $method Method call to test. + * @param integer $count Least number of times it should + * have been called. + * @param string $message Overridden message. + * @access public + */ + function expectMinimumCallCount($method, $count, $message = '%s') { + $this->dieOnNoMethod($method, 'set minimum call count'); + $message .= Mock::getExpectationLine(); + $this->expected_counts[strtolower($method)] = + new MinimumCallCountExpectation($method, $count, $message); + } + + /** + * Convenience method for barring a method + * call. + * @param string $method Method call to ban. + * @param string $message Overridden message. + * @access public + */ + function expectNever($method, $message = '%s') { + $this->expectMaximumCallCount($method, 0, $message); + } + + /** + * Convenience method for a single method + * call. + * @param string $method Method call to track. + * @param array $args Expected argument list or + * false for any arguments. + * @param string $message Overridden message. + * @access public + */ + function expectOnce($method, $args = false, $message = '%s') { + $this->expectCallCount($method, 1, $message); + if ($args !== false) { + $this->expect($method, $args, $message); + } + } + + /** + * Convenience method for requiring a method + * call. + * @param string $method Method call to track. + * @param array $args Expected argument list or + * false for any arguments. + * @param string $message Overridden message. + * @access public + */ + function expectAtLeastOnce($method, $args = false, $message = '%s') { + $this->expectMinimumCallCount($method, 1, $message); + if ($args !== false) { + $this->expect($method, $args, $message); + } + } + + /** + * Sets up a trigger to throw an exception upon the + * method call. + * @param string $method Method name to throw on. + */ + function throwOn($method, $exception = false, $args = false) { + $this->dieOnNoMethod($method, "throw on"); + $this->actions->register($method, $args, + new SimpleThrower($exception ? $exception : new Exception())); + } + + /** + * Sets up a trigger to throw an exception upon the + * method call. + */ + function throwAt($timing, $method, $exception = false, $args = false) { + $this->dieOnNoMethod($method, "throw at"); + $this->actions->registerAt($timing, $method, $args, + new SimpleThrower($exception ? $exception : new Exception())); + } + + /** + * Sets up a trigger to throw an error upon the + * method call. + */ + function errorOn($method, $error = 'A mock error', $args = false, $severity = E_USER_ERROR) { + $this->dieOnNoMethod($method, "error on"); + $this->actions->register($method, $args, new SimpleErrorThrower($error, $severity)); + } + + /** + * Sets up a trigger to throw an error upon the + * method call. + */ + function errorAt($timing, $method, $error = 'A mock error', $args = false, $severity = E_USER_ERROR) { + $this->dieOnNoMethod($method, "error at"); + $this->actions->registerAt($timing, $method, $args, new SimpleErrorThrower($error, $severity)); + } + + /** + * Receives event from unit test that the current + * test method has finished. Totals up the call + * counts and triggers a test assertion if a test + * is present for expected call counts. + * @param string $test_method Current method name. + * @param SimpleTestCase $test Test to send message to. + * @access public + */ + function atTestEnd($test_method, &$test) { + foreach ($this->expected_counts as $method => $expectation) { + $test->assert($expectation, $this->getCallCount($method)); + } + foreach ($this->max_counts as $method => $expectation) { + if ($expectation->test($this->getCallCount($method))) { + $test->assert($expectation, $this->getCallCount($method)); + } + } + } + + /** + * Returns the expected value for the method name + * and checks expectations. Will generate any + * test assertions as a result of expectations + * if there is a test present. + * @param string $method Name of method to simulate. + * @param array $args Arguments as an array. + * @return mixed Stored return. + * @access private + */ + function &invoke($method, $args) { + $method = strtolower($method); + $step = $this->getCallCount($method); + $this->addCall($method, $args); + $this->checkExpectations($method, $args, $step); + $was = $this->disableEStrict(); + try { + $result = &$this->emulateCall($method, $args, $step); + } catch (Exception $e) { + $this->restoreEStrict($was); + throw $e; + } + $this->restoreEStrict($was); + return $result; + } + + /** + * Finds the return value matching the incoming + * arguments. If there is no matching value found + * then an error is triggered. + * @param string $method Method name. + * @param array $args Calling arguments. + * @param integer $step Current position in the + * call history. + * @return mixed Stored return or other action. + * @access protected + */ + protected function &emulateCall($method, $args, $step) { + return $this->actions->respond($step, $method, $args); + } + + /** + * Tests the arguments against expectations. + * @param string $method Method to check. + * @param array $args Argument list to match. + * @param integer $timing The position of this call + * in the call history. + * @access private + */ + protected function checkExpectations($method, $args, $timing) { + $test = $this->getCurrentTestCase(); + if (isset($this->max_counts[$method])) { + if (! $this->max_counts[$method]->test($timing + 1)) { + $test->assert($this->max_counts[$method], $timing + 1); + } + } + if (isset($this->expected_args_at[$timing][$method])) { + $test->assert( + $this->expected_args_at[$timing][$method], + $args, + "Mock method [$method] at [$timing] -> %s"); + } elseif (isset($this->expected_args[$method])) { + $test->assert( + $this->expected_args[$method], + $args, + "Mock method [$method] -> %s"); + } + } + + private function disableEStrict() { + $was = error_reporting(); + error_reporting($was & ~E_STRICT); + return $was; + } + + private function restoreEStrict($was) { + error_reporting($was); + } +} + +/** + * Static methods only service class for code generation of + * mock objects. + * @package SimpleTest + * @subpackage MockObjects + */ +class Mock { + + /** + * Factory for mock object classes. + * @access public + */ + function __construct() { + trigger_error('Mock factory methods are static.'); + } + + /** + * Clones a class' interface and creates a mock version + * that can have return values and expectations set. + * @param string $class Class to clone. + * @param string $mock_class New class name. Default is + * the old name with "Mock" + * prepended. + * @param array $methods Additional methods to add beyond + * those in the cloned class. Use this + * to emulate the dynamic addition of + * methods in the cloned class or when + * the class hasn't been written yet.sta + * @access public + */ + static function generate($class, $mock_class = false, $methods = false) { + $generator = new MockGenerator($class, $mock_class); + return @$generator->generateSubclass($methods); + } + + /** + * Generates a version of a class with selected + * methods mocked only. Inherits the old class + * and chains the mock methods of an aggregated + * mock object. + * @param string $class Class to clone. + * @param string $mock_class New class name. + * @param array $methods Methods to be overridden + * with mock versions. + * @access public + */ + static function generatePartial($class, $mock_class, $methods) { + $generator = new MockGenerator($class, $mock_class); + return @$generator->generatePartial($methods); + } + + /** + * Uses a stack trace to find the line of an assertion. + * @access public + */ + static function getExpectationLine() { + $trace = new SimpleStackTrace(array('expect')); + return $trace->traceMethod(); + } +} + +/** + * Service class for code generation of mock objects. + * @package SimpleTest + * @subpackage MockObjects + */ +class MockGenerator { + private $class; + private $mock_class; + private $mock_base; + private $reflection; + + /** + * Builds initial reflection object. + * @param string $class Class to be mocked. + * @param string $mock_class New class with identical interface, + * but no behaviour. + */ + function __construct($class, $mock_class) { + $this->class = $class; + $this->mock_class = $mock_class; + if (! $this->mock_class) { + $this->mock_class = 'Mock' . $this->class; + } + $this->mock_base = SimpleTest::getMockBaseClass(); + $this->reflection = new SimpleReflection($this->class); + } + + /** + * Clones a class' interface and creates a mock version + * that can have return values and expectations set. + * @param array $methods Additional methods to add beyond + * those in th cloned class. Use this + * to emulate the dynamic addition of + * methods in the cloned class or when + * the class hasn't been written yet. + * @access public + */ + function generate($methods) { + if (! $this->reflection->classOrInterfaceExists()) { + return false; + } + $mock_reflection = new SimpleReflection($this->mock_class); + if ($mock_reflection->classExistsSansAutoload()) { + return false; + } + $code = $this->createClassCode($methods ? $methods : array()); + return eval("$code return \$code;"); + } + + /** + * Subclasses a class and overrides every method with a mock one + * that can have return values and expectations set. Chains + * to an aggregated SimpleMock. + * @param array $methods Additional methods to add beyond + * those in the cloned class. Use this + * to emulate the dynamic addition of + * methods in the cloned class or when + * the class hasn't been written yet. + * @access public + */ + function generateSubclass($methods) { + if (! $this->reflection->classOrInterfaceExists()) { + return false; + } + $mock_reflection = new SimpleReflection($this->mock_class); + if ($mock_reflection->classExistsSansAutoload()) { + return false; + } + if ($this->reflection->isInterface() || $this->reflection->hasFinal()) { + $code = $this->createClassCode($methods ? $methods : array()); + return eval("$code return \$code;"); + } else { + $code = $this->createSubclassCode($methods ? $methods : array()); + return eval("$code return \$code;"); + } + } + + /** + * Generates a version of a class with selected + * methods mocked only. Inherits the old class + * and chains the mock methods of an aggregated + * mock object. + * @param array $methods Methods to be overridden + * with mock versions. + * @access public + */ + function generatePartial($methods) { + if (! $this->reflection->classExists($this->class)) { + return false; + } + $mock_reflection = new SimpleReflection($this->mock_class); + if ($mock_reflection->classExistsSansAutoload()) { + trigger_error('Partial mock class [' . $this->mock_class . '] already exists'); + return false; + } + $code = $this->extendClassCode($methods); + return eval("$code return \$code;"); + } + + /** + * The new mock class code as a string. + * @param array $methods Additional methods. + * @return string Code for new mock class. + * @access private + */ + protected function createClassCode($methods) { + $implements = ''; + $interfaces = $this->reflection->getInterfaces(); + if (function_exists('spl_classes')) { + $interfaces = array_diff($interfaces, array('Traversable')); + } + if (count($interfaces) > 0) { + $implements = 'implements ' . implode(', ', $interfaces); + } + $code = "class " . $this->mock_class . " extends " . $this->mock_base . " $implements {\n"; + $code .= " function " . $this->mock_class . "() {\n"; + $code .= " \$this->" . $this->mock_base . "();\n"; + $code .= " }\n"; + if (in_array('__construct', $this->reflection->getMethods())) { + $code .= " function __construct() {\n"; + $code .= " \$this->" . $this->mock_base . "();\n"; + $code .= " }\n"; + } + $code .= $this->createHandlerCode($methods); + $code .= "}\n"; + return $code; + } + + /** + * The new mock class code as a string. The mock will + * be a subclass of the original mocked class. + * @param array $methods Additional methods. + * @return string Code for new mock class. + * @access private + */ + protected function createSubclassCode($methods) { + $code = "class " . $this->mock_class . " extends " . $this->class . " {\n"; + $code .= " public \$mock;\n"; + $code .= $this->addMethodList(array_merge($methods, $this->reflection->getMethods())); + $code .= "\n"; + $code .= " function " . $this->mock_class . "() {\n"; + $code .= " \$this->mock = new " . $this->mock_base . "();\n"; + $code .= " \$this->mock->disableExpectationNameChecks();\n"; + $code .= " }\n"; + $code .= $this->chainMockReturns(); + $code .= $this->chainMockExpectations(); + $code .= $this->chainThrowMethods(); + $code .= $this->overrideMethods($this->reflection->getMethods()); + $code .= $this->createNewMethodCode($methods); + $code .= "}\n"; + return $code; + } + + /** + * The extension class code as a string. The class + * composites a mock object and chains mocked methods + * to it. + * @param array $methods Mocked methods. + * @return string Code for a new class. + * @access private + */ + protected function extendClassCode($methods) { + $code = "class " . $this->mock_class . " extends " . $this->class . " {\n"; + $code .= " protected \$mock;\n"; + $code .= $this->addMethodList($methods); + $code .= "\n"; + $code .= " function " . $this->mock_class . "() {\n"; + $code .= " \$this->mock = new " . $this->mock_base . "();\n"; + $code .= " \$this->mock->disableExpectationNameChecks();\n"; + $code .= " }\n"; + $code .= $this->chainMockReturns(); + $code .= $this->chainMockExpectations(); + $code .= $this->chainThrowMethods(); + $code .= $this->overrideMethods($methods); + $code .= "}\n"; + return $code; + } + + /** + * Creates code within a class to generate replaced + * methods. All methods call the invoke() handler + * with the method name and the arguments in an + * array. + * @param array $methods Additional methods. + * @access private + */ + protected function createHandlerCode($methods) { + $code = ''; + $methods = array_merge($methods, $this->reflection->getMethods()); + foreach ($methods as $method) { + if ($this->isConstructor($method)) { + continue; + } + $mock_reflection = new SimpleReflection($this->mock_base); + if (in_array($method, $mock_reflection->getMethods())) { + continue; + } + $code .= " " . $this->reflection->getSignature($method) . " {\n"; + $code .= " \$args = func_get_args();\n"; + $code .= " \$result = &\$this->invoke(\"$method\", \$args);\n"; + $code .= " return \$result;\n"; + $code .= " }\n"; + } + return $code; + } + + /** + * Creates code within a class to generate a new + * methods. All methods call the invoke() handler + * on the internal mock with the method name and + * the arguments in an array. + * @param array $methods Additional methods. + * @access private + */ + protected function createNewMethodCode($methods) { + $code = ''; + foreach ($methods as $method) { + if ($this->isConstructor($method)) { + continue; + } + $mock_reflection = new SimpleReflection($this->mock_base); + if (in_array($method, $mock_reflection->getMethods())) { + continue; + } + $code .= " " . $this->reflection->getSignature($method) . " {\n"; + $code .= " \$args = func_get_args();\n"; + $code .= " \$result = &\$this->mock->invoke(\"$method\", \$args);\n"; + $code .= " return \$result;\n"; + $code .= " }\n"; + } + return $code; + } + + /** + * Tests to see if a special PHP method is about to + * be stubbed by mistake. + * @param string $method Method name. + * @return boolean True if special. + * @access private + */ + protected function isConstructor($method) { + return in_array( + strtolower($method), + array('__construct', '__destruct')); + } + + /** + * Creates a list of mocked methods for error checking. + * @param array $methods Mocked methods. + * @return string Code for a method list. + * @access private + */ + protected function addMethodList($methods) { + return " protected \$mocked_methods = array('" . + implode("', '", array_map('strtolower', $methods)) . + "');\n"; + } + + /** + * Creates code to abandon the expectation if not mocked. + * @param string $alias Parameter name of method name. + * @return string Code for bail out. + * @access private + */ + protected function bailOutIfNotMocked($alias) { + $code = " if (! in_array(strtolower($alias), \$this->mocked_methods)) {\n"; + $code .= " trigger_error(\"Method [$alias] is not mocked\");\n"; + $code .= " \$null = null;\n"; + $code .= " return \$null;\n"; + $code .= " }\n"; + return $code; + } + + /** + * Creates source code for chaining to the composited + * mock object. + * @return string Code for mock set up. + * @access private + */ + protected function chainMockReturns() { + $code = " function returns(\$method, \$value, \$args = false) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->returns(\$method, \$value, \$args);\n"; + $code .= " }\n"; + $code .= " function returnsAt(\$timing, \$method, \$value, \$args = false) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->returnsAt(\$timing, \$method, \$value, \$args);\n"; + $code .= " }\n"; + $code .= " function setReturnValue(\$method, \$value, \$args = false) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->setReturnValue(\$method, \$value, \$args);\n"; + $code .= " }\n"; + $code .= " function setReturnValueAt(\$timing, \$method, \$value, \$args = false) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->setReturnValueAt(\$timing, \$method, \$value, \$args);\n"; + $code .= " }\n"; + $code .= " function setReturnReference(\$method, &\$ref, \$args = false) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->setReturnReference(\$method, \$ref, \$args);\n"; + $code .= " }\n"; + $code .= " function setReturnReferenceAt(\$timing, \$method, &\$ref, \$args = false) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->setReturnReferenceAt(\$timing, \$method, \$ref, \$args);\n"; + $code .= " }\n"; + return $code; + } + + /** + * Creates source code for chaining to an aggregated + * mock object. + * @return string Code for expectations. + * @access private + */ + protected function chainMockExpectations() { + $code = " function expect(\$method, \$args = false, \$msg = '%s') {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->expect(\$method, \$args, \$msg);\n"; + $code .= " }\n"; + $code .= " function expectAt(\$timing, \$method, \$args = false, \$msg = '%s') {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->expectAt(\$timing, \$method, \$args, \$msg);\n"; + $code .= " }\n"; + $code .= " function expectCallCount(\$method, \$count) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->expectCallCount(\$method, \$count, \$msg = '%s');\n"; + $code .= " }\n"; + $code .= " function expectMaximumCallCount(\$method, \$count, \$msg = '%s') {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->expectMaximumCallCount(\$method, \$count, \$msg = '%s');\n"; + $code .= " }\n"; + $code .= " function expectMinimumCallCount(\$method, \$count, \$msg = '%s') {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->expectMinimumCallCount(\$method, \$count, \$msg = '%s');\n"; + $code .= " }\n"; + $code .= " function expectNever(\$method) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->expectNever(\$method);\n"; + $code .= " }\n"; + $code .= " function expectOnce(\$method, \$args = false, \$msg = '%s') {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->expectOnce(\$method, \$args, \$msg);\n"; + $code .= " }\n"; + $code .= " function expectAtLeastOnce(\$method, \$args = false, \$msg = '%s') {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->expectAtLeastOnce(\$method, \$args, \$msg);\n"; + $code .= " }\n"; + return $code; + } + + /** + * Adds code for chaining the throw methods. + * @return string Code for chains. + * @access private + */ + protected function chainThrowMethods() { + $code = " function throwOn(\$method, \$exception = false, \$args = false) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->throwOn(\$method, \$exception, \$args);\n"; + $code .= " }\n"; + $code .= " function throwAt(\$timing, \$method, \$exception = false, \$args = false) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->throwAt(\$timing, \$method, \$exception, \$args);\n"; + $code .= " }\n"; + $code .= " function errorOn(\$method, \$error = 'A mock error', \$args = false, \$severity = E_USER_ERROR) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->errorOn(\$method, \$error, \$args, \$severity);\n"; + $code .= " }\n"; + $code .= " function errorAt(\$timing, \$method, \$error = 'A mock error', \$args = false, \$severity = E_USER_ERROR) {\n"; + $code .= $this->bailOutIfNotMocked("\$method"); + $code .= " \$this->mock->errorAt(\$timing, \$method, \$error, \$args, \$severity);\n"; + $code .= " }\n"; + return $code; + } + + /** + * Creates source code to override a list of methods + * with mock versions. + * @param array $methods Methods to be overridden + * with mock versions. + * @return string Code for overridden chains. + * @access private + */ + protected function overrideMethods($methods) { + $code = ""; + foreach ($methods as $method) { + if ($this->isConstructor($method)) { + continue; + } + $code .= " " . $this->reflection->getSignature($method) . " {\n"; + $code .= " \$args = func_get_args();\n"; + $code .= " \$result = &\$this->mock->invoke(\"$method\", \$args);\n"; + $code .= " return \$result;\n"; + $code .= " }\n"; + } + return $code; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/README b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/README new file mode 100644 index 0000000..3cf668e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/README @@ -0,0 +1,26 @@ +HOW TO MAKE A PACKAGE + +1. First make sure PEAR_PackageFileManager is installed; +(version 1.2.0 was used) + +$ pear install PEAR_PackageFileManager + +2. Edit the simpletest/packages/pear_package_create.php file (see comments for what +needs changing). + +3. Run the simpletest/packages/pear_package_create.php script, piping the output +to the file you want to create e.g.; + +$ ./pear_package_create.php > package.xml + +4. Copy the package.xml to the root of Simpletest. + +5. From the root of Simpletest type; + +$ pear package package.xml + +This creates the package zip + +6. Install with; + +$ pear install SimpleTest-x.x.x.tgz \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/build_tarball.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/build_tarball.sh new file mode 100755 index 0000000..943a347 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/build_tarball.sh @@ -0,0 +1,132 @@ +#!/bin/sh + +# Builds project release. +# +cd ../.. + +NAME=simpletest_`cat simpletest/VERSION`.tar.gz +FILES=(simpletest/README \ + simpletest/VERSION \ + simpletest/LICENSE \ + simpletest/HELP_MY_TESTS_DONT_WORK_ANYMORE \ + simpletest/authentication.php \ + simpletest/autorun.php \ + simpletest/browser.php \ + simpletest/collector.php \ + simpletest/compatibility.php \ + simpletest/cookies.php \ + simpletest/default_reporter.php \ + simpletest/detached.php \ + simpletest/dumper.php \ + simpletest/eclipse.php \ + simpletest/encoding.php \ + simpletest/errors.php \ + simpletest/exceptions.php \ + simpletest/expectation.php \ + simpletest/form.php \ + simpletest/frames.php \ + simpletest/http.php \ + simpletest/invoker.php \ + simpletest/mock_objects.php \ + simpletest/page.php \ + simpletest/parser.php \ + simpletest/reflection_php4.php \ + simpletest/reflection_php5.php \ + simpletest/remote.php \ + simpletest/reporter.php \ + simpletest/scorer.php \ + simpletest/selector.php \ + simpletest/shell_tester.php \ + simpletest/simpletest.php \ + simpletest/socket.php \ + simpletest/tag.php \ + simpletest/test_case.php \ + simpletest/unit_tester.php \ + simpletest/url.php \ + simpletest/user_agent.php \ + simpletest/web_tester.php \ + simpletest/xml.php \ + simpletest/extensions/pear_test_case.php \ + simpletest/extensions/phpunit_test_case.php \ + simpletest/extensions/testdox.php \ + simpletest/extensions/testdox/test.php \ + simpletest/test/acceptance_test.php \ + simpletest/test/adapter_test.php \ + simpletest/test/all_tests.php \ + simpletest/test/authentication_test.php \ + simpletest/test/bad_test_suite.php \ + simpletest/test/browser_test.php \ + simpletest/test/collector_test.php \ + simpletest/test/command_line_test.php \ + simpletest/test/compatibility_test.php \ + simpletest/test/cookies_test.php \ + simpletest/test/detached_test.php \ + simpletest/test/dumper_test.php \ + simpletest/test/eclipse_test.php \ + simpletest/test/encoding_test.php \ + simpletest/test/errors_test.php \ + simpletest/test/exceptions_test.php \ + simpletest/test/expectation_test.php \ + simpletest/test/form_test.php \ + simpletest/test/frames_test.php \ + simpletest/test/http_test.php \ + simpletest/test/interfaces_test.php \ + simpletest/test/live_test.php \ + simpletest/test/mock_objects_test.php \ + simpletest/test/page_test.php \ + simpletest/test/parse_error_test.php \ + simpletest/test/parser_test.php \ + simpletest/test/reflection_php4_test.php \ + simpletest/test/reflection_php5_test.php \ + simpletest/test/remote_test.php \ + simpletest/test/shell_test.php \ + simpletest/test/shell_tester_test.php \ + simpletest/test/simpletest_test.php \ + simpletest/test/socket_test.php \ + simpletest/test/tag_test.php \ + simpletest/test/test_with_parse_error.php \ + simpletest/test/unit_tests.php \ + simpletest/test/unit_tester_test.php \ + simpletest/test/autorun_test.php \ + simpletest/test/url_test.php \ + simpletest/test/user_agent_test.php \ + simpletest/test/visual_test.php \ + simpletest/test/web_tester_test.php \ + simpletest/test/xml_test.php \ + simpletest/test/support/collector/collectable.1 \ + simpletest/test/support/collector/collectable.2 \ + simpletest/test/support/upload_sample.txt \ + simpletest/test/support/supplementary_upload_sample.txt \ + simpletest/test/support/latin1_sample \ + simpletest/test/support/spl_examples.php \ + simpletest/test/support/empty_test_file.php \ + simpletest/test/support/test1.php \ + simpletest/docs/en/docs.css \ + simpletest/docs/en/index.html \ + simpletest/docs/en/overview.html \ + simpletest/docs/en/unit_test_documentation.html \ + simpletest/docs/en/group_test_documentation.html \ + simpletest/docs/en/mock_objects_documentation.html \ + simpletest/docs/en/partial_mocks_documentation.html \ + simpletest/docs/en/reporter_documentation.html \ + simpletest/docs/en/expectation_documentation.html \ + simpletest/docs/en/web_tester_documentation.html \ + simpletest/docs/en/form_testing_documentation.html \ + simpletest/docs/en/authentication_documentation.html \ + simpletest/docs/en/browser_documentation.html \ + simpletest/docs/fr/docs.css \ + simpletest/docs/fr/index.html \ + simpletest/docs/fr/overview.html \ + simpletest/docs/fr/unit_test_documentation.html \ + simpletest/docs/fr/group_test_documentation.html \ + simpletest/docs/fr/server_stubs_documentation.html \ + simpletest/docs/fr/mock_objects_documentation.html \ + simpletest/docs/fr/partial_mocks_documentation.html \ + simpletest/docs/fr/reporter_documentation.html \ + simpletest/docs/fr/expectation_documentation.html \ + simpletest/docs/fr/web_tester_documentation.html \ + simpletest/docs/fr/form_testing_documentation.html \ + simpletest/docs/fr/authentication_documentation.html \ + simpletest/docs/fr/browser_documentation.html) + +tar -zcf $NAME ${FILES[*]} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/bundled_docs.xslt b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/bundled_docs.xslt new file mode 100644 index 0000000..c194611 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/bundled_docs.xslt @@ -0,0 +1,246 @@ + + + + + + + + + + + + + + + + + <xsl:value-of select="//long_title"/> + + + + + + + + + +
+ +
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
( pages) +
+
+
+ + +

+
+ + + This page... +
    + +
+
+ + + References and related information... +
    + +
+
+ + + + + + +
+            
+                
+            
+        
+
+ + + + + + + + +
+            
+                
+            
+        
+
+ + +
+            
+                
+            
+        
+
+ + +
+            
+        
+
+ + +

+ + + + +

+ +
+ + + + + + + + + + + + + + + + .html + + + + + + + + + + + + + + + + +
  • +
    + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/bundled_map.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/bundled_map.xml new file mode 100644 index 0000000..b5b950f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/bundled_map.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/extension.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/extension.xml new file mode 100644 index 0000000..a897ab1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/extension.xml @@ -0,0 +1,40 @@ + + + + + + + Name of the extension to build + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/generate_package.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/generate_package.php new file mode 100644 index 0000000..dd433db --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/generate_package.php @@ -0,0 +1,54 @@ + 'svn', + 'simpleoutput' => true, + 'baseinstalldir' => 'simpletest', + 'packagedirectory' => dirname(__FILE__) . '/../', + 'clearcontents' => true, + 'ignore' => array('TODO.xml', 'VERSION', 'docs/', 'tutorials/', 'packages/', '.svn'), + 'dir_roles' => array( + 'test' => 'test' + ) +); + +$packagexml = PEAR_PackageFileManager2::importOptions($packagefile, $options); +$packagexml->setPackageType('php'); +$packagexml->setPackage('simpletest'); +$packagexml->setSummary('PHP Unit Tester'); +$packagexml->setDescription("Unit testing, mock objects and web testing framework for PHP"); + +// update this! do we have a default channel server? +$packagexml->setChannel('pear.php.net'); +$packagexml->setUri('http://os.coretxt.net.nz/simpletest-1.1'); + +$notes = file_get_contents(dirname(__FILE__).'/../README'); +$packagexml->setNotes($notes); + +$packagexml->setPhpDep('5.0.5'); +$packagexml->setPearinstallerDep('1.4.0'); +$packagexml->addPackageDepWithChannel('required', 'PEAR', 'pear.php.net', '1.4.0'); +$packagexml->addMaintainer('lead', 'lastcraft', 'Marcus Baker', 'marcus@lastcraft.com'); +$packagexml->setLicense('LGPL', 'http://www.gnu.org/licenses/lgpl-2.1.html'); + +preg_match("/([0-9\.]+)([a-z]+)/", file_get_contents(dirname(__FILE__).'/../VERSION'), $version); +$packagexml->setAPIVersion($version[1]); +$packagexml->setReleaseVersion($version[1]); +$packagexml->setReleaseStability($version[2]); +$packagexml->setAPIStability($version[2]); + +$packagexml->addRelease(); +$packagexml->generateContents(); + + +if (isset($_GET['make']) || (isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make')) { + $packagexml->writePackageFile(); +} else { + $packagexml->debugPackageFile(); +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/lastcraft.xslt b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/lastcraft.xslt new file mode 100644 index 0000000..e655b7d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/lastcraft.xslt @@ -0,0 +1,302 @@ + + + + + + + + + + + + + + + + + <xsl:value-of select="//long_title"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + +
    + + +
    + + LastCraft Home Page + +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + +
    • + + + + +
    • +
      +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + +
    ( pages) +
    +
    +
    + + +
    +
    +

    +
    + +
    +
    + +
    +
    +
    +
    + + + This page... +
      + +
    +
    + + + Related... +
      + +
    +
    + + + + + + +
    +            
    +                
    +            
    +        
    +
    + + + + + + + + +
    +            
    +                
    +            
    +        
    +
    + + +
    +            
    +        
    +
    + + +

    + + +

    + +

    + +
    + + + + + + +

    + News: + +

    +
    + + + + + + + + + .php + + + + + + + + + + + + + + + + +
  • +
    + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs.sh new file mode 100755 index 0000000..6245ff4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs.sh @@ -0,0 +1,25 @@ +#!/bin/sh +xsltproc bundled_docs.xslt ../docs/source/en/simple_test.xml > ../docs/en/index.html +xsltproc bundled_docs.xslt ../docs/source/en/overview.xml > ../docs/en/overview.html +xsltproc bundled_docs.xslt ../docs/source/en/unit_test_documentation.xml > ../docs/en/unit_test_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/group_test_documentation.xml > ../docs/en/group_test_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/mock_objects_documentation.xml > ../docs/en/mock_objects_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/partial_mocks_documentation.xml > ../docs/en/partial_mocks_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/reporter_documentation.xml > ../docs/en/reporter_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/expectation_documentation.xml > ../docs/en/expectation_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/web_tester_documentation.xml > ../docs/en/web_tester_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/form_testing_documentation.xml > ../docs/en/form_testing_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/authentication_documentation.xml > ../docs/en/authentication_documentation.html +xsltproc bundled_docs.xslt ../docs/source/en/browser_documentation.xml > ../docs/en/browser_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/simple_test.xml > ../docs/fr/index.html +xsltproc bundled_docs.xslt ../docs/source/fr/overview.xml > ../docs/fr/overview.html +xsltproc bundled_docs.xslt ../docs/source/fr/unit_test_documentation.xml > ../docs/fr/unit_test_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/group_test_documentation.xml > ../docs/fr/group_test_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/mock_objects_documentation.xml > ../docs/fr/mock_objects_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/partial_mocks_documentation.xml > ../docs/fr/partial_mocks_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/reporter_documentation.xml > ../docs/fr/reporter_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/expectation_documentation.xml > ../docs/fr/expectation_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/web_tester_documentation.xml > ../docs/fr/web_tester_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/form_testing_documentation.xml > ../docs/fr/form_testing_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/authentication_documentation.xml > ../docs/fr/authentication_documentation.html +xsltproc bundled_docs.xslt ../docs/source/fr/browser_documentation.xml > ../docs/fr/browser_documentation.html diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs_with_xalan.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs_with_xalan.sh new file mode 100755 index 0000000..cfc6de3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_bundled_docs_with_xalan.sh @@ -0,0 +1,26 @@ +#!/bin/sh +Xalan -o ../docs/en/index.html ../docs/source/en/simple_test.xml bundled_docs.xslt +Xalan -o ../docs/en/overview.html ../docs/source/en/overview.xml bundled_docs.xslt +Xalan -o ../docs/en/unit_test_documentation.html ../docs/source/en/unit_test_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/group_test_documentation.html ../docs/source/en/group_test_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/mock_objects_documentation.html ../docs/source/en/mock_objects_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/partial_mocks_documentation.html ../docs/source/en/partial_mocks_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/reporter_documentation.html ../docs/source/en/reporter_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/expectation_documentation.html ../docs/source/en/expectation_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/web_tester_documentation.html ../docs/source/en/web_tester_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/form_testing_documentation.html ../docs/source/en/form_testing_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/authentication_documentation.html ../docs/source/en/authentication_documentation.xml bundled_docs.xslt +Xalan -o ../docs/en/browser_documentation.html ../docs/source/en/browser_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/index.html ../docs/source/fr/simple_test.xml bundled_docs.xslt +Xalan -o ../docs/fr/overview.html ../docs/source/fr/overview.xml bundled_docs.xslt +Xalan -o ../docs/fr/unit_test_documentation.html ../docs/source/fr/unit_test_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/group_test_documentation.html ../docs/source/fr/group_test_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/server_stubs_documentation.html ../docs/source/fr/server_stubs_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/mock_objects_documentation.html ../docs/source/fr/mock_objects_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/partial_mocks_documentation.html ../docs/source/fr/partial_mocks_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/reporter_documentation.html ../docs/source/fr/reporter_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/expectation_documentation.html ../docs/source/fr/expectation_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/web_tester_documentation.html ../docs/source/fr/web_tester_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/form_testing_documentation.html ../docs/source/fr/form_testing_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/authentication_documentation.html ../docs/source/fr/authentication_documentation.xml bundled_docs.xslt +Xalan -o ../docs/fr/browser_documentation.html ../docs/source/fr/browser_documentation.xml bundled_docs.xslt diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_lastcraft_docs.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_lastcraft_docs.sh new file mode 100755 index 0000000..0eaf742 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_lastcraft_docs.sh @@ -0,0 +1,2 @@ +#!/bin/bash +php transform_all_lastcraft.php lastcraft.xslt ../docs/source/en/ ../docs/lastcraft/ diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_phpdoc_docs.sh b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_phpdoc_docs.sh new file mode 100755 index 0000000..fd56f33 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/make_phpdoc_docs.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +#DEST_DIR=../docs/pkg +if [ ! -d ../tutorials ] +then + mkdir ../tutorials +fi +if [ ! -d ../tutorials/SimpleTest ] +then + mkdir ../tutorials/SimpleTest +fi +DEST_DIR=../tutorials/SimpleTest + +rm ${DEST_DIR}/*.pkg +cp ../docs/pkg/SimpleTest.pkg.ini ${DEST_DIR} + +#Xalan -o ${DEST_DIR}/QuickStart.pkg ../docs/source/en/simple_test.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/SimpleTest.pkg ../docs/source/en/overview.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/UnitTestCase.pkg ../docs/source/en/unit_test_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/GroupTests.pkg ../docs/source/en/group_test_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/MockObjects.pkg ../docs/source/en/mock_objects_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/PartialMock.pkg ../docs/source/en/partial_mocks_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/Reporting.pkg ../docs/source/en/reporter_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/Expectations.pkg ../docs/source/en/expectation_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/WebTester.pkg ../docs/source/en/web_tester_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/FormTesting.pkg ../docs/source/en/form_testing_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/Authentication.pkg ../docs/source/en/authentication_documentation.xml phpdoc_docs.xslt +Xalan -o ${DEST_DIR}/Browser.pkg ../docs/source/en/browser_documentation.xml phpdoc_docs.xslt + +# some cleanup work +cd $DEST_DIR + +# remove XML declaration +for f in $(ls *.pkg --color=none) +do + grep -v -e '^ tmp.pkg + mv tmp.pkg $f +done + +# fix overview title +cat SimpleTest.pkg | sed -e 's/Overview/Simple Test PHP Unit Test Framework/g;s/<\([A-Za-z0-9]*\)\/>/<\1><\/\1>/g' > tmp.pkg +mv tmp.pkg SimpleTest.pkg diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/map_onpk.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/map_onpk.xml new file mode 100644 index 0000000..b4f6b41 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/map_onpk.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/onpk.xslt b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/onpk.xslt new file mode 100644 index 0000000..2053066 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/onpk.xslt @@ -0,0 +1,227 @@ + + + + + + + + + + + + + + + + + + + <xsl:value-of select="//long_title"/> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + +
    + + + + + + + + + + + + + + + + + + + + + +
      + +
    • + + + +
    • +
      +
    +
    +
    + + + + + + + + + + + + +
    + +

    +
    + +
    +
    +
    + + + Cette page... +
      + +
    +
    + + + Pour aller plus loin... +
      + +
    +
    + + +
    + +
    +
    + + + + + + + + + + + + + + +
    +			
    +				
    +			
    +		
    +
    + + + + + + + + +

    + + +

    + +

    + +
    + + + + + + + + + + + + + .php + + + + + + + + + + + + + + + + +
  • +
    + + + + + + + + + + + + + + + + +
    \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/transform_all_onpk.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/transform_all_onpk.php new file mode 100644 index 0000000..c80350a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/onpk/transform_all_onpk.php @@ -0,0 +1,32 @@ +"; + } else { + echo "erreur pour ".$destination." : ".xslt_error($xh)."
    "; + } + + xslt_free($xsltProcessor); +} +closedir($dir); +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/package.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/package.xml new file mode 100644 index 0000000..f82c599 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/package.xml @@ -0,0 +1,710 @@ + + + + SimpleTest + Unit testing, mock objects and web testing framework for PHP. + The heart of SimpleTest is a testing framework built around test case classes. +These are written as extensions of base test case classes, each extended with +methods that actually contain test code. Top level test scripts then invoke +the run() methods on every one of these test cases in order. Each test +method is written to invoke various assertions that the developer expects to +be true such as assertEqual(). If the expectation is correct, then a +successful result is dispatched to the observing test reporter, but any +failure triggers an alert and a description of the mismatch. + +These tools are designed for the developer. Tests are written in the PHP +language itself more or less as the application itself is built. The advantage +of using PHP itself as the testing language is that there are no new languages +to learn, testing can start straight away, and the developer can test any part +of the code. Basically, all parts that can be accessed by the application code +can also be accessed by the test code if they are in the same language. + + + lastcraft + Marcus Baker + marcus@lastcraft.com + lead + + + jsweat + Jason Sweat + jsweat_php@yahoo.com + helper + + + hfuecks + Harry Fuecks + hfuecks@phppatterns.com + helper + + + + 0.9.4 + 2004-02-20 + The Open Group Test Suite License + beta + This is the final version of the PHP unit and web testing tool before the +stable release 1.0 version. It features many improvements to the HTML form +parsing and exposure of the underlying web browser. There are also numerous +minor improvements and bug fixes. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0.9.4 + 2004-02-20 + The Open Group Test Suite License + beta + This is the final version of the PHP unit and web testing tool before the +stable release 1.0 version. It features many improvements to the HTML form +parsing and exposure of the underlying web browser. There are also numerous +minor improvements and bug fixes. + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/pear_package_create.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/pear_package_create.php new file mode 100755 index 0000000..2b5b7ff --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/pear_package_create.php @@ -0,0 +1,170 @@ +#!/usr/bin/env php -q +'lastcraft','role'=>'lead','name'=>'Marcus Baker', 'email'=>'marcus@lastcraft.com'), + array ('handle'=>'jsweat','role'=>'helper','name'=>'Jason Sweat', 'email'=>'jsweat_php@yahoo.com'), + array ('handle'=>'hfuecks','role'=>'helper','name'=>'Harry Fuecks', 'email'=>'hfuecks@phppatterns.com'), +); +/*---------------------------------------------------------------------------*/ + +/** +* Code starts here +*/ +require_once('PEAR/PackageFileManager.php'); +$PPFM = new PEAR_PackageFileManager; + +if (version_compare(phpversion(), '4.3.0', '<') || + php_sapi_name() == 'cgi') { + define('STDOUT', fopen('php://stdout', 'w')); + define('STDERR', fopen('php://stderr', 'w')); + register_shutdown_function( + create_function('', 'fclose(STDOUT); fclose(STDERR); return true;')); +} + +/** +* A giant array to configure the PackageFileManager. For the "roles" see +* http://pear.php.net/manual/en/developers.packagedef.php +*/ +$options = array( + 'baseinstalldir' => 'simpletest', + 'version' => $version, + 'packagedirectory' => $packagedir, + 'outputdirectory' => $packagedir, + 'pathtopackagefile' => $packagedir, + 'state' => $state, + 'summary' => $shortDesc, + 'description' => $longDesc, + 'filelistgenerator' => 'file', + 'notes' => $releaseNotes, + 'package' => 'SimpleTest', + 'license' => 'The Open Group Test Suite License', + + 'dir_roles' => array( + 'docs' => 'doc', + 'test' => 'test', + 'extensions' => 'php', + //'tutorials' => 'doc', + //'tutorials/SimpleTest' => 'doc', + //'ui' => 'php', + //'ui/css' => 'data', + //'ui/img' => 'data', + //'ui/js' => 'data', + //'ui/js/tests' => 'test', + ), + 'exceptions' => + array( + 'HELP_MY_TESTS_DONT_WORK_ANYMORE' => 'doc', + 'LICENSE' => 'doc', + 'README' => 'doc', + 'TODO' => 'doc', + 'VERSION' => 'doc', + ), + 'ignore' => + array( + "$packagedir/packages", + "$packagedir/ui", + ), + ); + +$status = $PPFM->setOptions($options); + +if (PEAR::isError($status)) { + fwrite (STDERR,$status->getMessage()); + exit; +} + +foreach ( $maintainers as $maintainer ) { + $PPFM->addMaintainer( + $maintainer['handle'], + $maintainer['role'], + $maintainer['name'], + $maintainer['email'] ); +} + +// Adds a dependency of PHP 4.2.3+ +$status = $PPFM->addDependency('php', '4.2.3', 'ge', 'php'); +if (PEAR::isError($status)) { + fwrite (STDERR,$status->getMessage()); + exit; +} + +// hack (apparently) +$PPFM->addRole('tpl', 'php'); +$PPFM->addRole('png', 'php'); +$PPFM->addRole('gif', 'php'); +$PPFM->addRole('jpg', 'php'); +$PPFM->addRole('css', 'php'); +$PPFM->addRole('js', 'php'); +$PPFM->addRole('ini', 'php'); +$PPFM->addRole('inc', 'php'); +$PPFM->addRole('afm', 'php'); +$PPFM->addRole('pkg', 'doc'); +$PPFM->addRole('cls', 'doc'); +$PPFM->addRole('proc', 'doc'); +$PPFM->addRole('sh', 'script'); + +ob_start(); +$status = $PPFM->writePackageFile(false); +$output = ob_get_contents(); +ob_end_clean(); + +// Hacks to handle PPFM output +$start = strpos ($output,"getMessage()); +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/phpdoc_docs.xslt b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/phpdoc_docs.xslt new file mode 100644 index 0000000..6d09150 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/phpdoc_docs.xslt @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    + + + + + + + + + + + + + + + <![CDATA[ + + + + ]]> + + + + + + + + + + + {@id } + <xsl:value-of select="@title"/> + + + + + + + + + + + + <xsl:value-of select="h2"/> + + + + + + + + + .html + + + + } + + + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.ini b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.ini new file mode 100755 index 0000000..8767680 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.ini @@ -0,0 +1,92 @@ +;; phpDocumentor parse configuration file +;; +;; This file is designed to cut down on repetitive typing on the command-line or web interface +;; You can copy this file to create a number of configuration files that can be used with the +;; command-line switch -c, as in phpdoc -c default.ini or phpdoc -c myini.ini. The web +;; interface will automatically generate a list of .ini files that can be used. +;; +;; default.ini is used to generate the online manual at http://www.phpdoc.org/docs +;; +;; ALL .ini files must be in the user subdirectory of phpDocumentor with an extension of .ini +;; +;; Copyright 2002, Greg Beaver +;; +;; WARNING: do not change the name of any command-line parameters, phpDocumentor will ignore them + +[Parse Data] +;; title of all the documentation +;; legal values: any string +title = SimpleTest API Documentation + +;; parse files that start with a . like .bash_profile +;; legal values: true, false +hidden = false + +;; show elements marked @access private in documentation by setting this to on +;; legal values: on, off +parseprivate = off + +;; parse with javadoc-like description (first sentence is always the short description) +;; legal values: on, off +javadocdesc = off + +;; add any custom @tags separated by commas here +;; legal values: any legal tagname separated by commas. +;customtags = mytag1,mytag2 + +;; This is only used by the XML:DocBook/peardoc2 converter +defaultcategoryname = Documentation + +;; what is the main package? +;; legal values: alphanumeric string plus - and _ +defaultpackagename = SimpleTest + +;; output any parsing information? set to on for cron jobs +;; legal values: on +;quiet = on + +;; parse a PEAR-style repository. Do not turn this on if your project does +;; not have a parent directory named "pear" +;; legal values: on/off +;pear = on + +;; where should the documentation be written? +;; legal values: a legal path +target = /home/groups/s/si/simpletest/htdocs/api + +;; limit output to the specified packages, even if others are parsed +;; legal values: package names separated by commas +;packageoutput = package1,package2 + +;; comma-separated list of files to parse +;; legal values: paths separated by commas +;filename = /path/to/file1,/path/to/file2,fileincurrentdirectory + +;; comma-separated list of directories to parse +;; legal values: directory paths separated by commas +;directory = /path1,/path2,.,..,subdirectory +;directory = /home/jeichorn/cvs/pear +directory = /home/groups/s/si/simpletest/simpletest_doc_target + +;; template base directory (the equivalent directory of /phpDocumentor) +;templatebase = /path/to/my/templates + +;; comma-separated list of files, directories or wildcards ? and * (any wildcard) to ignore +;; legal values: any wildcard strings separated by commas +;ignore = /path/to/ignore*,*list.php,myfile.php,subdirectory/ +;ignore = templates_c/,*HTML/default/*,spec/ +ignore = docs/,packages/,test/ + +;; comma-separated list of Converters to use in outputformat:Convertername:templatedirectory format +;; legal values: HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib, +;; HTML:frames:earthli, +;; HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de, +;; HTML:frames:DOM/phphtmllib,HTML:frames:DOM/earthli +;; HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS +;; PDF:default:default,CHM:default:default,XML:DocBook/peardoc2:default +;output=HTML:frames:earthli,HTML:frames:default,HTML:frames:l0l33t,HTML:frames:phpdoc.de,HTML:frames:phphtmllib,HTML:frames:DOM/default,HTML:frames:DOM/l0l33t,HTML:frames:DOM/phpdoc.de,HTML:frames:DOM/earthli,HTML:frames:DOM/phphtmllib,HTML:frames:phpedit,HTML:Smarty:default,HTML:Smarty:PHP,HTML:Smarty:HandS,CHM:default:default,PDF:default:default +output=HTML:frames:DOM/earthlisf + +;; turn this option on if you want highlighted source code for every file +;; legal values: on/off +sourcecode = off diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/index.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/index.php new file mode 100644 index 0000000..9c8a6e6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/index.php @@ -0,0 +1,54 @@ +destination(dirname(__FILE__).'/map.xml'); + + if (!empty($destination)) { + $page = file_get_contents(dirname(__FILE__).'/template.html'); + + $page = str_replace('KEYWORDS', $source->keywords(), $page); + $page = str_replace('TITLE', $source->title(), $page); + $page = str_replace('CONTENT', $source->content(), $page); + $page = str_replace('INTERNAL', $source->internal(), $page); + $page = str_replace('EXTERNAL', $source->external(), $page); + + $links = $source->links(dirname(__FILE__).'/map.xml'); + foreach ($links as $category => $link) { + $page = str_replace("LINKS_".strtoupper($category), $link, $page); + } + + $destination_dir = dirname($destination_path.$destination); + if (!is_dir($destination_dir)) { + mkdir($destination_dir); + } + + $ok = file_put_contents($destination_path.$destination, $page); + touch($destination_path.$destination, filemtime($source_path.$language.$file)); + + if ($ok) { + $result = "OK"; + } else { + $result = "KO"; + } + + $synchronisation = new PackagingSynchronisation($source_path.$language.$file); + $result .= " ".$synchronisation->result(); + + echo $destination_path.$destination." : ".$result."\n"; + } + } + } + closedir($dir); +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/integration.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/integration.php new file mode 100755 index 0000000..e4c5881 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/integration.php @@ -0,0 +1,41 @@ +updateTestLogs($cli_directory, $test); + +$working_copy = dirname(__FILE__)."/working-copies/simpletest"; +$binary = "svn"; +$integration->updateSvnLog($working_copy, $binary); + +class SimpleIntegration { + public $target_directory; + + function __construct($target_directory="") { + $this->target_directory = $target_directory; + } + + function updateTestLogs($cli_directory, $test_file) { + foreach(new DirectoryIterator($cli_directory) as $node) { + if ($node->isDir() and !$node->isDot()) { + $bin = $node->getPathname()."/bin/php"; + $result = shell_exec($bin." ".$test_file); + + $result_file = $this->target_directory."/simpletest.".$node->getFilename().".log"; + file_put_contents($result_file, $result); + } + } + } + + function updateSvnLog($working_copy, $binary="svn") { + $start = date("Y-m-d", strtotime('-1year')); + $command = $binary." log --xml --revision {".$start."}:HEAD ".$working_copy." > ".$this->target_directory."/svn.xml"; + return exec($command); + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/map.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/map.xml new file mode 100644 index 0000000..78cb933 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/map.xml @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/package.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/package.php new file mode 100644 index 0000000..f266625 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/package.php @@ -0,0 +1,440 @@ +xpath('//page'); + return $titles[0]->attributes()->title; + } + + function transform_code($code) { + $code = str_replace('', '', $code); + $code = str_replace('<strong>', '', $code); + $code = str_replace('</strong>', '', $code); + $code = str_replace('&', '&', $code); + + return $code; + } + + function content() { + $content = $this->introduction(); + $sections = $this->xpath('//section'); + if (count($sections) > 0) { + $content .= $this->content_with_sections(); + } else { + $content .= $this->content_without_sections(); + } + $content = preg_replace("/href=\"([a-z_]*)\.php\"/", "href=\"\\1.html\"", $content); + + return $content; + } + + function introduction() { + $content = ""; + + $introductions = $this->xpath('//introduction'); + foreach ($introductions as $introduction) { + foreach ($introduction as $element) { + $content .= $this->deal_with_php_code($element->asXML()); + } + } + + return $content; + } + + function content_without_sections() { + $content_without_sections = ""; + $contents = $this->xpath('//content'); + foreach ($contents as $content) { + $content_without_sections .= $this->deal_with_php_code($content->asXML()); + } + + return $content_without_sections; + } + + function deal_with_php_code($content) { + $elements_divided = preg_split('/|<\/php>/', $content); + $content_element = ''; + + if (count($elements_divided) > 1) { + foreach ($elements_divided as $element_divided) { + if (strpos($element_divided, '
    '.$this->transform_code($element_divided).'

    '; + } + $content_element .= $element_divided; + } + } else { + $content_element .= $content; + } + + return $content_element; + } + + function as_title($name) { + return ucfirst(str_replace("-", " ", $name)); + } + + function as_tracker_link($number) { + return "".$number.""; + } + + function content_with_sections() { + $content = ""; + $sections = $this->xpath('//section'); + $anchors = array(); + foreach ($sections as $section) { + if (!isset($anchors[(string)$section->attributes()->name])) { + $content .= "attributes()->name."\">"; + $anchors[(string)$section->attributes()->name] = true; + } + $content .= "

    ".(string)$section->attributes()->title."

    "; + foreach ($section->p as $paragraph) { + $content .= $this->deal_with_php_code($paragraph->asXML()); + } + $content .= $this->deal_with_milestones($section); + $content .= $this->deal_with_changelogs($section); + } + + return $content; + } + + function deal_with_changelogs($section) { + $content = ""; + + foreach ($section->changelog as $changelog) { + $content .= "

    Version ".(string)$changelog->attributes()->version."

    "; + $content .= "
      "; + foreach ($changelog->change as $change) { + $content .= "
    • "; + $content .= trim((string)$change); + $content .= "
    • "; + } + foreach ($changelog->bug as $bug) { + $content .= "
    • "; + $number = ""; + if (isset($bug->attributes()->tracker)) { + $number = " ".$this->as_tracker_link($bug->attributes()->tracker); + } + $content .= "[bug".$number."] ".trim((string)$bug); + $content .= "
    • "; + } + foreach ($changelog->patch as $patch) { + $content .= "
    • "; + $number = ""; + if (isset($patch->attributes()->tracker)) { + $number = " ".$this->as_tracker_link($patch->attributes()->tracker); + } + $content .= "[patch".$number."] ".trim((string)$patch); + $content .= "
    • "; + } + $content .= "
    "; + } + return $content; + } + + function deal_with_milestones($section) { + $content = ""; + + foreach ($section->milestone as $milestone) { + $content .= "

    ".(string)$milestone->attributes()->version."

    "; + foreach ($milestone->concern as $concern) { + if (!isset($anchors[(string)$concern->attributes()->name])) { + $content .= "attributes()->name."\">"; + $anchors[(string)$concern->attributes()->name] = true; + } + $content .= "

    ".$this->as_title($concern->attributes()->name)."

    "; + if (sizeof($concern) > 0) { + $content .= "
    "; + foreach ($concern as $type => $element) { + $status = ""; + if (isset($element->attributes()->status)) { + $status = " class=\"".$element->attributes()->status."\""; + } + $content .= "[".$type."] ".trim($element).""; + foreach ($element->attributes() as $name => $value) { + if ($name == "tracker" and $type == "bug") { + $value = $this->as_tracker_link($value); + } + $content .= "
    ".$name." : ".$value."
    "; + } + foreach ($element->note as $note) { + $content .= "
    ".trim((string)$note)."
    "; + } + } + $content .= "
    "; + } + } + } + + return $content; + } + + function internal() { + $internal = ""; + + if (isset($this->internal->link)) { + foreach ($this->internal->link as $link) { + $internal .= "
    ".$link->asXML()."
    "; + } + } + + return $internal; + } + + function external() { + $external = ""; + + if (isset($this->external->link)) { + foreach ($this->external->link as $link) { + $external .= "
    ".$link->asXML()."
    "; + } + } + + return $external; + } + + function keywords() { + return trim(preg_replace('/(\s+)/', ' ', $this->meta->keywords)); + } + + function here() { + $here = $this->xpath('@here'); + return (string)$here[0]; + } + + function parent($map) { + $here = $this->here(); + $pages = $map->xpath('//page[normalize-space(@here)="'.$here.'"]/parent::*'); + return $pages[0]->attributes()->here; + } + + function destination($path_to_map) { + $destination = ''; + $here = $this->here(); + + $map = simplexml_load_file($path_to_map); + $pages = $map->xpath('//page'); + $i = 0; + foreach ($pages as $page) { + $i++; + if ((string)$page->attributes()->here == $here) { + $destination = (string)$page->attributes()->file; + break; + } + } + return $destination; + } + + function url($file) { + $segments = explode("/", $file); + + return array_pop($segments); + } + + function links_from_xpath($xpath, $map) { + $link = ""; + + $here = $this->here(); + $pages = $map->xpath($xpath); + foreach ($pages as $page) { + $link .= '
  • '; + $link .= $page->attributes()->title.'
  • '; + } + + return $link; + } + + function links_parent_siblings_after($map) { + $here = $this->parent($map); + $query = '//page[normalize-space(@here)="'.$here.'"]/following-sibling::*'; + + return $this->links_from_xpath($query, $map); + } + + function links_parent($map) { + $here = $this->parent($map); + $query = '//page[normalize-space(@here)="'.$here.'"]'; + + return $this->links_from_xpath($query, $map); + } + + function links_parent_siblings_before($map) { + $here = $this->parent($map); + $query = '//page[normalize-space(@here)="'.$here.'"]/preceding-sibling::*'; + + return $this->links_from_xpath($query, $map); + } + + function links_parent_ancestors($map) { + $here = $this->parent($map); + return $this->links_ancestors_from($here, $map); + } + + function links_self_ancestors($map) { + $here = $this->here(); + return $this->links_ancestors_from($here, $map); + } + + function links_ancestors_from($here, $map) { + $link = ""; + + $pages = $map->xpath('//page[normalize-space(@here)="'.$here.'"]/ancestor::*'); + foreach ($pages as $page) { + $here = (string)$page->attributes()->here; + if ($this->level_from_root($here, $map) >= 2) { + $link .= '
  • '; + $link .= $page->attributes()->title.'
  • '; + } + } + + return $link; + } + function links_siblings_before($map) { + $here = $this->here(); + $query = '//page[normalize-space(@here)="'.$here.'"]/preceding-sibling::*'; + + return $this->links_from_xpath($query, $map); + } + + function links_self($map) { + $here = $this->here(); + $query = '//page[normalize-space(@here)="'.$here.'"]'; + + return $this->links_from_xpath($query, $map); + } + + function links_siblings_after($map) { + $here = $this->here(); + $query = '//page[normalize-space(@here)="'.$here.'"]/following-sibling::*'; + + return $this->links_from_xpath($query, $map); + } + + function links_children($map) { + $here = $this->here(); + $query = '//page[normalize-space(@here)="'.$here.'"]/child::*'; + + return $this->links_from_xpath($query, $map); + } + + function links($path_to_map) { + $links['download'] = ""; + $links['start_testing'] = ""; + $links['support'] = ""; + $links['contribute'] = ""; + + $map = simplexml_load_file($path_to_map); + + $link = '
      '; + $here = $this->here(); + $level = $this->level_from_root($here, $map); + if ($level == 2) { + $link .= $this->links_self($map); + $link .= $this->links_children($map); + } + if ($level == 3) { + $link .= $this->links_self_ancestors($map); + $link .= $this->links_siblings_before($map); + $link .= $this->links_self($map); + $chilren = $this->links_children($map); + if ($chilren) { + $link = preg_replace('/(<\/li>)$/', '', $link).'
        '.$chilren.'
      '; + } + $link .= $this->links_siblings_after($map); + } + if ($level == 4) { + $link .= $this->links_parent_ancestors($map); + $link .= $this->links_parent_siblings_before($map); + $link .= $this->links_parent($map); + $link = preg_replace('/(<\/li>)$/', '', $link).'
        '; + $link .= $this->links_siblings_before($map); + $link .= $this->links_self($map); + $chilren = $this->links_children($map); + if ($chilren) { + $link = preg_replace('/(<\/li>)$/', '', $link).'
          '.$chilren.'
        '; + } + $link .= $this->links_siblings_after($map); + $link .= '
      '; + $link .= $this->links_parent_siblings_after($map); + } + $link .= '
    '; + + if (strpos($link, 'download.html') !== false) { + $links['download'] = $link; + } elseif (strpos($link, 'start-testing.html') !== false) { + $links['start_testing'] = $link; + } elseif (strpos($link, 'support.html') !== false) { + $links['support'] = $link; + } elseif (strpos($link, 'todo.html') !== false) { + $links['contribute'] = $link; + } + + return $links; + } + + function level_from_root($here, $map) { + $ancestors = $map->xpath('//page[normalize-space(@here)="'.$here.'"]/ancestor::*'); + + return count($ancestors); + } +} + +class PackagingSynchronisation { + public $file; + public $lang; + public $content; + + function __construct($file, $lang="fr") { + $this->file = $file; + $this->lang = $lang; + $this->content = ""; + if (file_exists($this->file)) { + $this->content = file_get_contents($this->file); + } + } + + function isSynchronisable() { + return (bool)strpos($this->content, "isSynchronisable()) { + return "source"; + } elseif (!$this->sourceRevision()) { + return "missing id"; + } elseif ($this->sourceRevision() > $this->lastSynchroRevision()) { + return "late"; + } else { + return "synchro"; + } + } + + function revision() { + $matches = array(); + preg_match("/Id: [a-z_-]*\.[a-z]* ([0-9]*)/", $this->content, $matches); + return $matches[1]; + } + + function sourceLang() { + $matches = array(); + preg_match("/synchronisation.*lang=\"([a-z]*)\"/", $this->content, $matches); + return $matches[1]; + } + + function sourceRevision() { + $source_lang = $this->sourceLang(); + $source_file = str_replace("/".$this->lang."/", "/".$source_lang."/", $this->file); + if (file_exists($source_file)) { + $source = new PackagingSynchronisation($source_file, $source_lang); + return $source->revision(); + } + return false; + } + + function lastSynchroRevision() { + $matches = array(); + preg_match("/synchronisation.*version=\"([0-9]*)\"/", $this->content, $matches); + return $matches[1]; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/template.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/template.html new file mode 100644 index 0000000..e785398 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/template.html @@ -0,0 +1,59 @@ + + + + + +TITLE + + + + +
    +
    + +
    +
    + + LINKS_DOWNLOAD +
    +
    + + LINKS_START_TESTING +
    +
    + + LINKS_SUPPORT +
    +
    + + LINKS_CONTRIBUTE +
    +
    + + SourceForge.net Logo + +
    +
    +
    +
    +

    TITLE

    + + CONTENT + +
    + +
    INTERNAL
    + +
    +
    + +
    EXTERNAL
    + +
    +
    +
    + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/content_without_section.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/content_without_section.xml new file mode 100644 index 0000000..d3b1308 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/content_without_section.xml @@ -0,0 +1,91 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/en/synchronisation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/en/synchronisation.xml new file mode 100755 index 0000000..f95a8ad --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/en/synchronisation.xml @@ -0,0 +1,92 @@ + + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/no-synchronisation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/no-synchronisation.xml new file mode 100755 index 0000000..d3b1308 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/no-synchronisation.xml @@ -0,0 +1,91 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/synchronisation.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/synchronisation.xml new file mode 100755 index 0000000..7fd400c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/fr/synchronisation.xml @@ -0,0 +1,93 @@ + + + + + + Le texte en français + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_download.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_download.xml new file mode 100644 index 0000000..4179725 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_download.xml @@ -0,0 +1,91 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_overview.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_overview.xml new file mode 100644 index 0000000..d3b1308 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_overview.xml @@ -0,0 +1,91 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_simpletest.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_simpletest.xml new file mode 100644 index 0000000..428b3c7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_simpletest.xml @@ -0,0 +1,91 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_start_testing.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_start_testing.xml new file mode 100644 index 0000000..d3b1308 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_start_testing.xml @@ -0,0 +1,91 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_support.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_support.xml new file mode 100644 index 0000000..4d43dc4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_support.xml @@ -0,0 +1,91 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_unit-tester.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_unit-tester.xml new file mode 100644 index 0000000..7e32910 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/here_unit-tester.xml @@ -0,0 +1,91 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/map.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/map.xml new file mode 100644 index 0000000..ec25596 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/map.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_changelogged.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_changelogged.xml new file mode 100755 index 0000000..22b1d90 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_changelogged.xml @@ -0,0 +1,65 @@ + + + + SimpleTest's Changelog + +
    + + + Patches and whitespace clean up + + + Some in line documentation fixes + + + SimpleFileLoader::load: fix for $test_file already included, by daniel hahler - blueyed + + + New tests for UTF8 inside the browser. + + + Fixing one of the incompatible interface errors + + + expectException() + + +
    +
    + + + Changelog for version 1.0.1 + + + + + SimpleTest project page on SourceForge. + + + The developer's API for SimpleTest + gives full detail on the classes and assertions available. + + + + + software development, + php programming for clients, + customer focused php, + software development tools, + acceptance testing framework, + free php scripts, + log in boxes, + unit testing authentication systems, + php resources, + HTMLUnit, + JWebUnit, + php testing, + unit test resource, + web testing, + HTTP authentication, + testing log in, + authentication testing, + security tests + + +
    \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_milestoned.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_milestoned.xml new file mode 100644 index 0000000..f495772 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_milestoned.xml @@ -0,0 +1,95 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +
    + + + Undefined property $_reporter + fatal error + + + + The HELP_MY_TESTS_DONT_WORK_ANYMORE needs to be updated. + + + + + PHP 5.3 compatible under E_STRICT + PHP 5.2.0-5 compatible under E_STRICT + PHP 5.1.0-6 compatible under E_STRICT + continuous integration + + error_reporting(E_ALL|E_STRICT)gives lots of warning + + We've know this for years, this is the time. + + + + Drop underscores from protected methods and + private variables. + Make all variables private and add protected + accessors where we use them internally. + + That way people will start complaining. + Upon each complaint we'll add an accessor and + capture the use case from them. + + + We'll stick the use cases in the feature request + tracker for now + + + Move web site to new server + + +
    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_with_autorum_php.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_with_autorum_php.xml new file mode 100644 index 0000000..8e6ee88 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_with_autorum_php.xml @@ -0,0 +1,87 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +
    +

    + Use the &quote;autorun.php&quote; with no link. +

    +

    + Use the "autodive.php" with no link. +

    +

    + Use the autowalk. +

    +
    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_with_php_code.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_with_php_code.xml new file mode 100644 index 0000000..552647d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package/one_section_with_php_code.xml @@ -0,0 +1,93 @@ + + + + Overview and feature list for the SimpleTest PHP unit tester and web tester + + +
    +

    + A test case looks like this... +MyTestCase extends UnitTestCase { + + function testLogWroteMessage() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> +]]> +

    +
    +
    + + + Quick summary + of the SimpleTest tool for PHP. + + + List of features, + both current ones and those planned. + + + There are plenty of unit testing resources + on the web. + + + + + Documentation for SimpleTest. + + + How to write PHP test cases + is a fairly advanced tutorial. + + + SimpleTest API from phpdoc. + + + + + software development tools, + php programming, + programming php, + software development tools, + Tools for extreme programming, + free php scripts, + links of testing tools, + php testing resources, + mock objects, + junit, + jwebunit, + htmlunit, + itc, + php testing links, + unit test advice and documentation, + extreme programming in php + + + + + + Marcus Baker + + Primary Developer{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package_test.php new file mode 100644 index 0000000..cb2b955 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/simpletest.org/test/package_test.php @@ -0,0 +1,150 @@ +assertEqual($synchro->result(), "source"); + + $source = dirname(__FILE__)."/package/en/synchronisation.xml"; + $synchro = new PackagingSynchronisation($source); + $this->assertEqual($synchro->result(), "source"); + } + + function testOfSynchronisationNecessary() { + $source = dirname(__FILE__)."/package/fr/synchronisation.xml"; + $synchro = new PackagingSynchronisation($source); + $this->assertEqual($synchro->revision(), "1672"); + $this->assertEqual($synchro->sourceRevision(), "1671"); + $this->assertEqual($synchro->sourceLang(), "en"); + $this->assertEqual($synchro->lastSynchroRevision(), "1475"); + $this->assertEqual($synchro->result(), "late"); + } +} + +class TestOfContentTransformationFromXMLToHTML extends UnitTestCase { + function testOfNonLinksFileWithPHPExtension() { + $file = dirname(__FILE__).'/package/one_section_with_autorum_php.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $content = $source->content(); + $this->assertPattern('/autorun\.php/', $content); + $this->assertNoPattern('/autorun\.html/', $content); + $this->assertPattern('/autodive\.php/', $content); + $this->assertNoPattern('/autodive\.html/', $content); + $this->assertNoPattern('/autowalk\.php/', $content); + $this->assertPattern('/autowalk\.html/', $content); + } + + function testOfPHPTags() { + $file = dirname(__FILE__).'/package/one_section_with_php_code.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $content = $source->content(); + $this->assertPattern('/
    /', $content);
    +		$this->assertNoPattern('/<\!\[CDATA\[/', $content);
    +		$this->assertPattern('/

    /', $content); + $this->assertPattern('/\$log = &new Log\(\'my.log\'\);/', $content); + $this->assertPattern('/log->message/', $content); + } + + function testOfContentWithoutSections() { + $file = dirname(__FILE__).'/package/content_without_section.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $content = $source->content(); + $this->assertPattern('/

    /', $content); + } + + function testOfContentFromChangeLogSection() { + $file = dirname(__FILE__).'/package/one_section_changelogged.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $content = $source->content(); + $this->assertPattern('/

    Version 1.0.1<\/h3>/', $content); + $this->assertPattern('/
  • \[bug\] Patches and whitespace clean up<\/li>/', $content); + $this->assertPattern('/
  • Some in line documentation fixes<\/li>/', $content); + $this->assertPattern('/
  • \[bug 1853765<\/a>\] Fixing one of the incompatible interface errors<\/li>/', $content); + } + + function testOfContentFromMilestoneSection() { + $file = dirname(__FILE__).'/package/one_section_milestoned.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $content = $source->content(); + $this->assertPattern('/

    1\.1beta<\/h3>/', $content); + $this->assertPattern('/<\/a>/', $content); + $this->assertPattern('/

    Unit tester<\/h4>/', $content); + $this->assertPattern('/

    Documentation<\/h4>/', $content); + $this->assertPattern('/

    Extensions<\/h4>/', $content); + $this->assertPattern('/

    Build<\/h4>/', $content); + $this->assertPattern('/
    \[bug\] Undefined property \$_reporter \+ fatal error<\/dt>/', $content); + $this->assertPattern('/
    tracker : 1896582<\/a><\/dd>/', $content); + $this->assertPattern('/
    \[task\] The HELP_MY_TESTS_DONT_WORK_ANYMORE needs to be updated\.<\/dt>/', $content); + $this->assertPattern('/
    \[task\] PHP 5.3 compatible under E_STRICT<\/dt>/', $content); + $this->assertPattern('/
    \[bug\] continuous integration<\/dt>/', $content); + $this->assertPattern('/
    \[bug\] error_reporting\(E_ALL|E_STRICT\)gives lots of warning<\/dt>/', $content); + $this->assertPattern('/
    We\'ve know this for years, this is the time\.<\/dd>/', $content); + } + + function testOfSingleLink() { + $file = dirname(__FILE__).'/package/here_download.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $map = dirname(__FILE__).'/package/map.xml'; + $links = $source->links($map); + $this->assertEqual(count($links), 4); + $links_download = ''; + $this->assertEqual($links['download'], $links_download); + } + + function testOfMultipleLinks() { + $file = dirname(__FILE__).'/package/here_support.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $map = dirname(__FILE__).'/package/map.xml'; + $links = $source->links($map); + $this->assertEqual(count($links), 4); + $links_support = ''; + $this->assertEqual($links['support'], $links_support); + } + + function testOfHierarchicalLinks() { + $file = dirname(__FILE__).'/package/here_overview.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $map = dirname(__FILE__).'/package/map.xml'; + $links = $source->links($map); + $this->assertEqual(count($links), 4); + $links_start_testing = ''; + $this->assertEqual($links['start_testing'], $links_start_testing); + } + + function testOfRootLinksWithHierarchy() { + $file = dirname(__FILE__).'/package/here_simpletest.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $map = dirname(__FILE__).'/package/map.xml'; + $links = $source->links($map); + $this->assertEqual(count($links), 4); + $links_start_testing = ''; + $this->assertEqual($links['start_testing'], $links_start_testing); + } + + function testOfLinksWithNonRootParent() { + $file = dirname(__FILE__).'/package/here_unit-tester.xml'; + $source = simplexml_load_file($file, "SimpleTestXMLElement"); + $map = dirname(__FILE__).'/package/map.xml'; + $links = $source->links($map); + $this->assertEqual(count($links), 4); + $links_start_testing = ''; + $this->assertEqual($links['start_testing'], $links_start_testing); + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/site_map.xml b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/site_map.xml new file mode 100644 index 0000000..10e5663 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/site_map.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/transform_all_lastcraft.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/transform_all_lastcraft.php new file mode 100644 index 0000000..9b317df --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/packages/transform_all_lastcraft.php @@ -0,0 +1,17 @@ + $destination\n"; + `$command`; + } + closedir($dir); +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/page.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/page.php new file mode 100644 index 0000000..cfaa255 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/page.php @@ -0,0 +1,979 @@ + 'SimpleAnchorTag', + 'title' => 'SimpleTitleTag', + 'base' => 'SimpleBaseTag', + 'button' => 'SimpleButtonTag', + 'textarea' => 'SimpleTextAreaTag', + 'option' => 'SimpleOptionTag', + 'label' => 'SimpleLabelTag', + 'form' => 'SimpleFormTag', + 'frame' => 'SimpleFrameTag'); + $attributes = $this->keysToLowerCase($attributes); + if (array_key_exists($name, $map)) { + $tag_class = $map[$name]; + return new $tag_class($attributes); + } elseif ($name == 'select') { + return $this->createSelectionTag($attributes); + } elseif ($name == 'input') { + return $this->createInputTag($attributes); + } + return new SimpleTag($name, $attributes); + } + + /** + * Factory for selection fields. + * @param hash $attributes Element attributes. + * @return SimpleTag Tag object. + * @access protected + */ + protected function createSelectionTag($attributes) { + if (isset($attributes['multiple'])) { + return new MultipleSelectionTag($attributes); + } + return new SimpleSelectionTag($attributes); + } + + /** + * Factory for input tags. + * @param hash $attributes Element attributes. + * @return SimpleTag Tag object. + * @access protected + */ + protected function createInputTag($attributes) { + if (! isset($attributes['type'])) { + return new SimpleTextTag($attributes); + } + $type = strtolower(trim($attributes['type'])); + $map = array( + 'submit' => 'SimpleSubmitTag', + 'image' => 'SimpleImageSubmitTag', + 'checkbox' => 'SimpleCheckboxTag', + 'radio' => 'SimpleRadioButtonTag', + 'text' => 'SimpleTextTag', + 'hidden' => 'SimpleTextTag', + 'password' => 'SimpleTextTag', + 'file' => 'SimpleUploadTag'); + if (array_key_exists($type, $map)) { + $tag_class = $map[$type]; + return new $tag_class($attributes); + } + return false; + } + + /** + * Make the keys lower case for case insensitive look-ups. + * @param hash $map Hash to convert. + * @return hash Unchanged values, but keys lower case. + * @access private + */ + protected function keysToLowerCase($map) { + $lower = array(); + foreach ($map as $key => $value) { + $lower[strtolower($key)] = $value; + } + return $lower; + } +} + +/** + * SAX event handler. Maintains a list of + * open tags and dispatches them as they close. + * @package SimpleTest + * @subpackage WebTester + */ +class SimplePageBuilder extends SimpleSaxListener { + private $tags; + private $page; + private $private_content_tag; + + /** + * Sets the builder up empty. + * @access public + */ + function __construct() { + parent::__construct(); + } + + /** + * Frees up any references so as to allow the PHP garbage + * collection from unset() to work. + * @access public + */ + function free() { + unset($this->tags); + unset($this->page); + unset($this->private_content_tags); + } + + /** + * Reads the raw content and send events + * into the page to be built. + * @param $response SimpleHttpResponse Fetched response. + * @return SimplePage Newly parsed page. + * @access public + */ + function parse($response) { + $this->tags = array(); + $this->page = $this->createPage($response); + $parser = $this->createParser($this); + $parser->parse($response->getContent()); + $this->page->acceptPageEnd(); + return $this->page; + } + + /** + * Creates an empty page. + * @return SimplePage New unparsed page. + * @access protected + */ + protected function createPage($response) { + return new SimplePage($response); + } + + /** + * Creates the parser used with the builder. + * @param $listener SimpleSaxListener Target of parser. + * @return SimpleSaxParser Parser to generate + * events for the builder. + * @access protected + */ + protected function createParser(&$listener) { + return new SimpleHtmlSaxParser($listener); + } + + /** + * Start of element event. Opens a new tag. + * @param string $name Element name. + * @param hash $attributes Attributes without content + * are marked as true. + * @return boolean False on parse error. + * @access public + */ + function startElement($name, $attributes) { + $factory = new SimpleTagBuilder(); + $tag = $factory->createTag($name, $attributes); + if (! $tag) { + return true; + } + if ($tag->getTagName() == 'label') { + $this->page->acceptLabelStart($tag); + $this->openTag($tag); + return true; + } + if ($tag->getTagName() == 'form') { + $this->page->acceptFormStart($tag); + return true; + } + if ($tag->getTagName() == 'frameset') { + $this->page->acceptFramesetStart($tag); + return true; + } + if ($tag->getTagName() == 'frame') { + $this->page->acceptFrame($tag); + return true; + } + if ($tag->isPrivateContent() && ! isset($this->private_content_tag)) { + $this->private_content_tag = &$tag; + } + if ($tag->expectEndTag()) { + $this->openTag($tag); + return true; + } + $this->page->acceptTag($tag); + return true; + } + + /** + * End of element event. + * @param string $name Element name. + * @return boolean False on parse error. + * @access public + */ + function endElement($name) { + if ($name == 'label') { + $this->page->acceptLabelEnd(); + return true; + } + if ($name == 'form') { + $this->page->acceptFormEnd(); + return true; + } + if ($name == 'frameset') { + $this->page->acceptFramesetEnd(); + return true; + } + if ($this->hasNamedTagOnOpenTagStack($name)) { + $tag = array_pop($this->tags[$name]); + if ($tag->isPrivateContent() && $this->private_content_tag->getTagName() == $name) { + unset($this->private_content_tag); + } + $this->addContentTagToOpenTags($tag); + $this->page->acceptTag($tag); + return true; + } + return true; + } + + /** + * Test to see if there are any open tags awaiting + * closure that match the tag name. + * @param string $name Element name. + * @return boolean True if any are still open. + * @access private + */ + protected function hasNamedTagOnOpenTagStack($name) { + return isset($this->tags[$name]) && (count($this->tags[$name]) > 0); + } + + /** + * Unparsed, but relevant data. The data is added + * to every open tag. + * @param string $text May include unparsed tags. + * @return boolean False on parse error. + * @access public + */ + function addContent($text) { + if (isset($this->private_content_tag)) { + $this->private_content_tag->addContent($text); + } else { + $this->addContentToAllOpenTags($text); + } + return true; + } + + /** + * Any content fills all currently open tags unless it + * is part of an option tag. + * @param string $text May include unparsed tags. + * @access private + */ + protected function addContentToAllOpenTags($text) { + foreach (array_keys($this->tags) as $name) { + for ($i = 0, $count = count($this->tags[$name]); $i < $count; $i++) { + $this->tags[$name][$i]->addContent($text); + } + } + } + + /** + * Parsed data in tag form. The parsed tag is added + * to every open tag. Used for adding options to select + * fields only. + * @param SimpleTag $tag Option tags only. + * @access private + */ + protected function addContentTagToOpenTags(&$tag) { + if ($tag->getTagName() != 'option') { + return; + } + foreach (array_keys($this->tags) as $name) { + for ($i = 0, $count = count($this->tags[$name]); $i < $count; $i++) { + $this->tags[$name][$i]->addTag($tag); + } + } + } + + /** + * Opens a tag for receiving content. Multiple tags + * will be receiving input at the same time. + * @param SimpleTag $tag New content tag. + * @access private + */ + protected function openTag($tag) { + $name = $tag->getTagName(); + if (! in_array($name, array_keys($this->tags))) { + $this->tags[$name] = array(); + } + $this->tags[$name][] = $tag; + } +} + +/** + * A wrapper for a web page. + * @package SimpleTest + * @subpackage WebTester + */ +class SimplePage { + private $links; + private $title; + private $last_widget; + private $label; + private $left_over_labels; + private $open_forms; + private $complete_forms; + private $frameset; + private $frames; + private $frameset_nesting_level; + private $transport_error; + private $raw; + private $text; + private $sent; + private $headers; + private $method; + private $url; + private $base = false; + private $request_data; + + /** + * Parses a page ready to access it's contents. + * @param SimpleHttpResponse $response Result of HTTP fetch. + * @access public + */ + function __construct($response = false) { + $this->links = array(); + $this->title = false; + $this->left_over_labels = array(); + $this->open_forms = array(); + $this->complete_forms = array(); + $this->frameset = false; + $this->frames = array(); + $this->frameset_nesting_level = 0; + $this->text = false; + if ($response) { + $this->extractResponse($response); + } else { + $this->noResponse(); + } + } + + /** + * Extracts all of the response information. + * @param SimpleHttpResponse $response Response being parsed. + * @access private + */ + protected function extractResponse($response) { + $this->transport_error = $response->getError(); + $this->raw = $response->getContent(); + $this->sent = $response->getSent(); + $this->headers = $response->getHeaders(); + $this->method = $response->getMethod(); + $this->url = $response->getUrl(); + $this->request_data = $response->getRequestData(); + } + + /** + * Sets up a missing response. + * @access private + */ + protected function noResponse() { + $this->transport_error = 'No page fetched yet'; + $this->raw = false; + $this->sent = false; + $this->headers = false; + $this->method = 'GET'; + $this->url = false; + $this->request_data = false; + } + + /** + * Original request as bytes sent down the wire. + * @return mixed Sent content. + * @access public + */ + function getRequest() { + return $this->sent; + } + + /** + * Accessor for raw text of page. + * @return string Raw unparsed content. + * @access public + */ + function getRaw() { + return $this->raw; + } + + /** + * Accessor for plain text of page as a text browser + * would see it. + * @return string Plain text of page. + * @access public + */ + function getText() { + if (! $this->text) { + $this->text = SimpleHtmlSaxParser::normalise($this->raw); + } + return $this->text; + } + + /** + * Accessor for raw headers of page. + * @return string Header block as text. + * @access public + */ + function getHeaders() { + if ($this->headers) { + return $this->headers->getRaw(); + } + return false; + } + + /** + * Original request method. + * @return string GET, POST or HEAD. + * @access public + */ + function getMethod() { + return $this->method; + } + + /** + * Original resource name. + * @return SimpleUrl Current url. + * @access public + */ + function getUrl() { + return $this->url; + } + + /** + * Base URL if set via BASE tag page url otherwise + * @return SimpleUrl Base url. + * @access public + */ + function getBaseUrl() { + return $this->base; + } + + /** + * Original request data. + * @return mixed Sent content. + * @access public + */ + function getRequestData() { + return $this->request_data; + } + + /** + * Accessor for last error. + * @return string Error from last response. + * @access public + */ + function getTransportError() { + return $this->transport_error; + } + + /** + * Accessor for current MIME type. + * @return string MIME type as string; e.g. 'text/html' + * @access public + */ + function getMimeType() { + if ($this->headers) { + return $this->headers->getMimeType(); + } + return false; + } + + /** + * Accessor for HTTP response code. + * @return integer HTTP response code received. + * @access public + */ + function getResponseCode() { + if ($this->headers) { + return $this->headers->getResponseCode(); + } + return false; + } + + /** + * Accessor for last Authentication type. Only valid + * straight after a challenge (401). + * @return string Description of challenge type. + * @access public + */ + function getAuthentication() { + if ($this->headers) { + return $this->headers->getAuthentication(); + } + return false; + } + + /** + * Accessor for last Authentication realm. Only valid + * straight after a challenge (401). + * @return string Name of security realm. + * @access public + */ + function getRealm() { + if ($this->headers) { + return $this->headers->getRealm(); + } + return false; + } + + /** + * Accessor for current frame focus. Will be + * false as no frames. + * @return array Always empty. + * @access public + */ + function getFrameFocus() { + return array(); + } + + /** + * Sets the focus by index. The integer index starts from 1. + * @param integer $choice Chosen frame. + * @return boolean Always false. + * @access public + */ + function setFrameFocusByIndex($choice) { + return false; + } + + /** + * Sets the focus by name. Always fails for a leaf page. + * @param string $name Chosen frame. + * @return boolean False as no frames. + * @access public + */ + function setFrameFocus($name) { + return false; + } + + /** + * Clears the frame focus. Does nothing for a leaf page. + * @access public + */ + function clearFrameFocus() { + } + + /** + * Adds a tag to the page. + * @param SimpleTag $tag Tag to accept. + * @access public + */ + function acceptTag($tag) { + if ($tag->getTagName() == "a") { + $this->addLink($tag); + } elseif ($tag->getTagName() == "base") { + $this->setBase($tag); + } elseif ($tag->getTagName() == "title") { + $this->setTitle($tag); + } elseif ($this->isFormElement($tag->getTagName())) { + for ($i = 0; $i < count($this->open_forms); $i++) { + $this->open_forms[$i]->addWidget($tag); + } + $this->last_widget = &$tag; + } + } + + /** + * Opens a label for a described widget. + * @param SimpleFormTag $tag Tag to accept. + * @access public + */ + function acceptLabelStart($tag) { + $this->label = $tag; + unset($this->last_widget); + } + + /** + * Closes the most recently opened label. + * @access public + */ + function acceptLabelEnd() { + if (isset($this->label)) { + if (isset($this->last_widget)) { + $this->last_widget->setLabel($this->label->getText()); + unset($this->last_widget); + } else { + $this->left_over_labels[] = SimpleTestCompatibility::copy($this->label); + } + unset($this->label); + } + } + + /** + * Tests to see if a tag is a possible form + * element. + * @param string $name HTML element name. + * @return boolean True if form element. + * @access private + */ + protected function isFormElement($name) { + return in_array($name, array('input', 'button', 'textarea', 'select')); + } + + /** + * Opens a form. New widgets go here. + * @param SimpleFormTag $tag Tag to accept. + * @access public + */ + function acceptFormStart($tag) { + $this->open_forms[] = new SimpleForm($tag, $this); + } + + /** + * Closes the most recently opened form. + * @access public + */ + function acceptFormEnd() { + if (count($this->open_forms)) { + $this->complete_forms[] = array_pop($this->open_forms); + } + } + + /** + * Opens a frameset. A frameset may contain nested + * frameset tags. + * @param SimpleFramesetTag $tag Tag to accept. + * @access public + */ + function acceptFramesetStart($tag) { + if (! $this->isLoadingFrames()) { + $this->frameset = $tag; + } + $this->frameset_nesting_level++; + } + + /** + * Closes the most recently opened frameset. + * @access public + */ + function acceptFramesetEnd() { + if ($this->isLoadingFrames()) { + $this->frameset_nesting_level--; + } + } + + /** + * Takes a single frame tag and stashes it in + * the current frame set. + * @param SimpleFrameTag $tag Tag to accept. + * @access public + */ + function acceptFrame($tag) { + if ($this->isLoadingFrames()) { + if ($tag->getAttribute('src')) { + $this->frames[] = $tag; + } + } + } + + /** + * Test to see if in the middle of reading + * a frameset. + * @return boolean True if inframeset. + * @access private + */ + protected function isLoadingFrames() { + if (! $this->frameset) { + return false; + } + return ($this->frameset_nesting_level > 0); + } + + /** + * Test to see if link is an absolute one. + * @param string $url Url to test. + * @return boolean True if absolute. + * @access protected + */ + protected function linkIsAbsolute($url) { + $parsed = new SimpleUrl($url); + return (boolean)($parsed->getScheme() && $parsed->getHost()); + } + + /** + * Adds a link to the page. + * @param SimpleAnchorTag $tag Link to accept. + * @access protected + */ + protected function addLink($tag) { + $this->links[] = $tag; + } + + /** + * Marker for end of complete page. Any work in + * progress can now be closed. + * @access public + */ + function acceptPageEnd() { + while (count($this->open_forms)) { + $this->complete_forms[] = array_pop($this->open_forms); + } + foreach ($this->left_over_labels as $label) { + for ($i = 0, $count = count($this->complete_forms); $i < $count; $i++) { + $this->complete_forms[$i]->attachLabelBySelector( + new SimpleById($label->getFor()), + $label->getText()); + } + } + } + + /** + * Test for the presence of a frameset. + * @return boolean True if frameset. + * @access public + */ + function hasFrames() { + return (boolean)$this->frameset; + } + + /** + * Accessor for frame name and source URL for every frame that + * will need to be loaded. Immediate children only. + * @return boolean/array False if no frameset or + * otherwise a hash of frame URLs. + * The key is either a numerical + * base one index or the name attribute. + * @access public + */ + function getFrameset() { + if (! $this->frameset) { + return false; + } + $urls = array(); + for ($i = 0; $i < count($this->frames); $i++) { + $name = $this->frames[$i]->getAttribute('name'); + $url = new SimpleUrl($this->frames[$i]->getAttribute('src')); + $urls[$name ? $name : $i + 1] = $this->expandUrl($url); + } + return $urls; + } + + /** + * Fetches a list of loaded frames. + * @return array/string Just the URL for a single page. + * @access public + */ + function getFrames() { + $url = $this->expandUrl($this->getUrl()); + return $url->asString(); + } + + /** + * Accessor for a list of all links. + * @return array List of urls with scheme of + * http or https and hostname. + * @access public + */ + function getUrls() { + $all = array(); + foreach ($this->links as $link) { + $url = $this->getUrlFromLink($link); + $all[] = $url->asString(); + } + return $all; + } + + /** + * Accessor for URLs by the link label. Label will match + * regardess of whitespace issues and case. + * @param string $label Text of link. + * @return array List of links with that label. + * @access public + */ + function getUrlsByLabel($label) { + $matches = array(); + foreach ($this->links as $link) { + if ($link->getText() == $label) { + $matches[] = $this->getUrlFromLink($link); + } + } + return $matches; + } + + /** + * Accessor for a URL by the id attribute. + * @param string $id Id attribute of link. + * @return SimpleUrl URL with that id of false if none. + * @access public + */ + function getUrlById($id) { + foreach ($this->links as $link) { + if ($link->getAttribute('id') === (string)$id) { + return $this->getUrlFromLink($link); + } + } + return false; + } + + /** + * Converts a link tag into a target URL. + * @param SimpleAnchor $link Parsed link. + * @return SimpleUrl URL with frame target if any. + * @access private + */ + protected function getUrlFromLink($link) { + $url = $this->expandUrl($link->getHref()); + if ($link->getAttribute('target')) { + $url->setTarget($link->getAttribute('target')); + } + return $url; + } + + /** + * Expands expandomatic URLs into fully qualified + * URLs. + * @param SimpleUrl $url Relative URL. + * @return SimpleUrl Absolute URL. + * @access public + */ + function expandUrl($url) { + if (! is_object($url)) { + $url = new SimpleUrl($url); + } + $location = $this->getBaseUrl() ? $this->getBaseUrl() : new SimpleUrl(); + return $url->makeAbsolute($location->makeAbsolute($this->getUrl())); + } + + /** + * Sets the base url for the page. + * @param SimpleTag $tag Base URL for page. + * @access protected + */ + protected function setBase($tag) { + $url = $tag->getAttribute('href'); + $this->base = new SimpleUrl($url); + } + + /** + * Sets the title tag contents. + * @param SimpleTitleTag $tag Title of page. + * @access protected + */ + protected function setTitle($tag) { + $this->title = $tag; + } + + /** + * Accessor for parsed title. + * @return string Title or false if no title is present. + * @access public + */ + function getTitle() { + if ($this->title) { + return $this->title->getText(); + } + return false; + } + + /** + * Finds a held form by button label. Will only + * search correctly built forms. + * @param SimpleSelector $selector Button finder. + * @return SimpleForm Form object containing + * the button. + * @access public + */ + function &getFormBySubmit($selector) { + for ($i = 0; $i < count($this->complete_forms); $i++) { + if ($this->complete_forms[$i]->hasSubmit($selector)) { + return $this->complete_forms[$i]; + } + } + $null = null; + return $null; + } + + /** + * Finds a held form by image using a selector. + * Will only search correctly built forms. + * @param SimpleSelector $selector Image finder. + * @return SimpleForm Form object containing + * the image. + * @access public + */ + function getFormByImage($selector) { + for ($i = 0; $i < count($this->complete_forms); $i++) { + if ($this->complete_forms[$i]->hasImage($selector)) { + return $this->complete_forms[$i]; + } + } + return null; + } + + /** + * Finds a held form by the form ID. A way of + * identifying a specific form when we have control + * of the HTML code. + * @param string $id Form label. + * @return SimpleForm Form object containing the matching ID. + * @access public + */ + function getFormById($id) { + for ($i = 0; $i < count($this->complete_forms); $i++) { + if ($this->complete_forms[$i]->getId() == $id) { + return $this->complete_forms[$i]; + } + } + return null; + } + + /** + * Sets a field on each form in which the field is + * available. + * @param SimpleSelector $selector Field finder. + * @param string $value Value to set field to. + * @return boolean True if value is valid. + * @access public + */ + function setField($selector, $value, $position=false) { + $is_set = false; + for ($i = 0; $i < count($this->complete_forms); $i++) { + if ($this->complete_forms[$i]->setField($selector, $value, $position)) { + $is_set = true; + } + } + return $is_set; + } + + /** + * Accessor for a form element value within a page. + * @param SimpleSelector $selector Field finder. + * @return string/boolean A string if the field is + * present, false if unchecked + * and null if missing. + * @access public + */ + function getField($selector) { + for ($i = 0; $i < count($this->complete_forms); $i++) { + $value = $this->complete_forms[$i]->getValue($selector); + if (isset($value)) { + return $value; + } + } + return null; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/parser.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/parser.php new file mode 100644 index 0000000..e95df81 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/parser.php @@ -0,0 +1,760 @@ + $constant) { + if (! defined($constant)) { + define($constant, $i + 1); + } +} +/**#@-*/ + +/** + * Compounded regular expression. Any of + * the contained patterns could match and + * when one does, it's label is returned. + * @package SimpleTest + * @subpackage WebTester + */ +class ParallelRegex { + private $patterns; + private $labels; + private $regex; + private $case; + + /** + * Constructor. Starts with no patterns. + * @param boolean $case True for case sensitive, false + * for insensitive. + * @access public + */ + function __construct($case) { + $this->case = $case; + $this->patterns = array(); + $this->labels = array(); + $this->regex = null; + } + + /** + * Adds a pattern with an optional label. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $label Label of regex to be returned + * on a match. + * @access public + */ + function addPattern($pattern, $label = true) { + $count = count($this->patterns); + $this->patterns[$count] = $pattern; + $this->labels[$count] = $label; + $this->regex = null; + } + + /** + * Attempts to match all patterns at once against + * a string. + * @param string $subject String to match against. + * @param string $match First matched portion of + * subject. + * @return boolean True on success. + * @access public + */ + function match($subject, &$match) { + if (count($this->patterns) == 0) { + return false; + } + if (! preg_match($this->getCompoundedRegex(), $subject, $matches)) { + $match = ''; + return false; + } + $match = $matches[0]; + for ($i = 1; $i < count($matches); $i++) { + if ($matches[$i]) { + return $this->labels[$i - 1]; + } + } + return true; + } + + /** + * Compounds the patterns into a single + * regular expression separated with the + * "or" operator. Caches the regex. + * Will automatically escape (, ) and / tokens. + * @param array $patterns List of patterns in order. + * @access private + */ + protected function getCompoundedRegex() { + if ($this->regex == null) { + for ($i = 0, $count = count($this->patterns); $i < $count; $i++) { + $this->patterns[$i] = '(' . str_replace( + array('/', '(', ')'), + array('\/', '\(', '\)'), + $this->patterns[$i]) . ')'; + } + $this->regex = "/" . implode("|", $this->patterns) . "/" . $this->getPerlMatchingFlags(); + } + return $this->regex; + } + + /** + * Accessor for perl regex mode flags to use. + * @return string Perl regex flags. + * @access private + */ + protected function getPerlMatchingFlags() { + return ($this->case ? "msS" : "msSi"); + } +} + +/** + * States for a stack machine. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleStateStack { + private $stack; + + /** + * Constructor. Starts in named state. + * @param string $start Starting state name. + * @access public + */ + function __construct($start) { + $this->stack = array($start); + } + + /** + * Accessor for current state. + * @return string State. + * @access public + */ + function getCurrent() { + return $this->stack[count($this->stack) - 1]; + } + + /** + * Adds a state to the stack and sets it + * to be the current state. + * @param string $state New state. + * @access public + */ + function enter($state) { + array_push($this->stack, $state); + } + + /** + * Leaves the current state and reverts + * to the previous one. + * @return boolean False if we drop off + * the bottom of the list. + * @access public + */ + function leave() { + if (count($this->stack) == 1) { + return false; + } + array_pop($this->stack); + return true; + } +} + +/** + * Accepts text and breaks it into tokens. + * Some optimisation to make the sure the + * content is only scanned by the PHP regex + * parser once. Lexer modes must not start + * with leading underscores. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleLexer { + private $regexes; + private $parser; + private $mode; + private $mode_handlers; + private $case; + + /** + * Sets up the lexer in case insensitive matching + * by default. + * @param SimpleSaxParser $parser Handling strategy by + * reference. + * @param string $start Starting handler. + * @param boolean $case True for case sensitive. + * @access public + */ + function __construct($parser, $start = "accept", $case = false) { + $this->case = $case; + $this->regexes = array(); + $this->parser = $parser; + $this->mode = new SimpleStateStack($start); + $this->mode_handlers = array($start => $start); + } + + /** + * Adds a token search pattern for a particular + * parsing mode. The pattern does not change the + * current mode. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @access public + */ + function addPattern($pattern, $mode = "accept") { + if (! isset($this->regexes[$mode])) { + $this->regexes[$mode] = new ParallelRegex($this->case); + } + $this->regexes[$mode]->addPattern($pattern); + if (! isset($this->mode_handlers[$mode])) { + $this->mode_handlers[$mode] = $mode; + } + } + + /** + * Adds a pattern that will enter a new parsing + * mode. Useful for entering parenthesis, strings, + * tags, etc. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @param string $new_mode Change parsing to this new + * nested mode. + * @access public + */ + function addEntryPattern($pattern, $mode, $new_mode) { + if (! isset($this->regexes[$mode])) { + $this->regexes[$mode] = new ParallelRegex($this->case); + } + $this->regexes[$mode]->addPattern($pattern, $new_mode); + if (! isset($this->mode_handlers[$new_mode])) { + $this->mode_handlers[$new_mode] = $new_mode; + } + } + + /** + * Adds a pattern that will exit the current mode + * and re-enter the previous one. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Mode to leave. + * @access public + */ + function addExitPattern($pattern, $mode) { + if (! isset($this->regexes[$mode])) { + $this->regexes[$mode] = new ParallelRegex($this->case); + } + $this->regexes[$mode]->addPattern($pattern, "__exit"); + if (! isset($this->mode_handlers[$mode])) { + $this->mode_handlers[$mode] = $mode; + } + } + + /** + * Adds a pattern that has a special mode. Acts as an entry + * and exit pattern in one go, effectively calling a special + * parser handler for this token only. + * @param string $pattern Perl style regex, but ( and ) + * lose the usual meaning. + * @param string $mode Should only apply this + * pattern when dealing with + * this type of input. + * @param string $special Use this mode for this one token. + * @access public + */ + function addSpecialPattern($pattern, $mode, $special) { + if (! isset($this->regexes[$mode])) { + $this->regexes[$mode] = new ParallelRegex($this->case); + } + $this->regexes[$mode]->addPattern($pattern, "_$special"); + if (! isset($this->mode_handlers[$special])) { + $this->mode_handlers[$special] = $special; + } + } + + /** + * Adds a mapping from a mode to another handler. + * @param string $mode Mode to be remapped. + * @param string $handler New target handler. + * @access public + */ + function mapHandler($mode, $handler) { + $this->mode_handlers[$mode] = $handler; + } + + /** + * Splits the page text into tokens. Will fail + * if the handlers report an error or if no + * content is consumed. If successful then each + * unparsed and parsed token invokes a call to the + * held listener. + * @param string $raw Raw HTML text. + * @return boolean True on success, else false. + * @access public + */ + function parse($raw) { + if (! isset($this->parser)) { + return false; + } + $length = strlen($raw); + while (is_array($parsed = $this->reduce($raw))) { + list($raw, $unmatched, $matched, $mode) = $parsed; + if (! $this->dispatchTokens($unmatched, $matched, $mode)) { + return false; + } + if ($raw === '') { + return true; + } + if (strlen($raw) == $length) { + return false; + } + $length = strlen($raw); + } + if (! $parsed) { + return false; + } + return $this->invokeParser($raw, LEXER_UNMATCHED); + } + + /** + * Sends the matched token and any leading unmatched + * text to the parser changing the lexer to a new + * mode if one is listed. + * @param string $unmatched Unmatched leading portion. + * @param string $matched Actual token match. + * @param string $mode Mode after match. A boolean + * false mode causes no change. + * @return boolean False if there was any error + * from the parser. + * @access private + */ + protected function dispatchTokens($unmatched, $matched, $mode = false) { + if (! $this->invokeParser($unmatched, LEXER_UNMATCHED)) { + return false; + } + if (is_bool($mode)) { + return $this->invokeParser($matched, LEXER_MATCHED); + } + if ($this->isModeEnd($mode)) { + if (! $this->invokeParser($matched, LEXER_EXIT)) { + return false; + } + return $this->mode->leave(); + } + if ($this->isSpecialMode($mode)) { + $this->mode->enter($this->decodeSpecial($mode)); + if (! $this->invokeParser($matched, LEXER_SPECIAL)) { + return false; + } + return $this->mode->leave(); + } + $this->mode->enter($mode); + return $this->invokeParser($matched, LEXER_ENTER); + } + + /** + * Tests to see if the new mode is actually to leave + * the current mode and pop an item from the matching + * mode stack. + * @param string $mode Mode to test. + * @return boolean True if this is the exit mode. + * @access private + */ + protected function isModeEnd($mode) { + return ($mode === "__exit"); + } + + /** + * Test to see if the mode is one where this mode + * is entered for this token only and automatically + * leaves immediately afterwoods. + * @param string $mode Mode to test. + * @return boolean True if this is the exit mode. + * @access private + */ + protected function isSpecialMode($mode) { + return (strncmp($mode, "_", 1) == 0); + } + + /** + * Strips the magic underscore marking single token + * modes. + * @param string $mode Mode to decode. + * @return string Underlying mode name. + * @access private + */ + protected function decodeSpecial($mode) { + return substr($mode, 1); + } + + /** + * Calls the parser method named after the current + * mode. Empty content will be ignored. The lexer + * has a parser handler for each mode in the lexer. + * @param string $content Text parsed. + * @param boolean $is_match Token is recognised rather + * than unparsed data. + * @access private + */ + protected function invokeParser($content, $is_match) { + if (($content === '') || ($content === false)) { + return true; + } + $handler = $this->mode_handlers[$this->mode->getCurrent()]; + return $this->parser->$handler($content, $is_match); + } + + /** + * Tries to match a chunk of text and if successful + * removes the recognised chunk and any leading + * unparsed data. Empty strings will not be matched. + * @param string $raw The subject to parse. This is the + * content that will be eaten. + * @return array/boolean Three item list of unparsed + * content followed by the + * recognised token and finally the + * action the parser is to take. + * True if no match, false if there + * is a parsing error. + * @access private + */ + protected function reduce($raw) { + if ($action = $this->regexes[$this->mode->getCurrent()]->match($raw, $match)) { + $unparsed_character_count = strpos($raw, $match); + $unparsed = substr($raw, 0, $unparsed_character_count); + $raw = substr($raw, $unparsed_character_count + strlen($match)); + return array($raw, $unparsed, $match, $action); + } + return true; + } +} + +/** + * Breaks HTML into SAX events. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleHtmlLexer extends SimpleLexer { + + /** + * Sets up the lexer with case insensitive matching + * and adds the HTML handlers. + * @param SimpleSaxParser $parser Handling strategy by + * reference. + * @access public + */ + function __construct($parser) { + parent::__construct($parser, 'text'); + $this->mapHandler('text', 'acceptTextToken'); + $this->addSkipping(); + foreach ($this->getParsedTags() as $tag) { + $this->addTag($tag); + } + $this->addInTagTokens(); + } + + /** + * List of parsed tags. Others are ignored. + * @return array List of searched for tags. + * @access private + */ + protected function getParsedTags() { + return array('a', 'base', 'title', 'form', 'input', 'button', 'textarea', 'select', + 'option', 'frameset', 'frame', 'label'); + } + + /** + * The lexer has to skip certain sections such + * as server code, client code and styles. + * @access private + */ + protected function addSkipping() { + $this->mapHandler('css', 'ignore'); + $this->addEntryPattern('addExitPattern('', 'css'); + $this->mapHandler('js', 'ignore'); + $this->addEntryPattern('addExitPattern('', 'js'); + $this->mapHandler('comment', 'ignore'); + $this->addEntryPattern('', 'comment'); + } + + /** + * Pattern matches to start and end a tag. + * @param string $tag Name of tag to scan for. + * @access private + */ + protected function addTag($tag) { + $this->addSpecialPattern("", 'text', 'acceptEndToken'); + $this->addEntryPattern("<$tag", 'text', 'tag'); + } + + /** + * Pattern matches to parse the inside of a tag + * including the attributes and their quoting. + * @access private + */ + protected function addInTagTokens() { + $this->mapHandler('tag', 'acceptStartToken'); + $this->addSpecialPattern('\s+', 'tag', 'ignore'); + $this->addAttributeTokens(); + $this->addExitPattern('/>', 'tag'); + $this->addExitPattern('>', 'tag'); + } + + /** + * Matches attributes that are either single quoted, + * double quoted or unquoted. + * @access private + */ + protected function addAttributeTokens() { + $this->mapHandler('dq_attribute', 'acceptAttributeToken'); + $this->addEntryPattern('=\s*"', 'tag', 'dq_attribute'); + $this->addPattern("\\\\\"", 'dq_attribute'); + $this->addExitPattern('"', 'dq_attribute'); + $this->mapHandler('sq_attribute', 'acceptAttributeToken'); + $this->addEntryPattern("=\s*'", 'tag', 'sq_attribute'); + $this->addPattern("\\\\'", 'sq_attribute'); + $this->addExitPattern("'", 'sq_attribute'); + $this->mapHandler('uq_attribute', 'acceptAttributeToken'); + $this->addSpecialPattern('=\s*[^>\s]*', 'tag', 'uq_attribute'); + } +} + +/** + * Converts HTML tokens into selected SAX events. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleHtmlSaxParser { + private $lexer; + private $listener; + private $tag; + private $attributes; + private $current_attribute; + + /** + * Sets the listener. + * @param SimpleSaxListener $listener SAX event handler. + * @access public + */ + function __construct($listener) { + $this->listener = $listener; + $this->lexer = $this->createLexer($this); + $this->tag = ''; + $this->attributes = array(); + $this->current_attribute = ''; + } + + /** + * Runs the content through the lexer which + * should call back to the acceptors. + * @param string $raw Page text to parse. + * @return boolean False if parse error. + * @access public + */ + function parse($raw) { + return $this->lexer->parse($raw); + } + + /** + * Sets up the matching lexer. Starts in 'text' mode. + * @param SimpleSaxParser $parser Event generator, usually $self. + * @return SimpleLexer Lexer suitable for this parser. + * @access public + */ + static function createLexer(&$parser) { + return new SimpleHtmlLexer($parser); + } + + /** + * Accepts a token from the tag mode. If the + * starting element completes then the element + * is dispatched and the current attributes + * set back to empty. The element or attribute + * name is converted to lower case. + * @param string $token Incoming characters. + * @param integer $event Lexer event type. + * @return boolean False if parse error. + * @access public + */ + function acceptStartToken($token, $event) { + if ($event == LEXER_ENTER) { + $this->tag = strtolower(substr($token, 1)); + return true; + } + if ($event == LEXER_EXIT) { + $success = $this->listener->startElement( + $this->tag, + $this->attributes); + $this->tag = ''; + $this->attributes = array(); + return $success; + } + if ($token != '=') { + $this->current_attribute = strtolower(SimpleHtmlSaxParser::decodeHtml($token)); + $this->attributes[$this->current_attribute] = ''; + } + return true; + } + + /** + * Accepts a token from the end tag mode. + * The element name is converted to lower case. + * @param string $token Incoming characters. + * @param integer $event Lexer event type. + * @return boolean False if parse error. + * @access public + */ + function acceptEndToken($token, $event) { + if (! preg_match('/<\/(.*)>/', $token, $matches)) { + return false; + } + return $this->listener->endElement(strtolower($matches[1])); + } + + /** + * Part of the tag data. + * @param string $token Incoming characters. + * @param integer $event Lexer event type. + * @return boolean False if parse error. + * @access public + */ + function acceptAttributeToken($token, $event) { + if ($this->current_attribute) { + if ($event == LEXER_UNMATCHED) { + $this->attributes[$this->current_attribute] .= + SimpleHtmlSaxParser::decodeHtml($token); + } + if ($event == LEXER_SPECIAL) { + $this->attributes[$this->current_attribute] .= + preg_replace('/^=\s*/' , '', SimpleHtmlSaxParser::decodeHtml($token)); + } + } + return true; + } + + /** + * A character entity. + * @param string $token Incoming characters. + * @param integer $event Lexer event type. + * @return boolean False if parse error. + * @access public + */ + function acceptEntityToken($token, $event) { + } + + /** + * Character data between tags regarded as + * important. + * @param string $token Incoming characters. + * @param integer $event Lexer event type. + * @return boolean False if parse error. + * @access public + */ + function acceptTextToken($token, $event) { + return $this->listener->addContent($token); + } + + /** + * Incoming data to be ignored. + * @param string $token Incoming characters. + * @param integer $event Lexer event type. + * @return boolean False if parse error. + * @access public + */ + function ignore($token, $event) { + return true; + } + + /** + * Decodes any HTML entities. + * @param string $html Incoming HTML. + * @return string Outgoing plain text. + * @access public + */ + static function decodeHtml($html) { + return html_entity_decode($html, ENT_QUOTES); + } + + /** + * Turns HTML into text browser visible text. Images + * are converted to their alt text and tags are supressed. + * Entities are converted to their visible representation. + * @param string $html HTML to convert. + * @return string Plain text. + * @access public + */ + static function normalise($html) { + $text = preg_replace('||', '', $html); + $text = preg_replace('|]*>.*?|', '', $text); + $text = preg_replace('|]*alt\s*=\s*"([^"]*)"[^>]*>|', ' \1 ', $text); + $text = preg_replace('|]*alt\s*=\s*\'([^\']*)\'[^>]*>|', ' \1 ', $text); + $text = preg_replace('|]*alt\s*=\s*([a-zA-Z_]+)[^>]*>|', ' \1 ', $text); + $text = preg_replace('|<[^>]*>|', '', $text); + $text = SimpleHtmlSaxParser::decodeHtml($text); + $text = preg_replace('|\s+|', ' ', $text); + return trim(trim($text), "\xA0"); // TODO: The \xAO is a  . Add a test for this. + } +} + +/** + * SAX event handler. + * @package SimpleTest + * @subpackage WebTester + * @abstract + */ +class SimpleSaxListener { + + /** + * Sets the document to write to. + * @access public + */ + function __construct() { + } + + /** + * Start of element event. + * @param string $name Element name. + * @param hash $attributes Name value pairs. + * Attributes without content + * are marked as true. + * @return boolean False on parse error. + * @access public + */ + function startElement($name, $attributes) { + } + + /** + * End of element event. + * @param string $name Element name. + * @return boolean False on parse error. + * @access public + */ + function endElement($name) { + } + + /** + * Unparsed, but relevant data. + * @param string $text May include unparsed tags. + * @return boolean False on parse error. + * @access public + */ + function addContent($text) { + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reflection_php4.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reflection_php4.php new file mode 100644 index 0000000..6c93915 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reflection_php4.php @@ -0,0 +1,136 @@ +_interface = $interface; + } + + /** + * Checks that a class has been declared. + * @return boolean True if defined. + * @access public + */ + function classExists() { + return class_exists($this->_interface); + } + + /** + * Needed to kill the autoload feature in PHP5 + * for classes created dynamically. + * @return boolean True if defined. + * @access public + */ + function classExistsSansAutoload() { + return class_exists($this->_interface); + } + + /** + * Checks that a class or interface has been + * declared. + * @return boolean True if defined. + * @access public + */ + function classOrInterfaceExists() { + return class_exists($this->_interface); + } + + /** + * Needed to kill the autoload feature in PHP5 + * for classes created dynamically. + * @return boolean True if defined. + * @access public + */ + function classOrInterfaceExistsSansAutoload() { + return class_exists($this->_interface); + } + + /** + * Gets the list of methods on a class or + * interface. + * @returns array List of method names. + * @access public + */ + function getMethods() { + return get_class_methods($this->_interface); + } + + /** + * Gets the list of interfaces from a class. If the + * class name is actually an interface then just that + * interface is returned. + * @returns array List of interfaces. + * @access public + */ + function getInterfaces() { + return array(); + } + + /** + * Finds the parent class name. + * @returns string Parent class name. + * @access public + */ + function getParent() { + return strtolower(get_parent_class($this->_interface)); + } + + /** + * Determines if the class is abstract, which for PHP 4 + * will never be the case. + * @returns boolean True if abstract. + * @access public + */ + function isAbstract() { + return false; + } + + /** + * Determines if the the entity is an interface, which for PHP 4 + * will never be the case. + * @returns boolean True if interface. + * @access public + */ + function isInterface() { + return false; + } + + /** + * Scans for final methods, but as it's PHP 4 there + * aren't any. + * @returns boolean True if the class has a final method. + * @access public + */ + function hasFinal() { + return false; + } + + /** + * Gets the source code matching the declaration + * of a method. + * @param string $method Method name. + * @access public + */ + function getSignature($method) { + return "function &$method()"; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reflection_php5.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reflection_php5.php new file mode 100644 index 0000000..02cceb5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reflection_php5.php @@ -0,0 +1,386 @@ +interface = $interface; + } + + /** + * Checks that a class has been declared. Versions + * before PHP5.0.2 need a check that it's not really + * an interface. + * @return boolean True if defined. + * @access public + */ + function classExists() { + if (! class_exists($this->interface)) { + return false; + } + $reflection = new ReflectionClass($this->interface); + return ! $reflection->isInterface(); + } + + /** + * Needed to kill the autoload feature in PHP5 + * for classes created dynamically. + * @return boolean True if defined. + * @access public + */ + function classExistsSansAutoload() { + return class_exists($this->interface, false); + } + + /** + * Checks that a class or interface has been + * declared. + * @return boolean True if defined. + * @access public + */ + function classOrInterfaceExists() { + return $this->classOrInterfaceExistsWithAutoload($this->interface, true); + } + + /** + * Needed to kill the autoload feature in PHP5 + * for classes created dynamically. + * @return boolean True if defined. + * @access public + */ + function classOrInterfaceExistsSansAutoload() { + return $this->classOrInterfaceExistsWithAutoload($this->interface, false); + } + + /** + * Needed to select the autoload feature in PHP5 + * for classes created dynamically. + * @param string $interface Class or interface name. + * @param boolean $autoload True totriggerautoload. + * @return boolean True if interface defined. + * @access private + */ + protected function classOrInterfaceExistsWithAutoload($interface, $autoload) { + if (function_exists('interface_exists')) { + if (interface_exists($this->interface, $autoload)) { + return true; + } + } + return class_exists($this->interface, $autoload); + } + + /** + * Gets the list of methods on a class or + * interface. + * @returns array List of method names. + * @access public + */ + function getMethods() { + return array_unique(get_class_methods($this->interface)); + } + + /** + * Gets the list of interfaces from a class. If the + * class name is actually an interface then just that + * interface is returned. + * @returns array List of interfaces. + * @access public + */ + function getInterfaces() { + $reflection = new ReflectionClass($this->interface); + if ($reflection->isInterface()) { + return array($this->interface); + } + return $this->onlyParents($reflection->getInterfaces()); + } + + /** + * Gets the list of methods for the implemented + * interfaces only. + * @returns array List of enforced method signatures. + * @access public + */ + function getInterfaceMethods() { + $methods = array(); + foreach ($this->getInterfaces() as $interface) { + $methods = array_merge($methods, get_class_methods($interface)); + } + return array_unique($methods); + } + + /** + * Checks to see if the method signature has to be tightly + * specified. + * @param string $method Method name. + * @returns boolean True if enforced. + * @access private + */ + protected function isInterfaceMethod($method) { + return in_array($method, $this->getInterfaceMethods()); + } + + /** + * Finds the parent class name. + * @returns string Parent class name. + * @access public + */ + function getParent() { + $reflection = new ReflectionClass($this->interface); + $parent = $reflection->getParentClass(); + if ($parent) { + return $parent->getName(); + } + return false; + } + + /** + * Trivially determines if the class is abstract. + * @returns boolean True if abstract. + * @access public + */ + function isAbstract() { + $reflection = new ReflectionClass($this->interface); + return $reflection->isAbstract(); + } + + /** + * Trivially determines if the class is an interface. + * @returns boolean True if interface. + * @access public + */ + function isInterface() { + $reflection = new ReflectionClass($this->interface); + return $reflection->isInterface(); + } + + /** + * Scans for final methods, as they screw up inherited + * mocks by not allowing you to override them. + * @returns boolean True if the class has a final method. + * @access public + */ + function hasFinal() { + $reflection = new ReflectionClass($this->interface); + foreach ($reflection->getMethods() as $method) { + if ($method->isFinal()) { + return true; + } + } + return false; + } + + /** + * Whittles a list of interfaces down to only the + * necessary top level parents. + * @param array $interfaces Reflection API interfaces + * to reduce. + * @returns array List of parent interface names. + * @access private + */ + protected function onlyParents($interfaces) { + $parents = array(); + $blacklist = array(); + foreach ($interfaces as $interface) { + foreach($interfaces as $possible_parent) { + if ($interface->getName() == $possible_parent->getName()) { + continue; + } + if ($interface->isSubClassOf($possible_parent)) { + $blacklist[$possible_parent->getName()] = true; + } + } + if (!isset($blacklist[$interface->getName()])) { + $parents[] = $interface->getName(); + } + } + return $parents; + } + + /** + * Checks whether a method is abstract or not. + * @param string $name Method name. + * @return bool true if method is abstract, else false + * @access private + */ + protected function isAbstractMethod($name) { + $interface = new ReflectionClass($this->interface); + if (! $interface->hasMethod($name)) { + return false; + } + return $interface->getMethod($name)->isAbstract(); + } + + /** + * Checks whether a method is the constructor. + * @param string $name Method name. + * @return bool true if method is the constructor + * @access private + */ + protected function isConstructor($name) { + return ($name == '__construct') || ($name == $this->interface); + } + + /** + * Checks whether a method is abstract in all parents or not. + * @param string $name Method name. + * @return bool true if method is abstract in parent, else false + * @access private + */ + protected function isAbstractMethodInParents($name) { + $interface = new ReflectionClass($this->interface); + $parent = $interface->getParentClass(); + while($parent) { + if (! $parent->hasMethod($name)) { + return false; + } + if ($parent->getMethod($name)->isAbstract()) { + return true; + } + $parent = $parent->getParentClass(); + } + return false; + } + + /** + * Checks whether a method is static or not. + * @param string $name Method name + * @return bool true if method is static, else false + * @access private + */ + protected function isStaticMethod($name) { + $interface = new ReflectionClass($this->interface); + if (! $interface->hasMethod($name)) { + return false; + } + return $interface->getMethod($name)->isStatic(); + } + + /** + * Writes the source code matching the declaration + * of a method. + * @param string $name Method name. + * @return string Method signature up to last + * bracket. + * @access public + */ + function getSignature($name) { + if ($name == '__set') { + return 'function __set($key, $value)'; + } + if ($name == '__call') { + return 'function __call($method, $arguments)'; + } + if (version_compare(phpversion(), '5.1.0', '>=')) { + if (in_array($name, array('__get', '__isset', $name == '__unset'))) { + return "function {$name}(\$key)"; + } + } + if ($name == '__toString') { + return "function $name()"; + } + + // This wonky try-catch is a work around for a faulty method_exists() + // in early versions of PHP 5 which would return false for static + // methods. The Reflection classes work fine, but hasMethod() + // doesn't exist prior to PHP 5.1.0, so we need to use a more crude + // detection method. + try { + $interface = new ReflectionClass($this->interface); + $interface->getMethod($name); + } catch (ReflectionException $e) { + return "function $name()"; + } + return $this->getFullSignature($name); + } + + /** + * For a signature specified in an interface, full + * details must be replicated to be a valid implementation. + * @param string $name Method name. + * @return string Method signature up to last + * bracket. + * @access private + */ + protected function getFullSignature($name) { + $interface = new ReflectionClass($this->interface); + $method = $interface->getMethod($name); + $reference = $method->returnsReference() ? '&' : ''; + $static = $method->isStatic() ? 'static ' : ''; + return "{$static}function $reference$name(" . + implode(', ', $this->getParameterSignatures($method)) . + ")"; + } + + /** + * Gets the source code for each parameter. + * @param ReflectionMethod $method Method object from + * reflection API + * @return array List of strings, each + * a snippet of code. + * @access private + */ + protected function getParameterSignatures($method) { + $signatures = array(); + foreach ($method->getParameters() as $parameter) { + $signature = ''; + $type = $parameter->getClass(); + if (is_null($type) && version_compare(phpversion(), '5.1.0', '>=') && $parameter->isArray()) { + $signature .= 'array '; + } elseif (!is_null($type)) { + $signature .= $type->getName() . ' '; + } + if ($parameter->isPassedByReference()) { + $signature .= '&'; + } + $signature .= '$' . $this->suppressSpurious($parameter->getName()); + if ($this->isOptional($parameter)) { + $signature .= ' = null'; + } + $signatures[] = $signature; + } + return $signatures; + } + + /** + * The SPL library has problems with the + * Reflection library. In particular, you can + * get extra characters in parameter names :(. + * @param string $name Parameter name. + * @return string Cleaner name. + * @access private + */ + protected function suppressSpurious($name) { + return str_replace(array('[', ']', ' '), '', $name); + } + + /** + * Test of a reflection parameter being optional + * that works with early versions of PHP5. + * @param reflectionParameter $parameter Is this optional. + * @return boolean True if optional. + * @access private + */ + protected function isOptional($parameter) { + if (method_exists($parameter, 'isOptional')) { + return $parameter->isOptional(); + } + return false; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/remote.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/remote.php new file mode 100644 index 0000000..43cc40f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/remote.php @@ -0,0 +1,115 @@ +url = $url; + $this->dry_url = $dry_url ? $dry_url : $url; + $this->size = false; + } + + /** + * Accessor for the test name for subclasses. + * @return string Name of the test. + * @access public + */ + function getLabel() { + return $this->url; + } + + /** + * Runs the top level test for this class. Currently + * reads the data as a single chunk. I'll fix this + * once I have added iteration to the browser. + * @param SimpleReporter $reporter Target of test results. + * @returns boolean True if no failures. + * @access public + */ + function run($reporter) { + $browser = $this->createBrowser(); + $xml = $browser->get($this->url); + if (! $xml) { + trigger_error('Cannot read remote test URL [' . $this->url . ']'); + return false; + } + $parser = $this->createParser($reporter); + if (! $parser->parse($xml)) { + trigger_error('Cannot parse incoming XML from [' . $this->url . ']'); + return false; + } + return true; + } + + /** + * Creates a new web browser object for fetching + * the XML report. + * @return SimpleBrowser New browser. + * @access protected + */ + protected function createBrowser() { + return new SimpleBrowser(); + } + + /** + * Creates the XML parser. + * @param SimpleReporter $reporter Target of test results. + * @return SimpleTestXmlListener XML reader. + * @access protected + */ + protected function createParser($reporter) { + return new SimpleTestXmlParser($reporter); + } + + /** + * Accessor for the number of subtests. + * @return integer Number of test cases. + * @access public + */ + function getSize() { + if ($this->size === false) { + $browser = $this->createBrowser(); + $xml = $browser->get($this->dry_url); + if (! $xml) { + trigger_error('Cannot read remote test URL [' . $this->dry_url . ']'); + return false; + } + $reporter = new SimpleReporter(); + $parser = $this->createParser($reporter); + if (! $parser->parse($xml)) { + trigger_error('Cannot parse incoming XML from [' . $this->dry_url . ']'); + return false; + } + $this->size = $reporter->getTestCaseCount(); + } + return $this->size; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reporter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reporter.php new file mode 100644 index 0000000..aaed016 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/reporter.php @@ -0,0 +1,446 @@ +character_set = $character_set; + } + + /** + * Paints the top of the web page setting the + * title to the name of the starting test. + * @param string $test_name Name class of test. + * @access public + */ + function paintHeader($test_name) { + $this->sendNoCacheHeaders(); + print ""; + print "\n\n$test_name\n"; + print "\n"; + print "\n"; + print "\n\n"; + print "

    $test_name

    \n"; + flush(); + } + + /** + * Send the headers necessary to ensure the page is + * reloaded on every request. Otherwise you could be + * scratching your head over out of date test data. + * @access public + */ + static function sendNoCacheHeaders() { + if (! headers_sent()) { + header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); + header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); + header("Cache-Control: no-store, no-cache, must-revalidate"); + header("Cache-Control: post-check=0, pre-check=0", false); + header("Pragma: no-cache"); + } + } + + /** + * Paints the CSS. Add additional styles here. + * @return string CSS code as text. + * @access protected + */ + protected function getCss() { + return ".fail { background-color: inherit; color: red; }" . + ".pass { background-color: inherit; color: green; }" . + " pre { background-color: lightgray; color: inherit; }"; + } + + /** + * Paints the end of the test with a summary of + * the passes and failures. + * @param string $test_name Name class of test. + * @access public + */ + function paintFooter($test_name) { + $colour = ($this->getFailCount() + $this->getExceptionCount() > 0 ? "red" : "green"); + print "
    "; + print $this->getTestCaseProgress() . "/" . $this->getTestCaseCount(); + print " test cases complete:\n"; + print "" . $this->getPassCount() . " passes, "; + print "" . $this->getFailCount() . " fails and "; + print "" . $this->getExceptionCount() . " exceptions."; + print "
    \n"; + print "\n\n"; + } + + /** + * Paints the test failure with a breadcrumbs + * trail of the nesting test suites below the + * top level test. + * @param string $message Failure message displayed in + * the context of the other tests. + * @access public + */ + function paintFail($message) { + parent::paintFail($message); + print "Fail: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode(" -> ", $breadcrumb); + print " -> " . $this->htmlEntities($message) . "
    \n"; + } + + /** + * Paints a PHP error. + * @param string $message Message is ignored. + * @access public + */ + function paintError($message) { + parent::paintError($message); + print "Exception: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode(" -> ", $breadcrumb); + print " -> " . $this->htmlEntities($message) . "
    \n"; + } + + /** + * Paints a PHP exception. + * @param Exception $exception Exception to display. + * @access public + */ + function paintException($exception) { + parent::paintException($exception); + print "Exception: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode(" -> ", $breadcrumb); + $message = 'Unexpected exception of type [' . get_class($exception) . + '] with message ['. $exception->getMessage() . + '] in ['. $exception->getFile() . + ' line ' . $exception->getLine() . ']'; + print " -> " . $this->htmlEntities($message) . "
    \n"; + } + + /** + * Prints the message for skipping tests. + * @param string $message Text of skip condition. + * @access public + */ + function paintSkip($message) { + parent::paintSkip($message); + print "Skipped: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode(" -> ", $breadcrumb); + print " -> " . $this->htmlEntities($message) . "
    \n"; + } + + /** + * Paints formatted text such as dumped privateiables. + * @param string $message Text to show. + * @access public + */ + function paintFormattedMessage($message) { + print '
    ' . $this->htmlEntities($message) . '
    '; + } + + /** + * Character set adjusted entity conversion. + * @param string $message Plain text or Unicode message. + * @return string Browser readable message. + * @access protected + */ + protected function htmlEntities($message) { + return htmlentities($message, ENT_COMPAT, $this->character_set); + } +} + +/** + * Sample minimal test displayer. Generates only + * failure messages and a pass count. For command + * line use. I've tried to make it look like JUnit, + * but I wanted to output the errors as they arrived + * which meant dropping the dots. + * @package SimpleTest + * @subpackage UnitTester + */ +class TextReporter extends SimpleReporter { + + /** + * Does nothing yet. The first output will + * be sent on the first test start. + * @access public + */ + function __construct() { + parent::__construct(); + } + + /** + * Paints the title only. + * @param string $test_name Name class of test. + * @access public + */ + function paintHeader($test_name) { + if (! SimpleReporter::inCli()) { + header('Content-type: text/plain'); + } + print "$test_name\n"; + flush(); + } + + /** + * Paints the end of the test with a summary of + * the passes and failures. + * @param string $test_name Name class of test. + * @access public + */ + function paintFooter($test_name) { + if ($this->getFailCount() + $this->getExceptionCount() == 0) { + print "OK\n"; + } else { + print "FAILURES!!!\n"; + } + print "Test cases run: " . $this->getTestCaseProgress() . + "/" . $this->getTestCaseCount() . + ", Passes: " . $this->getPassCount() . + ", Failures: " . $this->getFailCount() . + ", Exceptions: " . $this->getExceptionCount() . "\n"; + } + + /** + * Paints the test failure as a stack trace. + * @param string $message Failure message displayed in + * the context of the other tests. + * @access public + */ + function paintFail($message) { + parent::paintFail($message); + print $this->getFailCount() . ") $message\n"; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print "\tin " . implode("\n\tin ", array_reverse($breadcrumb)); + print "\n"; + } + + /** + * Paints a PHP error or exception. + * @param string $message Message to be shown. + * @access public + * @abstract + */ + function paintError($message) { + parent::paintError($message); + print "Exception " . $this->getExceptionCount() . "!\n$message\n"; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print "\tin " . implode("\n\tin ", array_reverse($breadcrumb)); + print "\n"; + } + + /** + * Paints a PHP error or exception. + * @param Exception $exception Exception to describe. + * @access public + * @abstract + */ + function paintException($exception) { + parent::paintException($exception); + $message = 'Unexpected exception of type [' . get_class($exception) . + '] with message ['. $exception->getMessage() . + '] in ['. $exception->getFile() . + ' line ' . $exception->getLine() . ']'; + print "Exception " . $this->getExceptionCount() . "!\n$message\n"; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print "\tin " . implode("\n\tin ", array_reverse($breadcrumb)); + print "\n"; + } + + /** + * Prints the message for skipping tests. + * @param string $message Text of skip condition. + * @access public + */ + function paintSkip($message) { + parent::paintSkip($message); + print "Skip: $message\n"; + } + + /** + * Paints formatted text such as dumped privateiables. + * @param string $message Text to show. + * @access public + */ + function paintFormattedMessage($message) { + print "$message\n"; + flush(); + } +} + +/** + * Runs just a single test group, a single case or + * even a single test within that case. + * @package SimpleTest + * @subpackage UnitTester + */ +class SelectiveReporter extends SimpleReporterDecorator { + private $just_this_case = false; + private $just_this_test = false; + private $on; + + /** + * Selects the test case or group to be run, + * and optionally a specific test. + * @param SimpleScorer $reporter Reporter to receive events. + * @param string $just_this_case Only this case or group will run. + * @param string $just_this_test Only this test method will run. + */ + function __construct($reporter, $just_this_case = false, $just_this_test = false) { + if (isset($just_this_case) && $just_this_case) { + $this->just_this_case = strtolower($just_this_case); + $this->off(); + } else { + $this->on(); + } + if (isset($just_this_test) && $just_this_test) { + $this->just_this_test = strtolower($just_this_test); + } + parent::__construct($reporter); + } + + /** + * Compares criteria to actual the case/group name. + * @param string $test_case The incoming test. + * @return boolean True if matched. + * @access protected + */ + protected function matchesTestCase($test_case) { + return $this->just_this_case == strtolower($test_case); + } + + /** + * Compares criteria to actual the test name. If no + * name was specified at the beginning, then all tests + * can run. + * @param string $method The incoming test method. + * @return boolean True if matched. + * @access protected + */ + protected function shouldRunTest($test_case, $method) { + if ($this->isOn() || $this->matchesTestCase($test_case)) { + if ($this->just_this_test) { + return $this->just_this_test == strtolower($method); + } else { + return true; + } + } + return false; + } + + /** + * Switch on testing for the group or subgroup. + * @access private + */ + protected function on() { + $this->on = true; + } + + /** + * Switch off testing for the group or subgroup. + * @access private + */ + protected function off() { + $this->on = false; + } + + /** + * Is this group actually being tested? + * @return boolean True if the current test group is active. + * @access private + */ + protected function isOn() { + return $this->on; + } + + /** + * Veto everything that doesn't match the method wanted. + * @param string $test_case Name of test case. + * @param string $method Name of test method. + * @return boolean True if test should be run. + * @access public + */ + function shouldInvoke($test_case, $method) { + if ($this->shouldRunTest($test_case, $method)) { + return $this->reporter->shouldInvoke($test_case, $method); + } + return false; + } + + /** + * Paints the start of a group test. + * @param string $test_case Name of test or other label. + * @param integer $size Number of test cases starting. + * @access public + */ + function paintGroupStart($test_case, $size) { + if ($this->just_this_case && $this->matchesTestCase($test_case)) { + $this->on(); + } + $this->reporter->paintGroupStart($test_case, $size); + } + + /** + * Paints the end of a group test. + * @param string $test_case Name of test or other label. + * @access public + */ + function paintGroupEnd($test_case) { + $this->reporter->paintGroupEnd($test_case); + if ($this->just_this_case && $this->matchesTestCase($test_case)) { + $this->off(); + } + } +} + +/** + * Suppresses skip messages. + * @package SimpleTest + * @subpackage UnitTester + */ +class NoSkipsReporter extends SimpleReporterDecorator { + + /** + * Does nothing. + * @param string $message Text of skip condition. + * @access public + */ + function paintSkip($message) { } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/scorer.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/scorer.php new file mode 100644 index 0000000..fa7c543 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/scorer.php @@ -0,0 +1,862 @@ +passes = 0; + $this->fails = 0; + $this->exceptions = 0; + $this->is_dry_run = false; + } + + /** + * Signals that the next evaluation will be a dry + * run. That is, the structure events will be + * recorded, but no tests will be run. + * @param boolean $is_dry Dry run if true. + * @access public + */ + function makeDry($is_dry = true) { + $this->is_dry_run = $is_dry; + } + + /** + * The reporter has a veto on what should be run. + * @param string $test_case_name name of test case. + * @param string $method Name of test method. + * @access public + */ + function shouldInvoke($test_case_name, $method) { + return ! $this->is_dry_run; + } + + /** + * Can wrap the invoker in preperation for running + * a test. + * @param SimpleInvoker $invoker Individual test runner. + * @return SimpleInvoker Wrapped test runner. + * @access public + */ + function createInvoker($invoker) { + return $invoker; + } + + /** + * Accessor for current status. Will be false + * if there have been any failures or exceptions. + * Used for command line tools. + * @return boolean True if no failures. + * @access public + */ + function getStatus() { + if ($this->exceptions + $this->fails > 0) { + return false; + } + return true; + } + + /** + * Paints the start of a group test. + * @param string $test_name Name of test or other label. + * @param integer $size Number of test cases starting. + * @access public + */ + function paintGroupStart($test_name, $size) { + } + + /** + * Paints the end of a group test. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintGroupEnd($test_name) { + } + + /** + * Paints the start of a test case. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintCaseStart($test_name) { + } + + /** + * Paints the end of a test case. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintCaseEnd($test_name) { + } + + /** + * Paints the start of a test method. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintMethodStart($test_name) { + } + + /** + * Paints the end of a test method. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintMethodEnd($test_name) { + } + + /** + * Increments the pass count. + * @param string $message Message is ignored. + * @access public + */ + function paintPass($message) { + $this->passes++; + } + + /** + * Increments the fail count. + * @param string $message Message is ignored. + * @access public + */ + function paintFail($message) { + $this->fails++; + } + + /** + * Deals with PHP 4 throwing an error. + * @param string $message Text of error formatted by + * the test case. + * @access public + */ + function paintError($message) { + $this->exceptions++; + } + + /** + * Deals with PHP 5 throwing an exception. + * @param Exception $exception The actual exception thrown. + * @access public + */ + function paintException($exception) { + $this->exceptions++; + } + + /** + * Prints the message for skipping tests. + * @param string $message Text of skip condition. + * @access public + */ + function paintSkip($message) { + } + + /** + * Accessor for the number of passes so far. + * @return integer Number of passes. + * @access public + */ + function getPassCount() { + return $this->passes; + } + + /** + * Accessor for the number of fails so far. + * @return integer Number of fails. + * @access public + */ + function getFailCount() { + return $this->fails; + } + + /** + * Accessor for the number of untrapped errors + * so far. + * @return integer Number of exceptions. + * @access public + */ + function getExceptionCount() { + return $this->exceptions; + } + + /** + * Paints a simple supplementary message. + * @param string $message Text to display. + * @access public + */ + function paintMessage($message) { + } + + /** + * Paints a formatted ASCII message such as a + * privateiable dump. + * @param string $message Text to display. + * @access public + */ + function paintFormattedMessage($message) { + } + + /** + * By default just ignores user generated events. + * @param string $type Event type as text. + * @param mixed $payload Message or object. + * @access public + */ + function paintSignal($type, $payload) { + } +} + +/** + * Recipient of generated test messages that can display + * page footers and headers. Also keeps track of the + * test nesting. This is the main base class on which + * to build the finished test (page based) displays. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleReporter extends SimpleScorer { + private $test_stack; + private $size; + private $progress; + + /** + * Starts the display with no results in. + * @access public + */ + function __construct() { + parent::__construct(); + $this->test_stack = array(); + $this->size = null; + $this->progress = 0; + } + + /** + * Gets the formatter for privateiables and other small + * generic data items. + * @return SimpleDumper Formatter. + * @access public + */ + function getDumper() { + return new SimpleDumper(); + } + + /** + * Paints the start of a group test. Will also paint + * the page header and footer if this is the + * first test. Will stash the size if the first + * start. + * @param string $test_name Name of test that is starting. + * @param integer $size Number of test cases starting. + * @access public + */ + function paintGroupStart($test_name, $size) { + if (! isset($this->size)) { + $this->size = $size; + } + if (count($this->test_stack) == 0) { + $this->paintHeader($test_name); + } + $this->test_stack[] = $test_name; + } + + /** + * Paints the end of a group test. Will paint the page + * footer if the stack of tests has unwound. + * @param string $test_name Name of test that is ending. + * @param integer $progress Number of test cases ending. + * @access public + */ + function paintGroupEnd($test_name) { + array_pop($this->test_stack); + if (count($this->test_stack) == 0) { + $this->paintFooter($test_name); + } + } + + /** + * Paints the start of a test case. Will also paint + * the page header and footer if this is the + * first test. Will stash the size if the first + * start. + * @param string $test_name Name of test that is starting. + * @access public + */ + function paintCaseStart($test_name) { + if (! isset($this->size)) { + $this->size = 1; + } + if (count($this->test_stack) == 0) { + $this->paintHeader($test_name); + } + $this->test_stack[] = $test_name; + } + + /** + * Paints the end of a test case. Will paint the page + * footer if the stack of tests has unwound. + * @param string $test_name Name of test that is ending. + * @access public + */ + function paintCaseEnd($test_name) { + $this->progress++; + array_pop($this->test_stack); + if (count($this->test_stack) == 0) { + $this->paintFooter($test_name); + } + } + + /** + * Paints the start of a test method. + * @param string $test_name Name of test that is starting. + * @access public + */ + function paintMethodStart($test_name) { + $this->test_stack[] = $test_name; + } + + /** + * Paints the end of a test method. Will paint the page + * footer if the stack of tests has unwound. + * @param string $test_name Name of test that is ending. + * @access public + */ + function paintMethodEnd($test_name) { + array_pop($this->test_stack); + } + + /** + * Paints the test document header. + * @param string $test_name First test top level + * to start. + * @access public + * @abstract + */ + function paintHeader($test_name) { + } + + /** + * Paints the test document footer. + * @param string $test_name The top level test. + * @access public + * @abstract + */ + function paintFooter($test_name) { + } + + /** + * Accessor for internal test stack. For + * subclasses that need to see the whole test + * history for display purposes. + * @return array List of methods in nesting order. + * @access public + */ + function getTestList() { + return $this->test_stack; + } + + /** + * Accessor for total test size in number + * of test cases. Null until the first + * test is started. + * @return integer Total number of cases at start. + * @access public + */ + function getTestCaseCount() { + return $this->size; + } + + /** + * Accessor for the number of test cases + * completed so far. + * @return integer Number of ended cases. + * @access public + */ + function getTestCaseProgress() { + return $this->progress; + } + + /** + * Static check for running in the comand line. + * @return boolean True if CLI. + * @access public + */ + static function inCli() { + return php_sapi_name() == 'cli'; + } +} + +/** + * For modifying the behaviour of the visual reporters. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleReporterDecorator { + protected $reporter; + + /** + * Mediates between the reporter and the test case. + * @param SimpleScorer $reporter Reporter to receive events. + */ + function __construct($reporter) { + $this->reporter = $reporter; + } + + /** + * Signals that the next evaluation will be a dry + * run. That is, the structure events will be + * recorded, but no tests will be run. + * @param boolean $is_dry Dry run if true. + * @access public + */ + function makeDry($is_dry = true) { + $this->reporter->makeDry($is_dry); + } + + /** + * Accessor for current status. Will be false + * if there have been any failures or exceptions. + * Used for command line tools. + * @return boolean True if no failures. + * @access public + */ + function getStatus() { + return $this->reporter->getStatus(); + } + + /** + * The reporter has a veto on what should be run. + * @param string $test_case_name name of test case. + * @param string $method Name of test method. + * @return boolean True if test should be run. + * @access public + */ + function shouldInvoke($test_case_name, $method) { + return $this->reporter->shouldInvoke($test_case_name, $method); + } + + /** + * Can wrap the invoker in preperation for running + * a test. + * @param SimpleInvoker $invoker Individual test runner. + * @return SimpleInvoker Wrapped test runner. + * @access public + */ + function createInvoker($invoker) { + return $this->reporter->createInvoker($invoker); + } + + /** + * Gets the formatter for privateiables and other small + * generic data items. + * @return SimpleDumper Formatter. + * @access public + */ + function getDumper() { + return $this->reporter->getDumper(); + } + + /** + * Paints the start of a group test. + * @param string $test_name Name of test or other label. + * @param integer $size Number of test cases starting. + * @access public + */ + function paintGroupStart($test_name, $size) { + $this->reporter->paintGroupStart($test_name, $size); + } + + /** + * Paints the end of a group test. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintGroupEnd($test_name) { + $this->reporter->paintGroupEnd($test_name); + } + + /** + * Paints the start of a test case. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintCaseStart($test_name) { + $this->reporter->paintCaseStart($test_name); + } + + /** + * Paints the end of a test case. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintCaseEnd($test_name) { + $this->reporter->paintCaseEnd($test_name); + } + + /** + * Paints the start of a test method. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintMethodStart($test_name) { + $this->reporter->paintMethodStart($test_name); + } + + /** + * Paints the end of a test method. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintMethodEnd($test_name) { + $this->reporter->paintMethodEnd($test_name); + } + + /** + * Chains to the wrapped reporter. + * @param string $message Message is ignored. + * @access public + */ + function paintPass($message) { + $this->reporter->paintPass($message); + } + + /** + * Chains to the wrapped reporter. + * @param string $message Message is ignored. + * @access public + */ + function paintFail($message) { + $this->reporter->paintFail($message); + } + + /** + * Chains to the wrapped reporter. + * @param string $message Text of error formatted by + * the test case. + * @access public + */ + function paintError($message) { + $this->reporter->paintError($message); + } + + /** + * Chains to the wrapped reporter. + * @param Exception $exception Exception to show. + * @access public + */ + function paintException($exception) { + $this->reporter->paintException($exception); + } + + /** + * Prints the message for skipping tests. + * @param string $message Text of skip condition. + * @access public + */ + function paintSkip($message) { + $this->reporter->paintSkip($message); + } + + /** + * Chains to the wrapped reporter. + * @param string $message Text to display. + * @access public + */ + function paintMessage($message) { + $this->reporter->paintMessage($message); + } + + /** + * Chains to the wrapped reporter. + * @param string $message Text to display. + * @access public + */ + function paintFormattedMessage($message) { + $this->reporter->paintFormattedMessage($message); + } + + /** + * Chains to the wrapped reporter. + * @param string $type Event type as text. + * @param mixed $payload Message or object. + * @return boolean Should return false if this + * type of signal should fail the + * test suite. + * @access public + */ + function paintSignal($type, $payload) { + $this->reporter->paintSignal($type, $payload); + } +} + +/** + * For sending messages to multiple reporters at + * the same time. + * @package SimpleTest + * @subpackage UnitTester + */ +class MultipleReporter { + private $reporters = array(); + + /** + * Adds a reporter to the subscriber list. + * @param SimpleScorer $reporter Reporter to receive events. + * @access public + */ + function attachReporter($reporter) { + $this->reporters[] = $reporter; + } + + /** + * Signals that the next evaluation will be a dry + * run. That is, the structure events will be + * recorded, but no tests will be run. + * @param boolean $is_dry Dry run if true. + * @access public + */ + function makeDry($is_dry = true) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->makeDry($is_dry); + } + } + + /** + * Accessor for current status. Will be false + * if there have been any failures or exceptions. + * If any reporter reports a failure, the whole + * suite fails. + * @return boolean True if no failures. + * @access public + */ + function getStatus() { + for ($i = 0; $i < count($this->reporters); $i++) { + if (! $this->reporters[$i]->getStatus()) { + return false; + } + } + return true; + } + + /** + * The reporter has a veto on what should be run. + * It requires all reporters to want to run the method. + * @param string $test_case_name name of test case. + * @param string $method Name of test method. + * @access public + */ + function shouldInvoke($test_case_name, $method) { + for ($i = 0; $i < count($this->reporters); $i++) { + if (! $this->reporters[$i]->shouldInvoke($test_case_name, $method)) { + return false; + } + } + return true; + } + + /** + * Every reporter gets a chance to wrap the invoker. + * @param SimpleInvoker $invoker Individual test runner. + * @return SimpleInvoker Wrapped test runner. + * @access public + */ + function createInvoker($invoker) { + for ($i = 0; $i < count($this->reporters); $i++) { + $invoker = $this->reporters[$i]->createInvoker($invoker); + } + return $invoker; + } + + /** + * Gets the formatter for privateiables and other small + * generic data items. + * @return SimpleDumper Formatter. + * @access public + */ + function getDumper() { + return new SimpleDumper(); + } + + /** + * Paints the start of a group test. + * @param string $test_name Name of test or other label. + * @param integer $size Number of test cases starting. + * @access public + */ + function paintGroupStart($test_name, $size) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintGroupStart($test_name, $size); + } + } + + /** + * Paints the end of a group test. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintGroupEnd($test_name) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintGroupEnd($test_name); + } + } + + /** + * Paints the start of a test case. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintCaseStart($test_name) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintCaseStart($test_name); + } + } + + /** + * Paints the end of a test case. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintCaseEnd($test_name) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintCaseEnd($test_name); + } + } + + /** + * Paints the start of a test method. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintMethodStart($test_name) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintMethodStart($test_name); + } + } + + /** + * Paints the end of a test method. + * @param string $test_name Name of test or other label. + * @access public + */ + function paintMethodEnd($test_name) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintMethodEnd($test_name); + } + } + + /** + * Chains to the wrapped reporter. + * @param string $message Message is ignored. + * @access public + */ + function paintPass($message) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintPass($message); + } + } + + /** + * Chains to the wrapped reporter. + * @param string $message Message is ignored. + * @access public + */ + function paintFail($message) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintFail($message); + } + } + + /** + * Chains to the wrapped reporter. + * @param string $message Text of error formatted by + * the test case. + * @access public + */ + function paintError($message) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintError($message); + } + } + + /** + * Chains to the wrapped reporter. + * @param Exception $exception Exception to display. + * @access public + */ + function paintException($exception) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintException($exception); + } + } + + /** + * Prints the message for skipping tests. + * @param string $message Text of skip condition. + * @access public + */ + function paintSkip($message) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintSkip($message); + } + } + + /** + * Chains to the wrapped reporter. + * @param string $message Text to display. + * @access public + */ + function paintMessage($message) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintMessage($message); + } + } + + /** + * Chains to the wrapped reporter. + * @param string $message Text to display. + * @access public + */ + function paintFormattedMessage($message) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintFormattedMessage($message); + } + } + + /** + * Chains to the wrapped reporter. + * @param string $type Event type as text. + * @param mixed $payload Message or object. + * @return boolean Should return false if this + * type of signal should fail the + * test suite. + * @access public + */ + function paintSignal($type, $payload) { + for ($i = 0; $i < count($this->reporters); $i++) { + $this->reporters[$i]->paintSignal($type, $payload); + } + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/selector.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/selector.php new file mode 100644 index 0000000..ba2fed3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/selector.php @@ -0,0 +1,141 @@ +name = $name; + } + + /** + * Accessor for name. + * @returns string $name Name to match. + */ + function getName() { + return $this->name; + } + + /** + * Compares with name attribute of widget. + * @param SimpleWidget $widget Control to compare. + * @access public + */ + function isMatch($widget) { + return ($widget->getName() == $this->name); + } +} + +/** + * Used to extract form elements for testing against. + * Searches by visible label or alt text. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleByLabel { + private $label; + + /** + * Stashes the name for later comparison. + * @param string $label Visible text to match. + */ + function __construct($label) { + $this->label = $label; + } + + /** + * Comparison. Compares visible text of widget or + * related label. + * @param SimpleWidget $widget Control to compare. + * @access public + */ + function isMatch($widget) { + if (! method_exists($widget, 'isLabel')) { + return false; + } + return $widget->isLabel($this->label); + } +} + +/** + * Used to extract form elements for testing against. + * Searches dy id attribute. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleById { + private $id; + + /** + * Stashes the name for later comparison. + * @param string $id ID atribute to match. + */ + function __construct($id) { + $this->id = $id; + } + + /** + * Comparison. Compares id attribute of widget. + * @param SimpleWidget $widget Control to compare. + * @access public + */ + function isMatch($widget) { + return $widget->isId($this->id); + } +} + +/** + * Used to extract form elements for testing against. + * Searches by visible label, name or alt text. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleByLabelOrName { + private $label; + + /** + * Stashes the name/label for later comparison. + * @param string $label Visible text to match. + */ + function __construct($label) { + $this->label = $label; + } + + /** + * Comparison. Compares visible text of widget or + * related label or name. + * @param SimpleWidget $widget Control to compare. + * @access public + */ + function isMatch($widget) { + if (method_exists($widget, 'isLabel')) { + if ($widget->isLabel($this->label)) { + return true; + } + } + return ($widget->getName() == $this->label); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/shell_tester.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/shell_tester.php new file mode 100644 index 0000000..b9d3762 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/shell_tester.php @@ -0,0 +1,330 @@ +output = false; + } + + /** + * Actually runs the command. Does not trap the + * error stream output as this need PHP 4.3+. + * @param string $command The actual command line + * to run. + * @return integer Exit code. + * @access public + */ + function execute($command) { + $this->output = false; + exec($command, $this->output, $ret); + return $ret; + } + + /** + * Accessor for the last output. + * @return string Output as text. + * @access public + */ + function getOutput() { + return implode("\n", $this->output); + } + + /** + * Accessor for the last output. + * @return array Output as array of lines. + * @access public + */ + function getOutputAsList() { + return $this->output; + } +} + +/** + * Test case for testing of command line scripts and + * utilities. Usually scripts that are external to the + * PHP code, but support it in some way. + * @package SimpleTest + * @subpackage UnitTester + */ +class ShellTestCase extends SimpleTestCase { + private $current_shell; + private $last_status; + private $last_command; + + /** + * Creates an empty test case. Should be subclassed + * with test methods for a functional test case. + * @param string $label Name of test case. Will use + * the class name if none specified. + * @access public + */ + function __construct($label = false) { + parent::__construct($label); + $this->current_shell = $this->createShell(); + $this->last_status = false; + $this->last_command = ''; + } + + /** + * Executes a command and buffers the results. + * @param string $command Command to run. + * @return boolean True if zero exit code. + * @access public + */ + function execute($command) { + $shell = $this->getShell(); + $this->last_status = $shell->execute($command); + $this->last_command = $command; + return ($this->last_status === 0); + } + + /** + * Dumps the output of the last command. + * @access public + */ + function dumpOutput() { + $this->dump($this->getOutput()); + } + + /** + * Accessor for the last output. + * @return string Output as text. + * @access public + */ + function getOutput() { + $shell = $this->getShell(); + return $shell->getOutput(); + } + + /** + * Accessor for the last output. + * @return array Output as array of lines. + * @access public + */ + function getOutputAsList() { + $shell = $this->getShell(); + return $shell->getOutputAsList(); + } + + /** + * Called from within the test methods to register + * passes and failures. + * @param boolean $result Pass on true. + * @param string $message Message to display describing + * the test state. + * @return boolean True on pass + * @access public + */ + function assertTrue($result, $message = false) { + return $this->assert(new TrueExpectation(), $result, $message); + } + + /** + * Will be true on false and vice versa. False + * is the PHP definition of false, so that null, + * empty strings, zero and an empty array all count + * as false. + * @param boolean $result Pass on false. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertFalse($result, $message = '%s') { + return $this->assert(new FalseExpectation(), $result, $message); + } + + /** + * Will trigger a pass if the two parameters have + * the same value only. Otherwise a fail. This + * is for testing hand extracted text, etc. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertEqual($first, $second, $message = "%s") { + return $this->assert( + new EqualExpectation($first), + $second, + $message); + } + + /** + * Will trigger a pass if the two parameters have + * a different value. Otherwise a fail. This + * is for testing hand extracted text, etc. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertNotEqual($first, $second, $message = "%s") { + return $this->assert( + new NotEqualExpectation($first), + $second, + $message); + } + + /** + * Tests the last status code from the shell. + * @param integer $status Expected status of last + * command. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertExitCode($status, $message = "%s") { + $message = sprintf($message, "Expected status code of [$status] from [" . + $this->last_command . "], but got [" . + $this->last_status . "]"); + return $this->assertTrue($status === $this->last_status, $message); + } + + /** + * Attempt to exactly match the combined STDERR and + * STDOUT output. + * @param string $expected Expected output. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertOutput($expected, $message = "%s") { + $shell = $this->getShell(); + return $this->assert( + new EqualExpectation($expected), + $shell->getOutput(), + $message); + } + + /** + * Scans the output for a Perl regex. If found + * anywhere it passes, else it fails. + * @param string $pattern Regex to search for. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertOutputPattern($pattern, $message = "%s") { + $shell = $this->getShell(); + return $this->assert( + new PatternExpectation($pattern), + $shell->getOutput(), + $message); + } + + /** + * If a Perl regex is found anywhere in the current + * output then a failure is generated, else a pass. + * @param string $pattern Regex to search for. + * @param $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertNoOutputPattern($pattern, $message = "%s") { + $shell = $this->getShell(); + return $this->assert( + new NoPatternExpectation($pattern), + $shell->getOutput(), + $message); + } + + /** + * File existence check. + * @param string $path Full filename and path. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertFileExists($path, $message = "%s") { + $message = sprintf($message, "File [$path] should exist"); + return $this->assertTrue(file_exists($path), $message); + } + + /** + * File non-existence check. + * @param string $path Full filename and path. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertFileNotExists($path, $message = "%s") { + $message = sprintf($message, "File [$path] should not exist"); + return $this->assertFalse(file_exists($path), $message); + } + + /** + * Scans a file for a Perl regex. If found + * anywhere it passes, else it fails. + * @param string $pattern Regex to search for. + * @param string $path Full filename and path. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertFilePattern($pattern, $path, $message = "%s") { + return $this->assert( + new PatternExpectation($pattern), + implode('', file($path)), + $message); + } + + /** + * If a Perl regex is found anywhere in the named + * file then a failure is generated, else a pass. + * @param string $pattern Regex to search for. + * @param string $path Full filename and path. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertNoFilePattern($pattern, $path, $message = "%s") { + return $this->assert( + new NoPatternExpectation($pattern), + implode('', file($path)), + $message); + } + + /** + * Accessor for current shell. Used for testing the + * the tester itself. + * @return Shell Current shell. + * @access protected + */ + protected function getShell() { + return $this->current_shell; + } + + /** + * Factory for the shell to run the command on. + * @return Shell New shell object. + * @access protected + */ + protected function createShell() { + return new SimpleShell(); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/simpletest.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/simpletest.php new file mode 100644 index 0000000..cfdadf2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/simpletest.php @@ -0,0 +1,396 @@ += 0) { + require_once(dirname(__FILE__) . '/reflection_php5.php'); +} else { + require_once(dirname(__FILE__) . '/reflection_php4.php'); +} +require_once(dirname(__FILE__) . '/default_reporter.php'); +require_once(dirname(__FILE__) . '/compatibility.php'); +/**#@-*/ + +/** + * Registry and test context. Includes a few + * global options that I'm slowly getting rid of. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleTest { + + /** + * Reads the SimpleTest version from the release file. + * @return string Version string. + * @access public + */ + static function getVersion() { + $content = file(dirname(__FILE__) . '/VERSION'); + return trim($content[0]); + } + + /** + * Sets the name of a test case to ignore, usually + * because the class is an abstract case that should + * not be run. Once PHP4 is dropped this will disappear + * as a public method and "abstract" will rule. + * @param string $class Add a class to ignore. + * @access public + */ + static function ignore($class) { + $registry = &SimpleTest::getRegistry(); + $registry['IgnoreList'][strtolower($class)] = true; + } + + /** + * Scans the now complete ignore list, and adds + * all parent classes to the list. If a class + * is not a runnable test case, then it's parents + * wouldn't be either. This is syntactic sugar + * to cut down on ommissions of ignore()'s or + * missing abstract declarations. This cannot + * be done whilst loading classes wiithout forcing + * a particular order on the class declarations and + * the ignore() calls. It's just nice to have the ignore() + * calls at the top of the file before the actual declarations. + * @param array $classes Class names of interest. + * @access public + */ + static function ignoreParentsIfIgnored($classes) { + $registry = &SimpleTest::getRegistry(); + foreach ($classes as $class) { + if (SimpleTest::isIgnored($class)) { + $reflection = new SimpleReflection($class); + if ($parent = $reflection->getParent()) { + SimpleTest::ignore($parent); + } + } + } + } + + /** + * Puts the object to the global pool of 'preferred' objects + * which can be retrieved with SimpleTest :: preferred() method. + * Instances of the same class are overwritten. + * @param object $object Preferred object + * @access public + * @see preferred() + */ + static function prefer($object) { + $registry = &SimpleTest::getRegistry(); + $registry['Preferred'][] = $object; + } + + /** + * Retrieves 'preferred' objects from global pool. Class filter + * can be applied in order to retrieve the object of the specific + * class + * @param array|string $classes Allowed classes or interfaces. + * @access public + * @return array|object|null + * @see prefer() + */ + static function preferred($classes) { + if (! is_array($classes)) { + $classes = array($classes); + } + $registry = &SimpleTest::getRegistry(); + for ($i = count($registry['Preferred']) - 1; $i >= 0; $i--) { + foreach ($classes as $class) { + if (SimpleTestCompatibility::isA($registry['Preferred'][$i], $class)) { + return $registry['Preferred'][$i]; + } + } + } + return null; + } + + /** + * Test to see if a test case is in the ignore + * list. Quite obviously the ignore list should + * be a separate object and will be one day. + * This method is internal to SimpleTest. Don't + * use it. + * @param string $class Class name to test. + * @return boolean True if should not be run. + * @access public + */ + static function isIgnored($class) { + $registry = &SimpleTest::getRegistry(); + return isset($registry['IgnoreList'][strtolower($class)]); + } + + /** + * Sets proxy to use on all requests for when + * testing from behind a firewall. Set host + * to false to disable. This will take effect + * if there are no other proxy settings. + * @param string $proxy Proxy host as URL. + * @param string $username Proxy username for authentication. + * @param string $password Proxy password for authentication. + * @access public + */ + static function useProxy($proxy, $username = false, $password = false) { + $registry = &SimpleTest::getRegistry(); + $registry['DefaultProxy'] = $proxy; + $registry['DefaultProxyUsername'] = $username; + $registry['DefaultProxyPassword'] = $password; + } + + /** + * Accessor for default proxy host. + * @return string Proxy URL. + * @access public + */ + static function getDefaultProxy() { + $registry = &SimpleTest::getRegistry(); + return $registry['DefaultProxy']; + } + + /** + * Accessor for default proxy username. + * @return string Proxy username for authentication. + * @access public + */ + static function getDefaultProxyUsername() { + $registry = &SimpleTest::getRegistry(); + return $registry['DefaultProxyUsername']; + } + + /** + * Accessor for default proxy password. + * @return string Proxy password for authentication. + * @access public + */ + static function getDefaultProxyPassword() { + $registry = &SimpleTest::getRegistry(); + return $registry['DefaultProxyPassword']; + } + + /** + * Accessor for global registry of options. + * @return hash All stored values. + * @access private + */ + protected static function &getRegistry() { + static $registry = false; + if (! $registry) { + $registry = SimpleTest::getDefaults(); + } + return $registry; + } + + /** + * Accessor for the context of the current + * test run. + * @return SimpleTestContext Current test run. + * @access public + */ + static function getContext() { + static $context = false; + if (! $context) { + $context = new SimpleTestContext(); + } + return $context; + } + + /** + * Constant default values. + * @return hash All registry defaults. + * @access private + */ + protected static function getDefaults() { + return array( + 'MockBaseClass' => 'SimpleMock', + 'IgnoreList' => array(), + 'DefaultProxy' => false, + 'DefaultProxyUsername' => false, + 'DefaultProxyPassword' => false, + 'Preferred' => array(new HtmlReporter(), new TextReporter(), new XmlReporter())); + } + + /** + * @deprecated + */ + static function setMockBaseClass($mock_base) { + $registry = &SimpleTest::getRegistry(); + $registry['MockBaseClass'] = $mock_base; + } + + /** + * @deprecated + */ + static function getMockBaseClass() { + $registry = &SimpleTest::getRegistry(); + return $registry['MockBaseClass']; + } +} + +/** + * Container for all components for a specific + * test run. Makes things like error queues + * available to PHP event handlers, and also + * gets around some nasty reference issues in + * the mocks. + * @package SimpleTest + */ +class SimpleTestContext { + private $test; + private $reporter; + private $resources; + + /** + * Clears down the current context. + * @access public + */ + function clear() { + $this->resources = array(); + } + + /** + * Sets the current test case instance. This + * global instance can be used by the mock objects + * to send message to the test cases. + * @param SimpleTestCase $test Test case to register. + * @access public + */ + function setTest($test) { + $this->clear(); + $this->test = $test; + } + + /** + * Accessor for currently running test case. + * @return SimpleTestCase Current test. + * @access public + */ + function getTest() { + return $this->test; + } + + /** + * Sets the current reporter. This + * global instance can be used by the mock objects + * to send messages. + * @param SimpleReporter $reporter Reporter to register. + * @access public + */ + function setReporter($reporter) { + $this->clear(); + $this->reporter = $reporter; + } + + /** + * Accessor for current reporter. + * @return SimpleReporter Current reporter. + * @access public + */ + function getReporter() { + return $this->reporter; + } + + /** + * Accessor for the Singleton resource. + * @return object Global resource. + * @access public + */ + function get($resource) { + if (! isset($this->resources[$resource])) { + $this->resources[$resource] = new $resource(); + } + return $this->resources[$resource]; + } +} + +/** + * Interrogates the stack trace to recover the + * failure point. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleStackTrace { + private $prefixes; + + /** + * Stashes the list of target prefixes. + * @param array $prefixes List of method prefixes + * to search for. + */ + function __construct($prefixes) { + $this->prefixes = $prefixes; + } + + /** + * Extracts the last method name that was not within + * Simpletest itself. Captures a stack trace if none given. + * @param array $stack List of stack frames. + * @return string Snippet of test report with line + * number and file. + * @access public + */ + function traceMethod($stack = false) { + $stack = $stack ? $stack : $this->captureTrace(); + foreach ($stack as $frame) { + if ($this->frameLiesWithinSimpleTestFolder($frame)) { + continue; + } + if ($this->frameMatchesPrefix($frame)) { + return ' at [' . $frame['file'] . ' line ' . $frame['line'] . ']'; + } + } + return ''; + } + + /** + * Test to see if error is generated by SimpleTest itself. + * @param array $frame PHP stack frame. + * @return boolean True if a SimpleTest file. + * @access private + */ + protected function frameLiesWithinSimpleTestFolder($frame) { + if (isset($frame['file'])) { + $path = substr(SIMPLE_TEST, 0, -1); + if (strpos($frame['file'], $path) === 0) { + if (dirname($frame['file']) == $path) { + return true; + } + } + } + return false; + } + + /** + * Tries to determine if the method call is an assert, etc. + * @param array $frame PHP stack frame. + * @return boolean True if matches a target. + * @access private + */ + protected function frameMatchesPrefix($frame) { + foreach ($this->prefixes as $prefix) { + if (strncmp($frame['function'], $prefix, strlen($prefix)) == 0) { + return true; + } + } + return false; + } + + /** + * Grabs a current stack trace. + * @return array Fulle trace. + * @access private + */ + protected function captureTrace() { + if (function_exists('debug_backtrace')) { + return array_reverse(debug_backtrace()); + } + return array(); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/socket.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/socket.php new file mode 100644 index 0000000..c30c877 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/socket.php @@ -0,0 +1,308 @@ +clearError(); + } + + /** + * Test for an outstanding error. + * @return boolean True if there is an error. + * @access public + */ + function isError() { + return ($this->error != ''); + } + + /** + * Accessor for an outstanding error. + * @return string Empty string if no error otherwise + * the error message. + * @access public + */ + function getError() { + return $this->error; + } + + /** + * Sets the internal error. + * @param string Error message to stash. + * @access protected + */ + function setError($error) { + $this->error = $error; + } + + /** + * Resets the error state to no error. + * @access protected + */ + function clearError() { + $this->setError(''); + } +} + +class SimpleFileSocket extends SimpleStickyError { + private $handle; + private $is_open = false; + private $sent = ''; + private $block_size; + + /** + * Opens a socket for reading and writing. + * @param SimpleUrl $file Target URI to fetch. + * @param integer $block_size Size of chunk to read. + * @access public + */ + function __construct($file, $block_size = 1024) { + parent::__construct(); + if (! ($this->handle = $this->openFile($file, $error))) { + $file_string = $file->asString(); + $this->setError("Cannot open [$file_string] with [$error]"); + return; + } + $this->is_open = true; + $this->block_size = $block_size; + } + + /** + * Writes some data to the socket and saves alocal copy. + * @param string $message String to send to socket. + * @return boolean True if successful. + * @access public + */ + function write($message) { + return true; + } + + /** + * Reads data from the socket. The error suppresion + * is a workaround for PHP4 always throwing a warning + * with a secure socket. + * @return integer/boolean Incoming bytes. False + * on error. + * @access public + */ + function read() { + $raw = @fread($this->handle, $this->block_size); + if ($raw === false) { + $this->setError('Cannot read from socket'); + $this->close(); + } + return $raw; + } + + /** + * Accessor for socket open state. + * @return boolean True if open. + * @access public + */ + function isOpen() { + return $this->is_open; + } + + /** + * Closes the socket preventing further reads. + * Cannot be reopened once closed. + * @return boolean True if successful. + * @access public + */ + function close() { + if (!$this->is_open) return false; + $this->is_open = false; + return fclose($this->handle); + } + + /** + * Accessor for content so far. + * @return string Bytes sent only. + * @access public + */ + function getSent() { + return $this->sent; + } + + /** + * Actually opens the low level socket. + * @param SimpleUrl $file SimpleUrl file target. + * @param string $error Recipient of error message. + * @param integer $timeout Maximum time to wait for connection. + * @access protected + */ + protected function openFile($file, &$error) { + return @fopen($file->asString(), 'r'); + } +} + +/** + * Wrapper for TCP/IP socket. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleSocket extends SimpleStickyError { + private $handle; + private $is_open = false; + private $sent = ''; + private $lock_size; + + /** + * Opens a socket for reading and writing. + * @param string $host Hostname to send request to. + * @param integer $port Port on remote machine to open. + * @param integer $timeout Connection timeout in seconds. + * @param integer $block_size Size of chunk to read. + * @access public + */ + function __construct($host, $port, $timeout, $block_size = 255) { + parent::__construct(); + if (! ($this->handle = $this->openSocket($host, $port, $error_number, $error, $timeout))) { + $this->setError("Cannot open [$host:$port] with [$error] within [$timeout] seconds"); + return; + } + $this->is_open = true; + $this->block_size = $block_size; + SimpleTestCompatibility::setTimeout($this->handle, $timeout); + } + + /** + * Writes some data to the socket and saves alocal copy. + * @param string $message String to send to socket. + * @return boolean True if successful. + * @access public + */ + function write($message) { + if ($this->isError() || ! $this->isOpen()) { + return false; + } + $count = fwrite($this->handle, $message); + if (! $count) { + if ($count === false) { + $this->setError('Cannot write to socket'); + $this->close(); + } + return false; + } + fflush($this->handle); + $this->sent .= $message; + return true; + } + + /** + * Reads data from the socket. The error suppresion + * is a workaround for PHP4 always throwing a warning + * with a secure socket. + * @return integer/boolean Incoming bytes. False + * on error. + * @access public + */ + function read() { + if ($this->isError() || ! $this->isOpen()) { + return false; + } + $raw = @fread($this->handle, $this->block_size); + if ($raw === false) { + $this->setError('Cannot read from socket'); + $this->close(); + } + return $raw; + } + + /** + * Accessor for socket open state. + * @return boolean True if open. + * @access public + */ + function isOpen() { + return $this->is_open; + } + + /** + * Closes the socket preventing further reads. + * Cannot be reopened once closed. + * @return boolean True if successful. + * @access public + */ + function close() { + $this->is_open = false; + return fclose($this->handle); + } + + /** + * Accessor for content so far. + * @return string Bytes sent only. + * @access public + */ + function getSent() { + return $this->sent; + } + + /** + * Actually opens the low level socket. + * @param string $host Host to connect to. + * @param integer $port Port on host. + * @param integer $error_number Recipient of error code. + * @param string $error Recipoent of error message. + * @param integer $timeout Maximum time to wait for connection. + * @access protected + */ + protected function openSocket($host, $port, &$error_number, &$error, $timeout) { + return @fsockopen($host, $port, $error_number, $error, $timeout); + } +} + +/** + * Wrapper for TCP/IP socket over TLS. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleSecureSocket extends SimpleSocket { + + /** + * Opens a secure socket for reading and writing. + * @param string $host Hostname to send request to. + * @param integer $port Port on remote machine to open. + * @param integer $timeout Connection timeout in seconds. + * @access public + */ + function __construct($host, $port, $timeout) { + parent::__construct($host, $port, $timeout); + } + + /** + * Actually opens the low level socket. + * @param string $host Host to connect to. + * @param integer $port Port on host. + * @param integer $error_number Recipient of error code. + * @param string $error Recipient of error message. + * @param integer $timeout Maximum time to wait for connection. + * @access protected + */ + function openSocket($host, $port, &$error_number, &$error, $timeout) { + return parent::openSocket("tls://$host", $port, $error_number, $error, $timeout); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tag.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tag.php new file mode 100644 index 0000000..c30417d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tag.php @@ -0,0 +1,1418 @@ +name = strtolower(trim($name)); + $this->attributes = $attributes; + $this->content = ''; + } + + /** + * Check to see if the tag can have both start and + * end tags with content in between. + * @return boolean True if content allowed. + * @access public + */ + function expectEndTag() { + return true; + } + + /** + * The current tag should not swallow all content for + * itself as it's searchable page content. Private + * content tags are usually widgets that contain default + * values. + * @return boolean False as content is available + * to other tags by default. + * @access public + */ + function isPrivateContent() { + return false; + } + + /** + * Appends string content to the current content. + * @param string $content Additional text. + * @access public + */ + function addContent($content) { + $this->content .= (string)$content; + } + + /** + * Adds an enclosed tag to the content. + * @param SimpleTag $tag New tag. + * @access public + */ + function addTag($tag) { + } + + /** + * Accessor for tag name. + * @return string Name of tag. + * @access public + */ + function getTagName() { + return $this->name; + } + + /** + * List of legal child elements. + * @return array List of element names. + * @access public + */ + function getChildElements() { + return array(); + } + + /** + * Accessor for an attribute. + * @param string $label Attribute name. + * @return string Attribute value. + * @access public + */ + function getAttribute($label) { + $label = strtolower($label); + if (! isset($this->attributes[$label])) { + return false; + } + return (string)$this->attributes[$label]; + } + + /** + * Sets an attribute. + * @param string $label Attribute name. + * @return string $value New attribute value. + * @access protected + */ + protected function setAttribute($label, $value) { + $this->attributes[strtolower($label)] = $value; + } + + /** + * Accessor for the whole content so far. + * @return string Content as big raw string. + * @access public + */ + function getContent() { + return $this->content; + } + + /** + * Accessor for content reduced to visible text. Acts + * like a text mode browser, normalising space and + * reducing images to their alt text. + * @return string Content as plain text. + * @access public + */ + function getText() { + return SimpleHtmlSaxParser::normalise($this->content); + } + + /** + * Test to see if id attribute matches. + * @param string $id ID to test against. + * @return boolean True on match. + * @access public + */ + function isId($id) { + return ($this->getAttribute('id') == $id); + } +} + +/** + * Base url. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleBaseTag extends SimpleTag { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('base', $attributes); + } + + /** + * Base tag is not a block tag. + * @return boolean false + * @access public + */ + function expectEndTag() { + return false; + } +} + +/** + * Page title. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleTitleTag extends SimpleTag { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('title', $attributes); + } +} + +/** + * Link. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleAnchorTag extends SimpleTag { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('a', $attributes); + } + + /** + * Accessor for URL as string. + * @return string Coerced as string. + * @access public + */ + function getHref() { + $url = $this->getAttribute('href'); + if (is_bool($url)) { + $url = ''; + } + return $url; + } +} + +/** + * Form element. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleWidget extends SimpleTag { + private $value; + private $label; + private $is_set; + + /** + * Starts with a named tag with attributes only. + * @param string $name Tag name. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($name, $attributes) { + parent::__construct($name, $attributes); + $this->value = false; + $this->label = false; + $this->is_set = false; + } + + /** + * Accessor for name submitted as the key in + * GET/POST privateiables hash. + * @return string Parsed value. + * @access public + */ + function getName() { + return $this->getAttribute('name'); + } + + /** + * Accessor for default value parsed with the tag. + * @return string Parsed value. + * @access public + */ + function getDefault() { + return $this->getAttribute('value'); + } + + /** + * Accessor for currently set value or default if + * none. + * @return string Value set by form or default + * if none. + * @access public + */ + function getValue() { + if (! $this->is_set) { + return $this->getDefault(); + } + return $this->value; + } + + /** + * Sets the current form element value. + * @param string $value New value. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + $this->value = $value; + $this->is_set = true; + return true; + } + + /** + * Resets the form element value back to the + * default. + * @access public + */ + function resetValue() { + $this->is_set = false; + } + + /** + * Allows setting of a label externally, say by a + * label tag. + * @param string $label Label to attach. + * @access public + */ + function setLabel($label) { + $this->label = trim($label); + } + + /** + * Reads external or internal label. + * @param string $label Label to test. + * @return boolean True is match. + * @access public + */ + function isLabel($label) { + return $this->label == trim($label); + } + + /** + * Dispatches the value into the form encoded packet. + * @param SimpleEncoding $encoding Form packet. + * @access public + */ + function write($encoding) { + if ($this->getName()) { + $encoding->add($this->getName(), $this->getValue()); + } + } +} + +/** + * Text, password and hidden field. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleTextTag extends SimpleWidget { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('input', $attributes); + if ($this->getAttribute('value') === false) { + $this->setAttribute('value', ''); + } + } + + /** + * Tag contains no content. + * @return boolean False. + * @access public + */ + function expectEndTag() { + return false; + } + + /** + * Sets the current form element value. Cannot + * change the value of a hidden field. + * @param string $value New value. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + if ($this->getAttribute('type') == 'hidden') { + return false; + } + return parent::setValue($value); + } +} + +/** + * Submit button as input tag. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleSubmitTag extends SimpleWidget { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('input', $attributes); + if ($this->getAttribute('value') === false) { + $this->setAttribute('value', 'Submit'); + } + } + + /** + * Tag contains no end element. + * @return boolean False. + * @access public + */ + function expectEndTag() { + return false; + } + + /** + * Disables the setting of the button value. + * @param string $value Ignored. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + return false; + } + + /** + * Value of browser visible text. + * @return string Visible label. + * @access public + */ + function getLabel() { + return $this->getValue(); + } + + /** + * Test for a label match when searching. + * @param string $label Label to test. + * @return boolean True on match. + * @access public + */ + function isLabel($label) { + return trim($label) == trim($this->getLabel()); + } +} + +/** + * Image button as input tag. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleImageSubmitTag extends SimpleWidget { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('input', $attributes); + } + + /** + * Tag contains no end element. + * @return boolean False. + * @access public + */ + function expectEndTag() { + return false; + } + + /** + * Disables the setting of the button value. + * @param string $value Ignored. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + return false; + } + + /** + * Value of browser visible text. + * @return string Visible label. + * @access public + */ + function getLabel() { + if ($this->getAttribute('title')) { + return $this->getAttribute('title'); + } + return $this->getAttribute('alt'); + } + + /** + * Test for a label match when searching. + * @param string $label Label to test. + * @return boolean True on match. + * @access public + */ + function isLabel($label) { + return trim($label) == trim($this->getLabel()); + } + + /** + * Dispatches the value into the form encoded packet. + * @param SimpleEncoding $encoding Form packet. + * @param integer $x X coordinate of click. + * @param integer $y Y coordinate of click. + * @access public + */ + function write($encoding, $x = 1, $y = 1) { + if ($this->getName()) { + $encoding->add($this->getName() . '.x', $x); + $encoding->add($this->getName() . '.y', $y); + } else { + $encoding->add('x', $x); + $encoding->add('y', $y); + } + } +} + +/** + * Submit button as button tag. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleButtonTag extends SimpleWidget { + + /** + * Starts with a named tag with attributes only. + * Defaults are very browser dependent. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('button', $attributes); + } + + /** + * Check to see if the tag can have both start and + * end tags with content in between. + * @return boolean True if content allowed. + * @access public + */ + function expectEndTag() { + return true; + } + + /** + * Disables the setting of the button value. + * @param string $value Ignored. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + return false; + } + + /** + * Value of browser visible text. + * @return string Visible label. + * @access public + */ + function getLabel() { + return $this->getContent(); + } + + /** + * Test for a label match when searching. + * @param string $label Label to test. + * @return boolean True on match. + * @access public + */ + function isLabel($label) { + return trim($label) == trim($this->getLabel()); + } +} + +/** + * Content tag for text area. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleTextAreaTag extends SimpleWidget { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('textarea', $attributes); + } + + /** + * Accessor for starting value. + * @return string Parsed value. + * @access public + */ + function getDefault() { + return $this->wrap(SimpleHtmlSaxParser::decodeHtml($this->getContent())); + } + + /** + * Applies word wrapping if needed. + * @param string $value New value. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + return parent::setValue($this->wrap($value)); + } + + /** + * Test to see if text should be wrapped. + * @return boolean True if wrapping on. + * @access private + */ + function wrapIsEnabled() { + if ($this->getAttribute('cols')) { + $wrap = $this->getAttribute('wrap'); + if (($wrap == 'physical') || ($wrap == 'hard')) { + return true; + } + } + return false; + } + + /** + * Performs the formatting that is peculiar to + * this tag. There is strange behaviour in this + * one, including stripping a leading new line. + * Go figure. I am using Firefox as a guide. + * @param string $text Text to wrap. + * @return string Text wrapped with carriage + * returns and line feeds + * @access private + */ + protected function wrap($text) { + $text = str_replace("\r\r\n", "\r\n", str_replace("\n", "\r\n", $text)); + $text = str_replace("\r\n\n", "\r\n", str_replace("\r", "\r\n", $text)); + if (strncmp($text, "\r\n", strlen("\r\n")) == 0) { + $text = substr($text, strlen("\r\n")); + } + if ($this->wrapIsEnabled()) { + return wordwrap( + $text, + (integer)$this->getAttribute('cols'), + "\r\n"); + } + return $text; + } + + /** + * The content of textarea is not part of the page. + * @return boolean True. + * @access public + */ + function isPrivateContent() { + return true; + } +} + +/** + * File upload widget. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleUploadTag extends SimpleWidget { + + /** + * Starts with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('input', $attributes); + } + + /** + * Tag contains no content. + * @return boolean False. + * @access public + */ + function expectEndTag() { + return false; + } + + /** + * Dispatches the value into the form encoded packet. + * @param SimpleEncoding $encoding Form packet. + * @access public + */ + function write($encoding) { + if (! file_exists($this->getValue())) { + return; + } + $encoding->attach( + $this->getName(), + implode('', file($this->getValue())), + basename($this->getValue())); + } +} + +/** + * Drop down widget. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleSelectionTag extends SimpleWidget { + private $options; + private $choice; + + /** + * Starts with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('select', $attributes); + $this->options = array(); + $this->choice = false; + } + + /** + * Adds an option tag to a selection field. + * @param SimpleOptionTag $tag New option. + * @access public + */ + function addTag($tag) { + if ($tag->getTagName() == 'option') { + $this->options[] = $tag; + } + } + + /** + * Text within the selection element is ignored. + * @param string $content Ignored. + * @access public + */ + function addContent($content) { + } + + /** + * Scans options for defaults. If none, then + * the first option is selected. + * @return string Selected field. + * @access public + */ + function getDefault() { + for ($i = 0, $count = count($this->options); $i < $count; $i++) { + if ($this->options[$i]->getAttribute('selected') !== false) { + return $this->options[$i]->getDefault(); + } + } + if ($count > 0) { + return $this->options[0]->getDefault(); + } + return ''; + } + + /** + * Can only set allowed values. + * @param string $value New choice. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + for ($i = 0, $count = count($this->options); $i < $count; $i++) { + if ($this->options[$i]->isValue($value)) { + $this->choice = $i; + return true; + } + } + return false; + } + + /** + * Accessor for current selection value. + * @return string Value attribute or + * content of opton. + * @access public + */ + function getValue() { + if ($this->choice === false) { + return $this->getDefault(); + } + return $this->options[$this->choice]->getValue(); + } +} + +/** + * Drop down widget. + * @package SimpleTest + * @subpackage WebTester + */ +class MultipleSelectionTag extends SimpleWidget { + private $options; + private $values; + + /** + * Starts with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('select', $attributes); + $this->options = array(); + $this->values = false; + } + + /** + * Adds an option tag to a selection field. + * @param SimpleOptionTag $tag New option. + * @access public + */ + function addTag($tag) { + if ($tag->getTagName() == 'option') { + $this->options[] = &$tag; + } + } + + /** + * Text within the selection element is ignored. + * @param string $content Ignored. + * @access public + */ + function addContent($content) { + } + + /** + * Scans options for defaults to populate the + * value array(). + * @return array Selected fields. + * @access public + */ + function getDefault() { + $default = array(); + for ($i = 0, $count = count($this->options); $i < $count; $i++) { + if ($this->options[$i]->getAttribute('selected') !== false) { + $default[] = $this->options[$i]->getDefault(); + } + } + return $default; + } + + /** + * Can only set allowed values. Any illegal value + * will result in a failure, but all correct values + * will be set. + * @param array $desired New choices. + * @return boolean True if all allowed. + * @access public + */ + function setValue($desired) { + $achieved = array(); + foreach ($desired as $value) { + $success = false; + for ($i = 0, $count = count($this->options); $i < $count; $i++) { + if ($this->options[$i]->isValue($value)) { + $achieved[] = $this->options[$i]->getValue(); + $success = true; + break; + } + } + if (! $success) { + return false; + } + } + $this->values = $achieved; + return true; + } + + /** + * Accessor for current selection value. + * @return array List of currently set options. + * @access public + */ + function getValue() { + if ($this->values === false) { + return $this->getDefault(); + } + return $this->values; + } +} + +/** + * Option for selection field. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleOptionTag extends SimpleWidget { + + /** + * Stashes the attributes. + */ + function __construct($attributes) { + parent::__construct('option', $attributes); + } + + /** + * Does nothing. + * @param string $value Ignored. + * @return boolean Not allowed. + * @access public + */ + function setValue($value) { + return false; + } + + /** + * Test to see if a value matches the option. + * @param string $compare Value to compare with. + * @return boolean True if possible match. + * @access public + */ + function isValue($compare) { + $compare = trim($compare); + if (trim($this->getValue()) == $compare) { + return true; + } + return trim($this->getContent()) == $compare; + } + + /** + * Accessor for starting value. Will be set to + * the option label if no value exists. + * @return string Parsed value. + * @access public + */ + function getDefault() { + if ($this->getAttribute('value') === false) { + return $this->getContent(); + } + return $this->getAttribute('value'); + } + + /** + * The content of options is not part of the page. + * @return boolean True. + * @access public + */ + function isPrivateContent() { + return true; + } +} + +/** + * Radio button. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleRadioButtonTag extends SimpleWidget { + + /** + * Stashes the attributes. + * @param array $attributes Hash of attributes. + */ + function __construct($attributes) { + parent::__construct('input', $attributes); + if ($this->getAttribute('value') === false) { + $this->setAttribute('value', 'on'); + } + } + + /** + * Tag contains no content. + * @return boolean False. + * @access public + */ + function expectEndTag() { + return false; + } + + /** + * The only allowed value sn the one in the + * "value" attribute. + * @param string $value New value. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + if ($value === false) { + return parent::setValue($value); + } + if ($value != $this->getAttribute('value')) { + return false; + } + return parent::setValue($value); + } + + /** + * Accessor for starting value. + * @return string Parsed value. + * @access public + */ + function getDefault() { + if ($this->getAttribute('checked') !== false) { + return $this->getAttribute('value'); + } + return false; + } +} + +/** + * Checkbox widget. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleCheckboxTag extends SimpleWidget { + + /** + * Starts with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('input', $attributes); + if ($this->getAttribute('value') === false) { + $this->setAttribute('value', 'on'); + } + } + + /** + * Tag contains no content. + * @return boolean False. + * @access public + */ + function expectEndTag() { + return false; + } + + /** + * The only allowed value in the one in the + * "value" attribute. The default for this + * attribute is "on". If this widget is set to + * true, then the usual value will be taken. + * @param string $value New value. + * @return boolean True if allowed. + * @access public + */ + function setValue($value) { + if ($value === false) { + return parent::setValue($value); + } + if ($value === true) { + return parent::setValue($this->getAttribute('value')); + } + if ($value != $this->getAttribute('value')) { + return false; + } + return parent::setValue($value); + } + + /** + * Accessor for starting value. The default + * value is "on". + * @return string Parsed value. + * @access public + */ + function getDefault() { + if ($this->getAttribute('checked') !== false) { + return $this->getAttribute('value'); + } + return false; + } +} + +/** + * A group of multiple widgets with some shared behaviour. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleTagGroup { + private $widgets = array(); + + /** + * Adds a tag to the group. + * @param SimpleWidget $widget + * @access public + */ + function addWidget($widget) { + $this->widgets[] = $widget; + } + + /** + * Accessor to widget set. + * @return array All widgets. + * @access protected + */ + protected function &getWidgets() { + return $this->widgets; + } + + /** + * Accessor for an attribute. + * @param string $label Attribute name. + * @return boolean Always false. + * @access public + */ + function getAttribute($label) { + return false; + } + + /** + * Fetches the name for the widget from the first + * member. + * @return string Name of widget. + * @access public + */ + function getName() { + if (count($this->widgets) > 0) { + return $this->widgets[0]->getName(); + } + } + + /** + * Scans the widgets for one with the appropriate + * ID field. + * @param string $id ID value to try. + * @return boolean True if matched. + * @access public + */ + function isId($id) { + for ($i = 0, $count = count($this->widgets); $i < $count; $i++) { + if ($this->widgets[$i]->isId($id)) { + return true; + } + } + return false; + } + + /** + * Scans the widgets for one with the appropriate + * attached label. + * @param string $label Attached label to try. + * @return boolean True if matched. + * @access public + */ + function isLabel($label) { + for ($i = 0, $count = count($this->widgets); $i < $count; $i++) { + if ($this->widgets[$i]->isLabel($label)) { + return true; + } + } + return false; + } + + /** + * Dispatches the value into the form encoded packet. + * @param SimpleEncoding $encoding Form packet. + * @access public + */ + function write($encoding) { + $encoding->add($this->getName(), $this->getValue()); + } +} + +/** + * A group of tags with the same name within a form. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleCheckboxGroup extends SimpleTagGroup { + + /** + * Accessor for current selected widget or false + * if none. + * @return string/array Widget values or false if none. + * @access public + */ + function getValue() { + $values = array(); + $widgets = $this->getWidgets(); + for ($i = 0, $count = count($widgets); $i < $count; $i++) { + if ($widgets[$i]->getValue() !== false) { + $values[] = $widgets[$i]->getValue(); + } + } + return $this->coerceValues($values); + } + + /** + * Accessor for starting value that is active. + * @return string/array Widget values or false if none. + * @access public + */ + function getDefault() { + $values = array(); + $widgets = $this->getWidgets(); + for ($i = 0, $count = count($widgets); $i < $count; $i++) { + if ($widgets[$i]->getDefault() !== false) { + $values[] = $widgets[$i]->getDefault(); + } + } + return $this->coerceValues($values); + } + + /** + * Accessor for current set values. + * @param string/array/boolean $values Either a single string, a + * hash or false for nothing set. + * @return boolean True if all values can be set. + * @access public + */ + function setValue($values) { + $values = $this->makeArray($values); + if (! $this->valuesArePossible($values)) { + return false; + } + $widgets = $this->getWidgets(); + for ($i = 0, $count = count($widgets); $i < $count; $i++) { + $possible = $widgets[$i]->getAttribute('value'); + if (in_array($widgets[$i]->getAttribute('value'), $values)) { + $widgets[$i]->setValue($possible); + } else { + $widgets[$i]->setValue(false); + } + } + return true; + } + + /** + * Tests to see if a possible value set is legal. + * @param string/array/boolean $values Either a single string, a + * hash or false for nothing set. + * @return boolean False if trying to set a + * missing value. + * @access private + */ + protected function valuesArePossible($values) { + $matches = array(); + $widgets = &$this->getWidgets(); + for ($i = 0, $count = count($widgets); $i < $count; $i++) { + $possible = $widgets[$i]->getAttribute('value'); + if (in_array($possible, $values)) { + $matches[] = $possible; + } + } + return ($values == $matches); + } + + /** + * Converts the output to an appropriate format. This means + * that no values is false, a single value is just that + * value and only two or more are contained in an array. + * @param array $values List of values of widgets. + * @return string/array/boolean Expected format for a tag. + * @access private + */ + protected function coerceValues($values) { + if (count($values) == 0) { + return false; + } elseif (count($values) == 1) { + return $values[0]; + } else { + return $values; + } + } + + /** + * Converts false or string into array. The opposite of + * the coercian method. + * @param string/array/boolean $value A single item is converted + * to a one item list. False + * gives an empty list. + * @return array List of values, possibly empty. + * @access private + */ + protected function makeArray($value) { + if ($value === false) { + return array(); + } + if (is_string($value)) { + return array($value); + } + return $value; + } +} + +/** + * A group of tags with the same name within a form. + * Used for radio buttons. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleRadioGroup extends SimpleTagGroup { + + /** + * Each tag is tried in turn until one is + * successfully set. The others will be + * unchecked if successful. + * @param string $value New value. + * @return boolean True if any allowed. + * @access public + */ + function setValue($value) { + if (! $this->valueIsPossible($value)) { + return false; + } + $index = false; + $widgets = $this->getWidgets(); + for ($i = 0, $count = count($widgets); $i < $count; $i++) { + if (! $widgets[$i]->setValue($value)) { + $widgets[$i]->setValue(false); + } + } + return true; + } + + /** + * Tests to see if a value is allowed. + * @param string Attempted value. + * @return boolean True if a valid value. + * @access private + */ + protected function valueIsPossible($value) { + $widgets = $this->getWidgets(); + for ($i = 0, $count = count($widgets); $i < $count; $i++) { + if ($widgets[$i]->getAttribute('value') == $value) { + return true; + } + } + return false; + } + + /** + * Accessor for current selected widget or false + * if none. + * @return string/boolean Value attribute or + * content of opton. + * @access public + */ + function getValue() { + $widgets = $this->getWidgets(); + for ($i = 0, $count = count($widgets); $i < $count; $i++) { + if ($widgets[$i]->getValue() !== false) { + return $widgets[$i]->getValue(); + } + } + return false; + } + + /** + * Accessor for starting value that is active. + * @return string/boolean Value of first checked + * widget or false if none. + * @access public + */ + function getDefault() { + $widgets = $this->getWidgets(); + for ($i = 0, $count = count($widgets); $i < $count; $i++) { + if ($widgets[$i]->getDefault() !== false) { + return $widgets[$i]->getDefault(); + } + } + return false; + } +} + +/** + * Tag to keep track of labels. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleLabelTag extends SimpleTag { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('label', $attributes); + } + + /** + * Access for the ID to attach the label to. + * @return string For attribute. + * @access public + */ + function getFor() { + return $this->getAttribute('for'); + } +} + +/** + * Tag to aid parsing the form. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleFormTag extends SimpleTag { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('form', $attributes); + } +} + +/** + * Tag to aid parsing the frames in a page. + * @package SimpleTest + * @subpackage WebTester + */ +class SimpleFrameTag extends SimpleTag { + + /** + * Starts with a named tag with attributes only. + * @param hash $attributes Attribute names and + * string values. + */ + function __construct($attributes) { + parent::__construct('frame', $attributes); + } + + /** + * Tag contains no content. + * @return boolean False. + * @access public + */ + function expectEndTag() { + return false; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/acceptance_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/acceptance_test.php new file mode 100644 index 0000000..aada433 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/acceptance_test.php @@ -0,0 +1,1653 @@ +addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $this->assertTrue($browser->get($this->samples() . 'network_confirm.php')); + $this->assertPattern('/target for the SimpleTest/', $browser->getContent()); + $this->assertPattern('/Request method.*?
    GET<\/dd>/', $browser->getContent()); + $this->assertEqual($browser->getTitle(), 'Simple test target file'); + $this->assertEqual($browser->getResponseCode(), 200); + $this->assertEqual($browser->getMimeType(), 'text/html'); + } + + function testPost() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $this->assertTrue($browser->post($this->samples() . 'network_confirm.php')); + $this->assertPattern('/target for the SimpleTest/', $browser->getContent()); + $this->assertPattern('/Request method.*?
    POST<\/dd>/', $browser->getContent()); + } + + function testAbsoluteLinkFollowing() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $browser->get($this->samples() . 'link_confirm.php'); + $this->assertTrue($browser->clickLink('Absolute')); + $this->assertPattern('/target for the SimpleTest/', $browser->getContent()); + } + + function testRelativeEncodedeLinkFollowing() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $browser->get($this->samples() . 'link_confirm.php'); + $this->assertTrue($browser->clickLink("m�rc�l kiek'eboe")); + $this->assertPattern('/target for the SimpleTest/', $browser->getContent()); + } + + function testRelativeLinkFollowing() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $browser->get($this->samples() . 'link_confirm.php'); + $this->assertTrue($browser->clickLink('Relative')); + $this->assertPattern('/target for the SimpleTest/', $browser->getContent()); + } + + function testUnifiedClickLinkClicking() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $browser->get($this->samples() . 'link_confirm.php'); + $this->assertTrue($browser->click('Relative')); + $this->assertPattern('/target for the SimpleTest/', $browser->getContent()); + } + + function testIdLinkFollowing() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $browser->get($this->samples() . 'link_confirm.php'); + $this->assertTrue($browser->clickLinkById(1)); + $this->assertPattern('/target for the SimpleTest/', $browser->getContent()); + } + + function testCookieReading() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $browser->get($this->samples() . 'set_cookies.php'); + $this->assertEqual($browser->getCurrentCookieValue('session_cookie'), 'A'); + $this->assertEqual($browser->getCurrentCookieValue('short_cookie'), 'B'); + $this->assertEqual($browser->getCurrentCookieValue('day_cookie'), 'C'); + } + + function testSimpleSubmit() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $browser->get($this->samples() . 'form.html'); + $this->assertTrue($browser->clickSubmit('Go!')); + $this->assertPattern('/Request method.*?
    POST<\/dd>/', $browser->getContent()); + $this->assertPattern('/go=\[Go!\]/', $browser->getContent()); + } + + function testUnifiedClickCanSubmit() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $browser->get($this->samples() . 'form.html'); + $this->assertTrue($browser->click('Go!')); + $this->assertPattern('/go=\[Go!\]/', $browser->getContent()); + } +} + +class TestOfLocalFileBrowser extends UnitTestCase { + function samples() { + return 'file://'.dirname(__FILE__).'/site/'; + } + + function testGet() { + $browser = new SimpleBrowser(); + $browser->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + $this->assertTrue($browser->get($this->samples() . 'file.html')); + $this->assertPattern('/Link to SimpleTest/', $browser->getContent()); + $this->assertEqual($browser->getTitle(), 'Link to SimpleTest'); + $this->assertFalse($browser->getResponseCode()); + $this->assertEqual($browser->getMimeType(), ''); + } +} + +class TestRadioFields extends SimpleTestAcceptanceTest { + function testSetFieldAsInteger() { + $this->get($this->samples() . 'form_with_radio_buttons.html'); + $this->assertTrue($this->setField('tested_field', 2)); + $this->clickSubmitByName('send'); + $this->assertEqual($this->getUrl(), $this->samples() . 'form_with_radio_buttons.html?tested_field=2&send=click+me'); + } + + function testSetFieldAsString() { + $this->get($this->samples() . 'form_with_radio_buttons.html'); + $this->assertTrue($this->setField('tested_field', '2')); + $this->clickSubmitByName('send'); + $this->assertEqual($this->getUrl(), $this->samples() . 'form_with_radio_buttons.html?tested_field=2&send=click+me'); + } +} + +class TestOfLiveFetching extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testFormWithArrayBasedInputs() { + $this->get($this->samples() . 'form_with_array_based_inputs.php'); + $this->setField('value[]', '3', '1'); + $this->setField('value[]', '4', '2'); + $this->clickSubmit('Go'); + $this->assertPattern('/QUERY_STRING : value%5B%5D=3&value%5B%5D=4&submit=Go/'); + } + + function testFormWithQuotedValues() { + $this->get($this->samples() . 'form_with_quoted_values.php'); + $this->assertField('a', 'default'); + $this->assertFieldById('text_field', 'default'); + $this->clickSubmit('Go'); + $this->assertPattern('/a=default&submit=Go/'); + } + + function testGet() { + $this->assertTrue($this->get($this->samples() . 'network_confirm.php')); + $this->assertEqual($this->getUrl(), $this->samples() . 'network_confirm.php'); + $this->assertText('target for the SimpleTest'); + $this->assertPattern('/Request method.*?
    GET<\/dd>/'); + $this->assertTitle('Simple test target file'); + $this->assertTitle(new PatternExpectation('/target file/')); + $this->assertResponse(200); + $this->assertMime('text/html'); + $this->assertHeader('connection', 'close'); + $this->assertHeader('connection', new PatternExpectation('/los/')); + } + + function testSlowGet() { + $this->assertTrue($this->get($this->samples() . 'slow_page.php')); + } + + function testTimedOutGet() { + $this->setConnectionTimeout(1); + $this->ignoreErrors(); + $this->assertFalse($this->get($this->samples() . 'slow_page.php')); + } + + function testPost() { + $this->assertTrue($this->post($this->samples() . 'network_confirm.php')); + $this->assertText('target for the SimpleTest'); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + } + + function testGetWithData() { + $this->get($this->samples() . 'network_confirm.php', array("a" => "aaa")); + $this->assertPattern('/Request method.*?
    GET<\/dd>/'); + $this->assertText('a=[aaa]'); + } + + function testPostWithData() { + $this->post($this->samples() . 'network_confirm.php', array("a" => "aaa")); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('a=[aaa]'); + } + + function testPostWithRecursiveData() { + $this->post($this->samples() . 'network_confirm.php', array("a" => "aaa")); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('a=[aaa]'); + + $this->post($this->samples() . 'network_confirm.php', array("a[aa]" => "aaa")); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('a=[aa=[aaa]]'); + + $this->post($this->samples() . 'network_confirm.php', array("a[aa][aaa]" => "aaaa")); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('a=[aa=[aaa=[aaaa]]]'); + + $this->post($this->samples() . 'network_confirm.php', array("a" => array("aa" => "aaa"))); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('a=[aa=[aaa]]'); + + $this->post($this->samples() . 'network_confirm.php', array("a" => array("aa" => array("aaa" => "aaaa")))); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('a=[aa=[aaa=[aaaa]]]'); + } + + function testRelativeGet() { + $this->get($this->samples() . 'link_confirm.php'); + $this->assertTrue($this->get('network_confirm.php')); + $this->assertText('target for the SimpleTest'); + } + + function testRelativePost() { + $this->post($this->samples() . 'link_confirm.php'); + $this->assertTrue($this->post('network_confirm.php')); + $this->assertText('target for the SimpleTest'); + } +} + +class TestOfLinkFollowing extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testLinkAssertions() { + $this->get($this->samples() . 'link_confirm.php'); + $this->assertLink('Absolute', $this->samples() . 'network_confirm.php'); + $this->assertLink('Absolute', new PatternExpectation('/confirm/')); + $this->assertClickable('Absolute'); + } + + function testAbsoluteLinkFollowing() { + $this->get($this->samples() . 'link_confirm.php'); + $this->assertTrue($this->clickLink('Absolute')); + $this->assertText('target for the SimpleTest'); + } + + function testRelativeLinkFollowing() { + $this->get($this->samples() . 'link_confirm.php'); + $this->assertTrue($this->clickLink('Relative')); + $this->assertText('target for the SimpleTest'); + } + + function testLinkIdFollowing() { + $this->get($this->samples() . 'link_confirm.php'); + $this->assertLinkById(1); + $this->assertTrue($this->clickLinkById(1)); + $this->assertText('target for the SimpleTest'); + } + + function testAbsoluteUrlBehavesAbsolutely() { + $this->get($this->samples() . 'link_confirm.php'); + $this->get('http://www.lastcraft.com'); + $this->assertText('No guarantee of quality is given or even intended'); + } + + function testRelativeUrlRespectsBaseTag() { + $this->get($this->samples() . 'base_tag/base_link.html'); + $this->click('Back to test pages'); + $this->assertTitle('Simple test target file'); + } +} + +class TestOfLivePageLinkingWithMinimalLinks extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testClickToExplicitelyNamedSelfReturns() { + $this->get($this->samples() . 'front_controller_style/a_page.php'); + $this->assertEqual($this->getUrl(), $this->samples() . 'front_controller_style/a_page.php'); + $this->assertTitle('Simple test page with links'); + $this->assertLink('Self'); + $this->clickLink('Self'); + $this->assertTitle('Simple test page with links'); + } + + function testClickToMissingPageReturnsToSamePage() { + $this->get($this->samples() . 'front_controller_style/a_page.php'); + $this->clickLink('No page'); + $this->assertTitle('Simple test page with links'); + $this->assertText('[action=no_page]'); + } + + function testClickToBareActionReturnsToSamePage() { + $this->get($this->samples() . 'front_controller_style/a_page.php'); + $this->clickLink('Bare action'); + $this->assertTitle('Simple test page with links'); + $this->assertText('[action=]'); + } + + function testClickToSingleQuestionMarkReturnsToSamePage() { + $this->get($this->samples() . 'front_controller_style/a_page.php'); + $this->clickLink('Empty query'); + $this->assertTitle('Simple test page with links'); + } + + function testClickToEmptyStringReturnsToSamePage() { + $this->get($this->samples() . 'front_controller_style/a_page.php'); + $this->clickLink('Empty link'); + $this->assertTitle('Simple test page with links'); + } + + function testClickToSingleDotGoesToCurrentDirectory() { + $this->get($this->samples() . 'front_controller_style/a_page.php'); + $this->clickLink('Current directory'); + $this->assertTitle( + 'Simple test front controller', + '%s -> index.php needs to be set as a default web server home page'); + } + + function testClickBackADirectoryLevel() { + $this->get($this->samples() . 'front_controller_style/'); + $this->clickLink('Down one'); + $this->assertPattern('|Index of .*?/test|i'); + } +} + +class TestOfLiveFrontControllerEmulation extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testJumpToNamedPage() { + $this->get($this->samples() . 'front_controller_style/'); + $this->assertText('Simple test front controller'); + $this->clickLink('Index'); + $this->assertResponse(200); + $this->assertText('[action=index]'); + } + + function testJumpToUnnamedPage() { + $this->get($this->samples() . 'front_controller_style/'); + $this->clickLink('No page'); + $this->assertResponse(200); + $this->assertText('Simple test front controller'); + $this->assertText('[action=no_page]'); + } + + function testJumpToUnnamedPageWithBareParameter() { + $this->get($this->samples() . 'front_controller_style/'); + $this->clickLink('Bare action'); + $this->assertResponse(200); + $this->assertText('Simple test front controller'); + $this->assertText('[action=]'); + } + + function testJumpToUnnamedPageWithEmptyQuery() { + $this->get($this->samples() . 'front_controller_style/'); + $this->clickLink('Empty query'); + $this->assertResponse(200); + $this->assertPattern('/Simple test front controller/'); + $this->assertPattern('/raw get data.*?\[\].*?get data/si'); + } + + function testJumpToUnnamedPageWithEmptyLink() { + $this->get($this->samples() . 'front_controller_style/'); + $this->clickLink('Empty link'); + $this->assertResponse(200); + $this->assertPattern('/Simple test front controller/'); + $this->assertPattern('/raw get data.*?\[\].*?get data/si'); + } + + function testJumpBackADirectoryLevel() { + $this->get($this->samples() . 'front_controller_style/'); + $this->clickLink('Down one'); + $this->assertPattern('|Index of .*?/test|'); + } + + function testSubmitToNamedPage() { + $this->get($this->samples() . 'front_controller_style/'); + $this->assertText('Simple test front controller'); + $this->clickSubmit('Index'); + $this->assertResponse(200); + $this->assertText('[action=Index]'); + } + + function testSubmitToSameDirectory() { + $this->get($this->samples() . 'front_controller_style/index.php'); + $this->clickSubmit('Same directory'); + $this->assertResponse(200); + $this->assertText('[action=Same+directory]'); + } + + function testSubmitToEmptyAction() { + $this->get($this->samples() . 'front_controller_style/index.php'); + $this->clickSubmit('Empty action'); + $this->assertResponse(200); + $this->assertText('[action=Empty+action]'); + } + + function testSubmitToNoAction() { + $this->get($this->samples() . 'front_controller_style/index.php'); + $this->clickSubmit('No action'); + $this->assertResponse(200); + $this->assertText('[action=No+action]'); + } + + function testSubmitBackADirectoryLevel() { + $this->get($this->samples() . 'front_controller_style/'); + $this->clickSubmit('Down one'); + $this->assertPattern('|Index of .*?/test|'); + } + + function testSubmitToNamedPageWithMixedPostAndGet() { + $this->get($this->samples() . 'front_controller_style/?a=A'); + $this->assertText('Simple test front controller'); + $this->clickSubmit('Index post'); + $this->assertText('action=[Index post]'); + $this->assertNoText('[a=A]'); + } + + function testSubmitToSameDirectoryMixedPostAndGet() { + $this->get($this->samples() . 'front_controller_style/index.php?a=A'); + $this->clickSubmit('Same directory post'); + $this->assertText('action=[Same directory post]'); + $this->assertNoText('[a=A]'); + } + + function testSubmitToEmptyActionMixedPostAndGet() { + $this->get($this->samples() . 'front_controller_style/index.php?a=A'); + $this->clickSubmit('Empty action post'); + $this->assertText('action=[Empty action post]'); + $this->assertText('[a=A]'); + } + + function testSubmitToNoActionMixedPostAndGet() { + $this->get($this->samples() . 'front_controller_style/index.php?a=A'); + $this->clickSubmit('No action post'); + $this->assertText('action=[No action post]'); + $this->assertText('[a=A]'); + } +} + +class TestOfLiveHeaders extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testConfirmingHeaderExistence() { + $this->get('http://www.lastcraft.com/'); + $this->assertHeader('content-type'); + $this->assertHeader('content-type', 'text/html'); + $this->assertHeader('content-type', new PatternExpectation('/HTML/i')); + $this->assertNoHeader('WWW-Authenticate'); + } +} + +class TestOfLiveRedirects extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testNoRedirects() { + $this->setMaximumRedirects(0); + $this->get($this->samples() . 'redirect.php'); + $this->assertTitle('Redirection test'); + } + + function testRedirects() { + $this->setMaximumRedirects(1); + $this->get($this->samples() . 'redirect.php'); + $this->assertTitle('Simple test target file'); + } + + function testRedirectLosesGetData() { + $this->get($this->samples() . 'redirect.php', array('a' => 'aaa')); + $this->assertNoText('a=[aaa]'); + } + + function testRedirectKeepsExtraRequestDataOfItsOwn() { + $this->get($this->samples() . 'redirect.php'); + $this->assertText('r=[rrr]'); + } + + function testRedirectLosesPostData() { + $this->post($this->samples() . 'redirect.php', array('a' => 'aaa')); + $this->assertTitle('Simple test target file'); + $this->assertNoText('a=[aaa]'); + } + + function testRedirectWithBaseUrlChange() { + $this->get($this->samples() . 'base_change_redirect.php'); + $this->assertTitle('Simple test target file in folder'); + $this->get($this->samples() . 'path/base_change_redirect.php'); + $this->assertTitle('Simple test target file'); + } + + function testRedirectWithDoubleBaseUrlChange() { + $this->get($this->samples() . 'double_base_change_redirect.php'); + $this->assertTitle('Simple test target file'); + } +} + +class TestOfLiveCookies extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function here() { + return new SimpleUrl($this->samples()); + } + + function thisHost() { + $here = $this->here(); + return $here->getHost(); + } + + function thisPath() { + $here = $this->here(); + return $here->getPath(); + } + + function testCookieSettingAndAssertions() { + $this->setCookie('a', 'Test cookie a'); + $this->setCookie('b', 'Test cookie b', $this->thisHost()); + $this->setCookie('c', 'Test cookie c', $this->thisHost(), $this->thisPath()); + $this->get($this->samples() . 'network_confirm.php'); + $this->assertText('Test cookie a'); + $this->assertText('Test cookie b'); + $this->assertText('Test cookie c'); + $this->assertCookie('a'); + $this->assertCookie('b', 'Test cookie b'); + $this->assertTrue($this->getCookie('c') == 'Test cookie c'); + } + + function testNoCookieSetWhenCookiesDisabled() { + $this->setCookie('a', 'Test cookie a'); + $this->ignoreCookies(); + $this->get($this->samples() . 'network_confirm.php'); + $this->assertNoText('Test cookie a'); + } + + function testCookieReading() { + $this->get($this->samples() . 'set_cookies.php'); + $this->assertCookie('session_cookie', 'A'); + $this->assertCookie('short_cookie', 'B'); + $this->assertCookie('day_cookie', 'C'); + } + + function testNoCookie() { + $this->assertNoCookie('aRandomCookie'); + } + + function testNoCookieReadingWhenCookiesDisabled() { + $this->ignoreCookies(); + $this->get($this->samples() . 'set_cookies.php'); + $this->assertNoCookie('session_cookie'); + $this->assertNoCookie('short_cookie'); + $this->assertNoCookie('day_cookie'); + } + + function testCookiePatternAssertions() { + $this->get($this->samples() . 'set_cookies.php'); + $this->assertCookie('session_cookie', new PatternExpectation('/a/i')); + } + + function testTemporaryCookieExpiry() { + $this->get($this->samples() . 'set_cookies.php'); + $this->restart(); + $this->assertNoCookie('session_cookie'); + $this->assertCookie('day_cookie', 'C'); + } + + function testTimedCookieExpiryWith100SecondMargin() { + $this->get($this->samples() . 'set_cookies.php'); + $this->ageCookies(3600); + $this->restart(time() + 100); + $this->assertNoCookie('session_cookie'); + $this->assertNoCookie('hour_cookie'); + $this->assertCookie('day_cookie', 'C'); + } + + function testNoClockOverDriftBy100Seconds() { + $this->get($this->samples() . 'set_cookies.php'); + $this->restart(time() + 200); + $this->assertNoCookie( + 'short_cookie', + '%s -> Please check your computer clock setting if you are not using NTP'); + } + + function testNoClockUnderDriftBy100Seconds() { + $this->get($this->samples() . 'set_cookies.php'); + $this->restart(time() + 0); + $this->assertCookie( + 'short_cookie', + 'B', + '%s -> Please check your computer clock setting if you are not using NTP'); + } + + function testCookiePath() { + $this->get($this->samples() . 'set_cookies.php'); + $this->assertNoCookie('path_cookie', 'D'); + $this->get('./path/show_cookies.php'); + $this->assertPattern('/path_cookie/'); + $this->assertCookie('path_cookie', 'D'); + } +} + +class LiveTestOfForms extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testSimpleSubmit() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('go=[Go!]'); + } + + function testDefaultFormValues() { + $this->get($this->samples() . 'form.html'); + $this->assertFieldByName('a', ''); + $this->assertFieldByName('b', 'Default text'); + $this->assertFieldByName('c', ''); + $this->assertFieldByName('d', 'd1'); + $this->assertFieldByName('e', false); + $this->assertFieldByName('f', 'on'); + $this->assertFieldByName('g', 'g3'); + $this->assertFieldByName('h', 2); + $this->assertFieldByName('go', 'Go!'); + $this->assertClickable('Go!'); + $this->assertSubmit('Go!'); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('go=[Go!]'); + $this->assertText('a=[]'); + $this->assertText('b=[Default text]'); + $this->assertText('c=[]'); + $this->assertText('d=[d1]'); + $this->assertNoText('e=['); + $this->assertText('f=[on]'); + $this->assertText('g=[g3]'); + } + + function testFormSubmissionByButtonLabel() { + $this->get($this->samples() . 'form.html'); + $this->setFieldByName('a', 'aaa'); + $this->setFieldByName('b', 'bbb'); + $this->setFieldByName('c', 'ccc'); + $this->setFieldByName('d', 'D2'); + $this->setFieldByName('e', 'on'); + $this->setFieldByName('f', false); + $this->setFieldByName('g', 'g2'); + $this->setFieldByName('h', 1); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('a=[aaa]'); + $this->assertText('b=[bbb]'); + $this->assertText('c=[ccc]'); + $this->assertText('d=[d2]'); + $this->assertText('e=[on]'); + $this->assertNoText('f=['); + $this->assertText('g=[g2]'); + } + + function testAdditionalFormValues() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->clickSubmit('Go!', array('add' => 'A'))); + $this->assertText('go=[Go!]'); + $this->assertText('add=[A]'); + } + + function testFormSubmissionByName() { + $this->get($this->samples() . 'form.html'); + $this->setFieldByName('a', 'A'); + $this->assertTrue($this->clickSubmitByName('go')); + $this->assertText('a=[A]'); + } + + function testFormSubmissionByNameAndAdditionalParameters() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->clickSubmitByName('go', array('add' => 'A'))); + $this->assertText('go=[Go!]'); + $this->assertText('add=[A]'); + } + + function testFormSubmissionBySubmitButtonLabeledSubmit() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->clickSubmitByName('test')); + $this->assertText('test=[Submit]'); + } + + function testFormSubmissionWithIds() { + $this->get($this->samples() . 'form.html'); + $this->assertFieldById(1, ''); + $this->assertFieldById(2, 'Default text'); + $this->assertFieldById(3, ''); + $this->assertFieldById(4, 'd1'); + $this->assertFieldById(5, false); + $this->assertFieldById(6, 'on'); + $this->assertFieldById(8, 'g3'); + $this->assertFieldById(11, 2); + $this->setFieldById(1, 'aaa'); + $this->setFieldById(2, 'bbb'); + $this->setFieldById(3, 'ccc'); + $this->setFieldById(4, 'D2'); + $this->setFieldById(5, 'on'); + $this->setFieldById(6, false); + $this->setFieldById(8, 'g2'); + $this->setFieldById(11, 'H1'); + $this->assertTrue($this->clickSubmitById(99)); + $this->assertText('a=[aaa]'); + $this->assertText('b=[bbb]'); + $this->assertText('c=[ccc]'); + $this->assertText('d=[d2]'); + $this->assertText('e=[on]'); + $this->assertNoText('f=['); + $this->assertText('g=[g2]'); + $this->assertText('h=[1]'); + $this->assertText('go=[Go!]'); + } + + function testFormSubmissionWithLabels() { + $this->get($this->samples() . 'form.html'); + $this->assertField('Text A', ''); + $this->assertField('Text B', 'Default text'); + $this->assertField('Text area C', ''); + $this->assertField('Selection D', 'd1'); + $this->assertField('Checkbox E', false); + $this->assertField('Checkbox F', 'on'); + $this->assertField('3', 'g3'); + $this->assertField('Selection H', 2); + $this->setField('Text A', 'aaa'); + $this->setField('Text B', 'bbb'); + $this->setField('Text area C', 'ccc'); + $this->setField('Selection D', 'D2'); + $this->setField('Checkbox E', 'on'); + $this->setField('Checkbox F', false); + $this->setField('2', 'g2'); + $this->setField('Selection H', 'H1'); + $this->clickSubmit('Go!'); + $this->assertText('a=[aaa]'); + $this->assertText('b=[bbb]'); + $this->assertText('c=[ccc]'); + $this->assertText('d=[d2]'); + $this->assertText('e=[on]'); + $this->assertNoText('f=['); + $this->assertText('g=[g2]'); + $this->assertText('h=[1]'); + $this->assertText('go=[Go!]'); + } + + function testSettingCheckboxWithBooleanTrueSetsUnderlyingValue() { + $this->get($this->samples() . 'form.html'); + $this->setField('Checkbox E', true); + $this->assertField('Checkbox E', 'on'); + $this->clickSubmit('Go!'); + $this->assertText('e=[on]'); + } + + function testFormSubmissionWithMixedPostAndGet() { + $this->get($this->samples() . 'form_with_mixed_post_and_get.html'); + $this->setField('Text A', 'Hello'); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('a=[Hello]'); + $this->assertText('x=[X]'); + $this->assertText('y=[Y]'); + } + + function testFormSubmissionWithMixedPostAndEncodedGet() { + $this->get($this->samples() . 'form_with_mixed_post_and_get.html'); + $this->setField('Text B', 'Hello'); + $this->assertTrue($this->clickSubmit('Go encoded!')); + $this->assertText('b=[Hello]'); + $this->assertText('x=[X]'); + $this->assertText('y=[Y]'); + } + + function testFormSubmissionWithoutAction() { + $this->get($this->samples() . 'form_without_action.php?test=test'); + $this->assertText('_GET : [test]'); + $this->assertTrue($this->clickSubmit('Submit Post With Empty Action')); + $this->assertText('_GET : [test]'); + $this->assertText('_POST : [test]'); + } + + function testImageSubmissionByLabel() { + $this->get($this->samples() . 'form.html'); + $this->assertImage('Image go!'); + $this->assertTrue($this->clickImage('Image go!', 10, 12)); + $this->assertText('go_x=[10]'); + $this->assertText('go_y=[12]'); + } + + function testImageSubmissionByLabelWithAdditionalParameters() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->clickImage('Image go!', 10, 12, array('add' => 'A'))); + $this->assertText('add=[A]'); + } + + function testImageSubmissionByName() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->clickImageByName('go', 10, 12)); + $this->assertText('go_x=[10]'); + $this->assertText('go_y=[12]'); + } + + function testImageSubmissionById() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->clickImageById(97, 10, 12)); + $this->assertText('go_x=[10]'); + $this->assertText('go_y=[12]'); + } + + function testButtonSubmissionByLabel() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->clickSubmit('Button go!', 10, 12)); + $this->assertPattern('/go=\[ButtonGo\]/s'); + } + + function testNamelessSubmitSendsNoValue() { + $this->get($this->samples() . 'form_with_unnamed_submit.html'); + $this->click('Go!'); + $this->assertNoText('Go!'); + $this->assertNoText('submit'); + } + + function testNamelessImageSendsXAndYValues() { + $this->get($this->samples() . 'form_with_unnamed_submit.html'); + $this->clickImage('Image go!', 4, 5); + $this->assertNoText('ImageGo'); + $this->assertText('x=[4]'); + $this->assertText('y=[5]'); + } + + function testNamelessButtonSendsNoValue() { + $this->get($this->samples() . 'form_with_unnamed_submit.html'); + $this->click('Button Go!'); + $this->assertNoText('ButtonGo'); + } + + function testSelfSubmit() { + $this->get($this->samples() . 'self_form.php'); + $this->assertNoText('[Submitted]'); + $this->assertNoText('[Wrong form]'); + $this->assertTrue($this->clickSubmit()); + $this->assertText('[Submitted]'); + $this->assertNoText('[Wrong form]'); + $this->assertTitle('Test of form self submission'); + } + + function testSelfSubmitWithParameters() { + $this->get($this->samples() . 'self_form.php'); + $this->setFieldByName('visible', 'Resent'); + $this->assertTrue($this->clickSubmit()); + $this->assertText('[Resent]'); + } + + function testSettingOfBlankOption() { + $this->get($this->samples() . 'form.html'); + $this->assertTrue($this->setFieldByName('d', '')); + $this->clickSubmit('Go!'); + $this->assertText('d=[]'); + } + + function testAssertingFieldValueWithPattern() { + $this->get($this->samples() . 'form.html'); + $this->setField('c', 'A very long string'); + $this->assertField('c', new PatternExpectation('/very long/')); + } + + function testSendingMultipartFormDataEncodedForm() { + $this->get($this->samples() . 'form_data_encoded_form.html'); + $this->assertField('Text A', ''); + $this->assertField('Text B', 'Default text'); + $this->assertField('Text area C', ''); + $this->assertField('Selection D', 'd1'); + $this->assertField('Checkbox E', false); + $this->assertField('Checkbox F', 'on'); + $this->assertField('3', 'g3'); + $this->assertField('Selection H', 2); + $this->setField('Text A', 'aaa'); + $this->setField('Text B', 'bbb'); + $this->setField('Text area C', 'ccc'); + $this->setField('Selection D', 'D2'); + $this->setField('Checkbox E', 'on'); + $this->setField('Checkbox F', false); + $this->setField('2', 'g2'); + $this->setField('Selection H', 'H1'); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('a=[aaa]'); + $this->assertText('b=[bbb]'); + $this->assertText('c=[ccc]'); + $this->assertText('d=[d2]'); + $this->assertText('e=[on]'); + $this->assertNoText('f=['); + $this->assertText('g=[g2]'); + $this->assertText('h=[1]'); + $this->assertText('go=[Go!]'); + } + + function testSettingVariousBlanksInFields() { + $this->get($this->samples() . 'form_with_false_defaults.html'); + $this->assertField('Text A', ''); + $this->setField('Text A', '0'); + $this->assertField('Text A', '0'); + $this->assertField('Text area B', ''); + $this->setField('Text area B', '0'); + $this->assertField('Text area B', '0'); + $this->assertField('Text area C', " "); + $this->assertField('Selection D', ''); + $this->setField('Selection D', 'D2'); + $this->assertField('Selection D', 'D2'); + $this->setField('Selection D', 'D3'); + $this->assertField('Selection D', '0'); + $this->setField('Selection D', 'D4'); + $this->assertField('Selection D', '?'); + $this->assertField('Checkbox E', ''); + $this->assertField('Checkbox F', 'on'); + $this->assertField('Checkbox G', '0'); + $this->assertField('Checkbox H', '?'); + $this->assertFieldByName('i', 'on'); + $this->setFieldByName('i', ''); + $this->assertFieldByName('i', ''); + $this->setFieldByName('i', '0'); + $this->assertFieldByName('i', '0'); + $this->setFieldByName('i', '?'); + $this->assertFieldByName('i', '?'); + } + + function testSubmissionOfBlankFields() { + $this->get($this->samples() . 'form_with_false_defaults.html'); + $this->setField('Text A', ''); + $this->setField('Text area B', ''); + $this->setFieldByName('i', ''); + $this->click('Go!'); + $this->assertText('a=[]'); + $this->assertText('b=[]'); + $this->assertPattern('/c=\[ \]/'); + $this->assertText('d=[]'); + $this->assertText('e=[]'); + $this->assertText('i=[]'); + } + + function testSubmissionOfEmptyValues() { + $this->get($this->samples() . 'form_with_false_defaults.html'); + $this->setField('Selection D', 'D2'); + $this->click('Go!'); + $this->assertText('a=[]'); + $this->assertText('b=[]'); + $this->assertText('d=[D2]'); + $this->assertText('f=[on]'); + $this->assertText('i=[on]'); + } + + function testSubmissionOfZeroes() { + $this->get($this->samples() . 'form_with_false_defaults.html'); + $this->setField('Text A', '0'); + $this->setField('Text area B', '0'); + $this->setField('Selection D', 'D3'); + $this->setFieldByName('i', '0'); + $this->click('Go!'); + $this->assertText('a=[0]'); + $this->assertText('b=[0]'); + $this->assertText('d=[0]'); + $this->assertText('g=[0]'); + $this->assertText('i=[0]'); + } + + function testSubmissionOfQuestionMarks() { + $this->get($this->samples() . 'form_with_false_defaults.html'); + $this->setField('Text A', '?'); + $this->setField('Text area B', '?'); + $this->setField('Selection D', 'D4'); + $this->setFieldByName('i', '?'); + $this->click('Go!'); + $this->assertText('a=[?]'); + $this->assertText('b=[?]'); + $this->assertText('d=[?]'); + $this->assertText('h=[?]'); + $this->assertText('i=[?]'); + } + + function testSubmissionOfHtmlEncodedValues() { + $this->get($this->samples() . 'form_with_tricky_defaults.html'); + $this->assertField('Text A', '&\'"<>'); + $this->assertField('Text B', '"'); + $this->assertField('Text area C', '&\'"<>'); + $this->assertField('Selection D', "'"); + $this->assertField('Checkbox E', '&\'"<>'); + $this->assertField('Checkbox F', false); + $this->assertFieldByname('i', "'"); + $this->click('Go!'); + $this->assertText('a=[&\'"<>, "]'); + $this->assertText('c=[&\'"<>]'); + $this->assertText("d=[']"); + $this->assertText('e=[&\'"<>]'); + $this->assertText("i=[']"); + } + + function testFormActionRespectsBaseTag() { + $this->get($this->samples() . 'base_tag/form.html'); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('go=[Go!]'); + $this->assertText('a=[]'); + } +} + +class TestOfLiveMultiValueWidgets extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testDefaultFormValueSubmission() { + $this->get($this->samples() . 'multiple_widget_form.html'); + $this->assertFieldByName('a', array('a2', 'a3')); + $this->assertFieldByName('b', array('b2', 'b3')); + $this->assertFieldByName('c[]', array('c2', 'c3')); + $this->assertFieldByName('d', array('2', '3')); + $this->assertFieldByName('e', array('2', '3')); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('a=[a2, a3]'); + $this->assertText('b=[b2, b3]'); + $this->assertText('c=[c2, c3]'); + $this->assertText('d=[2, 3]'); + $this->assertText('e=[2, 3]'); + } + + function testSubmittingMultipleValues() { + $this->get($this->samples() . 'multiple_widget_form.html'); + $this->setFieldByName('a', array('a1', 'a4')); + $this->assertFieldByName('a', array('a1', 'a4')); + $this->assertFieldByName('a', array('a4', 'a1')); + $this->setFieldByName('b', array('b1', 'b4')); + $this->assertFieldByName('b', array('b1', 'b4')); + $this->setFieldByName('c[]', array('c1', 'c4')); + $this->assertField('c[]', array('c1', 'c4')); + $this->setFieldByName('d', array('1', '4')); + $this->assertField('d', array('1', '4')); + $this->setFieldByName('e', array('e1', 'e4')); + $this->assertField('e', array('1', '4')); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('a=[a1, a4]'); + $this->assertText('b=[b1, b4]'); + $this->assertText('c=[c1, c4]'); + $this->assertText('d=[1, 4]'); + $this->assertText('e=[1, 4]'); + } + + function testSettingByOptionValue() { + $this->get($this->samples() . 'multiple_widget_form.html'); + $this->setFieldByName('d', array('1', '4')); + $this->assertField('d', array('1', '4')); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('d=[1, 4]'); + } + + function testSubmittingMultipleValuesByLabel() { + $this->get($this->samples() . 'multiple_widget_form.html'); + $this->setField('Multiple selection A', array('a1', 'a4')); + $this->assertField('Multiple selection A', array('a1', 'a4')); + $this->assertField('Multiple selection A', array('a4', 'a1')); + $this->setField('multiple selection C', array('c1', 'c4')); + $this->assertField('multiple selection C', array('c1', 'c4')); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('a=[a1, a4]'); + $this->assertText('c=[c1, c4]'); + } + + function testSavantStyleHiddenFieldDefaults() { + $this->get($this->samples() . 'savant_style_form.html'); + $this->assertFieldByName('a', array('a0')); + $this->assertFieldByName('b', array('b0')); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('a=[a0]'); + $this->assertText('b=[b0]'); + } + + function testSavantStyleHiddenDefaultsAreOverridden() { + $this->get($this->samples() . 'savant_style_form.html'); + $this->assertTrue($this->setFieldByName('a', array('a1'))); + $this->assertTrue($this->setFieldByName('b', 'b1')); + $this->assertTrue($this->clickSubmit('Go!')); + $this->assertText('a=[a1]'); + $this->assertText('b=[b1]'); + } + + function testSavantStyleFormSettingById() { + $this->get($this->samples() . 'savant_style_form.html'); + $this->assertFieldById(1, array('a0')); + $this->assertFieldById(4, array('b0')); + $this->assertTrue($this->setFieldById(2, 'a1')); + $this->assertTrue($this->setFieldById(5, 'b1')); + $this->assertTrue($this->clickSubmitById(99)); + $this->assertText('a=[a1]'); + $this->assertText('b=[b1]'); + } +} + +class TestOfFileUploads extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testSingleFileUpload() { + $this->get($this->samples() . 'upload_form.html'); + $this->assertTrue($this->setField('Content:', + dirname(__FILE__) . '/support/upload_sample.txt')); + $this->assertField('Content:', dirname(__FILE__) . '/support/upload_sample.txt'); + $this->click('Go!'); + $this->assertText('Sample for testing file upload'); + } + + function testMultipleFileUpload() { + $this->get($this->samples() . 'upload_form.html'); + $this->assertTrue($this->setField('Content:', + dirname(__FILE__) . '/support/upload_sample.txt')); + $this->assertTrue($this->setField('Supplemental:', + dirname(__FILE__) . '/support/supplementary_upload_sample.txt')); + $this->assertField('Supplemental:', + dirname(__FILE__) . '/support/supplementary_upload_sample.txt'); + $this->click('Go!'); + $this->assertText('Sample for testing file upload'); + $this->assertText('Some more text content'); + } + + function testBinaryFileUpload() { + $this->get($this->samples() . 'upload_form.html'); + $this->assertTrue($this->setField('Content:', + dirname(__FILE__) . '/support/latin1_sample')); + $this->click('Go!'); + $this->assertText( + implode('', file(dirname(__FILE__) . '/support/latin1_sample'))); + } +} + +class TestOfLiveHistoryNavigation extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testRetry() { + $this->get($this->samples() . 'cookie_based_counter.php'); + $this->assertPattern('/count: 1/i'); + $this->retry(); + $this->assertPattern('/count: 2/i'); + $this->retry(); + $this->assertPattern('/count: 3/i'); + } + + function testOfBackButton() { + $this->get($this->samples() . '1.html'); + $this->clickLink('2'); + $this->assertTitle('2'); + $this->assertTrue($this->back()); + $this->assertTitle('1'); + $this->assertTrue($this->forward()); + $this->assertTitle('2'); + $this->assertFalse($this->forward()); + } + + function testGetRetryResubmitsData() { + $this->assertTrue($this->get( + $this->samples() . 'network_confirm.php?a=aaa')); + $this->assertPattern('/Request method.*?
    GET<\/dd>/'); + $this->assertText('a=[aaa]'); + $this->retry(); + $this->assertPattern('/Request method.*?
    GET<\/dd>/'); + $this->assertText('a=[aaa]'); + } + + function testGetRetryResubmitsExtraData() { + $this->assertTrue($this->get( + $this->samples() . 'network_confirm.php', + array('a' => 'aaa'))); + $this->assertPattern('/Request method.*?
    GET<\/dd>/'); + $this->assertText('a=[aaa]'); + $this->retry(); + $this->assertPattern('/Request method.*?
    GET<\/dd>/'); + $this->assertText('a=[aaa]'); + } + + function testPostRetryResubmitsData() { + $this->assertTrue($this->post( + $this->samples() . 'network_confirm.php', + array('a' => 'aaa'))); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('a=[aaa]'); + $this->retry(); + $this->assertPattern('/Request method.*?
    POST<\/dd>/'); + $this->assertText('a=[aaa]'); + } + + function testGetRetryResubmitsRepeatedData() { + $this->assertTrue($this->get( + $this->samples() . 'network_confirm.php?a=1&a=2')); + $this->assertPattern('/Request method.*?
    GET<\/dd>/'); + $this->assertText('a=[1, 2]'); + $this->retry(); + $this->assertPattern('/Request method.*?
    GET<\/dd>/'); + $this->assertText('a=[1, 2]'); + } +} + +class TestOfLiveAuthentication extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testChallengeFromProtectedPage() { + $this->get($this->samples() . 'protected/'); + $this->assertResponse(401); + $this->assertAuthentication('Basic'); + $this->assertRealm('SimpleTest basic authentication'); + $this->assertRealm(new PatternExpectation('/simpletest/i')); + $this->authenticate('test', 'secret'); + $this->assertResponse(200); + $this->retry(); + $this->assertResponse(200); + } + + function testTrailingSlashImpliedWithinRealm() { + $this->get($this->samples() . 'protected/'); + $this->authenticate('test', 'secret'); + $this->assertResponse(200); + $this->get($this->samples() . 'protected'); + $this->assertResponse(200); + } + + function testTrailingSlashImpliedSettingRealm() { + $this->get($this->samples() . 'protected'); + $this->authenticate('test', 'secret'); + $this->assertResponse(200); + $this->get($this->samples() . 'protected/'); + $this->assertResponse(200); + } + + function testEncodedAuthenticationFetchesPage() { + $this->get('http://test:secret@www.lastcraft.com/test/protected/'); + $this->assertResponse(200); + } + + function testEncodedAuthenticationFetchesPageAfterTrailingSlashRedirect() { + $this->get('http://test:secret@www.lastcraft.com/test/protected'); + $this->assertResponse(200); + } + + function testRealmExtendsToWholeDirectory() { + $this->get($this->samples() . 'protected/1.html'); + $this->authenticate('test', 'secret'); + $this->clickLink('2'); + $this->assertResponse(200); + $this->clickLink('3'); + $this->assertResponse(200); + } + + function testRedirectKeepsAuthentication() { + $this->get($this->samples() . 'protected/local_redirect.php'); + $this->authenticate('test', 'secret'); + $this->assertTitle('Simple test target file'); + } + + function testRedirectKeepsEncodedAuthentication() { + $this->get('http://test:secret@www.lastcraft.com/test/protected/local_redirect.php'); + $this->assertResponse(200); + $this->assertTitle('Simple test target file'); + } + + function testSessionRestartLosesAuthentication() { + $this->get($this->samples() . 'protected/'); + $this->authenticate('test', 'secret'); + $this->assertResponse(200); + $this->restart(); + $this->get($this->samples() . 'protected/'); + $this->assertResponse(401); + } +} + +class TestOfLoadingFrames extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testNoFramesContentWhenFramesDisabled() { + $this->ignoreFrames(); + $this->get($this->samples() . 'one_page_frameset.html'); + $this->assertTitle('Frameset for testing of SimpleTest'); + $this->assertText('This content is for no frames only'); + } + + function testPatternMatchCanReadTheOnlyFrame() { + $this->get($this->samples() . 'one_page_frameset.html'); + $this->assertText('A target for the SimpleTest test suite'); + $this->assertNoText('This content is for no frames only'); + } + + function testMessyFramesetResponsesByName() { + $this->assertTrue($this->get( + $this->samples() . 'messy_frameset.html')); + $this->assertTitle('Frameset for testing of SimpleTest'); + + $this->assertTrue($this->setFrameFocus('Front controller')); + $this->assertResponse(200); + $this->assertText('Simple test front controller'); + + $this->assertTrue($this->setFrameFocus('One')); + $this->assertResponse(200); + $this->assertLink('2'); + + $this->assertTrue($this->setFrameFocus('Frame links')); + $this->assertResponse(200); + $this->assertLink('Set one to 2'); + + $this->assertTrue($this->setFrameFocus('Counter')); + $this->assertResponse(200); + $this->assertText('Count: 1'); + + $this->assertTrue($this->setFrameFocus('Redirected')); + $this->assertResponse(200); + $this->assertText('r=rrr'); + + $this->assertTrue($this->setFrameFocus('Protected')); + $this->assertResponse(401); + + $this->assertTrue($this->setFrameFocus('Protected redirect')); + $this->assertResponse(401); + + $this->assertTrue($this->setFrameFocusByIndex(1)); + $this->assertResponse(200); + $this->assertText('Simple test front controller'); + + $this->assertTrue($this->setFrameFocusByIndex(2)); + $this->assertResponse(200); + $this->assertLink('2'); + + $this->assertTrue($this->setFrameFocusByIndex(3)); + $this->assertResponse(200); + $this->assertLink('Set one to 2'); + + $this->assertTrue($this->setFrameFocusByIndex(4)); + $this->assertResponse(200); + $this->assertText('Count: 1'); + + $this->assertTrue($this->setFrameFocusByIndex(5)); + $this->assertResponse(200); + $this->assertText('r=rrr'); + + $this->assertTrue($this->setFrameFocusByIndex(6)); + $this->assertResponse(401); + + $this->assertTrue($this->setFrameFocusByIndex(7)); + } + + function testReloadingFramesetPage() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->assertText('Count: 1'); + $this->retry(); + $this->assertText('Count: 2'); + $this->retry(); + $this->assertText('Count: 3'); + } + + function testReloadingSingleFrameWithCookieCounter() { + $this->get($this->samples() . 'counting_frameset.html'); + $this->setFrameFocus('a'); + $this->assertText('Count: 1'); + $this->setFrameFocus('b'); + $this->assertText('Count: 2'); + + $this->setFrameFocus('a'); + $this->retry(); + $this->assertText('Count: 3'); + $this->retry(); + $this->assertText('Count: 4'); + $this->setFrameFocus('b'); + $this->assertText('Count: 2'); + } + + function testReloadingFrameWhenUnfocusedReloadsWholeFrameset() { + $this->get($this->samples() . 'counting_frameset.html'); + $this->setFrameFocus('a'); + $this->assertText('Count: 1'); + $this->setFrameFocus('b'); + $this->assertText('Count: 2'); + + $this->clearFrameFocus('a'); + $this->retry(); + + $this->assertTitle('Frameset for testing of SimpleTest'); + $this->setFrameFocus('a'); + $this->assertText('Count: 3'); + $this->setFrameFocus('b'); + $this->assertText('Count: 4'); + } + + function testClickingNormalLinkReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickLink('2'); + $this->assertLink('3'); + $this->assertText('Simple test front controller'); + } + + function testJumpToNamedPageReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->assertPattern('/Simple test front controller/'); + $this->clickLink('Index'); + $this->assertResponse(200); + $this->assertText('[action=index]'); + $this->assertText('Count: 1'); + } + + function testJumpToUnnamedPageReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickLink('No page'); + $this->assertResponse(200); + $this->assertText('Simple test front controller'); + $this->assertText('[action=no_page]'); + $this->assertText('Count: 1'); + } + + function testJumpToUnnamedPageWithBareParameterReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickLink('Bare action'); + $this->assertResponse(200); + $this->assertText('Simple test front controller'); + $this->assertText('[action=]'); + $this->assertText('Count: 1'); + } + + function testJumpToUnnamedPageWithEmptyQueryReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickLink('Empty query'); + $this->assertResponse(200); + $this->assertPattern('/Simple test front controller/'); + $this->assertPattern('/raw get data.*?\[\].*?get data/si'); + $this->assertPattern('/Count: 1/'); + } + + function testJumpToUnnamedPageWithEmptyLinkReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickLink('Empty link'); + $this->assertResponse(200); + $this->assertPattern('/Simple test front controller/'); + $this->assertPattern('/raw get data.*?\[\].*?get data/si'); + $this->assertPattern('/Count: 1/'); + } + + function testJumpBackADirectoryLevelReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickLink('Down one'); + $this->assertPattern('/index of .*\/test/i'); + $this->assertPattern('/Count: 1/'); + } + + function testSubmitToNamedPageReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->assertPattern('/Simple test front controller/'); + $this->clickSubmit('Index'); + $this->assertResponse(200); + $this->assertText('[action=Index]'); + $this->assertText('Count: 1'); + } + + function testSubmitToSameDirectoryReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickSubmit('Same directory'); + $this->assertResponse(200); + $this->assertText('[action=Same+directory]'); + $this->assertText('Count: 1'); + } + + function testSubmitToEmptyActionReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickSubmit('Empty action'); + $this->assertResponse(200); + $this->assertText('[action=Empty+action]'); + $this->assertText('Count: 1'); + } + + function testSubmitToNoActionReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickSubmit('No action'); + $this->assertResponse(200); + $this->assertText('[action=No+action]'); + $this->assertText('Count: 1'); + } + + function testSubmitBackADirectoryLevelReplacesJustThatFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickSubmit('Down one'); + $this->assertPattern('/index of .*\/test/i'); + $this->assertPattern('/Count: 1/'); + } + + function testTopLinkExitsFrameset() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->clickLink('Exit the frameset'); + $this->assertTitle('Simple test target file'); + } + + function testLinkInOnePageCanLoadAnother() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->assertNoLink('3'); + $this->clickLink('Set one to 2'); + $this->assertLink('3'); + $this->assertNoLink('2'); + $this->assertTitle('Frameset for testing of SimpleTest'); + } + + function testFrameWithRelativeLinksRespectsBaseTagForThatPage() { + $this->get($this->samples() . 'base_tag/frameset.html'); + $this->click('Back to test pages'); + $this->assertTitle('Frameset for testing of SimpleTest'); + $this->assertText('A target for the SimpleTest test suite'); + } + + function testRelativeLinkInFrameIsNotAffectedByFramesetBaseTag() { + $this->get($this->samples() . 'base_tag/frameset_with_base_tag.html'); + $this->assertText('This is page 1'); + $this->click('To page 2'); + $this->assertTitle('Frameset for testing of SimpleTest'); + $this->assertText('This is page 2'); + } +} + +class TestOfFrameAuthentication extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testUnauthenticatedFrameSendsChallenge() { + $this->get($this->samples() . 'protected/'); + $this->setFrameFocus('Protected'); + $this->assertAuthentication('Basic'); + $this->assertRealm('SimpleTest basic authentication'); + $this->assertResponse(401); + } + + function testCanReadFrameFromAlreadyAuthenticatedRealm() { + $this->get($this->samples() . 'protected/'); + $this->authenticate('test', 'secret'); + $this->get($this->samples() . 'messy_frameset.html'); + $this->setFrameFocus('Protected'); + $this->assertResponse(200); + $this->assertText('A target for the SimpleTest test suite'); + } + + function testCanAuthenticateFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->setFrameFocus('Protected'); + $this->authenticate('test', 'secret'); + $this->assertResponse(200); + $this->assertText('A target for the SimpleTest test suite'); + $this->clearFrameFocus(); + $this->assertText('Count: 1'); + } + + function testCanAuthenticateRedirectedFrame() { + $this->get($this->samples() . 'messy_frameset.html'); + $this->setFrameFocus('Protected redirect'); + $this->assertResponse(401); + $this->authenticate('test', 'secret'); + $this->assertResponse(200); + $this->assertText('A target for the SimpleTest test suite'); + $this->clearFrameFocus(); + $this->assertText('Count: 1'); + } +} + +class TestOfNestedFrames extends SimpleTestAcceptanceTest { + function setUp() { + $this->addHeader('User-Agent: SimpleTest ' . SimpleTest::getVersion()); + } + + function testCanNavigateToSpecificContent() { + $this->get($this->samples() . 'nested_frameset.html'); + $this->assertTitle('Nested frameset for testing of SimpleTest'); + + $this->assertPattern('/This is frame A/'); + $this->assertPattern('/This is frame B/'); + $this->assertPattern('/Simple test front controller/'); + $this->assertLink('2'); + $this->assertLink('Set one to 2'); + $this->assertPattern('/Count: 1/'); + $this->assertPattern('/r=rrr/'); + + $this->setFrameFocus('pair'); + $this->assertPattern('/This is frame A/'); + $this->assertPattern('/This is frame B/'); + $this->assertNoPattern('/Simple test front controller/'); + $this->assertNoLink('2'); + + $this->setFrameFocus('aaa'); + $this->assertPattern('/This is frame A/'); + $this->assertNoPattern('/This is frame B/'); + + $this->clearFrameFocus(); + $this->assertResponse(200); + $this->setFrameFocus('messy'); + $this->assertResponse(200); + $this->setFrameFocus('Front controller'); + $this->assertResponse(200); + $this->assertPattern('/Simple test front controller/'); + $this->assertNoLink('2'); + } + + function testReloadingFramesetPage() { + $this->get($this->samples() . 'nested_frameset.html'); + $this->assertPattern('/Count: 1/'); + $this->retry(); + $this->assertPattern('/Count: 2/'); + $this->retry(); + $this->assertPattern('/Count: 3/'); + } + + function testRetryingNestedPageOnlyRetriesThatSet() { + $this->get($this->samples() . 'nested_frameset.html'); + $this->assertPattern('/Count: 1/'); + $this->setFrameFocus('messy'); + $this->retry(); + $this->assertPattern('/Count: 2/'); + $this->setFrameFocus('Counter'); + $this->retry(); + $this->assertPattern('/Count: 3/'); + + $this->clearFrameFocus(); + $this->setFrameFocus('messy'); + $this->setFrameFocus('Front controller'); + $this->retry(); + + $this->clearFrameFocus(); + $this->assertPattern('/Count: 3/'); + } + + function testAuthenticatingNestedPage() { + $this->get($this->samples() . 'nested_frameset.html'); + $this->setFrameFocus('messy'); + $this->setFrameFocus('Protected'); + $this->assertAuthentication('Basic'); + $this->assertRealm('SimpleTest basic authentication'); + $this->assertResponse(401); + + $this->authenticate('test', 'secret'); + $this->assertResponse(200); + $this->assertPattern('/A target for the SimpleTest test suite/'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/adapter_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/adapter_test.php new file mode 100644 index 0000000..c1a06a2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/adapter_test.php @@ -0,0 +1,50 @@ +assertTrue(true, "PEAR true"); + $this->assertFalse(false, "PEAR false"); + } + + function testName() { + $this->assertTrue($this->getName() == get_class($this)); + } + + function testPass() { + $this->pass("PEAR pass"); + } + + function testNulls() { + $value = null; + $this->assertNull($value, "PEAR null"); + $value = 0; + $this->assertNotNull($value, "PEAR not null"); + } + + function testType() { + $this->assertType("Hello", "string", "PEAR type"); + } + + function testEquals() { + $this->assertEquals(12, 12, "PEAR identity"); + $this->setLooselyTyped(true); + $this->assertEquals("12", 12, "PEAR equality"); + } + + function testSame() { + $same = new SameTestClass(); + $this->assertSame($same, $same, "PEAR same"); + } + + function testRegExp() { + $this->assertRegExp('/hello/', "A big hello from me", "PEAR regex"); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/all_tests.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/all_tests.php new file mode 100644 index 0000000..99ce945 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/all_tests.php @@ -0,0 +1,13 @@ +TestSuite('All tests for SimpleTest ' . SimpleTest::getVersion()); + $this->addFile(dirname(__FILE__) . '/unit_tests.php'); + $this->addFile(dirname(__FILE__) . '/shell_test.php'); + $this->addFile(dirname(__FILE__) . '/live_test.php'); + $this->addFile(dirname(__FILE__) . '/acceptance_test.php'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/authentication_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/authentication_test.php new file mode 100644 index 0000000..081cccd --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/authentication_test.php @@ -0,0 +1,145 @@ +assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path/hello.html'))); + } + + function testInsideWithLongerUrl() { + $realm = new SimpleRealm( + 'Basic', + new SimpleUrl('http://www.here.com/path/')); + $this->assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path/hello.html'))); + } + + function testBelowRootIsOutside() { + $realm = new SimpleRealm( + 'Basic', + new SimpleUrl('http://www.here.com/path/')); + $this->assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path/more/hello.html'))); + } + + function testOldNetscapeDefinitionIsOutside() { + $realm = new SimpleRealm( + 'Basic', + new SimpleUrl('http://www.here.com/path/')); + $this->assertFalse($realm->isWithin( + new SimpleUrl('http://www.here.com/pathmore/hello.html'))); + } + + function testInsideWithMissingTrailingSlash() { + $realm = new SimpleRealm( + 'Basic', + new SimpleUrl('http://www.here.com/path/')); + $this->assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path'))); + } + + function testDifferentPageNameStillInside() { + $realm = new SimpleRealm( + 'Basic', + new SimpleUrl('http://www.here.com/path/hello.html')); + $this->assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path/goodbye.html'))); + } + + function testNewUrlInSameDirectoryDoesNotChangeRealm() { + $realm = new SimpleRealm( + 'Basic', + new SimpleUrl('http://www.here.com/path/hello.html')); + $realm->stretch(new SimpleUrl('http://www.here.com/path/goodbye.html')); + $this->assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path/index.html'))); + $this->assertFalse($realm->isWithin( + new SimpleUrl('http://www.here.com/index.html'))); + } + + function testNewUrlMakesRealmTheCommonPath() { + $realm = new SimpleRealm( + 'Basic', + new SimpleUrl('http://www.here.com/path/here/hello.html')); + $realm->stretch(new SimpleUrl('http://www.here.com/path/there/goodbye.html')); + $this->assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path/here/index.html'))); + $this->assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path/there/index.html'))); + $this->assertTrue($realm->isWithin( + new SimpleUrl('http://www.here.com/path/index.html'))); + $this->assertFalse($realm->isWithin( + new SimpleUrl('http://www.here.com/index.html'))); + $this->assertFalse($realm->isWithin( + new SimpleUrl('http://www.here.com/paths/index.html'))); + $this->assertFalse($realm->isWithin( + new SimpleUrl('http://www.here.com/pathindex.html'))); + } +} + +class TestOfAuthenticator extends UnitTestCase { + + function testNoRealms() { + $request = new MockSimpleHttpRequest(); + $request->expectNever('addHeaderLine'); + $authenticator = new SimpleAuthenticator(); + $authenticator->addHeaders($request, new SimpleUrl('http://here.com/')); + } + + function &createSingleRealm() { + $authenticator = new SimpleAuthenticator(); + $authenticator->addRealm( + new SimpleUrl('http://www.here.com/path/hello.html'), + 'Basic', + 'Sanctuary'); + $authenticator->setIdentityForRealm('www.here.com', 'Sanctuary', 'test', 'secret'); + return $authenticator; + } + + function testOutsideRealm() { + $request = new MockSimpleHttpRequest(); + $request->expectNever('addHeaderLine'); + $authenticator = &$this->createSingleRealm(); + $authenticator->addHeaders( + $request, + new SimpleUrl('http://www.here.com/hello.html')); + } + + function testWithinRealm() { + $request = new MockSimpleHttpRequest(); + $request->expectOnce('addHeaderLine'); + $authenticator = &$this->createSingleRealm(); + $authenticator->addHeaders( + $request, + new SimpleUrl('http://www.here.com/path/more/hello.html')); + } + + function testRestartingClearsRealm() { + $request = new MockSimpleHttpRequest(); + $request->expectNever('addHeaderLine'); + $authenticator = &$this->createSingleRealm(); + $authenticator->restartSession(); + $authenticator->addHeaders( + $request, + new SimpleUrl('http://www.here.com/hello.html')); + } + + function testDifferentHostIsOutsideRealm() { + $request = new MockSimpleHttpRequest(); + $request->expectNever('addHeaderLine'); + $authenticator = &$this->createSingleRealm(); + $authenticator->addHeaders( + $request, + new SimpleUrl('http://here.com/path/hello.html')); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/autorun_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/autorun_test.php new file mode 100644 index 0000000..8f7ff81 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/autorun_test.php @@ -0,0 +1,13 @@ +addFile(dirname(__FILE__) . '/support/test1.php'); + $this->assertEqual($tests->getSize(), 1); + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/bad_test_suite.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/bad_test_suite.php new file mode 100644 index 0000000..b426013 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/bad_test_suite.php @@ -0,0 +1,10 @@ +TestSuite('Two bad test cases'); + $this->addFile(dirname(__FILE__) . '/support/empty_test_file.php'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/browser_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/browser_test.php new file mode 100644 index 0000000..eabe091 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/browser_test.php @@ -0,0 +1,774 @@ +assertIdentical($history->getUrl(), false); + $this->assertIdentical($history->getParameters(), false); + } + + function testCannotMoveInEmptyHistory() { + $history = new SimpleBrowserHistory(); + $this->assertFalse($history->back()); + $this->assertFalse($history->forward()); + } + + function testCurrentTargetAccessors() { + $history = new SimpleBrowserHistory(); + $history->recordEntry( + new SimpleUrl('http://www.here.com/'), + new SimpleGetEncoding()); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.here.com/')); + $this->assertIdentical($history->getParameters(), new SimpleGetEncoding()); + } + + function testSecondEntryAccessors() { + $history = new SimpleBrowserHistory(); + $history->recordEntry( + new SimpleUrl('http://www.first.com/'), + new SimpleGetEncoding()); + $history->recordEntry( + new SimpleUrl('http://www.second.com/'), + new SimplePostEncoding(array('a' => 1))); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.second.com/')); + $this->assertIdentical( + $history->getParameters(), + new SimplePostEncoding(array('a' => 1))); + } + + function testGoingBackwards() { + $history = new SimpleBrowserHistory(); + $history->recordEntry( + new SimpleUrl('http://www.first.com/'), + new SimpleGetEncoding()); + $history->recordEntry( + new SimpleUrl('http://www.second.com/'), + new SimplePostEncoding(array('a' => 1))); + $this->assertTrue($history->back()); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.first.com/')); + $this->assertIdentical($history->getParameters(), new SimpleGetEncoding()); + } + + function testGoingBackwardsOffBeginning() { + $history = new SimpleBrowserHistory(); + $history->recordEntry( + new SimpleUrl('http://www.first.com/'), + new SimpleGetEncoding()); + $this->assertFalse($history->back()); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.first.com/')); + $this->assertIdentical($history->getParameters(), new SimpleGetEncoding()); + } + + function testGoingForwardsOffEnd() { + $history = new SimpleBrowserHistory(); + $history->recordEntry( + new SimpleUrl('http://www.first.com/'), + new SimpleGetEncoding()); + $this->assertFalse($history->forward()); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.first.com/')); + $this->assertIdentical($history->getParameters(), new SimpleGetEncoding()); + } + + function testGoingBackwardsAndForwards() { + $history = new SimpleBrowserHistory(); + $history->recordEntry( + new SimpleUrl('http://www.first.com/'), + new SimpleGetEncoding()); + $history->recordEntry( + new SimpleUrl('http://www.second.com/'), + new SimplePostEncoding(array('a' => 1))); + $this->assertTrue($history->back()); + $this->assertTrue($history->forward()); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.second.com/')); + $this->assertIdentical( + $history->getParameters(), + new SimplePostEncoding(array('a' => 1))); + } + + function testNewEntryReplacesNextOne() { + $history = new SimpleBrowserHistory(); + $history->recordEntry( + new SimpleUrl('http://www.first.com/'), + new SimpleGetEncoding()); + $history->recordEntry( + new SimpleUrl('http://www.second.com/'), + new SimplePostEncoding(array('a' => 1))); + $history->back(); + $history->recordEntry( + new SimpleUrl('http://www.third.com/'), + new SimpleGetEncoding()); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.third.com/')); + $this->assertIdentical($history->getParameters(), new SimpleGetEncoding()); + } + + function testNewEntryDropsFutureEntries() { + $history = new SimpleBrowserHistory(); + $history->recordEntry( + new SimpleUrl('http://www.first.com/'), + new SimpleGetEncoding()); + $history->recordEntry( + new SimpleUrl('http://www.second.com/'), + new SimpleGetEncoding()); + $history->recordEntry( + new SimpleUrl('http://www.third.com/'), + new SimpleGetEncoding()); + $history->back(); + $history->back(); + $history->recordEntry( + new SimpleUrl('http://www.fourth.com/'), + new SimpleGetEncoding()); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.fourth.com/')); + $this->assertFalse($history->forward()); + $history->back(); + $this->assertIdentical($history->getUrl(), new SimpleUrl('http://www.first.com/')); + $this->assertFalse($history->back()); + } +} + +class TestOfParsedPageAccess extends UnitTestCase { + + function loadPage(&$page) { + $response = new MockSimpleHttpResponse($this); + $agent = new MockSimpleUserAgent($this); + $agent->returns('fetchResponse', $response); + + $browser = new MockParseSimpleBrowser($this); + $browser->returns('createUserAgent', $agent); + $browser->returns('parse', $page); + $browser->__construct(); + + $browser->get('http://this.com/page.html'); + return $browser; + } + + function testAccessorsWhenNoPage() { + $agent = new MockSimpleUserAgent($this); + $browser = new MockParseSimpleBrowser($this); + $browser->returns('createUserAgent', $agent); + $browser->__construct(); + $this->assertEqual($browser->getContent(), ''); + } + + function testParse() { + $page = new MockSimplePage(); + $page->setReturnValue('getRequest', "GET here.html\r\n\r\n"); + $page->setReturnValue('getRaw', 'Raw HTML'); + $page->setReturnValue('getTitle', 'Here'); + $page->setReturnValue('getFrameFocus', 'Frame'); + $page->setReturnValue('getMimeType', 'text/html'); + $page->setReturnValue('getResponseCode', 200); + $page->setReturnValue('getAuthentication', 'Basic'); + $page->setReturnValue('getRealm', 'Somewhere'); + $page->setReturnValue('getTransportError', 'Ouch!'); + + $browser = $this->loadPage($page); + $this->assertEqual($browser->getRequest(), "GET here.html\r\n\r\n"); + $this->assertEqual($browser->getContent(), 'Raw HTML'); + $this->assertEqual($browser->getTitle(), 'Here'); + $this->assertEqual($browser->getFrameFocus(), 'Frame'); + $this->assertIdentical($browser->getResponseCode(), 200); + $this->assertEqual($browser->getMimeType(), 'text/html'); + $this->assertEqual($browser->getAuthentication(), 'Basic'); + $this->assertEqual($browser->getRealm(), 'Somewhere'); + $this->assertEqual($browser->getTransportError(), 'Ouch!'); + } + + function testLinkAffirmationWhenPresent() { + $page = new MockSimplePage(); + $page->setReturnValue('getUrlsByLabel', array('http://www.nowhere.com')); + $page->expectOnce('getUrlsByLabel', array('a link label')); + $browser = $this->loadPage($page); + $this->assertIdentical($browser->getLink('a link label'), 'http://www.nowhere.com'); + } + + function testLinkAffirmationByIdWhenPresent() { + $page = new MockSimplePage(); + $page->setReturnValue('getUrlById', 'a_page.com', array(99)); + $page->setReturnValue('getUrlById', false, array('*')); + $browser = $this->loadPage($page); + $this->assertIdentical($browser->getLinkById(99), 'a_page.com'); + $this->assertFalse($browser->getLinkById(98)); + } + + function testSettingFieldIsPassedToPage() { + $page = new MockSimplePage(); + $page->expectOnce('setField', array(new SimpleByLabelOrName('key'), 'Value', false)); + $page->setReturnValue('getField', 'Value'); + $browser = $this->loadPage($page); + $this->assertEqual($browser->getField('key'), 'Value'); + $browser->setField('key', 'Value'); + } +} + +class TestOfBrowserNavigation extends UnitTestCase { + function createBrowser($agent, $page) { + $browser = new MockParseSimpleBrowser(); + $browser->returns('createUserAgent', $agent); + $browser->returns('parse', $page); + $browser->__construct(); + return $browser; + } + + function testClickLinkRequestsPage() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + $agent->expectAt( + 0, + 'fetchResponse', + array(new SimpleUrl('http://this.com/page.html'), new SimpleGetEncoding())); + $agent->expectAt( + 1, + 'fetchResponse', + array(new SimpleUrl('http://this.com/new.html'), new SimpleGetEncoding())); + $agent->expectCallCount('fetchResponse', 2); + + $page = new MockSimplePage(); + $page->setReturnValue('getUrlsByLabel', array(new SimpleUrl('http://this.com/new.html'))); + $page->expectOnce('getUrlsByLabel', array('New')); + $page->setReturnValue('getRaw', 'A page'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickLink('New')); + } + + function testClickLinkWithUnknownFrameStillRequestsWholePage() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + $agent->expectAt( + 0, + 'fetchResponse', + array(new SimpleUrl('http://this.com/page.html'), new SimpleGetEncoding())); + $target = new SimpleUrl('http://this.com/new.html'); + $target->setTarget('missing'); + $agent->expectAt( + 1, + 'fetchResponse', + array($target, new SimpleGetEncoding())); + $agent->expectCallCount('fetchResponse', 2); + + $parsed_url = new SimpleUrl('http://this.com/new.html'); + $parsed_url->setTarget('missing'); + + $page = new MockSimplePage(); + $page->setReturnValue('getUrlsByLabel', array($parsed_url)); + $page->setReturnValue('hasFrames', false); + $page->expectOnce('getUrlsByLabel', array('New')); + $page->setReturnValue('getRaw', 'A page'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickLink('New')); + } + + function testClickingMissingLinkFails() { + $agent = new MockSimpleUserAgent($this); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + + $page = new MockSimplePage(); + $page->setReturnValue('getUrlsByLabel', array()); + $page->setReturnValue('getRaw', 'stuff'); + + $browser = $this->createBrowser($agent, $page); + $this->assertTrue($browser->get('http://this.com/page.html')); + $this->assertFalse($browser->clickLink('New')); + } + + function testClickIndexedLink() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + $agent->expectAt( + 1, + 'fetchResponse', + array(new SimpleUrl('1.html'), new SimpleGetEncoding())); + $agent->expectCallCount('fetchResponse', 2); + + $page = new MockSimplePage(); + $page->setReturnValue( + 'getUrlsByLabel', + array(new SimpleUrl('0.html'), new SimpleUrl('1.html'))); + $page->setReturnValue('getRaw', 'A page'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickLink('New', 1)); + } + + function testClinkLinkById() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + $agent->expectAt(1, 'fetchResponse', array( + new SimpleUrl('http://this.com/link.html'), + new SimpleGetEncoding())); + $agent->expectCallCount('fetchResponse', 2); + + $page = new MockSimplePage(); + $page->setReturnValue('getUrlById', new SimpleUrl('http://this.com/link.html')); + $page->expectOnce('getUrlById', array(2)); + $page->setReturnValue('getRaw', 'A page'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickLinkById(2)); + } + + function testClickingMissingLinkIdFails() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + + $page = new MockSimplePage(); + $page->setReturnValue('getUrlById', false); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertFalse($browser->clickLink(0)); + } + + function testSubmitFormByLabel() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + $agent->expectAt(1, 'fetchResponse', array( + new SimpleUrl('http://this.com/handler.html'), + new SimplePostEncoding(array('a' => 'A')))); + $agent->expectCallCount('fetchResponse', 2); + + $form = new MockSimpleForm(); + $form->setReturnValue('getAction', new SimpleUrl('http://this.com/handler.html')); + $form->setReturnValue('getMethod', 'post'); + $form->setReturnValue('submitButton', new SimplePostEncoding(array('a' => 'A'))); + $form->expectOnce('submitButton', array(new SimpleByLabel('Go'), false)); + + $page = new MockSimplePage(); + $page->returns('getFormBySubmit', $form); + $page->expectOnce('getFormBySubmit', array(new SimpleByLabel('Go'))); + $page->setReturnValue('getRaw', 'stuff'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickSubmit('Go')); + } + + function testDefaultSubmitFormByLabel() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + $agent->expectAt(1, 'fetchResponse', array( + new SimpleUrl('http://this.com/page.html'), + new SimpleGetEncoding(array('a' => 'A')))); + $agent->expectCallCount('fetchResponse', 2); + + $form = new MockSimpleForm(); + $form->setReturnValue('getAction', new SimpleUrl('http://this.com/page.html')); + $form->setReturnValue('getMethod', 'get'); + $form->setReturnValue('submitButton', new SimpleGetEncoding(array('a' => 'A'))); + + $page = new MockSimplePage(); + $page->returns('getFormBySubmit', $form); + $page->expectOnce('getFormBySubmit', array(new SimpleByLabel('Submit'))); + $page->setReturnValue('getRaw', 'stuff'); + $page->setReturnValue('getUrl', new SimpleUrl('http://this.com/page.html')); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickSubmit()); + } + + function testSubmitFormByName() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + + $form = new MockSimpleForm(); + $form->setReturnValue('getAction', new SimpleUrl('http://this.com/handler.html')); + $form->setReturnValue('getMethod', 'post'); + $form->setReturnValue('submitButton', new SimplePostEncoding(array('a' => 'A'))); + + $page = new MockSimplePage(); + $page->returns('getFormBySubmit', $form); + $page->expectOnce('getFormBySubmit', array(new SimpleByName('me'))); + $page->setReturnValue('getRaw', 'stuff'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickSubmitByName('me')); + } + + function testSubmitFormById() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + + $form = new MockSimpleForm(); + $form->setReturnValue('getAction', new SimpleUrl('http://this.com/handler.html')); + $form->setReturnValue('getMethod', 'post'); + $form->setReturnValue('submitButton', new SimplePostEncoding(array('a' => 'A'))); + $form->expectOnce('submitButton', array(new SimpleById(99), false)); + + $page = new MockSimplePage(); + $page->returns('getFormBySubmit', $form); + $page->expectOnce('getFormBySubmit', array(new SimpleById(99))); + $page->setReturnValue('getRaw', 'stuff'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickSubmitById(99)); + } + + function testSubmitFormByImageLabel() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + + $form = new MockSimpleForm(); + $form->setReturnValue('getAction', new SimpleUrl('http://this.com/handler.html')); + $form->setReturnValue('getMethod', 'post'); + $form->setReturnValue('submitImage', new SimplePostEncoding(array('a' => 'A'))); + $form->expectOnce('submitImage', array(new SimpleByLabel('Go!'), 10, 11, false)); + + $page = new MockSimplePage(); + $page->returns('getFormByImage', $form); + $page->expectOnce('getFormByImage', array(new SimpleByLabel('Go!'))); + $page->setReturnValue('getRaw', 'stuff'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickImage('Go!', 10, 11)); + } + + function testSubmitFormByImageName() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + + $form = new MockSimpleForm(); + $form->setReturnValue('getAction', new SimpleUrl('http://this.com/handler.html')); + $form->setReturnValue('getMethod', 'post'); + $form->setReturnValue('submitImage', new SimplePostEncoding(array('a' => 'A'))); + $form->expectOnce('submitImage', array(new SimpleByName('a'), 10, 11, false)); + + $page = new MockSimplePage(); + $page->returns('getFormByImage', $form); + $page->expectOnce('getFormByImage', array(new SimpleByName('a'))); + $page->setReturnValue('getRaw', 'stuff'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickImageByName('a', 10, 11)); + } + + function testSubmitFormByImageId() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + + $form = new MockSimpleForm(); + $form->setReturnValue('getAction', new SimpleUrl('http://this.com/handler.html')); + $form->setReturnValue('getMethod', 'post'); + $form->setReturnValue('submitImage', new SimplePostEncoding(array('a' => 'A'))); + $form->expectOnce('submitImage', array(new SimpleById(99), 10, 11, false)); + + $page = new MockSimplePage(); + $page->returns('getFormByImage', $form); + $page->expectOnce('getFormByImage', array(new SimpleById(99))); + $page->setReturnValue('getRaw', 'stuff'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->clickImageById(99, 10, 11)); + } + + function testSubmitFormByFormId() { + $agent = new MockSimpleUserAgent(); + $agent->returns('fetchResponse', new MockSimpleHttpResponse()); + $agent->expectAt(1, 'fetchResponse', array( + new SimpleUrl('http://this.com/handler.html'), + new SimplePostEncoding(array('a' => 'A')))); + $agent->expectCallCount('fetchResponse', 2); + + $form = new MockSimpleForm(); + $form->setReturnValue('getAction', new SimpleUrl('http://this.com/handler.html')); + $form->setReturnValue('getMethod', 'post'); + $form->setReturnValue('submit', new SimplePostEncoding(array('a' => 'A'))); + + $page = new MockSimplePage(); + $page->returns('getFormById', $form); + $page->expectOnce('getFormById', array(33)); + $page->setReturnValue('getRaw', 'stuff'); + + $browser = $this->createBrowser($agent, $page); + $browser->get('http://this.com/page.html'); + $this->assertTrue($browser->submitFormById(33)); + } +} + +class TestOfBrowserFrames extends UnitTestCase { + + function createBrowser($agent) { + $browser = new MockUserAgentSimpleBrowser(); + $browser->returns('createUserAgent', $agent); + $browser->__construct(); + return $browser; + } + + function createUserAgent($pages) { + $agent = new MockSimpleUserAgent(); + foreach ($pages as $url => $raw) { + $url = new SimpleUrl($url); + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', $url); + $response->setReturnValue('getContent', $raw); + $agent->returns('fetchResponse', $response, array($url, '*')); + } + return $agent; + } + + function testSimplePageHasNoFrames() { + $browser = $this->createBrowser($this->createUserAgent( + array('http://site.with.no.frames/' => 'A non-framed page'))); + $this->assertEqual( + $browser->get('http://site.with.no.frames/'), + 'A non-framed page'); + $this->assertIdentical($browser->getFrames(), 'http://site.with.no.frames/'); + } + + function testFramesetWithNoFrames() { + $browser = $this->createBrowser($this->createUserAgent( + array('http://site.with.no.frames/' => ''))); + $this->assertEqual($browser->get('http://site.with.no.frames/'), ''); + $this->assertIdentical($browser->getFrames(), array()); + } + + function testFramesetWithSingleFrame() { + $frameset = ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.one.frame/' => $frameset, + 'http://site.with.one.frame/frame.html' => 'A frame'))); + $this->assertEqual($browser->get('http://site.with.one.frame/'), 'A frame'); + $this->assertIdentical( + $browser->getFrames(), + array('a' => 'http://site.with.one.frame/frame.html')); + } + + function testTitleTakenFromFramesetPage() { + $frameset = 'Frameset title' . + ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.one.frame/' => $frameset, + 'http://site.with.one.frame/frame.html' => 'Page title'))); + $browser->get('http://site.with.one.frame/'); + $this->assertEqual($browser->getTitle(), 'Frameset title'); + } + + function testFramesetWithSingleUnnamedFrame() { + $frameset = ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.one.frame/' => $frameset, + 'http://site.with.one.frame/frame.html' => 'One frame'))); + $this->assertEqual( + $browser->get('http://site.with.one.frame/'), + 'One frame'); + $this->assertIdentical( + $browser->getFrames(), + array(1 => 'http://site.with.one.frame/frame.html')); + } + + function testFramesetWithMultipleFrames() { + $frameset = '' . + '' . + '' . + '' . + ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.frames/' => $frameset, + 'http://site.with.frames/frame_a.html' => 'A frame', + 'http://site.with.frames/frame_b.html' => 'B frame', + 'http://site.with.frames/frame_c.html' => 'C frame'))); + $this->assertEqual( + $browser->get('http://site.with.frames/'), + 'A frameB frameC frame'); + $this->assertIdentical($browser->getFrames(), array( + 'a' => 'http://site.with.frames/frame_a.html', + 'b' => 'http://site.with.frames/frame_b.html', + 'c' => 'http://site.with.frames/frame_c.html')); + } + + function testFrameFocusByName() { + $frameset = '' . + '' . + '' . + '' . + ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.frames/' => $frameset, + 'http://site.with.frames/frame_a.html' => 'A frame', + 'http://site.with.frames/frame_b.html' => 'B frame', + 'http://site.with.frames/frame_c.html' => 'C frame'))); + $browser->get('http://site.with.frames/'); + $browser->setFrameFocus('a'); + $this->assertEqual($browser->getContent(), 'A frame'); + $browser->setFrameFocus('b'); + $this->assertEqual($browser->getContent(), 'B frame'); + $browser->setFrameFocus('c'); + $this->assertEqual($browser->getContent(), 'C frame'); + } + + function testFramesetWithSomeNamedFrames() { + $frameset = '' . + '' . + '' . + '' . + '' . + ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.frames/' => $frameset, + 'http://site.with.frames/frame_a.html' => 'A frame', + 'http://site.with.frames/frame_b.html' => 'B frame', + 'http://site.with.frames/frame_c.html' => 'C frame', + 'http://site.with.frames/frame_d.html' => 'D frame'))); + $this->assertEqual( + $browser->get('http://site.with.frames/'), + 'A frameB frameC frameD frame'); + $this->assertIdentical($browser->getFrames(), array( + 'a' => 'http://site.with.frames/frame_a.html', + 2 => 'http://site.with.frames/frame_b.html', + 'c' => 'http://site.with.frames/frame_c.html', + 4 => 'http://site.with.frames/frame_d.html')); + } + + function testFrameFocusWithMixedNamesAndIndexes() { + $frameset = '' . + '' . + '' . + '' . + '' . + ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.frames/' => $frameset, + 'http://site.with.frames/frame_a.html' => 'A frame', + 'http://site.with.frames/frame_b.html' => 'B frame', + 'http://site.with.frames/frame_c.html' => 'C frame', + 'http://site.with.frames/frame_d.html' => 'D frame'))); + $browser->get('http://site.with.frames/'); + $browser->setFrameFocus('a'); + $this->assertEqual($browser->getContent(), 'A frame'); + $browser->setFrameFocus(2); + $this->assertEqual($browser->getContent(), 'B frame'); + $browser->setFrameFocus('c'); + $this->assertEqual($browser->getContent(), 'C frame'); + $browser->setFrameFocus(4); + $this->assertEqual($browser->getContent(), 'D frame'); + $browser->clearFrameFocus(); + $this->assertEqual($browser->getContent(), 'A frameB frameC frameD frame'); + } + + function testNestedFrameset() { + $inner = '' . + '' . + ''; + $outer = '' . + '' . + ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.nested.frame/' => $outer, + 'http://site.with.nested.frame/inner.html' => $inner, + 'http://site.with.nested.frame/page.html' => 'The page'))); + $this->assertEqual( + $browser->get('http://site.with.nested.frame/'), + 'The page'); + $this->assertIdentical($browser->getFrames(), array( + 'inner' => array( + 'page' => 'http://site.with.nested.frame/page.html'))); + } + + function testCanNavigateToNestedFrame() { + $inner = '' . + '' . + '' . + ''; + $outer = '' . + '' . + '' . + ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.nested.frames/' => $outer, + 'http://site.with.nested.frames/inner.html' => $inner, + 'http://site.with.nested.frames/one.html' => 'Page one', + 'http://site.with.nested.frames/two.html' => 'Page two', + 'http://site.with.nested.frames/three.html' => 'Page three'))); + + $browser->get('http://site.with.nested.frames/'); + $this->assertEqual($browser->getContent(), 'Page onePage twoPage three'); + + $this->assertTrue($browser->setFrameFocus('inner')); + $this->assertEqual($browser->getFrameFocus(), array('inner')); + $this->assertTrue($browser->setFrameFocus('one')); + $this->assertEqual($browser->getFrameFocus(), array('inner', 'one')); + $this->assertEqual($browser->getContent(), 'Page one'); + + $this->assertTrue($browser->setFrameFocus('two')); + $this->assertEqual($browser->getFrameFocus(), array('inner', 'two')); + $this->assertEqual($browser->getContent(), 'Page two'); + + $browser->clearFrameFocus(); + $this->assertTrue($browser->setFrameFocus('three')); + $this->assertEqual($browser->getFrameFocus(), array('three')); + $this->assertEqual($browser->getContent(), 'Page three'); + + $this->assertTrue($browser->setFrameFocus('inner')); + $this->assertEqual($browser->getContent(), 'Page onePage two'); + } + + function testCanNavigateToNestedFrameByIndex() { + $inner = '' . + '' . + '' . + ''; + $outer = '' . + '' . + '' . + ''; + $browser = $this->createBrowser($this->createUserAgent(array( + 'http://site.with.nested.frames/' => $outer, + 'http://site.with.nested.frames/inner.html' => $inner, + 'http://site.with.nested.frames/one.html' => 'Page one', + 'http://site.with.nested.frames/two.html' => 'Page two', + 'http://site.with.nested.frames/three.html' => 'Page three'))); + + $browser->get('http://site.with.nested.frames/'); + $this->assertEqual($browser->getContent(), 'Page onePage twoPage three'); + + $this->assertTrue($browser->setFrameFocusByIndex(1)); + $this->assertEqual($browser->getFrameFocus(), array(1)); + $this->assertTrue($browser->setFrameFocusByIndex(1)); + $this->assertEqual($browser->getFrameFocus(), array(1, 1)); + $this->assertEqual($browser->getContent(), 'Page one'); + + $this->assertTrue($browser->setFrameFocusByIndex(2)); + $this->assertEqual($browser->getFrameFocus(), array(1, 2)); + $this->assertEqual($browser->getContent(), 'Page two'); + + $browser->clearFrameFocus(); + $this->assertTrue($browser->setFrameFocusByIndex(2)); + $this->assertEqual($browser->getFrameFocus(), array(2)); + $this->assertEqual($browser->getContent(), 'Page three'); + + $this->assertTrue($browser->setFrameFocusByIndex(1)); + $this->assertEqual($browser->getContent(), 'Page onePage two'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/collector_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/collector_test.php new file mode 100644 index 0000000..efdbf37 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/collector_test.php @@ -0,0 +1,50 @@ +expectMinimumCallCount('addFile', 2); + $suite->expect( + 'addFile', + array(new PatternExpectation('/collectable\\.(1|2)$/'))); + $collector = new SimpleCollector(); + $collector->collect($suite, dirname(__FILE__) . '/support/collector/'); + } +} + +class TestOfPatternCollector extends UnitTestCase { + + function testAddingEverythingToGroup() { + $suite = new MockTestSuite(); + $suite->expectCallCount('addFile', 2); + $suite->expect( + 'addFile', + array(new PatternExpectation('/collectable\\.(1|2)$/'))); + $collector = new SimplePatternCollector('/.*/'); + $collector->collect($suite, dirname(__FILE__) . '/support/collector/'); + } + + function testOnlyMatchedFilesAreAddedToGroup() { + $suite = new MockTestSuite(); + $suite->expectOnce('addFile', array(new PathEqualExpectation( + dirname(__FILE__) . '/support/collector/collectable.1'))); + $collector = new SimplePatternCollector('/1$/'); + $collector->collect($suite, dirname(__FILE__) . '/support/collector/'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/command_line_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/command_line_test.php new file mode 100644 index 0000000..5baabff --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/command_line_test.php @@ -0,0 +1,40 @@ +assertIdentical($parser->getTest(), ''); + $this->assertIdentical($parser->getTestCase(), ''); + } + + function testNotXmlByDefault() { + $parser = new SimpleCommandLineParser(array()); + $this->assertFalse($parser->isXml()); + } + + function testCanDetectRequestForXml() { + $parser = new SimpleCommandLineParser(array('--xml')); + $this->assertTrue($parser->isXml()); + } + + function testCanReadAssignmentSyntax() { + $parser = new SimpleCommandLineParser(array('--test=myTest')); + $this->assertEqual($parser->getTest(), 'myTest'); + } + + function testCanReadFollowOnSyntax() { + $parser = new SimpleCommandLineParser(array('--test', 'myTest')); + $this->assertEqual($parser->getTest(), 'myTest'); + } + + function testCanReadShortForms() { + $parser = new SimpleCommandLineParser(array('-t', 'myTest', '-c', 'MyClass', '-x')); + $this->assertEqual($parser->getTest(), 'myTest'); + $this->assertEqual($parser->getTestCase(), 'MyClass'); + $this->assertTrue($parser->isXml()); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/compatibility_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/compatibility_test.php new file mode 100644 index 0000000..b8635e5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/compatibility_test.php @@ -0,0 +1,87 @@ +assertTrue(SimpleTestCompatibility::isA( + new ComparisonClass(), + 'ComparisonClass')); + $this->assertFalse(SimpleTestCompatibility::isA( + new ComparisonClass(), + 'ComparisonSubclass')); + $this->assertTrue(SimpleTestCompatibility::isA( + new ComparisonSubclass(), + 'ComparisonClass')); + } + + function testIdentityOfNumericStrings() { + $numericString1 = "123"; + $numericString2 = "00123"; + $this->assertNotIdentical($numericString1, $numericString2); + } + + function testIdentityOfObjects() { + $object1 = new ComparisonClass(); + $object2 = new ComparisonClass(); + $this->assertIdentical($object1, $object2); + } + + function testReferences () { + $thing = "Hello"; + $thing_reference = &$thing; + $thing_copy = $thing; + $this->assertTrue(SimpleTestCompatibility::isReference( + $thing, + $thing)); + $this->assertTrue(SimpleTestCompatibility::isReference( + $thing, + $thing_reference)); + $this->assertFalse(SimpleTestCompatibility::isReference( + $thing, + $thing_copy)); + } + + function testObjectReferences () { + $object = new ComparisonClass(); + $object_reference = $object; + $object_copy = new ComparisonClass(); + $object_assignment = $object; + $this->assertTrue(SimpleTestCompatibility::isReference( + $object, + $object)); + $this->assertTrue(SimpleTestCompatibility::isReference( + $object, + $object_reference)); + $this->assertFalse(SimpleTestCompatibility::isReference( + $object, + $object_copy)); + if (version_compare(phpversion(), '5', '>=')) { + $this->assertTrue(SimpleTestCompatibility::isReference( + $object, + $object_assignment)); + } else { + $this->assertFalse(SimpleTestCompatibility::isReference( + $object, + $object_assignment)); + } + } + + function testInteraceComparison() { + $object = new ComparisonClassWithInterface(); + $this->assertFalse(SimpleTestCompatibility::isA( + new ComparisonClass(), + 'ComparisonInterface')); + $this->assertTrue(SimpleTestCompatibility::isA( + new ComparisonClassWithInterface(), + 'ComparisonInterface')); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/cookies_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/cookies_test.php new file mode 100644 index 0000000..0b49e43 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/cookies_test.php @@ -0,0 +1,227 @@ +assertFalse($cookie->getValue()); + $this->assertEqual($cookie->getPath(), "/"); + $this->assertIdentical($cookie->getHost(), false); + $this->assertFalse($cookie->getExpiry()); + $this->assertFalse($cookie->isSecure()); + } + + function testCookieAccessors() { + $cookie = new SimpleCookie( + "name", + "value", + "/path", + "Mon, 18 Nov 2002 15:50:29 GMT", + true); + $this->assertEqual($cookie->getName(), "name"); + $this->assertEqual($cookie->getValue(), "value"); + $this->assertEqual($cookie->getPath(), "/path/"); + $this->assertEqual($cookie->getExpiry(), "Mon, 18 Nov 2002 15:50:29 GMT"); + $this->assertTrue($cookie->isSecure()); + } + + function testFullHostname() { + $cookie = new SimpleCookie("name"); + $this->assertTrue($cookie->setHost("host.name.here")); + $this->assertEqual($cookie->getHost(), "host.name.here"); + $this->assertTrue($cookie->setHost("host.com")); + $this->assertEqual($cookie->getHost(), "host.com"); + } + + function testHostTruncation() { + $cookie = new SimpleCookie("name"); + $cookie->setHost("this.host.name.here"); + $this->assertEqual($cookie->getHost(), "host.name.here"); + $cookie->setHost("this.host.com"); + $this->assertEqual($cookie->getHost(), "host.com"); + $this->assertTrue($cookie->setHost("dashes.in-host.com")); + $this->assertEqual($cookie->getHost(), "in-host.com"); + } + + function testBadHosts() { + $cookie = new SimpleCookie("name"); + $this->assertFalse($cookie->setHost("gibberish")); + $this->assertFalse($cookie->setHost("host.here")); + $this->assertFalse($cookie->setHost("host..com")); + $this->assertFalse($cookie->setHost("...")); + $this->assertFalse($cookie->setHost("host.com.")); + } + + function testHostValidity() { + $cookie = new SimpleCookie("name"); + $cookie->setHost("this.host.name.here"); + $this->assertTrue($cookie->isValidHost("host.name.here")); + $this->assertTrue($cookie->isValidHost("that.host.name.here")); + $this->assertFalse($cookie->isValidHost("bad.host")); + $this->assertFalse($cookie->isValidHost("nearly.name.here")); + } + + function testPathValidity() { + $cookie = new SimpleCookie("name", "value", "/path"); + $this->assertFalse($cookie->isValidPath("/")); + $this->assertTrue($cookie->isValidPath("/path/")); + $this->assertTrue($cookie->isValidPath("/path/more")); + } + + function testSessionExpiring() { + $cookie = new SimpleCookie("name", "value", "/path"); + $this->assertTrue($cookie->isExpired(0)); + } + + function testTimestampExpiry() { + $cookie = new SimpleCookie("name", "value", "/path", 456); + $this->assertFalse($cookie->isExpired(0)); + $this->assertTrue($cookie->isExpired(457)); + $this->assertFalse($cookie->isExpired(455)); + } + + function testDateExpiry() { + $cookie = new SimpleCookie( + "name", + "value", + "/path", + "Mon, 18 Nov 2002 15:50:29 GMT"); + $this->assertTrue($cookie->isExpired("Mon, 18 Nov 2002 15:50:30 GMT")); + $this->assertFalse($cookie->isExpired("Mon, 18 Nov 2002 15:50:28 GMT")); + } + + function testAging() { + $cookie = new SimpleCookie("name", "value", "/path", 200); + $cookie->agePrematurely(199); + $this->assertFalse($cookie->isExpired(0)); + $cookie->agePrematurely(2); + $this->assertTrue($cookie->isExpired(0)); + } +} + +class TestOfCookieJar extends UnitTestCase { + + function testAddCookie() { + $jar = new SimpleCookieJar(); + $jar->setCookie("a", "A"); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=A')); + } + + function testHostFilter() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A', 'my-host.com'); + $jar->setCookie('b', 'B', 'another-host.com'); + $jar->setCookie('c', 'C'); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('my-host.com')), + array('a=A', 'c=C')); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('another-host.com')), + array('b=B', 'c=C')); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('www.another-host.com')), + array('b=B', 'c=C')); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('new-host.org')), + array('c=C')); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('/')), + array('a=A', 'b=B', 'c=C')); + } + + function testPathFilter() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A', false, '/path/'); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array()); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/elsewhere')), array()); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/path/')), array('a=A')); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/path')), array('a=A')); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/pa')), array()); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/path/here')), array('a=A')); + } + + function testPathFilterDeeply() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A', false, '/path/more_path/'); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/path/')), array()); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/path')), array()); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/pa')), array()); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/path/more_path/')), array('a=A')); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/path/more_path/and_more')), array('a=A')); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/path/not_here/')), array()); + } + + function testMultipleCookieWithDifferentPathsButSameName() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'abc', false, '/'); + $jar->setCookie('a', '123', false, '/path/here/'); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('/')), + array('a=abc')); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('my-host.com/')), + array('a=abc')); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('my-host.com/path/')), + array('a=abc')); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('my-host.com/path/here')), + array('a=abc', 'a=123')); + $this->assertEqual( + $jar->selectAsPairs(new SimpleUrl('my-host.com/path/here/there')), + array('a=abc', 'a=123')); + } + + function testOverwrite() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'abc', false, '/'); + $jar->setCookie('a', 'cde', false, '/'); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=cde')); + } + + function testClearSessionCookies() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A', false, '/'); + $jar->restartSession(); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array()); + } + + function testExpiryFilterByDate() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A', false, '/', 'Wed, 25-Dec-02 04:24:20 GMT'); + $jar->restartSession("Wed, 25-Dec-02 04:24:19 GMT"); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=A')); + $jar->restartSession("Wed, 25-Dec-02 04:24:21 GMT"); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array()); + } + + function testExpiryFilterByAgeing() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A', false, '/', 'Wed, 25-Dec-02 04:24:20 GMT'); + $jar->restartSession("Wed, 25-Dec-02 04:24:19 GMT"); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=A')); + $jar->agePrematurely(2); + $jar->restartSession("Wed, 25-Dec-02 04:24:19 GMT"); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array()); + } + + function testCookieClearing() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'abc', false, '/'); + $jar->setCookie('a', '', false, '/'); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=')); + } + + function testCookieClearByLoweringDate() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'abc', false, '/', 'Wed, 25-Dec-02 04:24:21 GMT'); + $jar->setCookie('a', 'def', false, '/', 'Wed, 25-Dec-02 04:24:19 GMT'); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array('a=def')); + $jar->restartSession('Wed, 25-Dec-02 04:24:20 GMT'); + $this->assertEqual($jar->selectAsPairs(new SimpleUrl('/')), array()); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/detached_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/detached_test.php new file mode 100644 index 0000000..06db828 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/detached_test.php @@ -0,0 +1,15 @@ +addTestCase(new DetachedTestCase($command)); +if (SimpleReporter::inCli()) { + exit ($test->run(new TextReporter()) ? 0 : 1); +} +$test->run(new HtmlReporter()); +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/dumper_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/dumper_test.php new file mode 100644 index 0000000..789047d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/dumper_test.php @@ -0,0 +1,88 @@ +assertEqual( + $dumper->clipString("Hello", 6), + "Hello", + "Hello, 6->%s"); + $this->assertEqual( + $dumper->clipString("Hello", 5), + "Hello", + "Hello, 5->%s"); + $this->assertEqual( + $dumper->clipString("Hello world", 3), + "Hel...", + "Hello world, 3->%s"); + $this->assertEqual( + $dumper->clipString("Hello world", 6, 3), + "Hello ...", + "Hello world, 6, 3->%s"); + $this->assertEqual( + $dumper->clipString("Hello world", 3, 6), + "...o w...", + "Hello world, 3, 6->%s"); + $this->assertEqual( + $dumper->clipString("Hello world", 4, 11), + "...orld", + "Hello world, 4, 11->%s"); + $this->assertEqual( + $dumper->clipString("Hello world", 4, 12), + "...orld", + "Hello world, 4, 12->%s"); + } + + function testDescribeNull() { + $dumper = new SimpleDumper(); + $this->assertPattern('/null/i', $dumper->describeValue(null)); + } + + function testDescribeBoolean() { + $dumper = new SimpleDumper(); + $this->assertPattern('/boolean/i', $dumper->describeValue(true)); + $this->assertPattern('/true/i', $dumper->describeValue(true)); + $this->assertPattern('/false/i', $dumper->describeValue(false)); + } + + function testDescribeString() { + $dumper = new SimpleDumper(); + $this->assertPattern('/string/i', $dumper->describeValue('Hello')); + $this->assertPattern('/Hello/', $dumper->describeValue('Hello')); + } + + function testDescribeInteger() { + $dumper = new SimpleDumper(); + $this->assertPattern('/integer/i', $dumper->describeValue(35)); + $this->assertPattern('/35/', $dumper->describeValue(35)); + } + + function testDescribeFloat() { + $dumper = new SimpleDumper(); + $this->assertPattern('/float/i', $dumper->describeValue(0.99)); + $this->assertPattern('/0\.99/', $dumper->describeValue(0.99)); + } + + function testDescribeArray() { + $dumper = new SimpleDumper(); + $this->assertPattern('/array/i', $dumper->describeValue(array(1, 4))); + $this->assertPattern('/2/i', $dumper->describeValue(array(1, 4))); + } + + function testDescribeObject() { + $dumper = new SimpleDumper(); + $this->assertPattern( + '/object/i', + $dumper->describeValue(new DumperDummy())); + $this->assertPattern( + '/DumperDummy/i', + $dumper->describeValue(new DumperDummy())); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/eclipse_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/eclipse_test.php new file mode 100644 index 0000000..c90cbc9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/eclipse_test.php @@ -0,0 +1,32 @@ +expectOnce('write',array($expected)); + $listener->setReturnValue('write',-1); + + $pathparts = pathinfo($fullpath); + $filename = $pathparts['basename']; + $test= &new TestSuite($filename); + $test->addTestFile($fullpath); + $test->run(new EclipseReporter($listener)); + $this->assertEqual($expected,$listener->output); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/encoding_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/encoding_test.php new file mode 100644 index 0000000..91d80db --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/encoding_test.php @@ -0,0 +1,213 @@ +assertEqual($pair->asRequest(), 'a=A'); + } + + function testMimeEncodedAsHeadersAndContent() { + $pair = new SimpleEncodedPair('a', 'A'); + $this->assertEqual( + $pair->asMime(), + "Content-Disposition: form-data; name=\"a\"\r\n\r\nA"); + } + + function testAttachmentEncodedAsHeadersWithDispositionAndContent() { + $part = new SimpleAttachment('a', 'A', 'aaa.txt'); + $this->assertEqual( + $part->asMime(), + "Content-Disposition: form-data; name=\"a\"; filename=\"aaa.txt\"\r\n" . + "Content-Type: text/plain\r\n\r\nA"); + } +} + +class TestOfEncoding extends UnitTestCase { + private $content_so_far; + + function write($content) { + $this->content_so_far .= $content; + } + + function clear() { + $this->content_so_far = ''; + } + + function assertWritten($encoding, $content, $message = '%s') { + $this->clear(); + $encoding->writeTo($this); + $this->assertIdentical($this->content_so_far, $content, $message); + } + + function testGetEmpty() { + $encoding = new SimpleGetEncoding(); + $this->assertIdentical($encoding->getValue('a'), false); + $this->assertIdentical($encoding->asUrlRequest(), ''); + } + + function testPostEmpty() { + $encoding = new SimplePostEncoding(); + $this->assertIdentical($encoding->getValue('a'), false); + $this->assertWritten($encoding, ''); + } + + function testPrefilled() { + $encoding = new SimplePostEncoding(array('a' => 'aaa')); + $this->assertIdentical($encoding->getValue('a'), 'aaa'); + $this->assertWritten($encoding, 'a=aaa'); + } + + function testPrefilledWithTwoLevels() { + $query = array('a' => array('aa' => 'aaa')); + $encoding = new SimplePostEncoding($query); + $this->assertTrue($encoding->hasMoreThanOneLevel($query)); + $this->assertEqual($encoding->rewriteArrayWithMultipleLevels($query), array('a[aa]' => 'aaa')); + $this->assertIdentical($encoding->getValue('a[aa]'), 'aaa'); + $this->assertWritten($encoding, 'a%5Baa%5D=aaa'); + } + + function testPrefilledWithThreeLevels() { + $query = array('a' => array('aa' => array('aaa' => 'aaaa'))); + $encoding = new SimplePostEncoding($query); + $this->assertTrue($encoding->hasMoreThanOneLevel($query)); + $this->assertEqual($encoding->rewriteArrayWithMultipleLevels($query), array('a[aa][aaa]' => 'aaaa')); + $this->assertIdentical($encoding->getValue('a[aa][aaa]'), 'aaaa'); + $this->assertWritten($encoding, 'a%5Baa%5D%5Baaa%5D=aaaa'); + } + + function testPrefilledWithObject() { + $encoding = new SimplePostEncoding(new SimpleEncoding(array('a' => 'aaa'))); + $this->assertIdentical($encoding->getValue('a'), 'aaa'); + $this->assertWritten($encoding, 'a=aaa'); + } + + function testMultiplePrefilled() { + $query = array('a' => array('a1', 'a2')); + $encoding = new SimplePostEncoding($query); + $this->assertTrue($encoding->hasMoreThanOneLevel($query)); + $this->assertEqual($encoding->rewriteArrayWithMultipleLevels($query), array('a[0]' => 'a1', 'a[1]' => 'a2')); + $this->assertIdentical($encoding->getValue('a[0]'), 'a1'); + $this->assertIdentical($encoding->getValue('a[1]'), 'a2'); + $this->assertWritten($encoding, 'a%5B0%5D=a1&a%5B1%5D=a2'); + } + + function testSingleParameter() { + $encoding = new SimplePostEncoding(); + $encoding->add('a', 'Hello'); + $this->assertEqual($encoding->getValue('a'), 'Hello'); + $this->assertWritten($encoding, 'a=Hello'); + } + + function testFalseParameter() { + $encoding = new SimplePostEncoding(); + $encoding->add('a', false); + $this->assertEqual($encoding->getValue('a'), false); + $this->assertWritten($encoding, ''); + } + + function testUrlEncoding() { + $encoding = new SimplePostEncoding(); + $encoding->add('a', 'Hello there!'); + $this->assertWritten($encoding, 'a=Hello+there%21'); + } + + function testUrlEncodingOfKey() { + $encoding = new SimplePostEncoding(); + $encoding->add('a!', 'Hello'); + $this->assertWritten($encoding, 'a%21=Hello'); + } + + function testMultipleParameter() { + $encoding = new SimplePostEncoding(); + $encoding->add('a', 'Hello'); + $encoding->add('b', 'Goodbye'); + $this->assertWritten($encoding, 'a=Hello&b=Goodbye'); + } + + function testEmptyParameters() { + $encoding = new SimplePostEncoding(); + $encoding->add('a', ''); + $encoding->add('b', ''); + $this->assertWritten($encoding, 'a=&b='); + } + + function testRepeatedParameter() { + $encoding = new SimplePostEncoding(); + $encoding->add('a', 'Hello'); + $encoding->add('a', 'Goodbye'); + $this->assertIdentical($encoding->getValue('a'), array('Hello', 'Goodbye')); + $this->assertWritten($encoding, 'a=Hello&a=Goodbye'); + } + + function testAddingLists() { + $encoding = new SimplePostEncoding(); + $encoding->add('a', array('Hello', 'Goodbye')); + $this->assertIdentical($encoding->getValue('a'), array('Hello', 'Goodbye')); + $this->assertWritten($encoding, 'a=Hello&a=Goodbye'); + } + + function testMergeInHash() { + $encoding = new SimpleGetEncoding(array('a' => 'A1', 'b' => 'B')); + $encoding->merge(array('a' => 'A2')); + $this->assertIdentical($encoding->getValue('a'), array('A1', 'A2')); + $this->assertIdentical($encoding->getValue('b'), 'B'); + } + + function testMergeInObject() { + $encoding = new SimpleGetEncoding(array('a' => 'A1', 'b' => 'B')); + $encoding->merge(new SimpleEncoding(array('a' => 'A2'))); + $this->assertIdentical($encoding->getValue('a'), array('A1', 'A2')); + $this->assertIdentical($encoding->getValue('b'), 'B'); + } + + function testPrefilledMultipart() { + $encoding = new SimpleMultipartEncoding(array('a' => 'aaa'), 'boundary'); + $this->assertIdentical($encoding->getValue('a'), 'aaa'); + $this->assertwritten($encoding, + "--boundary\r\n" . + "Content-Disposition: form-data; name=\"a\"\r\n" . + "\r\n" . + "aaa\r\n" . + "--boundary--\r\n"); + } + + function testAttachment() { + $encoding = new SimpleMultipartEncoding(array(), 'boundary'); + $encoding->attach('a', 'aaa', 'aaa.txt'); + $this->assertIdentical($encoding->getValue('a'), 'aaa.txt'); + $this->assertwritten($encoding, + "--boundary\r\n" . + "Content-Disposition: form-data; name=\"a\"; filename=\"aaa.txt\"\r\n" . + "Content-Type: text/plain\r\n" . + "\r\n" . + "aaa\r\n" . + "--boundary--\r\n"); + } +} + +class TestOfFormHeaders extends UnitTestCase { + + function testEmptyEncodingWritesZeroContentLength() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("Content-Length: 0\r\n")); + $socket->expectAt(1, 'write', array("Content-Type: application/x-www-form-urlencoded\r\n")); + $encoding = new SimplePostEncoding(); + $encoding->writeHeadersTo($socket); + } + + function testEmptyMultipartEncodingWritesEndBoundaryContentLength() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("Content-Length: 14\r\n")); + $socket->expectAt(1, 'write', array("Content-Type: multipart/form-data, boundary=boundary\r\n")); + $encoding = new SimpleMultipartEncoding(array(), 'boundary'); + $encoding->writeHeadersTo($socket); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/errors_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/errors_test.php new file mode 100644 index 0000000..ebb9e05 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/errors_test.php @@ -0,0 +1,229 @@ +get('SimpleErrorQueue'); + $queue->clear(); + } + + function tearDown() { + $context = SimpleTest::getContext(); + $queue = $context->get('SimpleErrorQueue'); + $queue->clear(); + } + + function testExpectationMatchCancelsIncomingError() { + $test = new MockSimpleTestCase(); + $test->expectOnce('assert', array( + new IdenticalExpectation(new AnythingExpectation()), + 'B', + 'a message')); + $test->setReturnValue('assert', true); + $test->expectNever('error'); + $queue = new SimpleErrorQueue(); + $queue->setTestCase($test); + $queue->expectError(new AnythingExpectation(), 'a message'); + $queue->add(1024, 'B', 'b.php', 100); + } +} + +class TestOfErrorTrap extends UnitTestCase { + private $old; + + function setUp() { + $this->old = error_reporting(E_ALL); + set_error_handler('SimpleTestErrorHandler'); + } + + function tearDown() { + restore_error_handler(); + error_reporting($this->old); + } + + function testQueueStartsEmpty() { + $context = SimpleTest::getContext(); + $queue = $context->get('SimpleErrorQueue'); + $this->assertFalse($queue->extract()); + } + + function testErrorsAreSwallowedByMatchingExpectation() { + $this->expectError('Ouch!'); + trigger_error('Ouch!'); + } + + function testErrorsAreSwallowedInOrder() { + $this->expectError('a'); + $this->expectError('b'); + trigger_error('a'); + trigger_error('b'); + } + + function testAnyErrorCanBeSwallowed() { + $this->expectError(); + trigger_error('Ouch!'); + } + + function testErrorCanBeSwallowedByPatternMatching() { + $this->expectError(new PatternExpectation('/ouch/i')); + trigger_error('Ouch!'); + } + + function testErrorWithPercentsPassesWithNoSprintfError() { + $this->expectError("%"); + trigger_error('%'); + } +} + +class TestOfErrors extends UnitTestCase { + private $old; + + function setUp() { + $this->old = error_reporting(E_ALL); + } + + function tearDown() { + error_reporting($this->old); + } + + function testDefaultWhenAllReported() { + error_reporting(E_ALL); + $this->expectError('Ouch!'); + trigger_error('Ouch!'); + } + + function testNoticeWhenReported() { + error_reporting(E_ALL); + $this->expectError('Ouch!'); + trigger_error('Ouch!', E_USER_NOTICE); + } + + function testWarningWhenReported() { + error_reporting(E_ALL); + $this->expectError('Ouch!'); + trigger_error('Ouch!', E_USER_WARNING); + } + + function testErrorWhenReported() { + error_reporting(E_ALL); + $this->expectError('Ouch!'); + trigger_error('Ouch!', E_USER_ERROR); + } + + function testNoNoticeWhenNotReported() { + error_reporting(0); + trigger_error('Ouch!', E_USER_NOTICE); + } + + function testNoWarningWhenNotReported() { + error_reporting(0); + trigger_error('Ouch!', E_USER_WARNING); + } + + function testNoticeSuppressedWhenReported() { + error_reporting(E_ALL); + @trigger_error('Ouch!', E_USER_NOTICE); + } + + function testWarningSuppressedWhenReported() { + error_reporting(E_ALL); + @trigger_error('Ouch!', E_USER_WARNING); + } + + function testErrorWithPercentsReportedWithNoSprintfError() { + $this->expectError('%'); + trigger_error('%'); + } +} + +class TestOfPHP52RecoverableErrors extends UnitTestCase { + function skip() { + $this->skipIf( + version_compare(phpversion(), '5.2', '<'), + 'E_RECOVERABLE_ERROR not tested for PHP below 5.2'); + } + + function testError() { + eval(' + class RecoverableErrorTestingStub { + function ouch(RecoverableErrorTestingStub $obj) { + } + } + '); + + $stub = new RecoverableErrorTestingStub(); + $this->expectError(new PatternExpectation('/must be an instance of RecoverableErrorTestingStub/i')); + $stub->ouch(new stdClass()); + } +} + +class TestOfErrorsExcludingPHP52AndAbove extends UnitTestCase { + function skip() { + $this->skipIf( + version_compare(phpversion(), '5.2', '>='), + 'E_USER_ERROR not tested for PHP 5.2 and above'); + } + + function testNoErrorWhenNotReported() { + error_reporting(0); + trigger_error('Ouch!', E_USER_ERROR); + } + + function testErrorSuppressedWhenReported() { + error_reporting(E_ALL); + @trigger_error('Ouch!', E_USER_ERROR); + } +} + +SimpleTest::ignore('TestOfNotEnoughErrors'); +/** + * This test is ignored as it is used by {@link TestRunnerForLeftOverAndNotEnoughErrors} + * to verify that it fails as expected. + * + * @ignore + */ +class TestOfNotEnoughErrors extends UnitTestCase { + function testExpectTwoErrorsThrowOne() { + $this->expectError('Error 1'); + trigger_error('Error 1'); + $this->expectError('Error 2'); + } +} + +SimpleTest::ignore('TestOfLeftOverErrors'); +/** + * This test is ignored as it is used by {@link TestRunnerForLeftOverAndNotEnoughErrors} + * to verify that it fails as expected. + * + * @ignore + */ +class TestOfLeftOverErrors extends UnitTestCase { + function testExpectOneErrorGetTwo() { + $this->expectError('Error 1'); + trigger_error('Error 1'); + trigger_error('Error 2'); + } +} + +class TestRunnerForLeftOverAndNotEnoughErrors extends UnitTestCase { + function testRunLeftOverErrorsTestCase() { + $test = new TestOfLeftOverErrors(); + $this->assertFalse($test->run(new SimpleReporter())); + } + + function testRunNotEnoughErrors() { + $test = new TestOfNotEnoughErrors(); + $this->assertFalse($test->run(new SimpleReporter())); + } +} + +// TODO: Add stacked error handler test +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/exceptions_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/exceptions_test.php new file mode 100644 index 0000000..9cc35c5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/exceptions_test.php @@ -0,0 +1,153 @@ +assertTrue($expectation->test(new MyTestException())); + $this->assertTrue($expectation->test(new HigherTestException())); + $this->assertFalse($expectation->test(new OtherTestException())); + } + + function testMatchesClassAndMessageWhenExceptionExpected() { + $expectation = new ExceptionExpectation(new MyTestException('Hello')); + $this->assertTrue($expectation->test(new MyTestException('Hello'))); + $this->assertFalse($expectation->test(new HigherTestException('Hello'))); + $this->assertFalse($expectation->test(new OtherTestException('Hello'))); + $this->assertFalse($expectation->test(new MyTestException('Goodbye'))); + $this->assertFalse($expectation->test(new MyTestException())); + } + + function testMessagelessExceptionMatchesOnlyOnClass() { + $expectation = new ExceptionExpectation(new MyTestException()); + $this->assertTrue($expectation->test(new MyTestException())); + $this->assertFalse($expectation->test(new HigherTestException())); + } +} + +class TestOfExceptionTrap extends UnitTestCase { + + function testNoExceptionsInQueueMeansNoTestMessages() { + $test = new MockSimpleTestCase(); + $test->expectNever('assert'); + $queue = new SimpleExceptionTrap(); + $this->assertFalse($queue->isExpected($test, new Exception())); + } + + function testMatchingExceptionGivesTrue() { + $expectation = new MockSimpleExpectation(); + $expectation->setReturnValue('test', true); + $test = new MockSimpleTestCase(); + $test->setReturnValue('assert', true); + $queue = new SimpleExceptionTrap(); + $queue->expectException($expectation, 'message'); + $this->assertTrue($queue->isExpected($test, new Exception())); + } + + function testMatchingExceptionTriggersAssertion() { + $test = new MockSimpleTestCase(); + $test->expectOnce('assert', array( + '*', + new ExceptionExpectation(new Exception()), + 'message')); + $queue = new SimpleExceptionTrap(); + $queue->expectException(new ExceptionExpectation(new Exception()), 'message'); + $queue->isExpected($test, new Exception()); + } +} + +class TestOfCatchingExceptions extends UnitTestCase { + + function testCanCatchAnyExpectedException() { + $this->expectException(); + throw new Exception(); + } + + function testCanMatchExceptionByClass() { + $this->expectException('MyTestException'); + throw new HigherTestException(); + } + + function testCanMatchExceptionExactly() { + $this->expectException(new Exception('Ouch')); + throw new Exception('Ouch'); + } + + function testLastListedExceptionIsTheOneThatCounts() { + $this->expectException('OtherTestException'); + $this->expectException('MyTestException'); + throw new HigherTestException(); + } +} + +class TestOfCallingTearDownAfterExceptions extends UnitTestCase { + private $debri = 0; + + function tearDown() { + $this->debri--; + } + + function testLeaveSomeDebri() { + $this->debri++; + $this->expectException(); + throw new Exception(__FUNCTION__); + } + + function testDebriWasRemovedOnce() { + $this->assertEqual($this->debri, 0); + } +} + +class TestOfExceptionThrownInSetUpDoesNotRunTestBody extends UnitTestCase { + + function setUp() { + $this->expectException(); + throw new Exception(); + } + + function testShouldNotBeRun() { + $this->fail('This test body should not be run'); + } + + function testShouldNotBeRunEither() { + $this->fail('This test body should not be run either'); + } +} + +class TestOfExpectExceptionWithSetUp extends UnitTestCase { + + function setUp() { + $this->expectException(); + } + + function testThisExceptionShouldBeCaught() { + throw new Exception(); + } + + function testJustThrowingMyTestException() { + throw new MyTestException(); + } +} + +class TestOfThrowingExceptionsInTearDown extends UnitTestCase { + + function tearDown() { + throw new Exception(); + } + + function testDoesntFatal() { + $this->expectException(); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/expectation_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/expectation_test.php new file mode 100644 index 0000000..2283c19 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/expectation_test.php @@ -0,0 +1,223 @@ +assertTrue($is_true->test(true)); + $this->assertFalse($is_true->test(false)); + } + + function testStringMatch() { + $hello = new EqualExpectation("Hello"); + $this->assertTrue($hello->test("Hello")); + $this->assertFalse($hello->test("Goodbye")); + } + + function testInteger() { + $fifteen = new EqualExpectation(15); + $this->assertTrue($fifteen->test(15)); + $this->assertFalse($fifteen->test(14)); + } + + function testFloat() { + $pi = new EqualExpectation(3.14); + $this->assertTrue($pi->test(3.14)); + $this->assertFalse($pi->test(3.15)); + } + + function testArray() { + $colours = new EqualExpectation(array("r", "g", "b")); + $this->assertTrue($colours->test(array("r", "g", "b"))); + $this->assertFalse($colours->test(array("g", "b", "r"))); + } + + function testHash() { + $is_blue = new EqualExpectation(array("r" => 0, "g" => 0, "b" => 255)); + $this->assertTrue($is_blue->test(array("r" => 0, "g" => 0, "b" => 255))); + $this->assertFalse($is_blue->test(array("r" => 0, "g" => 255, "b" => 0))); + } + + function testHashWithOutOfOrderKeysShouldStillMatch() { + $any_order = new EqualExpectation(array('a' => 1, 'b' => 2)); + $this->assertTrue($any_order->test(array('b' => 2, 'a' => 1))); + } +} + +class TestOfWithin extends UnitTestCase { + + function testWithinFloatingPointMargin() { + $within = new WithinMarginExpectation(1.0, 0.2); + $this->assertFalse($within->test(0.7)); + $this->assertTrue($within->test(0.8)); + $this->assertTrue($within->test(0.9)); + $this->assertTrue($within->test(1.1)); + $this->assertTrue($within->test(1.2)); + $this->assertFalse($within->test(1.3)); + } + + function testOutsideFloatingPointMargin() { + $within = new OutsideMarginExpectation(1.0, 0.2); + $this->assertTrue($within->test(0.7)); + $this->assertFalse($within->test(0.8)); + $this->assertFalse($within->test(1.2)); + $this->assertTrue($within->test(1.3)); + } +} + +class TestOfInequality extends UnitTestCase { + + function testStringMismatch() { + $not_hello = new NotEqualExpectation("Hello"); + $this->assertTrue($not_hello->test("Goodbye")); + $this->assertFalse($not_hello->test("Hello")); + } +} + +class RecursiveNasty { + private $me; + + function RecursiveNasty() { + $this->me = $this; + } +} + +class TestOfIdentity extends UnitTestCase { + + function testType() { + $string = new IdenticalExpectation("37"); + $this->assertTrue($string->test("37")); + $this->assertFalse($string->test(37)); + $this->assertFalse($string->test("38")); + } + + function _testNastyPhp5Bug() { + $this->assertFalse(new RecursiveNasty() != new RecursiveNasty()); + } + + function _testReallyHorribleRecursiveStructure() { + $hopeful = new IdenticalExpectation(new RecursiveNasty()); + $this->assertTrue($hopeful->test(new RecursiveNasty())); + } +} + +class DummyReferencedObject{} + +class TestOfReference extends UnitTestCase { + + function testReference() { + $foo = "foo"; + $ref = &$foo; + $not_ref = $foo; + $bar = "bar"; + + $expect = new ReferenceExpectation($foo); + $this->assertTrue($expect->test($ref)); + $this->assertFalse($expect->test($not_ref)); + $this->assertFalse($expect->test($bar)); + } +} + +class TestOfNonIdentity extends UnitTestCase { + + function testType() { + $string = new NotIdenticalExpectation("37"); + $this->assertTrue($string->test("38")); + $this->assertTrue($string->test(37)); + $this->assertFalse($string->test("37")); + } +} + +class TestOfPatterns extends UnitTestCase { + + function testWanted() { + $pattern = new PatternExpectation('/hello/i'); + $this->assertTrue($pattern->test("Hello world")); + $this->assertFalse($pattern->test("Goodbye world")); + } + + function testUnwanted() { + $pattern = new NoPatternExpectation('/hello/i'); + $this->assertFalse($pattern->test("Hello world")); + $this->assertTrue($pattern->test("Goodbye world")); + } +} + +class ExpectedMethodTarget { + function hasThisMethod() {} +} + +class TestOfMethodExistence extends UnitTestCase { + + function testHasMethod() { + $instance = new ExpectedMethodTarget(); + $expectation = new MethodExistsExpectation('hasThisMethod'); + $this->assertTrue($expectation->test($instance)); + $expectation = new MethodExistsExpectation('doesNotHaveThisMethod'); + $this->assertFalse($expectation->test($instance)); + } +} + +class TestOfIsA extends UnitTestCase { + + function testString() { + $expectation = new IsAExpectation('string'); + $this->assertTrue($expectation->test('Hello')); + $this->assertFalse($expectation->test(5)); + } + + function testBoolean() { + $expectation = new IsAExpectation('boolean'); + $this->assertTrue($expectation->test(true)); + $this->assertFalse($expectation->test(1)); + } + + function testBool() { + $expectation = new IsAExpectation('bool'); + $this->assertTrue($expectation->test(true)); + $this->assertFalse($expectation->test(1)); + } + + function testDouble() { + $expectation = new IsAExpectation('double'); + $this->assertTrue($expectation->test(5.0)); + $this->assertFalse($expectation->test(5)); + } + + function testFloat() { + $expectation = new IsAExpectation('float'); + $this->assertTrue($expectation->test(5.0)); + $this->assertFalse($expectation->test(5)); + } + + function testReal() { + $expectation = new IsAExpectation('real'); + $this->assertTrue($expectation->test(5.0)); + $this->assertFalse($expectation->test(5)); + } + + function testInteger() { + $expectation = new IsAExpectation('integer'); + $this->assertTrue($expectation->test(5)); + $this->assertFalse($expectation->test(5.0)); + } + + function testInt() { + $expectation = new IsAExpectation('int'); + $this->assertTrue($expectation->test(5)); + $this->assertFalse($expectation->test(5.0)); + } +} + +class TestOfNotA extends UnitTestCase { + + function testString() { + $expectation = new NotAExpectation('string'); + $this->assertFalse($expectation->test('Hello')); + $this->assertTrue($expectation->test(5)); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/extensions_tests.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/extensions_tests.php new file mode 100644 index 0000000..b32fa8e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/extensions_tests.php @@ -0,0 +1,23 @@ +skipIf(version_compare(phpversion(), '5', '<'), + 'Many extensions only work with PHP5 and above'); + } + + function ExtensionsTests() { + $this->TestSuite('Extension tests for SimpleTest ' . SimpleTest::getVersion()); + + $nodes = new RecursiveDirectoryIterator(dirname(__FILE__).'/../extensions/'); + foreach(new RecursiveIteratorIterator($nodes) as $node) { + if (preg_match('/test\.php$/', $node->getFilename())) { + $this->addFile($node->getPathname()); + } + } + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/form_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/form_test.php new file mode 100644 index 0000000..de04537 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/form_test.php @@ -0,0 +1,324 @@ +returns('getUrl', new SimpleUrl($url)); + $page->returns('expandUrl', new SimpleUrl($url)); + return $page; + } + + function testFormAttributes() { + $tag = new SimpleFormTag(array('method' => 'GET', 'action' => 'here.php', 'id' => '33')); + $form = new SimpleForm($tag, $this->page('http://host/a/index.html')); + $this->assertEqual($form->getMethod(), 'get'); + $this->assertIdentical($form->getId(), '33'); + $this->assertNull($form->getValue(new SimpleByName('a'))); + } + + function testAction() { + $page = new MockSimplePage(); + $page->expectOnce('expandUrl', array(new SimpleUrl('here.php'))); + $page->setReturnValue('expandUrl', new SimpleUrl('http://host/here.php')); + $tag = new SimpleFormTag(array('method' => 'GET', 'action' => 'here.php')); + $form = new SimpleForm($tag, $page); + $this->assertEqual($form->getAction(), new SimpleUrl('http://host/here.php')); + } + + function testEmptyAction() { + $tag = new SimpleFormTag(array('method' => 'GET', 'action' => '', 'id' => '33')); + $form = new SimpleForm($tag, $this->page('http://host/a/index.html')); + $this->assertEqual( + $form->getAction(), + new SimpleUrl('http://host/a/index.html')); + } + + function testMissingAction() { + $tag = new SimpleFormTag(array('method' => 'GET')); + $form = new SimpleForm($tag, $this->page('http://host/a/index.html')); + $this->assertEqual( + $form->getAction(), + new SimpleUrl('http://host/a/index.html')); + } + + function testRootAction() { + $page = new MockSimplePage(); + $page->expectOnce('expandUrl', array(new SimpleUrl('/'))); + $page->setReturnValue('expandUrl', new SimpleUrl('http://host/')); + $tag = new SimpleFormTag(array('method' => 'GET', 'action' => '/')); + $form = new SimpleForm($tag, $page); + $this->assertEqual( + $form->getAction(), + new SimpleUrl('http://host/')); + } + + function testDefaultFrameTargetOnForm() { + $page = new MockSimplePage(); + $page->expectOnce('expandUrl', array(new SimpleUrl('here.php'))); + $page->setReturnValue('expandUrl', new SimpleUrl('http://host/here.php')); + $tag = new SimpleFormTag(array('method' => 'GET', 'action' => 'here.php')); + $form = new SimpleForm($tag, $page); + $form->setDefaultTarget('frame'); + $expected = new SimpleUrl('http://host/here.php'); + $expected->setTarget('frame'); + $this->assertEqual($form->getAction(), $expected); + } + + function testTextWidget() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleTextTag( + array('name' => 'me', 'type' => 'text', 'value' => 'Myself'))); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'Myself'); + $this->assertTrue($form->setField(new SimpleByName('me'), 'Not me')); + $this->assertFalse($form->setField(new SimpleByName('not_present'), 'Not me')); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'Not me'); + $this->assertNull($form->getValue(new SimpleByName('not_present'))); + } + + function testTextWidgetById() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleTextTag( + array('name' => 'me', 'type' => 'text', 'value' => 'Myself', 'id' => 50))); + $this->assertIdentical($form->getValue(new SimpleById(50)), 'Myself'); + $this->assertTrue($form->setField(new SimpleById(50), 'Not me')); + $this->assertIdentical($form->getValue(new SimpleById(50)), 'Not me'); + } + + function testTextWidgetByLabel() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $widget = new SimpleTextTag(array('name' => 'me', 'type' => 'text', 'value' => 'a')); + $form->addWidget($widget); + $widget->setLabel('thing'); + $this->assertIdentical($form->getValue(new SimpleByLabel('thing')), 'a'); + $this->assertTrue($form->setField(new SimpleByLabel('thing'), 'b')); + $this->assertIdentical($form->getValue(new SimpleByLabel('thing')), 'b'); + } + + function testSubmitEmpty() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $this->assertIdentical($form->submit(), new SimpleGetEncoding()); + } + + function testSubmitButton() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('http://host')); + $form->addWidget(new SimpleSubmitTag( + array('type' => 'submit', 'name' => 'go', 'value' => 'Go!', 'id' => '9'))); + $this->assertTrue($form->hasSubmit(new SimpleByName('go'))); + $this->assertEqual($form->getValue(new SimpleByName('go')), 'Go!'); + $this->assertEqual($form->getValue(new SimpleById(9)), 'Go!'); + $this->assertEqual( + $form->submitButton(new SimpleByName('go')), + new SimpleGetEncoding(array('go' => 'Go!'))); + $this->assertEqual( + $form->submitButton(new SimpleByLabel('Go!')), + new SimpleGetEncoding(array('go' => 'Go!'))); + $this->assertEqual( + $form->submitButton(new SimpleById(9)), + new SimpleGetEncoding(array('go' => 'Go!'))); + } + + function testSubmitWithAdditionalParameters() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('http://host')); + $form->addWidget(new SimpleSubmitTag( + array('type' => 'submit', 'name' => 'go', 'value' => 'Go!'))); + $this->assertEqual( + $form->submitButton(new SimpleByLabel('Go!'), array('a' => 'A')), + new SimpleGetEncoding(array('go' => 'Go!', 'a' => 'A'))); + } + + function testSubmitButtonWithLabelOfSubmit() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('http://host')); + $form->addWidget(new SimpleSubmitTag( + array('type' => 'submit', 'name' => 'test', 'value' => 'Submit'))); + $this->assertEqual( + $form->submitButton(new SimpleByName('test')), + new SimpleGetEncoding(array('test' => 'Submit'))); + $this->assertEqual( + $form->submitButton(new SimpleByLabel('Submit')), + new SimpleGetEncoding(array('test' => 'Submit'))); + } + + function testSubmitButtonWithWhitespacePaddedLabelOfSubmit() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('http://host')); + $form->addWidget(new SimpleSubmitTag( + array('type' => 'submit', 'name' => 'test', 'value' => ' Submit '))); + $this->assertEqual( + $form->submitButton(new SimpleByLabel('Submit')), + new SimpleGetEncoding(array('test' => ' Submit '))); + } + + function testImageSubmitButton() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleImageSubmitTag(array( + 'type' => 'image', + 'src' => 'source.jpg', + 'name' => 'go', + 'alt' => 'Go!', + 'id' => '9'))); + $this->assertTrue($form->hasImage(new SimpleByLabel('Go!'))); + $this->assertEqual( + $form->submitImage(new SimpleByLabel('Go!'), 100, 101), + new SimpleGetEncoding(array('go.x' => 100, 'go.y' => 101))); + $this->assertTrue($form->hasImage(new SimpleByName('go'))); + $this->assertEqual( + $form->submitImage(new SimpleByName('go'), 100, 101), + new SimpleGetEncoding(array('go.x' => 100, 'go.y' => 101))); + $this->assertTrue($form->hasImage(new SimpleById(9))); + $this->assertEqual( + $form->submitImage(new SimpleById(9), 100, 101), + new SimpleGetEncoding(array('go.x' => 100, 'go.y' => 101))); + } + + function testImageSubmitButtonWithAdditionalData() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleImageSubmitTag(array( + 'type' => 'image', + 'src' => 'source.jpg', + 'name' => 'go', + 'alt' => 'Go!'))); + $this->assertEqual( + $form->submitImage(new SimpleByLabel('Go!'), 100, 101, array('a' => 'A')), + new SimpleGetEncoding(array('go.x' => 100, 'go.y' => 101, 'a' => 'A'))); + } + + function testButtonTag() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('http://host')); + $widget = new SimpleButtonTag( + array('type' => 'submit', 'name' => 'go', 'value' => 'Go', 'id' => '9')); + $widget->addContent('Go!'); + $form->addWidget($widget); + $this->assertTrue($form->hasSubmit(new SimpleByName('go'))); + $this->assertTrue($form->hasSubmit(new SimpleByLabel('Go!'))); + $this->assertEqual( + $form->submitButton(new SimpleByName('go')), + new SimpleGetEncoding(array('go' => 'Go'))); + $this->assertEqual( + $form->submitButton(new SimpleByLabel('Go!')), + new SimpleGetEncoding(array('go' => 'Go'))); + $this->assertEqual( + $form->submitButton(new SimpleById(9)), + new SimpleGetEncoding(array('go' => 'Go'))); + } + + function testMultipleFieldsWithSameNameSubmitted() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $input = new SimpleTextTag(array('name' => 'elements[]', 'value' => '1')); + $form->addWidget($input); + $input = new SimpleTextTag(array('name' => 'elements[]', 'value' => '2')); + $form->addWidget($input); + $form->setField(new SimpleByLabelOrName('elements[]'), '3', 1); + $form->setField(new SimpleByLabelOrName('elements[]'), '4', 2); + $submit = $form->submit(); + $requests = $submit->getAll(); + $this->assertEqual(count($requests), 2); + $this->assertIdentical($requests[0], new SimpleEncodedPair('elements[]', '3')); + $this->assertIdentical($requests[1], new SimpleEncodedPair('elements[]', '4')); + } + + function testSingleSelectFieldSubmitted() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $select = new SimpleSelectionTag(array('name' => 'a')); + $select->addTag(new SimpleOptionTag( + array('value' => 'aaa', 'selected' => ''))); + $form->addWidget($select); + $this->assertIdentical( + $form->submit(), + new SimpleGetEncoding(array('a' => 'aaa'))); + } + + function testSingleSelectFieldSubmittedWithPost() { + $form = new SimpleForm(new SimpleFormTag(array('method' => 'post')), $this->page('htp://host')); + $select = new SimpleSelectionTag(array('name' => 'a')); + $select->addTag(new SimpleOptionTag( + array('value' => 'aaa', 'selected' => ''))); + $form->addWidget($select); + $this->assertIdentical( + $form->submit(), + new SimplePostEncoding(array('a' => 'aaa'))); + } + + function testUnchecked() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleCheckboxTag( + array('name' => 'me', 'type' => 'checkbox'))); + $this->assertIdentical($form->getValue(new SimpleByName('me')), false); + $this->assertTrue($form->setField(new SimpleByName('me'), 'on')); + $this->assertEqual($form->getValue(new SimpleByName('me')), 'on'); + $this->assertFalse($form->setField(new SimpleByName('me'), 'other')); + $this->assertEqual($form->getValue(new SimpleByName('me')), 'on'); + } + + function testChecked() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleCheckboxTag( + array('name' => 'me', 'value' => 'a', 'type' => 'checkbox', 'checked' => ''))); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'a'); + $this->assertTrue($form->setField(new SimpleByName('me'), 'a')); + $this->assertEqual($form->getValue(new SimpleByName('me')), 'a'); + $this->assertTrue($form->setField(new SimpleByName('me'), false)); + $this->assertEqual($form->getValue(new SimpleByName('me')), false); + } + + function testSingleUncheckedRadioButton() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleRadioButtonTag( + array('name' => 'me', 'value' => 'a', 'type' => 'radio'))); + $this->assertIdentical($form->getValue(new SimpleByName('me')), false); + $this->assertTrue($form->setField(new SimpleByName('me'), 'a')); + $this->assertEqual($form->getValue(new SimpleByName('me')), 'a'); + } + + function testSingleCheckedRadioButton() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleRadioButtonTag( + array('name' => 'me', 'value' => 'a', 'type' => 'radio', 'checked' => ''))); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'a'); + $this->assertFalse($form->setField(new SimpleByName('me'), 'other')); + } + + function testUncheckedRadioButtons() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleRadioButtonTag( + array('name' => 'me', 'value' => 'a', 'type' => 'radio'))); + $form->addWidget(new SimpleRadioButtonTag( + array('name' => 'me', 'value' => 'b', 'type' => 'radio'))); + $this->assertIdentical($form->getValue(new SimpleByName('me')), false); + $this->assertTrue($form->setField(new SimpleByName('me'), 'a')); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'a'); + $this->assertTrue($form->setField(new SimpleByName('me'), 'b')); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'b'); + $this->assertFalse($form->setField(new SimpleByName('me'), 'c')); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'b'); + } + + function testCheckedRadioButtons() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleRadioButtonTag( + array('name' => 'me', 'value' => 'a', 'type' => 'radio'))); + $form->addWidget(new SimpleRadioButtonTag( + array('name' => 'me', 'value' => 'b', 'type' => 'radio', 'checked' => ''))); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'b'); + $this->assertTrue($form->setField(new SimpleByName('me'), 'a')); + $this->assertIdentical($form->getValue(new SimpleByName('me')), 'a'); + } + + function testMultipleFieldsWithSameKey() { + $form = new SimpleForm(new SimpleFormTag(array()), $this->page('htp://host')); + $form->addWidget(new SimpleCheckboxTag( + array('name' => 'a', 'type' => 'checkbox', 'value' => 'me'))); + $form->addWidget(new SimpleCheckboxTag( + array('name' => 'a', 'type' => 'checkbox', 'value' => 'you'))); + $this->assertIdentical($form->getValue(new SimpleByName('a')), false); + $this->assertTrue($form->setField(new SimpleByName('a'), 'me')); + $this->assertIdentical($form->getValue(new SimpleByName('a')), 'me'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/frames_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/frames_test.php new file mode 100644 index 0000000..e3ab719 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/frames_test.php @@ -0,0 +1,549 @@ +setReturnValue('getTitle', 'This page'); + $frameset = new SimpleFrameset($page); + $this->assertEqual($frameset->getTitle(), 'This page'); + } + + function TestHeadersReadFromFramesetByDefault() { + $page = new MockSimplePage(); + $page->setReturnValue('getHeaders', 'Header: content'); + $page->setReturnValue('getMimeType', 'text/xml'); + $page->setReturnValue('getResponseCode', 401); + $page->setReturnValue('getTransportError', 'Could not parse headers'); + $page->setReturnValue('getAuthentication', 'Basic'); + $page->setReturnValue('getRealm', 'Safe place'); + + $frameset = new SimpleFrameset($page); + + $this->assertIdentical($frameset->getHeaders(), 'Header: content'); + $this->assertIdentical($frameset->getMimeType(), 'text/xml'); + $this->assertIdentical($frameset->getResponseCode(), 401); + $this->assertIdentical($frameset->getTransportError(), 'Could not parse headers'); + $this->assertIdentical($frameset->getAuthentication(), 'Basic'); + $this->assertIdentical($frameset->getRealm(), 'Safe place'); + } + + function testEmptyFramesetHasNoContent() { + $page = new MockSimplePage(); + $page->setReturnValue('getRaw', 'This content'); + $frameset = new SimpleFrameset($page); + $this->assertEqual($frameset->getRaw(), ''); + } + + function testRawContentIsFromOnlyFrame() { + $page = new MockSimplePage(); + $page->expectNever('getRaw'); + + $frame = new MockSimplePage(); + $frame->setReturnValue('getRaw', 'Stuff'); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame); + $this->assertEqual($frameset->getRaw(), 'Stuff'); + } + + function testRawContentIsFromAllFrames() { + $page = new MockSimplePage(); + $page->expectNever('getRaw'); + + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getRaw', 'Stuff1'); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue('getRaw', 'Stuff2'); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame1); + $frameset->addFrame($frame2); + $this->assertEqual($frameset->getRaw(), 'Stuff1Stuff2'); + } + + function testTextContentIsFromOnlyFrame() { + $page = new MockSimplePage(); + $page->expectNever('getText'); + + $frame = new MockSimplePage(); + $frame->setReturnValue('getText', 'Stuff'); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame); + $this->assertEqual($frameset->getText(), 'Stuff'); + } + + function testTextContentIsFromAllFrames() { + $page = new MockSimplePage(); + $page->expectNever('getText'); + + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getText', 'Stuff1'); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue('getText', 'Stuff2'); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame1); + $frameset->addFrame($frame2); + $this->assertEqual($frameset->getText(), 'Stuff1 Stuff2'); + } + + function testFieldFoundIsFirstInFramelist() { + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getField', null); + $frame1->expectOnce('getField', array(new SimpleByName('a'))); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue('getField', 'A'); + $frame2->expectOnce('getField', array(new SimpleByName('a'))); + + $frame3 = new MockSimplePage(); + $frame3->expectNever('getField'); + + $page = new MockSimplePage(); + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame1); + $frameset->addFrame($frame2); + $frameset->addFrame($frame3); + $this->assertIdentical($frameset->getField(new SimpleByName('a')), 'A'); + } + + function testFrameReplacementByIndex() { + $page = new MockSimplePage(); + $page->expectNever('getRaw'); + + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getRaw', 'Stuff1'); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue('getRaw', 'Stuff2'); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame1); + $frameset->setFrame(array(1), $frame2); + $this->assertEqual($frameset->getRaw(), 'Stuff2'); + } + + function testFrameReplacementByName() { + $page = new MockSimplePage(); + $page->expectNever('getRaw'); + + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getRaw', 'Stuff1'); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue('getRaw', 'Stuff2'); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame1, 'a'); + $frameset->setFrame(array('a'), $frame2); + $this->assertEqual($frameset->getRaw(), 'Stuff2'); + } +} + +class TestOfFrameNavigation extends UnitTestCase { + + function testStartsWithoutFrameFocus() { + $page = new MockSimplePage(); + $frameset = new SimpleFrameset($page); + $frameset->addFrame(new MockSimplePage()); + $this->assertFalse($frameset->getFrameFocus()); + } + + function testCanFocusOnSingleFrame() { + $page = new MockSimplePage(); + $page->expectNever('getRaw'); + + $frame = new MockSimplePage(); + $frame->setReturnValue('getFrameFocus', array()); + $frame->setReturnValue('getRaw', 'Stuff'); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame); + + $this->assertFalse($frameset->setFrameFocusByIndex(0)); + $this->assertTrue($frameset->setFrameFocusByIndex(1)); + $this->assertEqual($frameset->getRaw(), 'Stuff'); + $this->assertFalse($frameset->setFrameFocusByIndex(2)); + $this->assertIdentical($frameset->getFrameFocus(), array(1)); + } + + function testContentComesFromFrameInFocus() { + $page = new MockSimplePage(); + + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getRaw', 'Stuff1'); + $frame1->setReturnValue('getFrameFocus', array()); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue('getRaw', 'Stuff2'); + $frame2->setReturnValue('getFrameFocus', array()); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame1); + $frameset->addFrame($frame2); + + $this->assertTrue($frameset->setFrameFocusByIndex(1)); + $this->assertEqual($frameset->getFrameFocus(), array(1)); + $this->assertEqual($frameset->getRaw(), 'Stuff1'); + + $this->assertTrue($frameset->setFrameFocusByIndex(2)); + $this->assertEqual($frameset->getFrameFocus(), array(2)); + $this->assertEqual($frameset->getRaw(), 'Stuff2'); + + $this->assertFalse($frameset->setFrameFocusByIndex(3)); + $this->assertEqual($frameset->getFrameFocus(), array(2)); + + $frameset->clearFrameFocus(); + $this->assertEqual($frameset->getRaw(), 'Stuff1Stuff2'); + } + + function testCanFocusByName() { + $page = new MockSimplePage(); + + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getRaw', 'Stuff1'); + $frame1->setReturnValue('getFrameFocus', array()); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue('getRaw', 'Stuff2'); + $frame2->setReturnValue('getFrameFocus', array()); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame1, 'A'); + $frameset->addFrame($frame2, 'B'); + + $this->assertTrue($frameset->setFrameFocus('A')); + $this->assertEqual($frameset->getFrameFocus(), array('A')); + $this->assertEqual($frameset->getRaw(), 'Stuff1'); + + $this->assertTrue($frameset->setFrameFocusByIndex(2)); + $this->assertEqual($frameset->getFrameFocus(), array('B')); + $this->assertEqual($frameset->getRaw(), 'Stuff2'); + + $this->assertFalse($frameset->setFrameFocus('z')); + + $frameset->clearFrameFocus(); + $this->assertEqual($frameset->getRaw(), 'Stuff1Stuff2'); + } +} + +class TestOfFramesetPageInterface extends UnitTestCase { + private $page_interface; + private $frameset_interface; + + function __construct() { + parent::__construct(); + $this->page_interface = $this->getPageMethods(); + $this->frameset_interface = $this->getFramesetMethods(); + } + + function assertListInAnyOrder($list, $expected) { + sort($list); + sort($expected); + $this->assertEqual($list, $expected); + } + + private function getPageMethods() { + $methods = array(); + foreach (get_class_methods('SimplePage') as $method) { + if (strtolower($method) == strtolower('SimplePage')) { + continue; + } + if (strtolower($method) == strtolower('getFrameset')) { + continue; + } + if (strncmp($method, '_', 1) == 0) { + continue; + } + if (strncmp($method, 'accept', 6) == 0) { + continue; + } + $methods[] = $method; + } + return $methods; + } + + private function getFramesetMethods() { + $methods = array(); + foreach (get_class_methods('SimpleFrameset') as $method) { + if (strtolower($method) == strtolower('SimpleFrameset')) { + continue; + } + if (strncmp($method, '_', 1) == 0) { + continue; + } + if (strncmp($method, 'add', 3) == 0) { + continue; + } + $methods[] = $method; + } + return $methods; + } + + function testFramsetHasPageInterface() { + $difference = array(); + foreach ($this->page_interface as $method) { + if (! in_array($method, $this->frameset_interface)) { + $this->fail("No [$method] in Frameset class"); + return; + } + } + $this->pass('Frameset covers Page interface'); + } + + function testHeadersReadFromFrameIfInFocus() { + $frame = new MockSimplePage(); + $frame->setReturnValue('getUrl', new SimpleUrl('http://localhost/stuff')); + + $frame->setReturnValue('getRequest', 'POST stuff'); + $frame->setReturnValue('getMethod', 'POST'); + $frame->setReturnValue('getRequestData', array('a' => 'A')); + $frame->setReturnValue('getHeaders', 'Header: content'); + $frame->setReturnValue('getMimeType', 'text/xml'); + $frame->setReturnValue('getResponseCode', 401); + $frame->setReturnValue('getTransportError', 'Could not parse headers'); + $frame->setReturnValue('getAuthentication', 'Basic'); + $frame->setReturnValue('getRealm', 'Safe place'); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame($frame); + $frameset->setFrameFocusByIndex(1); + + $url = new SimpleUrl('http://localhost/stuff'); + $url->setTarget(1); + $this->assertIdentical($frameset->getUrl(), $url); + + $this->assertIdentical($frameset->getRequest(), 'POST stuff'); + $this->assertIdentical($frameset->getMethod(), 'POST'); + $this->assertIdentical($frameset->getRequestData(), array('a' => 'A')); + $this->assertIdentical($frameset->getHeaders(), 'Header: content'); + $this->assertIdentical($frameset->getMimeType(), 'text/xml'); + $this->assertIdentical($frameset->getResponseCode(), 401); + $this->assertIdentical($frameset->getTransportError(), 'Could not parse headers'); + $this->assertIdentical($frameset->getAuthentication(), 'Basic'); + $this->assertIdentical($frameset->getRealm(), 'Safe place'); + } + + function testUrlsComeFromBothFrames() { + $page = new MockSimplePage(); + $page->expectNever('getUrls'); + + $frame1 = new MockSimplePage(); + $frame1->setReturnValue( + 'getUrls', + array('http://www.lastcraft.com/', 'http://myserver/')); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue( + 'getUrls', + array('http://www.lastcraft.com/', 'http://test/')); + + $frameset = new SimpleFrameset($page); + $frameset->addFrame($frame1); + $frameset->addFrame($frame2); + $this->assertListInAnyOrder( + $frameset->getUrls(), + array('http://www.lastcraft.com/', 'http://myserver/', 'http://test/')); + } + + function testLabelledUrlsComeFromBothFrames() { + $frame1 = new MockSimplePage(); + $frame1->setReturnValue( + 'getUrlsByLabel', + array(new SimpleUrl('goodbye.php')), + array('a')); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue( + 'getUrlsByLabel', + array(new SimpleUrl('hello.php')), + array('a')); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame($frame1); + $frameset->addFrame($frame2, 'Two'); + + $expected1 = new SimpleUrl('goodbye.php'); + $expected1->setTarget(1); + $expected2 = new SimpleUrl('hello.php'); + $expected2->setTarget('Two'); + $this->assertEqual( + $frameset->getUrlsByLabel('a'), + array($expected1, $expected2)); + } + + function testUrlByIdComesFromFirstFrameToRespond() { + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getUrlById', new SimpleUrl('four.php'), array(4)); + $frame1->setReturnValue('getUrlById', false, array(5)); + + $frame2 = new MockSimplePage(); + $frame2->setReturnValue('getUrlById', false, array(4)); + $frame2->setReturnValue('getUrlById', new SimpleUrl('five.php'), array(5)); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame($frame1); + $frameset->addFrame($frame2); + + $four = new SimpleUrl('four.php'); + $four->setTarget(1); + $this->assertEqual($frameset->getUrlById(4), $four); + $five = new SimpleUrl('five.php'); + $five->setTarget(2); + $this->assertEqual($frameset->getUrlById(5), $five); + } + + function testReadUrlsFromFrameInFocus() { + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getUrls', array('a')); + $frame1->setReturnValue('getUrlsByLabel', array(new SimpleUrl('l'))); + $frame1->setReturnValue('getUrlById', new SimpleUrl('i')); + + $frame2 = new MockSimplePage(); + $frame2->expectNever('getUrls'); + $frame2->expectNever('getUrlsByLabel'); + $frame2->expectNever('getUrlById'); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame($frame1, 'A'); + $frameset->addFrame($frame2, 'B'); + $frameset->setFrameFocus('A'); + + $this->assertIdentical($frameset->getUrls(), array('a')); + $expected = new SimpleUrl('l'); + $expected->setTarget('A'); + $this->assertIdentical($frameset->getUrlsByLabel('label'), array($expected)); + $expected = new SimpleUrl('i'); + $expected->setTarget('A'); + $this->assertIdentical($frameset->getUrlById(99), $expected); + } + + function testReadFrameTaggedUrlsFromFrameInFocus() { + $frame = new MockSimplePage(); + + $by_label = new SimpleUrl('l'); + $by_label->setTarget('L'); + $frame->setReturnValue('getUrlsByLabel', array($by_label)); + + $by_id = new SimpleUrl('i'); + $by_id->setTarget('I'); + $frame->setReturnValue('getUrlById', $by_id); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame($frame, 'A'); + $frameset->setFrameFocus('A'); + + $this->assertIdentical($frameset->getUrlsByLabel('label'), array($by_label)); + $this->assertIdentical($frameset->getUrlById(99), $by_id); + } + + function testFindingFormsById() { + $frame = new MockSimplePage(); + $form = new MockSimpleForm(); + $frame->returns('getFormById', $form, array('a')); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame(new MockSimplePage(), 'A'); + $frameset->addFrame($frame, 'B'); + $this->assertSame($frameset->getFormById('a'), $form); + + $frameset->setFrameFocus('A'); + $this->assertNull($frameset->getFormById('a')); + + $frameset->setFrameFocus('B'); + $this->assertSame($frameset->getFormById('a'), $form); + } + + function testFindingFormsBySubmit() { + $frame = new MockSimplePage(); + $form = new MockSimpleForm(); + $frame->returns( + 'getFormBySubmit', + $form, + array(new SimpleByLabel('a'))); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame(new MockSimplePage(), 'A'); + $frameset->addFrame($frame, 'B'); + $this->assertSame($frameset->getFormBySubmit(new SimpleByLabel('a')), $form); + + $frameset->setFrameFocus('A'); + $this->assertNull($frameset->getFormBySubmit(new SimpleByLabel('a'))); + + $frameset->setFrameFocus('B'); + $this->assertSame($frameset->getFormBySubmit(new SimpleByLabel('a')), $form); + } + + function testFindingFormsByImage() { + $frame = new MockSimplePage(); + $form = new MockSimpleForm(); + $frame->returns( + 'getFormByImage', + $form, + array(new SimpleByLabel('a'))); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame(new MockSimplePage(), 'A'); + $frameset->addFrame($frame, 'B'); + $this->assertSame($frameset->getFormByImage(new SimpleByLabel('a')), $form); + + $frameset->setFrameFocus('A'); + $this->assertNull($frameset->getFormByImage(new SimpleByLabel('a'))); + + $frameset->setFrameFocus('B'); + $this->assertSame($frameset->getFormByImage(new SimpleByLabel('a')), $form); + } + + function testSettingAllFrameFieldsWhenNoFrameFocus() { + $frame1 = new MockSimplePage(); + $frame1->expectOnce('setField', array(new SimpleById(22), 'A')); + + $frame2 = new MockSimplePage(); + $frame2->expectOnce('setField', array(new SimpleById(22), 'A')); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame($frame1, 'A'); + $frameset->addFrame($frame2, 'B'); + $frameset->setField(new SimpleById(22), 'A'); + } + + function testOnlySettingFieldFromFocusedFrame() { + $frame1 = new MockSimplePage(); + $frame1->expectOnce('setField', array(new SimpleByLabelOrName('a'), 'A')); + + $frame2 = new MockSimplePage(); + $frame2->expectNever('setField'); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame($frame1, 'A'); + $frameset->addFrame($frame2, 'B'); + $frameset->setFrameFocus('A'); + $frameset->setField(new SimpleByLabelOrName('a'), 'A'); + } + + function testOnlyGettingFieldFromFocusedFrame() { + $frame1 = new MockSimplePage(); + $frame1->setReturnValue('getField', 'f', array(new SimpleByName('a'))); + + $frame2 = new MockSimplePage(); + $frame2->expectNever('getField'); + + $frameset = new SimpleFrameset(new MockSimplePage()); + $frameset->addFrame($frame1, 'A'); + $frameset->addFrame($frame2, 'B'); + $frameset->setFrameFocus('A'); + $this->assertIdentical($frameset->getField(new SimpleByName('a')), 'f'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/http_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/http_test.php new file mode 100644 index 0000000..3cf3d16 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/http_test.php @@ -0,0 +1,424 @@ +expectAt(0, 'write', array("GET /here.html HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: a.valid.host\r\n")); + $socket->expectAt(2, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 3); + $route = new PartialSimpleRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct(new SimpleUrl('http://a.valid.host/here.html')); + $this->assertSame($route->createConnection('GET', 15), $socket); + } + + function testDefaultPostRequest() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("POST /here.html HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: a.valid.host\r\n")); + $socket->expectAt(2, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 3); + + $route = new PartialSimpleRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct(new SimpleUrl('http://a.valid.host/here.html')); + + $route->createConnection('POST', 15); + } + + function testGetWithPort() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("GET /here.html HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: a.valid.host:81\r\n")); + $socket->expectAt(2, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 3); + + $route = new PartialSimpleRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct(new SimpleUrl('http://a.valid.host:81/here.html')); + + $route->createConnection('GET', 15); + } + + function testGetWithParameters() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("GET /here.html?a=1&b=2 HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: a.valid.host\r\n")); + $socket->expectAt(2, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 3); + + $route = new PartialSimpleRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct(new SimpleUrl('http://a.valid.host/here.html?a=1&b=2')); + + $route->createConnection('GET', 15); + } +} + +class TestOfProxyRoute extends UnitTestCase { + + function testDefaultGet() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("GET http://a.valid.host/here.html HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: my-proxy:8080\r\n")); + $socket->expectAt(2, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 3); + + $route = new PartialSimpleProxyRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct( + new SimpleUrl('http://a.valid.host/here.html'), + new SimpleUrl('http://my-proxy')); + $route->createConnection('GET', 15); + } + + function testDefaultPost() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("POST http://a.valid.host/here.html HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: my-proxy:8080\r\n")); + $socket->expectAt(2, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 3); + + $route = new PartialSimpleProxyRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct( + new SimpleUrl('http://a.valid.host/here.html'), + new SimpleUrl('http://my-proxy')); + $route->createConnection('POST', 15); + } + + function testGetWithPort() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("GET http://a.valid.host:81/here.html HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: my-proxy:8081\r\n")); + $socket->expectAt(2, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 3); + + $route = new PartialSimpleProxyRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct( + new SimpleUrl('http://a.valid.host:81/here.html'), + new SimpleUrl('http://my-proxy:8081')); + $route->createConnection('GET', 15); + } + + function testGetWithParameters() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("GET http://a.valid.host/here.html?a=1&b=2 HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: my-proxy:8080\r\n")); + $socket->expectAt(2, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 3); + + $route = new PartialSimpleProxyRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct( + new SimpleUrl('http://a.valid.host/here.html?a=1&b=2'), + new SimpleUrl('http://my-proxy')); + $route->createConnection('GET', 15); + } + + function testGetWithAuthentication() { + $encoded = base64_encode('Me:Secret'); + + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("GET http://a.valid.host/here.html HTTP/1.0\r\n")); + $socket->expectAt(1, 'write', array("Host: my-proxy:8080\r\n")); + $socket->expectAt(2, 'write', array("Proxy-Authorization: Basic $encoded\r\n")); + $socket->expectAt(3, 'write', array("Connection: close\r\n")); + $socket->expectCallCount('write', 4); + + $route = new PartialSimpleProxyRoute(); + $route->setReturnReference('createSocket', $socket); + $route->__construct( + new SimpleUrl('http://a.valid.host/here.html'), + new SimpleUrl('http://my-proxy'), + 'Me', + 'Secret'); + $route->createConnection('GET', 15); + } +} + +class TestOfHttpRequest extends UnitTestCase { + + function testReadingBadConnection() { + $socket = new MockSimpleSocket(); + $route = new MockSimpleRoute(); + $route->setReturnReference('createConnection', $socket); + $request = new SimpleHttpRequest($route, new SimpleGetEncoding()); + $reponse = $request->fetch(15); + $this->assertTrue($reponse->isError()); + } + + function testReadingGoodConnection() { + $socket = new MockSimpleSocket(); + $socket->expectOnce('write', array("\r\n")); + + $route = new MockSimpleRoute(); + $route->setReturnReference('createConnection', $socket); + $route->expect('createConnection', array('GET', 15)); + + $request = new SimpleHttpRequest($route, new SimpleGetEncoding()); + $this->assertIsA($request->fetch(15), 'SimpleHttpResponse'); + } + + function testWritingAdditionalHeaders() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("My: stuff\r\n")); + $socket->expectAt(1, 'write', array("\r\n")); + $socket->expectCallCount('write', 2); + + $route = new MockSimpleRoute(); + $route->setReturnReference('createConnection', $socket); + + $request = new SimpleHttpRequest($route, new SimpleGetEncoding()); + $request->addHeaderLine('My: stuff'); + $request->fetch(15); + } + + function testCookieWriting() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("Cookie: a=A\r\n")); + $socket->expectAt(1, 'write', array("\r\n")); + $socket->expectCallCount('write', 2); + + $route = new MockSimpleRoute(); + $route->setReturnReference('createConnection', $socket); + + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A'); + + $request = new SimpleHttpRequest($route, new SimpleGetEncoding()); + $request->readCookiesFromJar($jar, new SimpleUrl('/')); + $this->assertIsA($request->fetch(15), 'SimpleHttpResponse'); + } + + function testMultipleCookieWriting() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("Cookie: a=A;b=B\r\n")); + + $route = new MockSimpleRoute(); + $route->setReturnReference('createConnection', $socket); + + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A'); + $jar->setCookie('b', 'B'); + + $request = new SimpleHttpRequest($route, new SimpleGetEncoding()); + $request->readCookiesFromJar($jar, new SimpleUrl('/')); + $request->fetch(15); + } +} + +class TestOfHttpPostRequest extends UnitTestCase { + + function testReadingBadConnectionCausesErrorBecauseOfDeadSocket() { + $socket = new MockSimpleSocket(); + $route = new MockSimpleRoute(); + $route->setReturnReference('createConnection', $socket); + $request = new SimpleHttpRequest($route, new SimplePostEncoding()); + $reponse = $request->fetch(15); + $this->assertTrue($reponse->isError()); + } + + function testReadingGoodConnection() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("Content-Length: 0\r\n")); + $socket->expectAt(1, 'write', array("Content-Type: application/x-www-form-urlencoded\r\n")); + $socket->expectAt(2, 'write', array("\r\n")); + $socket->expectAt(3, 'write', array("")); + + $route = new MockSimpleRoute(); + $route->setReturnReference('createConnection', $socket); + $route->expect('createConnection', array('POST', 15)); + + $request = new SimpleHttpRequest($route, new SimplePostEncoding()); + $this->assertIsA($request->fetch(15), 'SimpleHttpResponse'); + } + + function testContentHeadersCalculated() { + $socket = new MockSimpleSocket(); + $socket->expectAt(0, 'write', array("Content-Length: 3\r\n")); + $socket->expectAt(1, 'write', array("Content-Type: application/x-www-form-urlencoded\r\n")); + $socket->expectAt(2, 'write', array("\r\n")); + $socket->expectAt(3, 'write', array("a=A")); + + $route = new MockSimpleRoute(); + $route->setReturnReference('createConnection', $socket); + $route->expect('createConnection', array('POST', 15)); + + $request = new SimpleHttpRequest( + $route, + new SimplePostEncoding(array('a' => 'A'))); + $this->assertIsA($request->fetch(15), 'SimpleHttpResponse'); + } +} + +class TestOfHttpHeaders extends UnitTestCase { + + function testParseBasicHeaders() { + $headers = new SimpleHttpHeaders( + "HTTP/1.1 200 OK\r\n" . + "Date: Mon, 18 Nov 2002 15:50:29 GMT\r\n" . + "Content-Type: text/plain\r\n" . + "Server: Apache/1.3.24 (Win32) PHP/4.2.3\r\n" . + "Connection: close"); + $this->assertIdentical($headers->getHttpVersion(), "1.1"); + $this->assertIdentical($headers->getResponseCode(), 200); + $this->assertEqual($headers->getMimeType(), "text/plain"); + } + + function testNonStandardResponseHeader() { + $headers = new SimpleHttpHeaders( + "HTTP/1.1 302 (HTTP-Version SP Status-Code CRLF)\r\n" . + "Connection: close"); + $this->assertIdentical($headers->getResponseCode(), 302); + } + + function testCanParseMultipleCookies() { + $jar = new MockSimpleCookieJar(); + $jar->expectAt(0, 'setCookie', array('a', 'aaa', 'host', '/here/', 'Wed, 25 Dec 2002 04:24:20 GMT')); + $jar->expectAt(1, 'setCookie', array('b', 'bbb', 'host', '/', false)); + + $headers = new SimpleHttpHeaders( + "HTTP/1.1 200 OK\r\n" . + "Date: Mon, 18 Nov 2002 15:50:29 GMT\r\n" . + "Content-Type: text/plain\r\n" . + "Server: Apache/1.3.24 (Win32) PHP/4.2.3\r\n" . + "Set-Cookie: a=aaa; expires=Wed, 25-Dec-02 04:24:20 GMT; path=/here/\r\n" . + "Set-Cookie: b=bbb\r\n" . + "Connection: close"); + $headers->writeCookiesToJar($jar, new SimpleUrl('http://host')); + } + + function testCanRecogniseRedirect() { + $headers = new SimpleHttpHeaders("HTTP/1.1 301 OK\r\n" . + "Content-Type: text/plain\r\n" . + "Content-Length: 0\r\n" . + "Location: http://www.somewhere-else.com/\r\n" . + "Connection: close"); + $this->assertIdentical($headers->getResponseCode(), 301); + $this->assertEqual($headers->getLocation(), "http://www.somewhere-else.com/"); + $this->assertTrue($headers->isRedirect()); + } + + function testCanParseChallenge() { + $headers = new SimpleHttpHeaders("HTTP/1.1 401 Authorization required\r\n" . + "Content-Type: text/plain\r\n" . + "Connection: close\r\n" . + "WWW-Authenticate: Basic realm=\"Somewhere\""); + $this->assertEqual($headers->getAuthentication(), 'Basic'); + $this->assertEqual($headers->getRealm(), 'Somewhere'); + $this->assertTrue($headers->isChallenge()); + } +} + +class TestOfHttpResponse extends UnitTestCase { + + function testBadRequest() { + $socket = new MockSimpleSocket(); + $socket->setReturnValue('getSent', ''); + + $response = new SimpleHttpResponse($socket, new SimpleUrl('here'), new SimpleGetEncoding()); + $this->assertTrue($response->isError()); + $this->assertPattern('/Nothing fetched/', $response->getError()); + $this->assertIdentical($response->getContent(), false); + $this->assertIdentical($response->getSent(), ''); + } + + function testBadSocketDuringResponse() { + $socket = new MockSimpleSocket(); + $socket->setReturnValueAt(0, "read", "HTTP/1.1 200 OK\r\n"); + $socket->setReturnValueAt(1, "read", "Date: Mon, 18 Nov 2002 15:50:29 GMT\r\n"); + $socket->setReturnValue("read", ""); + $socket->setReturnValue('getSent', 'HTTP/1.1 ...'); + + $response = new SimpleHttpResponse($socket, new SimpleUrl('here'), new SimpleGetEncoding()); + $this->assertTrue($response->isError()); + $this->assertEqual($response->getContent(), ''); + $this->assertEqual($response->getSent(), 'HTTP/1.1 ...'); + } + + function testIncompleteHeader() { + $socket = new MockSimpleSocket(); + $socket->setReturnValueAt(0, "read", "HTTP/1.1 200 OK\r\n"); + $socket->setReturnValueAt(1, "read", "Date: Mon, 18 Nov 2002 15:50:29 GMT\r\n"); + $socket->setReturnValueAt(2, "read", "Content-Type: text/plain\r\n"); + $socket->setReturnValue("read", ""); + + $response = new SimpleHttpResponse($socket, new SimpleUrl('here'), new SimpleGetEncoding()); + $this->assertTrue($response->isError()); + $this->assertEqual($response->getContent(), ""); + } + + function testParseOfResponseHeadersWhenChunked() { + $socket = new MockSimpleSocket(); + $socket->setReturnValueAt(0, "read", "HTTP/1.1 200 OK\r\nDate: Mon, 18 Nov 2002 15:50:29 GMT\r\n"); + $socket->setReturnValueAt(1, "read", "Content-Type: text/plain\r\n"); + $socket->setReturnValueAt(2, "read", "Server: Apache/1.3.24 (Win32) PHP/4.2.3\r\nConne"); + $socket->setReturnValueAt(3, "read", "ction: close\r\n\r\nthis is a test file\n"); + $socket->setReturnValueAt(4, "read", "with two lines in it\n"); + $socket->setReturnValue("read", ""); + + $response = new SimpleHttpResponse($socket, new SimpleUrl('here'), new SimpleGetEncoding()); + $this->assertFalse($response->isError()); + $this->assertEqual( + $response->getContent(), + "this is a test file\nwith two lines in it\n"); + $headers = $response->getHeaders(); + $this->assertIdentical($headers->getHttpVersion(), "1.1"); + $this->assertIdentical($headers->getResponseCode(), 200); + $this->assertEqual($headers->getMimeType(), "text/plain"); + $this->assertFalse($headers->isRedirect()); + $this->assertFalse($headers->getLocation()); + } + + function testRedirect() { + $socket = new MockSimpleSocket(); + $socket->setReturnValueAt(0, "read", "HTTP/1.1 301 OK\r\n"); + $socket->setReturnValueAt(1, "read", "Content-Type: text/plain\r\n"); + $socket->setReturnValueAt(2, "read", "Location: http://www.somewhere-else.com/\r\n"); + $socket->setReturnValueAt(3, "read", "Connection: close\r\n"); + $socket->setReturnValueAt(4, "read", "\r\n"); + $socket->setReturnValue("read", ""); + + $response = new SimpleHttpResponse($socket, new SimpleUrl('here'), new SimpleGetEncoding()); + $headers = $response->getHeaders(); + $this->assertTrue($headers->isRedirect()); + $this->assertEqual($headers->getLocation(), "http://www.somewhere-else.com/"); + } + + function testRedirectWithPort() { + $socket = new MockSimpleSocket(); + $socket->setReturnValueAt(0, "read", "HTTP/1.1 301 OK\r\n"); + $socket->setReturnValueAt(1, "read", "Content-Type: text/plain\r\n"); + $socket->setReturnValueAt(2, "read", "Location: http://www.somewhere-else.com:80/\r\n"); + $socket->setReturnValueAt(3, "read", "Connection: close\r\n"); + $socket->setReturnValueAt(4, "read", "\r\n"); + $socket->setReturnValue("read", ""); + + $response = new SimpleHttpResponse($socket, new SimpleUrl('here'), new SimpleGetEncoding()); + $headers = $response->getHeaders(); + $this->assertTrue($headers->isRedirect()); + $this->assertEqual($headers->getLocation(), "http://www.somewhere-else.com:80/"); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/interfaces_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/interfaces_test.php new file mode 100644 index 0000000..83c24d4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/interfaces_test.php @@ -0,0 +1,137 @@ +=')) { + include(dirname(__FILE__) . '/interfaces_test_php5_1.php'); +} + +interface DummyInterface { + function aMethod(); + function anotherMethod($a); + function &referenceMethod(&$a); +} + +Mock::generate('DummyInterface'); +Mock::generatePartial('DummyInterface', 'PartialDummyInterface', array()); + +class TestOfMockInterfaces extends UnitTestCase { + + function testCanMockAnInterface() { + $mock = new MockDummyInterface(); + $this->assertIsA($mock, 'SimpleMock'); + $this->assertIsA($mock, 'MockDummyInterface'); + $this->assertTrue(method_exists($mock, 'aMethod')); + $this->assertTrue(method_exists($mock, 'anotherMethod')); + $this->assertNull($mock->aMethod()); + } + + function testMockedInterfaceExpectsParameters() { + $mock = new MockDummyInterface(); + $this->expectError(); + $mock->anotherMethod(); + } + + function testCannotPartiallyMockAnInterface() { + $this->assertFalse(class_exists('PartialDummyInterface')); + } +} + +class TestOfSpl extends UnitTestCase { + + function skip() { + $this->skipUnless(function_exists('spl_classes'), 'No SPL module loaded'); + } + + function testCanMockAllSplClasses() { + if (! function_exists('spl_classes')) { + return; + } + foreach(spl_classes() as $class) { + if ($class == 'SplHeap') { + continue; + } + if (version_compare(PHP_VERSION, '5.1', '<') && + $class == 'CachingIterator' || + $class == 'CachingRecursiveIterator' || + $class == 'FilterIterator' || + $class == 'LimitIterator' || + $class == 'ParentIterator') { + // These iterators require an iterator be passed to them during + // construction in PHP 5.0; there is no way for SimpleTest + // to supply such an iterator, however, so support for it is + // disabled. + continue; + } + $mock_class = "Mock$class"; + Mock::generate($class); + $this->assertIsA(new $mock_class(), $mock_class); + } + } + + function testExtensionOfCommonSplClasses() { + Mock::generate('IteratorImplementation'); + $this->assertIsA( + new IteratorImplementation(), + 'IteratorImplementation'); + Mock::generate('IteratorAggregateImplementation'); + $this->assertIsA( + new IteratorAggregateImplementation(), + 'IteratorAggregateImplementation'); + } +} + +class WithHint { + function hinted(DummyInterface $object) { } +} + +class ImplementsDummy implements DummyInterface { + function aMethod() { } + function anotherMethod($a) { } + function &referenceMethod(&$a) { } + function extraMethod($a = false) { } +} +Mock::generate('ImplementsDummy'); + +class TestOfImplementations extends UnitTestCase { + + function testMockedInterfaceCanPassThroughTypeHint() { + $mock = new MockDummyInterface(); + $hinter = new WithHint(); + $hinter->hinted($mock); + } + + function testImplementedInterfacesAreCarried() { + $mock = new MockImplementsDummy(); + $hinter = new WithHint(); + $hinter->hinted($mock); + } + + function testNoSpuriousWarningsWhenSkippingDefaultedParameter() { + $mock = new MockImplementsDummy(); + $mock->extraMethod(); + } +} + +interface SampleInterfaceWithConstruct { + function __construct($something); +} + +class TestOfInterfaceMocksWithConstruct extends UnitTestCase { + function TODO_testBasicConstructOfAnInterface() { // Fails in PHP 5.3dev + Mock::generate('SampleInterfaceWithConstruct'); + } +} + +interface SampleInterfaceWithClone { + function __clone(); +} + +class TestOfSampleInterfaceWithClone extends UnitTestCase { + function testCanMockWithoutErrors() { + Mock::generate('SampleInterfaceWithClone'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/interfaces_test_php5_1.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/interfaces_test_php5_1.php new file mode 100644 index 0000000..3d154f9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/interfaces_test_php5_1.php @@ -0,0 +1,14 @@ +assertIsA($mock, 'SampleInterfaceWithHintInSignature'); + } +} + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/live_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/live_test.php new file mode 100644 index 0000000..3fbb544 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/live_test.php @@ -0,0 +1,47 @@ +assertTrue($socket->isError()); + $this->assertPattern( + '/Cannot open \\[bad_url:111\\] with \\[/', + $socket->getError()); + $this->assertFalse($socket->isOpen()); + $this->assertFalse($socket->write('A message')); + } + + function testSocketClosure() { + $socket = new SimpleSocket('www.lastcraft.com', 80, 15, 8); + $this->assertTrue($socket->isOpen()); + $this->assertTrue($socket->write("GET /test/network_confirm.php HTTP/1.0\r\n")); + $socket->write("Host: www.lastcraft.com\r\n"); + $socket->write("Connection: close\r\n\r\n"); + $this->assertEqual($socket->read(), "HTTP/1.1"); + $socket->close(); + $this->assertIdentical($socket->read(), false); + } + + function testRecordOfSentCharacters() { + $socket = new SimpleSocket('www.lastcraft.com', 80, 15); + $this->assertTrue($socket->write("GET /test/network_confirm.php HTTP/1.0\r\n")); + $socket->write("Host: www.lastcraft.com\r\n"); + $socket->write("Connection: close\r\n\r\n"); + $socket->close(); + $this->assertEqual($socket->getSent(), + "GET /test/network_confirm.php HTTP/1.0\r\n" . + "Host: www.lastcraft.com\r\n" . + "Connection: close\r\n\r\n"); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/mock_objects_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/mock_objects_test.php new file mode 100644 index 0000000..aac2396 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/mock_objects_test.php @@ -0,0 +1,1012 @@ +assertTrue($expectation->test(33)); + $this->assertTrue($expectation->test(false)); + $this->assertTrue($expectation->test(null)); + } +} + +class TestOfParametersExpectation extends UnitTestCase { + + function testEmptyMatch() { + $expectation = new ParametersExpectation(array()); + $this->assertTrue($expectation->test(array())); + $this->assertFalse($expectation->test(array(33))); + } + + function testSingleMatch() { + $expectation = new ParametersExpectation(array(0)); + $this->assertFalse($expectation->test(array(1))); + $this->assertTrue($expectation->test(array(0))); + } + + function testAnyMatch() { + $expectation = new ParametersExpectation(false); + $this->assertTrue($expectation->test(array())); + $this->assertTrue($expectation->test(array(1, 2))); + } + + function testMissingParameter() { + $expectation = new ParametersExpectation(array(0)); + $this->assertFalse($expectation->test(array())); + } + + function testNullParameter() { + $expectation = new ParametersExpectation(array(null)); + $this->assertTrue($expectation->test(array(null))); + $this->assertFalse($expectation->test(array())); + } + + function testAnythingExpectations() { + $expectation = new ParametersExpectation(array(new AnythingExpectation())); + $this->assertFalse($expectation->test(array())); + $this->assertIdentical($expectation->test(array(null)), true); + $this->assertIdentical($expectation->test(array(13)), true); + } + + function testOtherExpectations() { + $expectation = new ParametersExpectation( + array(new PatternExpectation('/hello/i'))); + $this->assertFalse($expectation->test(array('Goodbye'))); + $this->assertTrue($expectation->test(array('hello'))); + $this->assertTrue($expectation->test(array('Hello'))); + } + + function testIdentityOnly() { + $expectation = new ParametersExpectation(array("0")); + $this->assertFalse($expectation->test(array(0))); + $this->assertTrue($expectation->test(array("0"))); + } + + function testLongList() { + $expectation = new ParametersExpectation( + array("0", 0, new AnythingExpectation(), false)); + $this->assertTrue($expectation->test(array("0", 0, 37, false))); + $this->assertFalse($expectation->test(array("0", 0, 37, true))); + $this->assertFalse($expectation->test(array("0", 0, 37))); + } +} + +class TestOfSimpleSignatureMap extends UnitTestCase { + + function testEmpty() { + $map = new SimpleSignatureMap(); + $this->assertFalse($map->isMatch("any", array())); + $this->assertNull($map->findFirstAction("any", array())); + } + + function testDifferentCallSignaturesCanHaveDifferentReferences() { + $map = new SimpleSignatureMap(); + $fred = 'Fred'; + $jim = 'jim'; + $map->add(array(0), $fred); + $map->add(array('0'), $jim); + $this->assertSame($fred, $map->findFirstAction(array(0))); + $this->assertSame($jim, $map->findFirstAction(array('0'))); + } + + function testWildcard() { + $fred = 'Fred'; + $map = new SimpleSignatureMap(); + $map->add(array(new AnythingExpectation(), 1, 3), $fred); + $this->assertTrue($map->isMatch(array(2, 1, 3))); + $this->assertSame($map->findFirstAction(array(2, 1, 3)), $fred); + } + + function testAllWildcard() { + $fred = 'Fred'; + $map = new SimpleSignatureMap(); + $this->assertFalse($map->isMatch(array(2, 1, 3))); + $map->add('', $fred); + $this->assertTrue($map->isMatch(array(2, 1, 3))); + $this->assertSame($map->findFirstAction(array(2, 1, 3)), $fred); + } + + function testOrdering() { + $map = new SimpleSignatureMap(); + $map->add(array(1, 2), new SimpleByValue("1, 2")); + $map->add(array(1, 3), new SimpleByValue("1, 3")); + $map->add(array(1), new SimpleByValue("1")); + $map->add(array(1, 4), new SimpleByValue("1, 4")); + $map->add(array(new AnythingExpectation()), new SimpleByValue("Any")); + $map->add(array(2), new SimpleByValue("2")); + $map->add("", new SimpleByValue("Default")); + $map->add(array(), new SimpleByValue("None")); + $this->assertEqual($map->findFirstAction(array(1, 2)), new SimpleByValue("1, 2")); + $this->assertEqual($map->findFirstAction(array(1, 3)), new SimpleByValue("1, 3")); + $this->assertEqual($map->findFirstAction(array(1, 4)), new SimpleByValue("1, 4")); + $this->assertEqual($map->findFirstAction(array(1)), new SimpleByValue("1")); + $this->assertEqual($map->findFirstAction(array(2)), new SimpleByValue("Any")); + $this->assertEqual($map->findFirstAction(array(3)), new SimpleByValue("Any")); + $this->assertEqual($map->findFirstAction(array()), new SimpleByValue("Default")); + } +} + +class TestOfCallSchedule extends UnitTestCase { + function testCanBeSetToAlwaysReturnTheSameReference() { + $a = 5; + $schedule = new SimpleCallSchedule(); + $schedule->register('aMethod', false, new SimpleByReference($a)); + $this->assertReference($schedule->respond(0, 'aMethod', array()), $a); + $this->assertReference($schedule->respond(1, 'aMethod', array()), $a); + } + + function testSpecificSignaturesOverrideTheAlwaysCase() { + $any = 'any'; + $one = 'two'; + $schedule = new SimpleCallSchedule(); + $schedule->register('aMethod', array(1), new SimpleByReference($one)); + $schedule->register('aMethod', false, new SimpleByReference($any)); + $this->assertReference($schedule->respond(0, 'aMethod', array(2)), $any); + $this->assertReference($schedule->respond(0, 'aMethod', array(1)), $one); + } + + function testReturnsCanBeSetOverTime() { + $one = 'one'; + $two = 'two'; + $schedule = new SimpleCallSchedule(); + $schedule->registerAt(0, 'aMethod', false, new SimpleByReference($one)); + $schedule->registerAt(1, 'aMethod', false, new SimpleByReference($two)); + $this->assertReference($schedule->respond(0, 'aMethod', array()), $one); + $this->assertReference($schedule->respond(1, 'aMethod', array()), $two); + } + + function testReturnsOverTimecanBeAlteredByTheArguments() { + $one = '1'; + $two = '2'; + $two_a = '2a'; + $schedule = new SimpleCallSchedule(); + $schedule->registerAt(0, 'aMethod', false, new SimpleByReference($one)); + $schedule->registerAt(1, 'aMethod', array('a'), new SimpleByReference($two_a)); + $schedule->registerAt(1, 'aMethod', false, new SimpleByReference($two)); + $this->assertReference($schedule->respond(0, 'aMethod', array()), $one); + $this->assertReference($schedule->respond(1, 'aMethod', array()), $two); + $this->assertReference($schedule->respond(1, 'aMethod', array('a')), $two_a); + } + + function testCanReturnByValue() { + $a = 5; + $schedule = new SimpleCallSchedule(); + $schedule->register('aMethod', false, new SimpleByValue($a)); + $this->assertCopy($schedule->respond(0, 'aMethod', array()), $a); + } + + function testCanThrowException() { + if (version_compare(phpversion(), '5', '>=')) { + $schedule = new SimpleCallSchedule(); + $schedule->register('aMethod', false, new SimpleThrower(new Exception('Ouch'))); + $this->expectException(new Exception('Ouch')); + $schedule->respond(0, 'aMethod', array()); + } + } + + function testCanEmitError() { + $schedule = new SimpleCallSchedule(); + $schedule->register('aMethod', false, new SimpleErrorThrower('Ouch', E_USER_WARNING)); + $this->expectError('Ouch'); + $schedule->respond(0, 'aMethod', array()); + } +} + +class Dummy { + function Dummy() { + } + + function aMethod() { + return true; + } + + function &aReferenceMethod() { + return true; + } + + function anotherMethod() { + return true; + } +} +Mock::generate('Dummy'); +Mock::generate('Dummy', 'AnotherMockDummy'); +Mock::generate('Dummy', 'MockDummyWithExtraMethods', array('extraMethod')); + +class TestOfMockGeneration extends UnitTestCase { + + function testCloning() { + $mock = new MockDummy(); + $this->assertTrue(method_exists($mock, "aMethod")); + $this->assertNull($mock->aMethod()); + } + + function testCloningWithExtraMethod() { + $mock = new MockDummyWithExtraMethods(); + $this->assertTrue(method_exists($mock, "extraMethod")); + } + + function testCloningWithChosenClassName() { + $mock = new AnotherMockDummy(); + $this->assertTrue(method_exists($mock, "aMethod")); + } +} + +class TestOfMockReturns extends UnitTestCase { + + function testDefaultReturn() { + $mock = new MockDummy(); + $mock->setReturnValue("aMethod", "aaa"); + $this->assertIdentical($mock->aMethod(), "aaa"); + $this->assertIdentical($mock->aMethod(), "aaa"); + } + + function testParameteredReturn() { + $mock = new MockDummy(); + $mock->setReturnValue('aMethod', 'aaa', array(1, 2, 3)); + $this->assertNull($mock->aMethod()); + $this->assertIdentical($mock->aMethod(1, 2, 3), 'aaa'); + } + + function testSetReturnGivesObjectReference() { + $mock = new MockDummy(); + $object = new Dummy(); + $mock->returns('aMethod', $object, array(1, 2, 3)); + $this->assertSame($mock->aMethod(1, 2, 3), $object); + } + + function testSetReturnReferenceGivesOriginalReference() { + $mock = new MockDummy(); + $object = 1; + $mock->setReturnReference('aReferenceMethod', $object, array(1, 2, 3)); + $this->assertReference($mock->aReferenceMethod(1, 2, 3), $object); + } + + function testPatternMatchReturn() { + $mock = new MockDummy(); + $mock->setReturnValue( + "aMethod", + "aaa", + array(new PatternExpectation('/hello/i'))); + $this->assertIdentical($mock->aMethod('Hello'), "aaa"); + $this->assertNull($mock->aMethod('Goodbye')); + } + + function testMultipleMethods() { + $mock = new MockDummy(); + $mock->setReturnValue("aMethod", 100, array(1)); + $mock->setReturnValue("aMethod", 200, array(2)); + $mock->setReturnValue("anotherMethod", 10, array(1)); + $mock->setReturnValue("anotherMethod", 20, array(2)); + $this->assertIdentical($mock->aMethod(1), 100); + $this->assertIdentical($mock->anotherMethod(1), 10); + $this->assertIdentical($mock->aMethod(2), 200); + $this->assertIdentical($mock->anotherMethod(2), 20); + } + + function testReturnSequence() { + $mock = new MockDummy(); + $mock->setReturnValueAt(0, "aMethod", "aaa"); + $mock->setReturnValueAt(1, "aMethod", "bbb"); + $mock->setReturnValueAt(3, "aMethod", "ddd"); + $this->assertIdentical($mock->aMethod(), "aaa"); + $this->assertIdentical($mock->aMethod(), "bbb"); + $this->assertNull($mock->aMethod()); + $this->assertIdentical($mock->aMethod(), "ddd"); + } + + function testSetReturnReferenceAtGivesOriginal() { + $mock = new MockDummy(); + $object = 100; + $mock->setReturnReferenceAt(1, "aReferenceMethod", $object); + $this->assertNull($mock->aReferenceMethod()); + $this->assertReference($mock->aReferenceMethod(), $object); + $this->assertNull($mock->aReferenceMethod()); + } + + function testReturnsAtGivesOriginalObjectHandle() { + $mock = new MockDummy(); + $object = new Dummy(); + $mock->returnsAt(1, "aMethod", $object); + $this->assertNull($mock->aMethod()); + $this->assertSame($mock->aMethod(), $object); + $this->assertNull($mock->aMethod()); + } + + function testComplicatedReturnSequence() { + $mock = new MockDummy(); + $object = new Dummy(); + $mock->returnsAt(1, "aMethod", "aaa", array("a")); + $mock->returnsAt(1, "aMethod", "bbb"); + $mock->returnsAt(2, "aMethod", $object, array('*', 2)); + $mock->returnsAt(2, "aMethod", "value", array('*', 3)); + $mock->returns("aMethod", 3, array(3)); + $this->assertNull($mock->aMethod()); + $this->assertEqual($mock->aMethod("a"), "aaa"); + $this->assertSame($mock->aMethod(1, 2), $object); + $this->assertEqual($mock->aMethod(3), 3); + $this->assertNull($mock->aMethod()); + } + + function testMultipleMethodSequences() { + $mock = new MockDummy(); + $mock->setReturnValueAt(0, "aMethod", "aaa"); + $mock->setReturnValueAt(1, "aMethod", "bbb"); + $mock->setReturnValueAt(0, "anotherMethod", "ccc"); + $mock->setReturnValueAt(1, "anotherMethod", "ddd"); + $this->assertIdentical($mock->aMethod(), "aaa"); + $this->assertIdentical($mock->anotherMethod(), "ccc"); + $this->assertIdentical($mock->aMethod(), "bbb"); + $this->assertIdentical($mock->anotherMethod(), "ddd"); + } + + function testSequenceFallback() { + $mock = new MockDummy(); + $mock->setReturnValueAt(0, "aMethod", "aaa", array('a')); + $mock->setReturnValueAt(1, "aMethod", "bbb", array('a')); + $mock->setReturnValue("aMethod", "AAA"); + $this->assertIdentical($mock->aMethod('a'), "aaa"); + $this->assertIdentical($mock->aMethod('b'), "AAA"); + } + + function testMethodInterference() { + $mock = new MockDummy(); + $mock->setReturnValueAt(0, "anotherMethod", "aaa"); + $mock->setReturnValue("aMethod", "AAA"); + $this->assertIdentical($mock->aMethod(), "AAA"); + $this->assertIdentical($mock->anotherMethod(), "aaa"); + } +} + +class TestOfMockExpectationsThatPass extends UnitTestCase { + + function testAnyArgument() { + $mock = new MockDummy(); + $mock->expect('aMethod', array('*')); + $mock->aMethod(1); + $mock->aMethod('hello'); + } + + function testAnyTwoArguments() { + $mock = new MockDummy(); + $mock->expect('aMethod', array('*', '*')); + $mock->aMethod(1, 2); + } + + function testSpecificArgument() { + $mock = new MockDummy(); + $mock->expect('aMethod', array(1)); + $mock->aMethod(1); + } + + function testExpectation() { + $mock = new MockDummy(); + $mock->expect('aMethod', array(new IsAExpectation('Dummy'))); + $mock->aMethod(new Dummy()); + } + + function testArgumentsInSequence() { + $mock = new MockDummy(); + $mock->expectAt(0, 'aMethod', array(1, 2)); + $mock->expectAt(1, 'aMethod', array(3, 4)); + $mock->aMethod(1, 2); + $mock->aMethod(3, 4); + } + + function testAtLeastOnceSatisfiedByOneCall() { + $mock = new MockDummy(); + $mock->expectAtLeastOnce('aMethod'); + $mock->aMethod(); + } + + function testAtLeastOnceSatisfiedByTwoCalls() { + $mock = new MockDummy(); + $mock->expectAtLeastOnce('aMethod'); + $mock->aMethod(); + $mock->aMethod(); + } + + function testOnceSatisfiedByOneCall() { + $mock = new MockDummy(); + $mock->expectOnce('aMethod'); + $mock->aMethod(); + } + + function testMinimumCallsSatisfiedByEnoughCalls() { + $mock = new MockDummy(); + $mock->expectMinimumCallCount('aMethod', 1); + $mock->aMethod(); + } + + function testMinimumCallsSatisfiedByTooManyCalls() { + $mock = new MockDummy(); + $mock->expectMinimumCallCount('aMethod', 3); + $mock->aMethod(); + $mock->aMethod(); + $mock->aMethod(); + $mock->aMethod(); + } + + function testMaximumCallsSatisfiedByEnoughCalls() { + $mock = new MockDummy(); + $mock->expectMaximumCallCount('aMethod', 1); + $mock->aMethod(); + } + + function testMaximumCallsSatisfiedByNoCalls() { + $mock = new MockDummy(); + $mock->expectMaximumCallCount('aMethod', 1); + } +} + +class MockWithInjectedTestCase extends SimpleMock { + protected function getCurrentTestCase() { + return SimpleTest::getContext()->getTest()->getMockedTest(); + } +} +SimpleTest::setMockBaseClass('MockWithInjectedTestCase'); +Mock::generate('Dummy', 'MockDummyWithInjectedTestCase'); +SimpleTest::setMockBaseClass('SimpleMock'); +Mock::generate('SimpleTestCase'); + +class LikeExpectation extends IdenticalExpectation { + function __construct($expectation) { + $expectation->message = ''; + parent::__construct($expectation); + } + + function test($compare) { + $compare->message = ''; + return parent::test($compare); + } + + function testMessage($compare) { + $compare->message = ''; + return parent::testMessage($compare); + } +} + +class TestOfMockExpectations extends UnitTestCase { + private $test; + + function setUp() { + $this->test = new MockSimpleTestCase(); + } + + function getMockedTest() { + return $this->test; + } + + function testSettingExpectationOnNonMethodThrowsError() { + $mock = new MockDummyWithInjectedTestCase(); + $this->expectError(); + $mock->expectMaximumCallCount('aMissingMethod', 2); + } + + function testMaxCallsDetectsOverrun() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new MaximumCallCountExpectation('aMethod', 2)), + 3)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectMaximumCallCount('aMethod', 2); + $mock->aMethod(); + $mock->aMethod(); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testTallyOnMaxCallsSendsPassOnUnderrun() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new MaximumCallCountExpectation('aMethod', 2)), + 2)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectMaximumCallCount("aMethod", 2); + $mock->aMethod(); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testExpectNeverDetectsOverrun() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new MaximumCallCountExpectation('aMethod', 0)), + 1)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectNever('aMethod'); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testTallyOnExpectNeverStillSendsPassOnUnderrun() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new MaximumCallCountExpectation('aMethod', 0)), + 0)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectNever('aMethod'); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testMinCalls() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new MinimumCallCountExpectation('aMethod', 2)), + 2)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectMinimumCallCount('aMethod', 2); + $mock->aMethod(); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testFailedNever() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new MaximumCallCountExpectation('aMethod', 0)), + 1)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectNever('aMethod'); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testUnderOnce() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new CallCountExpectation('aMethod', 1)), + 0)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectOnce('aMethod'); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testOverOnce() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new CallCountExpectation('aMethod', 1)), + 2)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectOnce('aMethod'); + $mock->aMethod(); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testUnderAtLeastOnce() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new MinimumCallCountExpectation('aMethod', 1)), + 0)); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectAtLeastOnce("aMethod"); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testZeroArguments() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new ParametersExpectation(array())), + array(), + '*')); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expect("aMethod", array()); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testExpectedArguments() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new ParametersExpectation(array(1, 2, 3))), + array(1, 2, 3), + '*')); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expect('aMethod', array(1, 2, 3)); + $mock->aMethod(1, 2, 3); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testFailedArguments() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new ParametersExpectation(array('this'))), + array('that'), + '*')); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expect('aMethod', array('this')); + $mock->aMethod('that'); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testWildcardsAreTranslatedToAnythingExpectations() { + $this->test->expectOnce('assert', array( + new LikeExpectation(new ParametersExpectation(array( + new AnythingExpectation(), 123, new AnythingExpectation()))), + array(100, 123, 101), + '*')); + $mock = new MockDummyWithInjectedTestCase($this); + $mock->expect("aMethod", array('*', 123, '*')); + $mock->aMethod(100, 123, 101); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testSpecificPassingSequence() { + $this->test->expectAt(0, 'assert', array( + new LikeExpectation(new ParametersExpectation(array(1, 2, 3))), + array(1, 2, 3), + '*')); + $this->test->expectAt(1, 'assert', array( + new LikeExpectation(new ParametersExpectation(array('Hello'))), + array('Hello'), + '*')); + $mock = new MockDummyWithInjectedTestCase(); + $mock->expectAt(1, 'aMethod', array(1, 2, 3)); + $mock->expectAt(2, 'aMethod', array('Hello')); + $mock->aMethod(); + $mock->aMethod(1, 2, 3); + $mock->aMethod('Hello'); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } + + function testNonArrayForExpectedParametersGivesError() { + $mock = new MockDummyWithInjectedTestCase(); + $this->expectError(new PatternExpectation('/\$args.*not an array/i')); + $mock->expect("aMethod", "foo"); + $mock->aMethod(); + $mock->mock->atTestEnd('testSomething', $this->test); + } +} + +class TestOfMockComparisons extends UnitTestCase { + + function testEqualComparisonOfMocksDoesNotCrash() { + $expectation = new EqualExpectation(new MockDummy()); + $this->assertTrue($expectation->test(new MockDummy(), true)); + } + + function testIdenticalComparisonOfMocksDoesNotCrash() { + $expectation = new IdenticalExpectation(new MockDummy()); + $this->assertTrue($expectation->test(new MockDummy())); + } +} + +class ClassWithSpecialMethods { + function __get($name) { } + function __set($name, $value) { } + function __isset($name) { } + function __unset($name) { } + function __call($method, $arguments) { } + function __toString() { } +} +Mock::generate('ClassWithSpecialMethods'); + +class TestOfSpecialMethodsAfterPHP51 extends UnitTestCase { + + function skip() { + $this->skipIf(version_compare(phpversion(), '5.1', '<'), '__isset and __unset overloading not tested unless PHP 5.1+'); + } + + function testCanEmulateIsset() { + $mock = new MockClassWithSpecialMethods(); + $mock->setReturnValue('__isset', true); + $this->assertIdentical(isset($mock->a), true); + } + + function testCanExpectUnset() { + $mock = new MockClassWithSpecialMethods(); + $mock->expectOnce('__unset', array('a')); + unset($mock->a); + } + +} + +class TestOfSpecialMethods extends UnitTestCase { + function skip() { + $this->skipIf(version_compare(phpversion(), '5', '<'), 'Overloading not tested unless PHP 5+'); + } + + function testCanMockTheThingAtAll() { + $mock = new MockClassWithSpecialMethods(); + } + + function testReturnFromSpecialAccessor() { + $mock = new MockClassWithSpecialMethods(); + $mock->setReturnValue('__get', '1st Return', array('first')); + $mock->setReturnValue('__get', '2nd Return', array('second')); + $this->assertEqual($mock->first, '1st Return'); + $this->assertEqual($mock->second, '2nd Return'); + } + + function testcanExpectTheSettingOfValue() { + $mock = new MockClassWithSpecialMethods(); + $mock->expectOnce('__set', array('a', 'A')); + $mock->a = 'A'; + } + + function testCanSimulateAnOverloadmethod() { + $mock = new MockClassWithSpecialMethods(); + $mock->expectOnce('__call', array('amOverloaded', array('A'))); + $mock->setReturnValue('__call', 'aaa'); + $this->assertIdentical($mock->amOverloaded('A'), 'aaa'); + } + + function testToStringMagic() { + $mock = new MockClassWithSpecialMethods(); + $mock->expectOnce('__toString'); + $mock->setReturnValue('__toString', 'AAA'); + ob_start(); + print $mock; + $output = ob_get_contents(); + ob_end_clean(); + $this->assertEqual($output, 'AAA'); + } +} + +class WithStaticMethod { + static function aStaticMethod() { } +} +Mock::generate('WithStaticMethod'); + +class TestOfMockingClassesWithStaticMethods extends UnitTestCase { + + function testStaticMethodIsMockedAsStatic() { + $mock = new WithStaticMethod(); + $reflection = new ReflectionClass($mock); + $method = $reflection->getMethod('aStaticMethod'); + $this->assertTrue($method->isStatic()); + } +} + +class MockTestException extends Exception { } + +class TestOfThrowingExceptionsFromMocks extends UnitTestCase { + + function testCanThrowOnMethodCall() { + $mock = new MockDummy(); + $mock->throwOn('aMethod'); + $this->expectException(); + $mock->aMethod(); + } + + function testCanThrowSpecificExceptionOnMethodCall() { + $mock = new MockDummy(); + $mock->throwOn('aMethod', new MockTestException()); + $this->expectException(); + $mock->aMethod(); + } + + function testThrowsOnlyWhenCallSignatureMatches() { + $mock = new MockDummy(); + $mock->throwOn('aMethod', new MockTestException(), array(3)); + $mock->aMethod(1); + $mock->aMethod(2); + $this->expectException(); + $mock->aMethod(3); + } + + function testCanThrowOnParticularInvocation() { + $mock = new MockDummy(); + $mock->throwAt(2, 'aMethod', new MockTestException()); + $mock->aMethod(); + $mock->aMethod(); + $this->expectException(); + $mock->aMethod(); + } +} + +class TestOfThrowingErrorsFromMocks extends UnitTestCase { + + function testCanGenerateErrorFromMethodCall() { + $mock = new MockDummy(); + $mock->errorOn('aMethod', 'Ouch!'); + $this->expectError('Ouch!'); + $mock->aMethod(); + } + + function testGeneratesErrorOnlyWhenCallSignatureMatches() { + $mock = new MockDummy(); + $mock->errorOn('aMethod', 'Ouch!', array(3)); + $mock->aMethod(1); + $mock->aMethod(2); + $this->expectError(); + $mock->aMethod(3); + } + + function testCanGenerateErrorOnParticularInvocation() { + $mock = new MockDummy(); + $mock->errorAt(2, 'aMethod', 'Ouch!'); + $mock->aMethod(); + $mock->aMethod(); + $this->expectError(); + $mock->aMethod(); + } +} + +Mock::generatePartial('Dummy', 'TestDummy', array('anotherMethod', 'aReferenceMethod')); + +class TestOfPartialMocks extends UnitTestCase { + + function testMethodReplacementWithNoBehaviourReturnsNull() { + $mock = new TestDummy(); + $this->assertEqual($mock->aMethod(99), 99); + $this->assertNull($mock->anotherMethod()); + } + + function testSettingReturns() { + $mock = new TestDummy(); + $mock->setReturnValue('anotherMethod', 33, array(3)); + $mock->setReturnValue('anotherMethod', 22); + $mock->setReturnValueAt(2, 'anotherMethod', 44, array(3)); + $this->assertEqual($mock->anotherMethod(), 22); + $this->assertEqual($mock->anotherMethod(3), 33); + $this->assertEqual($mock->anotherMethod(3), 44); + } + + function testSetReturnReferenceGivesOriginal() { + $mock = new TestDummy(); + $object = 99; + $mock->setReturnReferenceAt(0, 'aReferenceMethod', $object, array(3)); + $this->assertReference($mock->aReferenceMethod(3), $object); + } + + function testReturnsAtGivesOriginalObjectHandle() { + $mock = new TestDummy(); + $object = new Dummy(); + $mock->returnsAt(0, 'anotherMethod', $object, array(3)); + $this->assertSame($mock->anotherMethod(3), $object); + } + + function testExpectations() { + $mock = new TestDummy(); + $mock->expectCallCount('anotherMethod', 2); + $mock->expect('anotherMethod', array(77)); + $mock->expectAt(1, 'anotherMethod', array(66)); + $mock->anotherMethod(77); + $mock->anotherMethod(66); + } + + function testSettingExpectationOnMissingMethodThrowsError() { + $mock = new TestDummy(); + $this->expectError(); + $mock->expectCallCount('aMissingMethod', 2); + } +} + +class ConstructorSuperClass { + function ConstructorSuperClass() { } +} + +class ConstructorSubClass extends ConstructorSuperClass { } + +class TestOfPHP4StyleSuperClassConstruct extends UnitTestCase { + function testBasicConstruct() { + Mock::generate('ConstructorSubClass'); + $mock = new MockConstructorSubClass(); + $this->assertIsA($mock, 'ConstructorSubClass'); + $this->assertTrue(method_exists($mock, 'ConstructorSuperClass')); + } +} + +class TestOfPHP5StaticMethodMocking extends UnitTestCase { + function testCanCreateAMockObjectWithStaticMethodsWithoutError() { + eval(' + class SimpleObjectContainingStaticMethod { + static function someStatic() { } + } + '); + Mock::generate('SimpleObjectContainingStaticMethod'); + } +} + +class TestOfPHP5AbstractMethodMocking extends UnitTestCase { + function testCanCreateAMockObjectFromAnAbstractWithProperFunctionDeclarations() { + eval(' + abstract class SimpleAbstractClassContainingAbstractMethods { + abstract function anAbstract(); + abstract function anAbstractWithParameter($foo); + abstract function anAbstractWithMultipleParameters($foo, $bar); + } + '); + Mock::generate('SimpleAbstractClassContainingAbstractMethods'); + $this->assertTrue( + method_exists( + // Testing with class name alone does not work in PHP 5.0 + new MockSimpleAbstractClassContainingAbstractMethods, + 'anAbstract' + ) + ); + $this->assertTrue( + method_exists( + new MockSimpleAbstractClassContainingAbstractMethods, + 'anAbstractWithParameter' + ) + ); + $this->assertTrue( + method_exists( + new MockSimpleAbstractClassContainingAbstractMethods, + 'anAbstractWithMultipleParameters' + ) + ); + } + + function testMethodsDefinedAsAbstractInParentShouldHaveFullSignature() { + eval(' + abstract class SimpleParentAbstractClassContainingAbstractMethods { + abstract function anAbstract(); + abstract function anAbstractWithParameter($foo); + abstract function anAbstractWithMultipleParameters($foo, $bar); + } + + class SimpleChildAbstractClassContainingAbstractMethods extends SimpleParentAbstractClassContainingAbstractMethods { + function anAbstract(){} + function anAbstractWithParameter($foo){} + function anAbstractWithMultipleParameters($foo, $bar){} + } + + class EvenDeeperEmptyChildClass extends SimpleChildAbstractClassContainingAbstractMethods {} + '); + Mock::generate('SimpleChildAbstractClassContainingAbstractMethods'); + $this->assertTrue( + method_exists( + new MockSimpleChildAbstractClassContainingAbstractMethods, + 'anAbstract' + ) + ); + $this->assertTrue( + method_exists( + new MockSimpleChildAbstractClassContainingAbstractMethods, + 'anAbstractWithParameter' + ) + ); + $this->assertTrue( + method_exists( + new MockSimpleChildAbstractClassContainingAbstractMethods, + 'anAbstractWithMultipleParameters' + ) + ); + Mock::generate('EvenDeeperEmptyChildClass'); + $this->assertTrue( + method_exists( + new MockEvenDeeperEmptyChildClass, + 'anAbstract' + ) + ); + $this->assertTrue( + method_exists( + new MockEvenDeeperEmptyChildClass, + 'anAbstractWithParameter' + ) + ); + $this->assertTrue( + method_exists( + new MockEvenDeeperEmptyChildClass, + 'anAbstractWithMultipleParameters' + ) + ); + } +} + +class DummyWithProtected +{ + public function aMethodCallsProtected() { return $this->aProtectedMethod(); } + protected function aProtectedMethod() { return true; } +} + +Mock::generatePartial('DummyWithProtected', 'TestDummyWithProtected', array('aProtectedMethod')); +class TestOfProtectedMethodPartialMocks extends UnitTestCase +{ + function testProtectedMethodExists() { + $this->assertTrue( + method_exists( + new TestDummyWithProtected, + 'aProtectedMethod' + ) + ); + } + + function testProtectedMethodIsCalled() { + $object = new DummyWithProtected(); + $this->assertTrue($object->aMethodCallsProtected(), 'ensure original was called'); + } + + function testMockedMethodIsCalled() { + $object = new TestDummyWithProtected(); + $object->setReturnValue('aProtectedMethod', false); + $this->assertFalse($object->aMethodCallsProtected()); + } +} + +?> diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/page_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/page_test.php new file mode 100644 index 0000000..eb61c4f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/page_test.php @@ -0,0 +1,898 @@ + 'http://somewhere')); + $tag->addContent('Label'); + + $page = new MockSimplePage(); + $page->expect('acceptTag', array($tag)); + $page->expectCallCount('acceptTag', 1); + + $builder = new PartialSimplePageBuilder(); + $builder->returns('createPage', $page); + $builder->returns('createParser', new MockSimpleHtmlSaxParser()); + $builder->__construct(); + + $builder->parse(new MockSimpleHttpResponse()); + $this->assertTrue($builder->startElement( + 'a', + array('href' => 'http://somewhere'))); + $this->assertTrue($builder->addContent('Label')); + $this->assertTrue($builder->endElement('a')); + } + + function testLinkWithId() { + $tag = new SimpleAnchorTag(array("href" => "http://somewhere", "id" => "44")); + $tag->addContent("Label"); + + $page = new MockSimplePage(); + $page->expect("acceptTag", array($tag)); + $page->expectCallCount("acceptTag", 1); + + $builder = new PartialSimplePageBuilder(); + $builder->returns('createPage', $page); + $builder->returns('createParser', new MockSimpleHtmlSaxParser()); + $builder->__construct(); + + $builder->parse(new MockSimpleHttpResponse()); + $this->assertTrue($builder->startElement( + "a", + array("href" => "http://somewhere", "id" => "44"))); + $this->assertTrue($builder->addContent("Label")); + $this->assertTrue($builder->endElement("a")); + } + + function testLinkExtraction() { + $tag = new SimpleAnchorTag(array("href" => "http://somewhere")); + $tag->addContent("Label"); + + $page = new MockSimplePage(); + $page->expect("acceptTag", array($tag)); + $page->expectCallCount("acceptTag", 1); + + $builder = new PartialSimplePageBuilder(); + $builder->returns('createPage', $page); + $builder->returns('createParser', new MockSimpleHtmlSaxParser()); + $builder->__construct(); + + $builder->parse(new MockSimpleHttpResponse()); + $this->assertTrue($builder->addContent("Starting stuff")); + $this->assertTrue($builder->startElement( + "a", + array("href" => "http://somewhere"))); + $this->assertTrue($builder->addContent("Label")); + $this->assertTrue($builder->endElement("a")); + $this->assertTrue($builder->addContent("Trailing stuff")); + } + + function testMultipleLinks() { + $a1 = new SimpleAnchorTag(array("href" => "http://somewhere")); + $a1->addContent("1"); + + $a2 = new SimpleAnchorTag(array("href" => "http://elsewhere")); + $a2->addContent("2"); + + $page = new MockSimplePage(); + $page->expectAt(0, "acceptTag", array($a1)); + $page->expectAt(1, "acceptTag", array($a2)); + $page->expectCallCount("acceptTag", 2); + + $builder = new PartialSimplePageBuilder(); + $builder->returns('createPage', $page); + $builder->returns('createParser', new MockSimpleHtmlSaxParser()); + $builder->__construct(); + + $builder->parse(new MockSimpleHttpResponse()); + $builder->startElement("a", array("href" => "http://somewhere")); + $builder->addContent("1"); + $builder->endElement("a"); + $builder->addContent("Padding"); + $builder->startElement("a", array("href" => "http://elsewhere")); + $builder->addContent("2"); + $builder->endElement("a"); + } + + function testTitle() { + $tag = new SimpleTitleTag(array()); + $tag->addContent("HereThere"); + + $page = new MockSimplePage(); + $page->expect("acceptTag", array($tag)); + $page->expectCallCount("acceptTag", 1); + + $builder = new PartialSimplePageBuilder(); + $builder->returns('createPage', $page); + $builder->returns('createParser', new MockSimpleHtmlSaxParser()); + $builder->__construct(); + + $builder->parse(new MockSimpleHttpResponse()); + $builder->startElement("title", array()); + $builder->addContent("Here"); + $builder->addContent("There"); + $builder->endElement("title"); + } + + function testForm() { + $page = new MockSimplePage(); + $page->expectOnce("acceptFormStart", array(new SimpleFormTag(array()))); + $page->expectOnce("acceptFormEnd", array()); + + $builder = new PartialSimplePageBuilder(); + $builder->returns('createPage', $page); + $builder->returns('createParser', new MockSimpleHtmlSaxParser()); + $builder->__construct(); + + $builder->parse(new MockSimpleHttpResponse()); + $builder->startElement("form", array()); + $builder->addContent("Stuff"); + $builder->endElement("form"); + } +} + +class TestOfPageParsing extends UnitTestCase { + + function testParseMechanics() { + $parser = new MockSimpleHtmlSaxParser(); + $parser->expectOnce('parse', array('stuff')); + + $page = new MockSimplePage(); + $page->expectOnce('acceptPageEnd'); + + $builder = new PartialSimplePageBuilder(); + $builder->returns('createPage', $page); + $builder->returns('createParser', $parser); + $builder->__construct(); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', 'stuff'); + $builder->parse($response); + } +} + +class TestOfPageInterface extends UnitTestCase { + + function testInterfaceOnEmptyPage() { + $page = new SimplePage(); + $this->assertEqual($page->getTransportError(), 'No page fetched yet'); + $this->assertIdentical($page->getRaw(), false); + $this->assertIdentical($page->getHeaders(), false); + $this->assertIdentical($page->getMimeType(), false); + $this->assertIdentical($page->getResponseCode(), false); + $this->assertIdentical($page->getAuthentication(), false); + $this->assertIdentical($page->getRealm(), false); + $this->assertFalse($page->hasFrames()); + $this->assertIdentical($page->getUrls(), array()); + $this->assertIdentical($page->getTitle(), false); + } +} + +class TestOfPageHeaders extends UnitTestCase { + + function testUrlAccessor() { + $headers = new MockSimpleHttpHeaders(); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getHeaders', $headers); + $response->setReturnValue('getMethod', 'POST'); + $response->setReturnValue('getUrl', new SimpleUrl('here')); + $response->setReturnValue('getRequestData', array('a' => 'A')); + + $page = new SimplePage($response); + $this->assertEqual($page->getMethod(), 'POST'); + $this->assertEqual($page->getUrl(), new SimpleUrl('here')); + $this->assertEqual($page->getRequestData(), array('a' => 'A')); + } + + function testTransportError() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getError', 'Ouch'); + + $page = new SimplePage($response); + $this->assertEqual($page->getTransportError(), 'Ouch'); + } + + function testHeadersAccessor() { + $headers = new MockSimpleHttpHeaders(); + $headers->setReturnValue('getRaw', 'My: Headers'); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getHeaders', $headers); + + $page = new SimplePage($response); + $this->assertEqual($page->getHeaders(), 'My: Headers'); + } + + function testMimeAccessor() { + $headers = new MockSimpleHttpHeaders(); + $headers->setReturnValue('getMimeType', 'text/html'); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getHeaders', $headers); + + $page = new SimplePage($response); + $this->assertEqual($page->getMimeType(), 'text/html'); + } + + function testResponseAccessor() { + $headers = new MockSimpleHttpHeaders(); + $headers->setReturnValue('getResponseCode', 301); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getHeaders', $headers); + + $page = new SimplePage($response); + $this->assertIdentical($page->getResponseCode(), 301); + } + + function testAuthenticationAccessors() { + $headers = new MockSimpleHttpHeaders(); + $headers->setReturnValue('getAuthentication', 'Basic'); + $headers->setReturnValue('getRealm', 'Secret stuff'); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getHeaders', $headers); + + $page = new SimplePage($response); + $this->assertEqual($page->getAuthentication(), 'Basic'); + $this->assertEqual($page->getRealm(), 'Secret stuff'); + } +} + +class TestOfHtmlPage extends UnitTestCase { + + function testRawAccessor() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', 'Raw HTML'); + + $page = new SimplePage($response); + $this->assertEqual($page->getRaw(), 'Raw HTML'); + } + + function testTextAccessor() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', 'Some "messy" HTML'); + + $page = new SimplePage($response); + $this->assertEqual($page->getText(), 'Some "messy" HTML'); + } + + function testNoLinks() { + $page = new SimplePage(new MockSimpleHttpResponse()); + $this->assertIdentical($page->getUrls(), array()); + $this->assertIdentical($page->getUrlsByLabel('Label'), array()); + } + + function testAddAbsoluteLink() { + $link = new SimpleAnchorTag(array('href' => 'http://somewhere.com')); + $link->addContent('Label'); + $page = new SimplePage(new MockSimpleHttpResponse()); + $page->AcceptTag($link); + $this->assertEqual( + $page->getUrlsByLabel('Label'), + array(new SimpleUrl('http://somewhere.com'))); + } + + function testAddStrictRelativeLink() { + $link = new SimpleAnchorTag(array('href' => './somewhere.php')); + $link->addContent('Label'); + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + $page = new SimplePage($response); + $page->AcceptTag($link); + $this->assertEqual( + $page->getUrlsByLabel('Label'), + array(new SimpleUrl('http://host/somewhere.php'))); + } + + function testAddBareRelativeLink() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + $page = new SimplePage($response); + $page->AcceptTag(new SimpleAnchorTag(array('href' => 'somewhere.php'))); + $this->assertIdentical($page->getUrls(), array('http://host/somewhere.php')); + } + + function testAddRelativeLinkWithBaseTag() { + $link = new SimpleAnchorTag(array('href' => 'somewhere.php')); + $link->addContent('Label'); + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + $page = new SimplePage($response); + $page->AcceptTag($link); + $base = new SimpleBaseTag(array('href' => 'www.lastcraft.com/stuff/')); + $page->AcceptTag($base); + $this->assertEqual( + $page->getUrlsByLabel('Label'), + array(new SimpleUrl('www.lastcraft.com/stuff/somewhere.php'))); + } + + function testAddAbsoluteLinkWithBaseTag() { + $link = new SimpleAnchorTag(array('href' => 'http://here.com/somewhere.php')); + $link->addContent('Label'); + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + $page = new SimplePage($response); + $page->AcceptTag($link); + $base = new SimpleBaseTag(array('href' => 'www.lastcraft.com/stuff/')); + $page->AcceptTag($base); + $this->assertEqual( + $page->getUrlsByLabel('Label'), + array(new SimpleUrl('http://here.com/somewhere.php'))); + } + + function testLinkIds() { + $link = new SimpleAnchorTag(array('href' => './somewhere.php', 'id' => 33)); + $link->addContent('Label'); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + + $page = new SimplePage($response); + $page->AcceptTag($link); + + $this->assertEqual( + $page->getUrlsByLabel('Label'), + array(new SimpleUrl('http://host/somewhere.php'))); + $this->assertFalse($page->getUrlById(0)); + $this->assertEqual( + $page->getUrlById(33), + new SimpleUrl('http://host/somewhere.php')); + } + + function testFindLinkWithNormalisation() { + $link = new SimpleAnchorTag(array('href' => './somewhere.php', 'id' => 33)); + $link->addContent(' Long & thin '); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + + $page = new SimplePage($response); + $page->AcceptTag($link); + + $this->assertEqual( + $page->getUrlsByLabel('Long & thin'), + array(new SimpleUrl('http://host/somewhere.php'))); + } + + function testFindLinkWithImage() { + $link = new SimpleAnchorTag(array('href' => './somewhere.php', 'id' => 33)); + $link->addContent('<A picture>'); + + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + + $page = new SimplePage($response); + $page->AcceptTag($link); + + $this->assertEqual( + $page->getUrlsByLabel(''), + array(new SimpleUrl('http://host/somewhere.php'))); + } + + function testTitleSetting() { + $title = new SimpleTitleTag(array()); + $title->addContent('Title'); + $page = new SimplePage(new MockSimpleHttpResponse()); + $page->AcceptTag($title); + $this->assertEqual($page->getTitle(), 'Title'); + } + + function testFramesetAbsence() { + $url = new SimpleUrl('here'); + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', $url); + $page = new SimplePage($response); + $this->assertFalse($page->hasFrames()); + $this->assertIdentical($page->getFrameset(), false); + } + + function testHasEmptyFrameset() { + $page = new SimplePage(new MockSimpleHttpResponse()); + $page->acceptFramesetStart(new SimpleTag('frameset', array())); + $page->acceptFramesetEnd(); + $this->assertTrue($page->hasFrames()); + $this->assertIdentical($page->getFrameset(), array()); + } + + function testFramesInPage() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://here')); + + $page = new SimplePage($response); + $page->acceptFrame(new SimpleFrameTag(array('src' => '1.html'))); + $page->acceptFramesetStart(new SimpleTag('frameset', array())); + $page->acceptFrame(new SimpleFrameTag(array('src' => '2.html'))); + $page->acceptFrame(new SimpleFrameTag(array('src' => '3.html'))); + $page->acceptFramesetEnd(); + $page->acceptFrame(new SimpleFrameTag(array('src' => '4.html'))); + + $this->assertTrue($page->hasFrames()); + $this->assertIdentical($page->getFrameset(), array( + 1 => new SimpleUrl('http://here/2.html'), + 2 => new SimpleUrl('http://here/3.html'))); + } + + function testNamedFramesInPage() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://here')); + + $page = new SimplePage($response); + $page->acceptFramesetStart(new SimpleTag('frameset', array())); + $page->acceptFrame(new SimpleFrameTag(array('src' => '1.html'))); + $page->acceptFrame(new SimpleFrameTag(array('src' => '2.html', 'name' => 'A'))); + $page->acceptFrame(new SimpleFrameTag(array('src' => '3.html', 'name' => 'B'))); + $page->acceptFrame(new SimpleFrameTag(array('src' => '4.html'))); + $page->acceptFramesetEnd(); + + $this->assertTrue($page->hasFrames()); + $this->assertIdentical($page->getFrameset(), array( + 1 => new SimpleUrl('http://here/1.html'), + 'A' => new SimpleUrl('http://here/2.html'), + 'B' => new SimpleUrl('http://here/3.html'), + 4 => new SimpleUrl('http://here/4.html'))); + } + + function testRelativeFramesRespectBaseTag() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getUrl', new SimpleUrl('http://here.com/')); + $page = new SimplePage($response); + + $base = new SimpleBaseTag(array('href' => 'https://there.com/stuff/')); + $page->AcceptTag($base); + + $page->acceptFramesetStart(new SimpleTag('frameset', array())); + $page->acceptFrame(new SimpleFrameTag(array('src' => '1.html'))); + $page->acceptFramesetEnd(); + $this->assertIdentical( + $page->getFrameset(), + array(1 => new SimpleUrl('https://there.com/stuff/1.html'))); + } +} + +class TestOfFormsCreatedFromEventStream extends UnitTestCase { + + function testFormCanBeSubmitted() { + $page = new SimplePage(new MockSimpleHttpResponse()); + $page->acceptFormStart( + new SimpleFormTag(array('method' => 'GET', 'action' => 'here.php'))); + $page->AcceptTag( + new SimpleSubmitTag(array('type' => 'submit', 'name' => 's'))); + $page->acceptFormEnd(); + $form = &$page->getFormBySubmit(new SimpleByLabel('Submit')); + $this->assertEqual( + $form->submitButton(new SimpleByLabel('Submit')), + new SimpleGetEncoding(array('s' => 'Submit'))); + } + + function testInputFieldCanBeReadBack() { + $page = new SimplePage(new MockSimpleHttpResponse()); + $page->acceptFormStart( + new SimpleFormTag(array("method" => "GET", "action" => "here.php"))); + $page->AcceptTag( + new SimpleTextTag(array("type" => "text", "name" => "a", "value" => "A"))); + $page->AcceptTag( + new SimpleSubmitTag(array("type" => "submit", "name" => "s"))); + $page->acceptFormEnd(); + $this->assertEqual($page->getField(new SimpleByName('a')), 'A'); + } + + function testInputFieldCanBeReadBackByLabel() { + $label = new SimpleLabelTag(array()); + $page = new SimplePage(new MockSimpleHttpResponse()); + $page->acceptFormStart( + new SimpleFormTag(array("method" => "GET", "action" => "here.php"))); + $page->acceptLabelStart($label); + $label->addContent('l'); + $page->AcceptTag( + new SimpleTextTag(array("type" => "text", "name" => "a", "value" => "A"))); + $page->acceptLabelEnd(); + $page->AcceptTag( + new SimpleSubmitTag(array("type" => "submit", "name" => "s"))); + $page->acceptFormEnd(); + $this->assertEqual($page->getField(new SimpleByLabel('l')), 'A'); + } +} + +class TestOfPageScraping extends UnitTestCase { + + function parse($response) { + $builder = new SimplePageBuilder(); + $page = $builder->parse($response); + return $page; + } + + function testEmptyPage() { + $page = new SimplePage(new MockSimpleHttpResponse()); + $this->assertIdentical($page->getUrls(), array()); + $this->assertIdentical($page->getTitle(), false); + } + + function testUninterestingPage() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', '

    Stuff

    '); + $page = $this->parse($response); + $this->assertIdentical($page->getUrls(), array()); + } + + function testLinksPage() { + $raw = ''; + $raw .= '
    There'; + $raw .= 'That page'; + $raw .= ''; + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', $raw); + $response->setReturnValue('getUrl', new SimpleUrl('http://www.here.com/a/index.html')); + $page = $this->parse($response); + $this->assertIdentical( + $page->getUrls(), + array('http://www.here.com/a/there.html', 'http://there.com/that.html')); + $this->assertIdentical( + $page->getUrlsByLabel('There'), + array(new SimpleUrl('http://www.here.com/a/there.html'))); + $this->assertEqual( + $page->getUrlById('0'), + new SimpleUrl('http://there.com/that.html')); + } + + function testTitle() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', 'Me'); + $page = $this->parse($response); + $this->assertEqual($page->getTitle(), 'Me'); + } + + function testNastyTitle() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue( + 'getContent', + ' <b>Me&Me '); + $page = $this->parse($response); + $this->assertEqual($page->getTitle(), "Me&Me"); + } + + function testCompleteForm() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByName('here')), "Hello"); + } + + function testUnclosedForm() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + ''); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByName('here')), "Hello"); + } + + function testEmptyFrameset() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue( + 'getContent', + ''); + $page = $this->parse($response); + $this->assertTrue($page->hasFrames()); + $this->assertIdentical($page->getFrameset(), array()); + } + + function testSingleFrame() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue( + 'getContent', + ''); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + $page = $this->parse($response); + $this->assertTrue($page->hasFrames()); + $this->assertIdentical( + $page->getFrameset(), + array(1 => new SimpleUrl('http://host/a.html'))); + } + + function testSingleFrameInNestedFrameset() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '' . + '' . + ''); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + $page = $this->parse($response); + $this->assertTrue($page->hasFrames()); + $this->assertIdentical( + $page->getFrameset(), + array(1 => new SimpleUrl('http://host/a.html'))); + } + + function testFrameWithNoSource() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue( + 'getContent', + ''); + $page = $this->parse($response); + $this->assertTrue($page->hasFrames()); + $this->assertIdentical($page->getFrameset(), array()); + } + + function testFramesCollectedWithNestedFramesetTags() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '' . + '' . + '' . + '' . + ''); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + $page = $this->parse($response); + $this->assertTrue($page->hasFrames()); + $this->assertIdentical($page->getFrameset(), array( + 1 => new SimpleUrl('http://host/a.html'), + 2 => new SimpleUrl('http://host/b.html'), + 3 => new SimpleUrl('http://host/c.html'))); + } + + function testNamedFrames() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '' . + '' . + '' . + '' . + '' . + ''); + $response->setReturnValue('getUrl', new SimpleUrl('http://host/')); + $page = $this->parse($response); + $this->assertTrue($page->hasFrames()); + $this->assertIdentical($page->getFrameset(), array( + 1 => new SimpleUrl('http://host/a.html'), + '_one' => new SimpleUrl('http://host/b.html'), + 3 => new SimpleUrl('http://host/c.html'), + '_two' => new SimpleUrl('http://host/d.html'))); + } + + function testFindFormByLabel() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue( + 'getContent', + '
    '); + $page = $this->parse($response); + $this->assertNull($page->getFormBySubmit(new SimpleByLabel('submit'))); + $this->assertNull($page->getFormBySubmit(new SimpleByName('submit'))); + $this->assertIsA( + $page->getFormBySubmit(new SimpleByLabel('Submit')), + 'SimpleForm'); + } + + function testConfirmSubmitAttributesAreCaseSensitive() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue( + 'getContent', + '
    '); + $page = $this->parse($response); + $this->assertIsA( + $page->getFormBySubmit(new SimpleByName('S')), + 'SimpleForm'); + $this->assertIsA( + $page->getFormBySubmit(new SimpleByLabel('S')), + 'SimpleForm'); + } + + function testFindFormByImage() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertIsA( + $page->getFormByImage(new SimpleByLabel('Label')), + 'SimpleForm'); + $this->assertIsA( + $page->getFormByImage(new SimpleByName('me')), + 'SimpleForm'); + $this->assertIsA( + $page->getFormByImage(new SimpleById(100)), + 'SimpleForm'); + } + + function testFindFormByButtonTag() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertNull($page->getFormBySubmit(new SimpleByLabel('b'))); + $this->assertNull($page->getFormBySubmit(new SimpleByLabel('B'))); + $this->assertIsA( + $page->getFormBySubmit(new SimpleByName('b')), + 'SimpleForm'); + $this->assertIsA( + $page->getFormBySubmit(new SimpleByLabel('BBB')), + 'SimpleForm'); + } + + function testFindFormById() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue( + 'getContent', + '
    '); + $page = $this->parse($response); + $this->assertNull($page->getFormById(54)); + $this->assertIsA($page->getFormById(55), 'SimpleForm'); + } + + function testReadingTextField() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertNull($page->getField(new SimpleByName('missing'))); + $this->assertIdentical($page->getField(new SimpleByName('a')), ''); + $this->assertIdentical($page->getField(new SimpleByName('b')), 'bbb'); + } + + function testReadingTextFieldIsCaseInsensitive() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertNull($page->getField(new SimpleByName('missing'))); + $this->assertIdentical($page->getField(new SimpleByName('a')), ''); + $this->assertIdentical($page->getField(new SimpleByName('b')), 'bbb'); + } + + function testSettingTextField() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertTrue($page->setField(new SimpleByName('a'), 'aaa')); + $this->assertEqual($page->getField(new SimpleByName('a')), 'aaa'); + $this->assertTrue($page->setField(new SimpleById(3), 'bbb')); + $this->assertEqual($page->getField(new SimpleBYId(3)), 'bbb'); + $this->assertFalse($page->setField(new SimpleByName('z'), 'zzz')); + $this->assertNull($page->getField(new SimpleByName('z'))); + } + + function testSettingTextFieldByEnclosingLabel() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByName('a')), 'A'); + $this->assertEqual($page->getField(new SimpleByLabel('Stuff')), 'A'); + $this->assertTrue($page->setField(new SimpleByLabel('Stuff'), 'aaa')); + $this->assertEqual($page->getField(new SimpleByLabel('Stuff')), 'aaa'); + } + + function testGettingTextFieldByEnclosingLabelWithConflictingOtherFields() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByName('a')), 'A'); + $this->assertEqual($page->getField(new SimpleByName('b')), 'B'); + $this->assertEqual($page->getField(new SimpleByLabel('Stuff')), 'A'); + } + + function testSettingTextFieldByExternalLabel() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByLabel('Stuff')), 'A'); + $this->assertTrue($page->setField(new SimpleByLabel('Stuff'), 'aaa')); + $this->assertEqual($page->getField(new SimpleByLabel('Stuff')), 'aaa'); + } + + function testReadingTextArea() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByName('a')), 'aaa'); + } + + function testSettingTextArea() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertTrue($page->setField(new SimpleByName('a'), 'AAA')); + $this->assertEqual($page->getField(new SimpleByName('a')), 'AAA'); + } + + function testSettingSelectionField() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByName('a')), 'bbb'); + $this->assertFalse($page->setField(new SimpleByName('a'), 'ccc')); + $this->assertTrue($page->setField(new SimpleByName('a'), 'aaa')); + $this->assertEqual($page->getField(new SimpleByName('a')), 'aaa'); + } + + function testSettingSelectionFieldByEnclosingLabel() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByLabel('Stuff')), 'A'); + $this->assertTrue($page->setField(new SimpleByLabel('Stuff'), 'B')); + $this->assertEqual($page->getField(new SimpleByLabel('Stuff')), 'B'); + } + + function testSettingRadioButtonByEnclosingLabel() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', + '
    ' . + '' . + '' . + '
    '); + $page = $this->parse($response); + $this->assertEqual($page->getField(new SimpleByLabel('A')), 'a'); + $this->assertTrue($page->setField(new SimpleBylabel('B'), 'b')); + $this->assertEqual($page->getField(new SimpleByLabel('B')), 'b'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/parse_error_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/parse_error_test.php new file mode 100644 index 0000000..c3ffb3d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/parse_error_test.php @@ -0,0 +1,9 @@ +addFile('test_with_parse_error.php'); +$test->run(new HtmlReporter()); +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/parser_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/parser_test.php new file mode 100644 index 0000000..fd01d57 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/parser_test.php @@ -0,0 +1,551 @@ +assertFalse($regex->match("Hello", $match)); + $this->assertEqual($match, ""); + } + + function testNoSubject() { + $regex = new ParallelRegex(false); + $regex->addPattern(".*"); + $this->assertTrue($regex->match("", $match)); + $this->assertEqual($match, ""); + } + + function testMatchAll() { + $regex = new ParallelRegex(false); + $regex->addPattern(".*"); + $this->assertTrue($regex->match("Hello", $match)); + $this->assertEqual($match, "Hello"); + } + + function testCaseSensitive() { + $regex = new ParallelRegex(true); + $regex->addPattern("abc"); + $this->assertTrue($regex->match("abcdef", $match)); + $this->assertEqual($match, "abc"); + $this->assertTrue($regex->match("AAABCabcdef", $match)); + $this->assertEqual($match, "abc"); + } + + function testCaseInsensitive() { + $regex = new ParallelRegex(false); + $regex->addPattern("abc"); + $this->assertTrue($regex->match("abcdef", $match)); + $this->assertEqual($match, "abc"); + $this->assertTrue($regex->match("AAABCabcdef", $match)); + $this->assertEqual($match, "ABC"); + } + + function testMatchMultiple() { + $regex = new ParallelRegex(true); + $regex->addPattern("abc"); + $regex->addPattern("ABC"); + $this->assertTrue($regex->match("abcdef", $match)); + $this->assertEqual($match, "abc"); + $this->assertTrue($regex->match("AAABCabcdef", $match)); + $this->assertEqual($match, "ABC"); + $this->assertFalse($regex->match("Hello", $match)); + } + + function testPatternLabels() { + $regex = new ParallelRegex(false); + $regex->addPattern("abc", "letter"); + $regex->addPattern("123", "number"); + $this->assertIdentical($regex->match("abcdef", $match), "letter"); + $this->assertEqual($match, "abc"); + $this->assertIdentical($regex->match("0123456789", $match), "number"); + $this->assertEqual($match, "123"); + } +} + +class TestOfStateStack extends UnitTestCase { + + function testStartState() { + $stack = new SimpleStateStack("one"); + $this->assertEqual($stack->getCurrent(), "one"); + } + + function testExhaustion() { + $stack = new SimpleStateStack("one"); + $this->assertFalse($stack->leave()); + } + + function testStateMoves() { + $stack = new SimpleStateStack("one"); + $stack->enter("two"); + $this->assertEqual($stack->getCurrent(), "two"); + $stack->enter("three"); + $this->assertEqual($stack->getCurrent(), "three"); + $this->assertTrue($stack->leave()); + $this->assertEqual($stack->getCurrent(), "two"); + $stack->enter("third"); + $this->assertEqual($stack->getCurrent(), "third"); + $this->assertTrue($stack->leave()); + $this->assertTrue($stack->leave()); + $this->assertEqual($stack->getCurrent(), "one"); + } +} + +class TestParser { + + function accept() { + } + + function a() { + } + + function b() { + } +} +Mock::generate('TestParser'); + +class TestOfLexer extends UnitTestCase { + + function testEmptyPage() { + $handler = new MockTestParser(); + $handler->expectNever("accept"); + $handler->setReturnValue("accept", true); + $handler->expectNever("accept"); + $handler->setReturnValue("accept", true); + $lexer = new SimpleLexer($handler); + $lexer->addPattern("a+"); + $this->assertTrue($lexer->parse("")); + } + + function testSinglePattern() { + $handler = new MockTestParser(); + $handler->expectAt(0, "accept", array("aaa", LEXER_MATCHED)); + $handler->expectAt(1, "accept", array("x", LEXER_UNMATCHED)); + $handler->expectAt(2, "accept", array("a", LEXER_MATCHED)); + $handler->expectAt(3, "accept", array("yyy", LEXER_UNMATCHED)); + $handler->expectAt(4, "accept", array("a", LEXER_MATCHED)); + $handler->expectAt(5, "accept", array("x", LEXER_UNMATCHED)); + $handler->expectAt(6, "accept", array("aaa", LEXER_MATCHED)); + $handler->expectAt(7, "accept", array("z", LEXER_UNMATCHED)); + $handler->expectCallCount("accept", 8); + $handler->setReturnValue("accept", true); + $lexer = new SimpleLexer($handler); + $lexer->addPattern("a+"); + $this->assertTrue($lexer->parse("aaaxayyyaxaaaz")); + } + + function testMultiplePattern() { + $handler = new MockTestParser(); + $target = array("a", "b", "a", "bb", "x", "b", "a", "xxxxxx", "a", "x"); + for ($i = 0; $i < count($target); $i++) { + $handler->expectAt($i, "accept", array($target[$i], '*')); + } + $handler->expectCallCount("accept", count($target)); + $handler->setReturnValue("accept", true); + $lexer = new SimpleLexer($handler); + $lexer->addPattern("a+"); + $lexer->addPattern("b+"); + $this->assertTrue($lexer->parse("ababbxbaxxxxxxax")); + } +} + +class TestOfLexerModes extends UnitTestCase { + + function testIsolatedPattern() { + $handler = new MockTestParser(); + $handler->expectAt(0, "a", array("a", LEXER_MATCHED)); + $handler->expectAt(1, "a", array("b", LEXER_UNMATCHED)); + $handler->expectAt(2, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(3, "a", array("bxb", LEXER_UNMATCHED)); + $handler->expectAt(4, "a", array("aaa", LEXER_MATCHED)); + $handler->expectAt(5, "a", array("x", LEXER_UNMATCHED)); + $handler->expectAt(6, "a", array("aaaa", LEXER_MATCHED)); + $handler->expectAt(7, "a", array("x", LEXER_UNMATCHED)); + $handler->expectCallCount("a", 8); + $handler->setReturnValue("a", true); + $lexer = new SimpleLexer($handler, "a"); + $lexer->addPattern("a+", "a"); + $lexer->addPattern("b+", "b"); + $this->assertTrue($lexer->parse("abaabxbaaaxaaaax")); + } + + function testModeChange() { + $handler = new MockTestParser(); + $handler->expectAt(0, "a", array("a", LEXER_MATCHED)); + $handler->expectAt(1, "a", array("b", LEXER_UNMATCHED)); + $handler->expectAt(2, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(3, "a", array("b", LEXER_UNMATCHED)); + $handler->expectAt(4, "a", array("aaa", LEXER_MATCHED)); + $handler->expectAt(0, "b", array(":", LEXER_ENTER)); + $handler->expectAt(1, "b", array("a", LEXER_UNMATCHED)); + $handler->expectAt(2, "b", array("b", LEXER_MATCHED)); + $handler->expectAt(3, "b", array("a", LEXER_UNMATCHED)); + $handler->expectAt(4, "b", array("bb", LEXER_MATCHED)); + $handler->expectAt(5, "b", array("a", LEXER_UNMATCHED)); + $handler->expectAt(6, "b", array("bbb", LEXER_MATCHED)); + $handler->expectAt(7, "b", array("a", LEXER_UNMATCHED)); + $handler->expectCallCount("a", 5); + $handler->expectCallCount("b", 8); + $handler->setReturnValue("a", true); + $handler->setReturnValue("b", true); + $lexer = new SimpleLexer($handler, "a"); + $lexer->addPattern("a+", "a"); + $lexer->addEntryPattern(":", "a", "b"); + $lexer->addPattern("b+", "b"); + $this->assertTrue($lexer->parse("abaabaaa:ababbabbba")); + } + + function testNesting() { + $handler = new MockTestParser(); + $handler->setReturnValue("a", true); + $handler->setReturnValue("b", true); + $handler->expectAt(0, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(1, "a", array("b", LEXER_UNMATCHED)); + $handler->expectAt(2, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(3, "a", array("b", LEXER_UNMATCHED)); + $handler->expectAt(0, "b", array("(", LEXER_ENTER)); + $handler->expectAt(1, "b", array("bb", LEXER_MATCHED)); + $handler->expectAt(2, "b", array("a", LEXER_UNMATCHED)); + $handler->expectAt(3, "b", array("bb", LEXER_MATCHED)); + $handler->expectAt(4, "b", array(")", LEXER_EXIT)); + $handler->expectAt(4, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(5, "a", array("b", LEXER_UNMATCHED)); + $handler->expectCallCount("a", 6); + $handler->expectCallCount("b", 5); + $lexer = new SimpleLexer($handler, "a"); + $lexer->addPattern("a+", "a"); + $lexer->addEntryPattern("(", "a", "b"); + $lexer->addPattern("b+", "b"); + $lexer->addExitPattern(")", "b"); + $this->assertTrue($lexer->parse("aabaab(bbabb)aab")); + } + + function testSingular() { + $handler = new MockTestParser(); + $handler->setReturnValue("a", true); + $handler->setReturnValue("b", true); + $handler->expectAt(0, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(1, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(2, "a", array("xx", LEXER_UNMATCHED)); + $handler->expectAt(3, "a", array("xx", LEXER_UNMATCHED)); + $handler->expectAt(0, "b", array("b", LEXER_SPECIAL)); + $handler->expectAt(1, "b", array("bbb", LEXER_SPECIAL)); + $handler->expectCallCount("a", 4); + $handler->expectCallCount("b", 2); + $lexer = new SimpleLexer($handler, "a"); + $lexer->addPattern("a+", "a"); + $lexer->addSpecialPattern("b+", "a", "b"); + $this->assertTrue($lexer->parse("aabaaxxbbbxx")); + } + + function testUnwindTooFar() { + $handler = new MockTestParser(); + $handler->setReturnValue("a", true); + $handler->expectAt(0, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(1, "a", array(")", LEXER_EXIT)); + $handler->expectCallCount("a", 2); + $lexer = new SimpleLexer($handler, "a"); + $lexer->addPattern("a+", "a"); + $lexer->addExitPattern(")", "a"); + $this->assertFalse($lexer->parse("aa)aa")); + } +} + +class TestOfLexerHandlers extends UnitTestCase { + + function testModeMapping() { + $handler = new MockTestParser(); + $handler->setReturnValue("a", true); + $handler->expectAt(0, "a", array("aa", LEXER_MATCHED)); + $handler->expectAt(1, "a", array("(", LEXER_ENTER)); + $handler->expectAt(2, "a", array("bb", LEXER_MATCHED)); + $handler->expectAt(3, "a", array("a", LEXER_UNMATCHED)); + $handler->expectAt(4, "a", array("bb", LEXER_MATCHED)); + $handler->expectAt(5, "a", array(")", LEXER_EXIT)); + $handler->expectAt(6, "a", array("b", LEXER_UNMATCHED)); + $handler->expectCallCount("a", 7); + $lexer = new SimpleLexer($handler, "mode_a"); + $lexer->addPattern("a+", "mode_a"); + $lexer->addEntryPattern("(", "mode_a", "mode_b"); + $lexer->addPattern("b+", "mode_b"); + $lexer->addExitPattern(")", "mode_b"); + $lexer->mapHandler("mode_a", "a"); + $lexer->mapHandler("mode_b", "a"); + $this->assertTrue($lexer->parse("aa(bbabb)b")); + } +} + +class TestOfSimpleHtmlLexer extends UnitTestCase { + + function &createParser() { + $parser = new MockSimpleHtmlSaxParser(); + $parser->setReturnValue('acceptStartToken', true); + $parser->setReturnValue('acceptEndToken', true); + $parser->setReturnValue('acceptAttributeToken', true); + $parser->setReturnValue('acceptEntityToken', true); + $parser->setReturnValue('acceptTextToken', true); + $parser->setReturnValue('ignore', true); + return $parser; + } + + function testNoContent() { + $parser = &$this->createParser(); + $parser->expectNever('acceptStartToken'); + $parser->expectNever('acceptEndToken'); + $parser->expectNever('acceptAttributeToken'); + $parser->expectNever('acceptEntityToken'); + $parser->expectNever('acceptTextToken'); + $lexer = new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse('')); + } + + function testUninteresting() { + $parser = &$this->createParser(); + $parser->expectOnce('acceptTextToken', array('', '*')); + $lexer = new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse('')); + } + + function testSkipCss() { + $parser = &$this->createParser(); + $parser->expectNever('acceptTextToken'); + $parser->expectAtLeastOnce('ignore'); + $lexer = new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse("")); + } + + function testSkipJavaScript() { + $parser = &$this->createParser(); + $parser->expectNever('acceptTextToken'); + $parser->expectAtLeastOnce('ignore'); + $lexer = new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse("")); + } + + function testSkipHtmlComments() { + $parser = &$this->createParser(); + $parser->expectNever('acceptTextToken'); + $parser->expectAtLeastOnce('ignore'); + $lexer = new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse("")); + } + + function testTagWithNoAttributes() { + $parser = &$this->createParser(); + $parser->expectAt(0, 'acceptStartToken', array('expectAt(1, 'acceptStartToken', array('>', '*')); + $parser->expectCallCount('acceptStartToken', 2); + $parser->expectOnce('acceptTextToken', array('Hello', '*')); + $parser->expectOnce('acceptEndToken', array('', '*')); + $lexer = new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse('Hello')); + } + + function testTagWithAttributes() { + $parser = &$this->createParser(); + $parser->expectOnce('acceptTextToken', array('label', '*')); + $parser->expectAt(0, 'acceptStartToken', array('expectAt(1, 'acceptStartToken', array('href', '*')); + $parser->expectAt(2, 'acceptStartToken', array('>', '*')); + $parser->expectCallCount('acceptStartToken', 3); + $parser->expectAt(0, 'acceptAttributeToken', array('= "', '*')); + $parser->expectAt(1, 'acceptAttributeToken', array('here.html', '*')); + $parser->expectAt(2, 'acceptAttributeToken', array('"', '*')); + $parser->expectCallCount('acceptAttributeToken', 3); + $parser->expectOnce('acceptEndToken', array('', '*')); + $lexer = new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse('label')); + } +} + +class TestOfHtmlSaxParser extends UnitTestCase { + + function &createListener() { + $listener = new MockSimpleSaxListener(); + $listener->setReturnValue('startElement', true); + $listener->setReturnValue('addContent', true); + $listener->setReturnValue('endElement', true); + return $listener; + } + + function testFramesetTag() { + $listener = &$this->createListener(); + $listener->expectOnce('startElement', array('frameset', array())); + $listener->expectOnce('addContent', array('Frames')); + $listener->expectOnce('endElement', array('frameset')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse('Frames')); + } + + function testTagWithUnquotedAttributes() { + $listener = &$this->createListener(); + $listener->expectOnce( + 'startElement', + array('input', array('name' => 'a.b.c', 'value' => 'd'))); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse('')); + } + + function testTagInsideContent() { + $listener = &$this->createListener(); + $listener->expectOnce('startElement', array('a', array())); + $listener->expectAt(0, 'addContent', array('')); + $listener->expectAt(1, 'addContent', array('')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse('')); + } + + function testTagWithInternalContent() { + $listener = &$this->createListener(); + $listener->expectOnce('startElement', array('a', array())); + $listener->expectOnce('addContent', array('label')); + $listener->expectOnce('endElement', array('a')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse('label')); + } + + function testLinkAddress() { + $listener = &$this->createListener(); + $listener->expectOnce('startElement', array('a', array('href' => 'here.html'))); + $listener->expectOnce('addContent', array('label')); + $listener->expectOnce('endElement', array('a')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse("label")); + } + + function testEncodedAttribute() { + $listener = &$this->createListener(); + $listener->expectOnce('startElement', array('a', array('href' => 'here&there.html'))); + $listener->expectOnce('addContent', array('label')); + $listener->expectOnce('endElement', array('a')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse("label")); + } + + function testTagWithId() { + $listener = &$this->createListener(); + $listener->expectOnce('startElement', array('a', array('id' => '0'))); + $listener->expectOnce('addContent', array('label')); + $listener->expectOnce('endElement', array('a')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse('label')); + } + + function testTagWithEmptyAttributes() { + $listener = &$this->createListener(); + $listener->expectOnce( + 'startElement', + array('option', array('value' => '', 'selected' => ''))); + $listener->expectOnce('addContent', array('label')); + $listener->expectOnce('endElement', array('option')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse('')); + } + + function testComplexTagWithLotsOfCaseVariations() { + $listener = &$this->createListener(); + $listener->expectOnce( + 'startElement', + array('a', array('href' => 'here.html', 'style' => "'cool'"))); + $listener->expectOnce('addContent', array('label')); + $listener->expectOnce('endElement', array('a')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse('label')); + } + + function testXhtmlSelfClosingTag() { + $listener = &$this->createListener(); + $listener->expectOnce( + 'startElement', + array('input', array('type' => 'submit', 'name' => 'N', 'value' => 'V'))); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse('')); + } + + function testNestedFrameInFrameset() { + $listener = &$this->createListener(); + $listener->expectAt(0, 'startElement', array('frameset', array())); + $listener->expectAt(1, 'startElement', array('frame', array('src' => 'frame.html'))); + $listener->expectCallCount('startElement', 2); + $listener->expectOnce('addContent', array('Hello')); + $listener->expectOnce('endElement', array('frameset')); + $parser = new SimpleHtmlSaxParser($listener); + $this->assertTrue($parser->parse( + 'Hello')); + } +} + +class TestOfTextExtraction extends UnitTestCase { + + function testImageSuppressionWhileKeepingParagraphsAndAltText() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise('

    some text

    bar'), + 'some text bar'); + + } + + function testSpaceNormalisation() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise("\nOne\tTwo \nThree\t"), + 'One Two Three'); + } + + function testMultilinesCommentSuppression() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise(''), + ''); + } + + function testCommentSuppression() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise(''), + ''); + } + + function testJavascriptSuppression() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise(''), + ''); + $this->assertEqual( + SimpleHtmlSaxParser::normalise(''), + ''); + $this->assertEqual( + SimpleHtmlSaxParser::normalise(''), + ''); + } + + function testTagSuppression() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise('Hello'), + 'Hello'); + } + + function testAdjoiningTagSuppression() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise('HelloGoodbye'), + 'HelloGoodbye'); + } + + function testExtractImageAltTextWithDifferentQuotes() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise('One\'Two\'Three'), + 'One Two Three'); + } + + function testExtractImageAltTextMultipleTimes() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise('OneTwoThree'), + 'One Two Three'); + } + + function testHtmlEntityTranslation() { + $this->assertEqual( + SimpleHtmlSaxParser::normalise('<>"&''), + '<>"&\''); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/reflection_php4_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/reflection_php4_test.php new file mode 100644 index 0000000..8ee211b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/reflection_php4_test.php @@ -0,0 +1,61 @@ +assertTrue($reflection->classOrInterfaceExists()); + $this->assertTrue($reflection->classOrInterfaceExistsSansAutoload()); + } + + function testClassNonExistence() { + $reflection = new SimpleReflection('UnknownThing'); + $this->assertFalse($reflection->classOrInterfaceExists()); + $this->assertFalse($reflection->classOrInterfaceExistsSansAutoload()); + } + + function testDetectionOfInterfacesAlwaysFalse() { + $reflection = new SimpleReflection('AnyOldThing'); + $this->assertFalse($reflection->isAbstract()); + $this->assertFalse($reflection->isInterface()); + } + + function testFindingParentClass() { + $reflection = new SimpleReflection('AnyOldChildThing'); + $this->assertEqual(strtolower($reflection->getParent()), 'anyoldthing'); + } + + function testMethodsListFromClass() { + $reflection = new SimpleReflection('AnyOldThing'); + $methods = $reflection->getMethods(); + $this->assertEqualIgnoringCase($methods[0], 'aMethod'); + } + + function testNoInterfacesForPHP4() { + $reflection = new SimpleReflection('AnyOldThing'); + $this->assertEqual( + $reflection->getInterfaces(), + array()); + } + + function testMostGeneralPossibleSignature() { + $reflection = new SimpleReflection('AnyOldThing'); + $this->assertEqualIgnoringCase( + $reflection->getSignature('aMethod'), + 'function &aMethod()'); + } + + function assertEqualIgnoringCase($a, $b) { + return $this->assertEqual(strtolower($a), strtolower($b)); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/reflection_php5_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/reflection_php5_test.php new file mode 100644 index 0000000..d9f46e6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/reflection_php5_test.php @@ -0,0 +1,263 @@ +assertTrue($reflection->classOrInterfaceExists()); + $this->assertTrue($reflection->classOrInterfaceExistsSansAutoload()); + $this->assertFalse($reflection->isAbstract()); + $this->assertFalse($reflection->isInterface()); + } + + function testClassNonExistence() { + $reflection = new SimpleReflection('UnknownThing'); + $this->assertFalse($reflection->classOrInterfaceExists()); + $this->assertFalse($reflection->classOrInterfaceExistsSansAutoload()); + } + + function testDetectionOfAbstractClass() { + $reflection = new SimpleReflection('AnyOldClass'); + $this->assertTrue($reflection->isAbstract()); + } + + function testDetectionOfFinalMethods() { + $reflection = new SimpleReflection('AnyOldClass'); + $this->assertFalse($reflection->hasFinal()); + $reflection = new SimpleReflection('AnyOldLeafClassWithAFinal'); + $this->assertTrue($reflection->hasFinal()); + } + + function testFindingParentClass() { + $reflection = new SimpleReflection('AnyOldSubclass'); + $this->assertEqual($reflection->getParent(), 'AnyOldImplementation'); + } + + function testInterfaceExistence() { + $reflection = new SimpleReflection('AnyOldInterface'); + $this->assertTrue($reflection->classOrInterfaceExists()); + $this->assertTrue($reflection->classOrInterfaceExistsSansAutoload()); + $this->assertTrue($reflection->isInterface()); + } + + function testMethodsListFromClass() { + $reflection = new SimpleReflection('AnyOldClass'); + $this->assertIdentical($reflection->getMethods(), array('aMethod')); + } + + function testMethodsListFromInterface() { + $reflection = new SimpleReflection('AnyOldInterface'); + $this->assertIdentical($reflection->getMethods(), array('aMethod')); + $this->assertIdentical($reflection->getInterfaceMethods(), array('aMethod')); + } + + function testMethodsComeFromDescendentInterfacesASWell() { + $reflection = new SimpleReflection('AnyDescendentInterface'); + $this->assertIdentical($reflection->getMethods(), array('aMethod')); + } + + function testCanSeparateInterfaceMethodsFromOthers() { + $reflection = new SimpleReflection('AnyOldImplementation'); + $this->assertIdentical($reflection->getMethods(), array('aMethod', 'extraMethod')); + $this->assertIdentical($reflection->getInterfaceMethods(), array('aMethod')); + } + + function testMethodsComeFromDescendentInterfacesInAbstractClass() { + $reflection = new SimpleReflection('AnyAbstractImplementation'); + $this->assertIdentical($reflection->getMethods(), array('aMethod')); + } + + function testInterfaceHasOnlyItselfToImplement() { + $reflection = new SimpleReflection('AnyOldInterface'); + $this->assertEqual( + $reflection->getInterfaces(), + array('AnyOldInterface')); + } + + function testInterfacesListedForClass() { + $reflection = new SimpleReflection('AnyOldImplementation'); + $this->assertEqual( + $reflection->getInterfaces(), + array('AnyOldInterface')); + } + + function testInterfacesListedForSubclass() { + $reflection = new SimpleReflection('AnyOldSubclass'); + $this->assertEqual( + $reflection->getInterfaces(), + array('AnyOldInterface')); + } + + function testNoParameterCreationWhenNoInterface() { + $reflection = new SimpleReflection('AnyOldArgumentClass'); + $function = $reflection->getSignature('aMethod'); + if (version_compare(phpversion(), '5.0.2', '<=')) { + $this->assertEqual('function amethod($argument)', strtolower($function)); + } else { + $this->assertEqual('function aMethod($argument)', $function); + } + } + + function testParameterCreationWithoutTypeHinting() { + $reflection = new SimpleReflection('AnyOldArgumentImplementation'); + $function = $reflection->getSignature('aMethod'); + if (version_compare(phpversion(), '5.0.2', '<=')) { + $this->assertEqual('function amethod(AnyOldInterface $argument)', $function); + } else { + $this->assertEqual('function aMethod(AnyOldInterface $argument)', $function); + } + } + + function testParameterCreationForTypeHinting() { + $reflection = new SimpleReflection('AnyOldTypeHintedClass'); + $function = $reflection->getSignature('aMethod'); + if (version_compare(phpversion(), '5.0.2', '<=')) { + $this->assertEqual('function amethod(AnyOldInterface $argument)', $function); + } else { + $this->assertEqual('function aMethod(AnyOldInterface $argument)', $function); + } + } + + function testIssetFunctionSignature() { + $reflection = new SimpleReflection('AnyOldOverloadedClass'); + $function = $reflection->getSignature('__isset'); + $this->assertEqual('function __isset($key)', $function); + } + + function testUnsetFunctionSignature() { + $reflection = new SimpleReflection('AnyOldOverloadedClass'); + $function = $reflection->getSignature('__unset'); + $this->assertEqual('function __unset($key)', $function); + } + + function testProperlyReflectsTheFinalInterfaceWhenObjectImplementsAnExtendedInterface() { + $reflection = new SimpleReflection('AnyDescendentImplementation'); + $interfaces = $reflection->getInterfaces(); + $this->assertEqual(1, count($interfaces)); + $this->assertEqual('AnyDescendentInterface', array_shift($interfaces)); + } + + function testCreatingSignatureForAbstractMethod() { + $reflection = new SimpleReflection('AnotherOldAbstractClass'); + $this->assertEqual($reflection->getSignature('aMethod'), 'function aMethod(AnyOldInterface $argument)'); + } + + function testCanProperlyGenerateStaticMethodSignatures() { + $reflection = new SimpleReflection('AnyOldClassWithStaticMethods'); + $this->assertEqual('static function aStatic()', $reflection->getSignature('aStatic')); + $this->assertEqual( + 'static function aStaticWithParameters($arg1, $arg2)', + $reflection->getSignature('aStaticWithParameters') + ); + } +} + +class TestOfReflectionWithTypeHints extends UnitTestCase { + function skip() { + $this->skipIf(version_compare(phpversion(), '5.1.0', '<'), 'Reflection with type hints only tested for PHP 5.1.0 and above'); + } + + function testParameterCreationForTypeHintingWithArray() { + eval('interface AnyOldArrayTypeHintedInterface { + function amethod(array $argument); + } + class AnyOldArrayTypeHintedClass implements AnyOldArrayTypeHintedInterface { + function amethod(array $argument) {} + }'); + $reflection = new SimpleReflection('AnyOldArrayTypeHintedClass'); + $function = $reflection->getSignature('amethod'); + $this->assertEqual('function amethod(array $argument)', $function); + } +} + +class TestOfAbstractsWithAbstractMethods extends UnitTestCase { + function testCanProperlyGenerateAbstractMethods() { + $reflection = new SimpleReflection('AnyOldAbstractClassWithAbstractMethods'); + $this->assertEqual( + 'function anAbstract()', + $reflection->getSignature('anAbstract') + ); + $this->assertEqual( + 'function anAbstractWithParameter($foo)', + $reflection->getSignature('anAbstractWithParameter') + ); + $this->assertEqual( + 'function anAbstractWithMultipleParameters($foo, $bar)', + $reflection->getSignature('anAbstractWithMultipleParameters') + ); + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/remote_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/remote_test.php new file mode 100644 index 0000000..5f3f96a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/remote_test.php @@ -0,0 +1,19 @@ +add(new RemoteTestCase($test_url . '?xml=yes', $test_url . '?xml=yes&dry=yes')); +if (SimpleReporter::inCli()) { + exit ($test->run(new TextReporter()) ? 0 : 1); +} +$test->run(new HtmlReporter()); diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/shell_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/shell_test.php new file mode 100644 index 0000000..d1d769a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/shell_test.php @@ -0,0 +1,38 @@ +assertIdentical($shell->execute('echo Hello'), 0); + $this->assertPattern('/Hello/', $shell->getOutput()); + } + + function testBadCommand() { + $shell = new SimpleShell(); + $this->assertNotEqual($ret = $shell->execute('blurgh! 2>&1'), 0); + } +} + +class TestOfShellTesterAndShell extends ShellTestCase { + + function testEcho() { + $this->assertTrue($this->execute('echo Hello')); + $this->assertExitCode(0); + $this->assertoutput('Hello'); + } + + function testFileExistence() { + $this->assertFileExists(dirname(__FILE__) . '/all_tests.php'); + $this->assertFileNotExists('wibble'); + } + + function testFilePatterns() { + $this->assertFilePattern('/all[_ ]tests/i', dirname(__FILE__) . '/all_tests.php'); + $this->assertNoFilePattern('/sputnik/i', dirname(__FILE__) . '/all_tests.php'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/shell_tester_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/shell_tester_test.php new file mode 100644 index 0000000..b12c602 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/shell_tester_test.php @@ -0,0 +1,42 @@ +mock_shell; + } + + function testGenericEquality() { + $this->assertEqual('a', 'a'); + $this->assertNotEqual('a', 'A'); + } + + function testExitCode() { + $this->mock_shell = new MockSimpleShell(); + $this->mock_shell->setReturnValue('execute', 0); + $this->mock_shell->expectOnce('execute', array('ls')); + $this->assertTrue($this->execute('ls')); + $this->assertExitCode(0); + } + + function testOutput() { + $this->mock_shell = new MockSimpleShell(); + $this->mock_shell->setReturnValue('execute', 0); + $this->mock_shell->setReturnValue('getOutput', "Line 1\nLine 2\n"); + $this->assertOutput("Line 1\nLine 2\n"); + } + + function testOutputPatterns() { + $this->mock_shell = new MockSimpleShell(); + $this->mock_shell->setReturnValue('execute', 0); + $this->mock_shell->setReturnValue('getOutput', "Line 1\nLine 2\n"); + $this->assertOutputPattern('/line/i'); + $this->assertNoOutputPattern('/line 2/'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/simpletest_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/simpletest_test.php new file mode 100644 index 0000000..daa65c6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/simpletest_test.php @@ -0,0 +1,58 @@ +fail('Should be ignored'); + } +} + +class ShouldNeverBeRunEither extends ShouldNeverBeRun { } + +class TestOfStackTrace extends UnitTestCase { + + function testCanFindAssertInTrace() { + $trace = new SimpleStackTrace(array('assert')); + $this->assertEqual( + $trace->traceMethod(array(array( + 'file' => '/my_test.php', + 'line' => 24, + 'function' => 'assertSomething'))), + ' at [/my_test.php line 24]'); + } +} + +class DummyResource { } + +class TestOfContext extends UnitTestCase { + + function testCurrentContextIsUnique() { + $this->assertSame( + SimpleTest::getContext(), + SimpleTest::getContext()); + } + + function testContextHoldsCurrentTestCase() { + $context = SimpleTest::getContext(); + $this->assertSame($this, $context->getTest()); + } + + function testResourceIsSingleInstanceWithContext() { + $context = new SimpleTestContext(); + $this->assertSame( + $context->get('DummyResource'), + $context->get('DummyResource')); + } + + function testClearingContextResetsResources() { + $context = new SimpleTestContext(); + $resource = $context->get('DummyResource'); + $context->clear(); + $this->assertClone($resource, $context->get('DummyResource')); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/.htaccess b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/.htaccess new file mode 100644 index 0000000..fb3bc55 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/.htaccess @@ -0,0 +1,2 @@ +DirectoryIndex index.php +Options Indexes diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/1.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/1.html new file mode 100644 index 0000000..cdc3e0b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/1.html @@ -0,0 +1,6 @@ + + 1 + + 2 + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/2.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/2.html new file mode 100644 index 0000000..fea1449 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/2.html @@ -0,0 +1,6 @@ + + 2 + + 3 + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/3.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/3.html new file mode 100644 index 0000000..fdd1380 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/3.html @@ -0,0 +1,6 @@ + + 3 + + 1 + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_change_redirect.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_change_redirect.php new file mode 100644 index 0000000..096c45d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_change_redirect.php @@ -0,0 +1,6 @@ + + Redirection test + This is a test page for the SimpleTest PHP unit tester + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/base_link.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/base_link.html new file mode 100644 index 0000000..fc4266b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/base_link.html @@ -0,0 +1,9 @@ + + + Links and base tag + + + + Back to test pages + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/form.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/form.html new file mode 100644 index 0000000..dacb1bb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/form.html @@ -0,0 +1,50 @@ + + + Test of form submission + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    + Radio G + + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/frameset.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/frameset.html new file mode 100644 index 0000000..8ff7b75 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/frameset.html @@ -0,0 +1,9 @@ + + Frameset for testing of SimpleTest + + + + This content is for no frames only. + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/frameset_with_base_tag.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/frameset_with_base_tag.html new file mode 100644 index 0000000..fb284e1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/frameset_with_base_tag.html @@ -0,0 +1,12 @@ + + + Frameset for testing of SimpleTest + + + + + + This content is for no frames only. + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/page_1.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/page_1.html new file mode 100644 index 0000000..bb53264 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/page_1.html @@ -0,0 +1,7 @@ + + Page 1 + + This is page 1. + To page 2 + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/page_2.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/page_2.html new file mode 100644 index 0000000..715aaf4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/page_2.html @@ -0,0 +1,7 @@ + + Page 2 + + This is page 2. + To page 1 + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/relative_link.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/relative_link.html new file mode 100644 index 0000000..ac1edbe --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/base_tag/relative_link.html @@ -0,0 +1,8 @@ + + + Links without base tag + + + Back to test pages + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/cookie_based_counter.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/cookie_based_counter.php new file mode 100644 index 0000000..239b9c8 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/cookie_based_counter.php @@ -0,0 +1,10 @@ + + Cookie Counter + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/counting_frameset.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/counting_frameset.html new file mode 100644 index 0000000..eec24c4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/counting_frameset.html @@ -0,0 +1,10 @@ + + Frameset for testing of SimpleTest + + + + + <body>This content is for no frames only.</body> + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/double_base_change_redirect.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/double_base_change_redirect.php new file mode 100644 index 0000000..a76172f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/double_base_change_redirect.php @@ -0,0 +1,6 @@ + + Redirection test + This is a test page for the SimpleTest PHP unit tester + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/file.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/file.html new file mode 100644 index 0000000..cc41aee --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/file.html @@ -0,0 +1,6 @@ + + Link to SimpleTest + + Link to SimpleTest + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form.html new file mode 100644 index 0000000..cc1138e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form.html @@ -0,0 +1,47 @@ + + Test of form submission + +
    + +
    + +
    + +
    + +
    + +
    + +
    + Radio G + + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_data_encoded_form.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_data_encoded_form.html new file mode 100644 index 0000000..a0f6b01 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_data_encoded_form.html @@ -0,0 +1,47 @@ + + Test of form submission + +
    + +
    + +
    + +
    + +
    + +
    + +
    + Radio G + + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_array_based_inputs.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_array_based_inputs.php new file mode 100644 index 0000000..e4d6f82 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_array_based_inputs.php @@ -0,0 +1,15 @@ + + + Form with quoted values + + +

    + QUERY_STRING : +

    +
    + + + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_false_defaults.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_false_defaults.html new file mode 100644 index 0000000..9f3fb38 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_false_defaults.html @@ -0,0 +1,40 @@ + + Test of form submission + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + Radio I + + + + +
    + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_mixed_post_and_get.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_mixed_post_and_get.html new file mode 100644 index 0000000..cf8e551 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_mixed_post_and_get.html @@ -0,0 +1,15 @@ + + Test of form submission + +
    + +
    + +
    +
    + +
    + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_quoted_values.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_quoted_values.php new file mode 100644 index 0000000..2d552d7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_quoted_values.php @@ -0,0 +1,14 @@ + + + Form with quoted values + + +

    + QUERY_STRING : +

    +
    + + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_radio_buttons.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_radio_buttons.html new file mode 100644 index 0000000..ba99969 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_radio_buttons.html @@ -0,0 +1,10 @@ + + +
    + 1 + 2 + 3 + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_tricky_defaults.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_tricky_defaults.html new file mode 100644 index 0000000..e028ceb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_tricky_defaults.html @@ -0,0 +1,35 @@ + + Test of form submission + +
    + +
    + +
    + +
    + +
    + +
    + +
    + Radio I + + + + + +
    + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_unnamed_submit.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_unnamed_submit.html new file mode 100644 index 0000000..08801f1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_with_unnamed_submit.html @@ -0,0 +1,12 @@ + + Test of form submission + +
    + +
    + + + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_without_action.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_without_action.php new file mode 100644 index 0000000..e17bcf5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/form_without_action.php @@ -0,0 +1,11 @@ + + Test of form submission + +

    _GET : []

    +

    _POST : []

    +
    + + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_a.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_a.html new file mode 100644 index 0000000..6eeb802 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_a.html @@ -0,0 +1,6 @@ + + A + + This is frame A
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_b.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_b.html new file mode 100644 index 0000000..1957614 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_b.html @@ -0,0 +1,6 @@ + + B + + This is frame B
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_links.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_links.html new file mode 100644 index 0000000..864960a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frame_links.html @@ -0,0 +1,7 @@ + + 1 + + Set one to 2 + Exit the frameset + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frameset.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frameset.html new file mode 100644 index 0000000..fb9217a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/frameset.html @@ -0,0 +1,10 @@ + + Frameset for testing of SimpleTest + + + + + <body>This content is for no frames only.</body> + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/a_page.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/a_page.php new file mode 100644 index 0000000..5f28c24 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/a_page.php @@ -0,0 +1,37 @@ + 0) { + $_COOKIE = $HTTP_COOKIE_VARS; + } + if (count($HTTP_GET_VARS) > 0) { + $_GET = $HTTP_GET_VARS; + } + if (count($HTTP_POST_VARS) > 0) { + $_POST = $HTTP_POST_VARS; + } + if (! isset($_SERVER)) { + $_SERVER = $HTTP_SERVER_VARS; + } + global $HTTP_RAW_POST_DATA; + + require_once('../page_request.php'); +?> + Simple test page with links + + Simple test page with links +

    Links

    + Self + No page + Bare action + Empty query + Empty link + Current directory + Down one +

    Forms

    +
    +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/index.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/index.php new file mode 100644 index 0000000..3f2dd08 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/index.php @@ -0,0 +1,44 @@ + 0) { + $_COOKIE = $HTTP_COOKIE_VARS; + } + if (count($HTTP_GET_VARS) > 0) { + $_GET = $HTTP_GET_VARS; + } + if (count($HTTP_POST_VARS) > 0) { + $_POST = $HTTP_POST_VARS; + } + if (! isset($_SERVER)) { + $_SERVER = $HTTP_SERVER_VARS; + } + global $HTTP_RAW_POST_DATA; + + require_once('../page_request.php'); +?> + Simple test front controller + + Simple test front controller +

    Links

    + Index + No page + Bare action + Empty query + Empty link + Down one + +

    Forms

    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/show_request.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/show_request.php new file mode 100644 index 0000000..f38473a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/front_controller_style/show_request.php @@ -0,0 +1,49 @@ +

    Request

    +
    +
    Protocol version
    +
    Request method
    +
    Accept header
    +
    +

    Cookies

    + 0) { + foreach ($_COOKIE as $key => $value) { + print "$key=[$value]
    \n"; + } + } + ?> +

    Raw GET data

    + +

    GET data

    + 0) { + foreach ($get as $key => $value) { + if (is_array($value)) { + $value = implode(', ', $value); + } + print "$key=[$value]
    \n"; + } + } + ?> +

    Raw POST data

    + +
    +

    POST data

    + 0) { + foreach ($_POST as $key => $value) { + print $key . "=["; + if (is_array($value)) { + print implode(', ', $value); + } else { + print $value; + } + print "]
    \n"; + } + } + ?> diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/link_confirm.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/link_confirm.php new file mode 100644 index 0000000..373ba35 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/link_confirm.php @@ -0,0 +1,18 @@ + + SimpleTest testing links + +

    + A target for the + SimpleTest + test suite. +

    + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/local_redirect.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/local_redirect.php new file mode 100644 index 0000000..8535711 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/local_redirect.php @@ -0,0 +1,6 @@ + + Redirection test + This is a test page for the SimpleTest PHP unit tester + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/messy_frameset.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/messy_frameset.html new file mode 100644 index 0000000..8364977 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/messy_frameset.html @@ -0,0 +1,16 @@ + + Frameset for testing of SimpleTest + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/multiple_widget_form.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/multiple_widget_form.html new file mode 100644 index 0000000..ec26b11 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/multiple_widget_form.html @@ -0,0 +1,59 @@ + + Test of form submission + +
    + + +
    + Multiple checkboxes B + + + + +
    + PHP compatible + +
    + + +
    + + +
    + +
    + + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/nested_frameset.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/nested_frameset.html new file mode 100644 index 0000000..0227e5c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/nested_frameset.html @@ -0,0 +1,10 @@ + + Nested frameset for testing of SimpleTest + + + + + <body>This content is for no frames only.</body> + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/network_confirm.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/network_confirm.php new file mode 100644 index 0000000..034ac3f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/network_confirm.php @@ -0,0 +1,84 @@ + 0) { + $_COOKIE = $HTTP_COOKIE_VARS; + } + if (count($HTTP_GET_VARS) > 0) { + $_GET = $HTTP_GET_VARS; + } + if (count($HTTP_POST_VARS) > 0) { + $_POST = $HTTP_POST_VARS; + } + if (! isset($_SERVER)) { + $_SERVER = $HTTP_SERVER_VARS; + } + global $HTTP_RAW_POST_DATA; + + require_once('page_request.php'); +?> + Simple test target file + + A target for the SimpleTest test suite. +

    Request

    +
    +
    Protocol version
    +
    Request method
    +
    Accept header
    +
    +

    Cookies

    + 0) { + foreach ($_COOKIE as $key => $value) { + print htmlentities($key) . "=[" . htmlentities($value) . "]
    \n"; + } + } + ?> +

    Raw GET data

    + +

    GET data

    + 0) { + foreach ($get as $key => $value) { + if (is_array($value)) { + $value = implode(', ', $value); + } + print htmlentities($key) . "=[" . htmlentities($value) . "]
    \n"; + } + } + ?> +

    Dump of $_GET data

    + '; + print_r($_GET); + print '

  • '; + ?> +

    Raw POST data

    + +
    +

    POST data

    + $value) { + $html .= htmlentities($key) . "=["; + if (is_array($value)) { + $html .= show_array_value($value); + } else { + $html .= htmlentities($value); + } + $html .= "]"; + } + + return $html; + } + + if (count($_POST) > 0) { + echo show_array_value($_POST)."
    \n"; + } + ?> + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/one_page_frameset.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/one_page_frameset.html new file mode 100644 index 0000000..c3e0ac7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/one_page_frameset.html @@ -0,0 +1,9 @@ + + Frameset for testing of SimpleTest + + + + <body>This content is for no frames only.</body> + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/page_request.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/page_request.php new file mode 100644 index 0000000..19ae978 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/page_request.php @@ -0,0 +1,60 @@ +parsed = array(); + foreach ($statements as $statement) { + if (strpos($statement, '=') === false) { + continue; + } + $this->parseStatement($statement); + } + } + + private function parseStatement($statement) { + list($key, $value) = explode('=', $statement); + $key = urldecode($key); + if (preg_match('/(.*)\[\]$/', $key, $matches)) { + $key = $matches[1]; + if (! isset($this->parsed[$key])) { + $this->parsed[$key] = array(); + } + $this->addValue($key, $value); + } elseif (isset($this->parsed[$key])) { + $this->addValue($key, $value); + } else { + $this->setValue($key, $value); + } + } + + private function addValue($key, $value) { + if (! is_array($this->parsed[$key])) { + $this->parsed[$key] = array($this->parsed[$key]); + } + $this->parsed[$key][] = urldecode($value); + } + + private function setValue($key, $value) { + $this->parsed[$key] = urldecode($value); + } + + function getAll() { + return $this->parsed; + } + + function get() { + $request = &new PageRequest($_SERVER['QUERY_STRING']); + return $request->getAll(); + } + + function post() { + global $HTTP_RAW_POST_DATA; + $request = &new PageRequest($HTTP_RAW_POST_DATA); + return $request->getAll(); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/base_change_redirect.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/base_change_redirect.php new file mode 100644 index 0000000..08636a9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/base_change_redirect.php @@ -0,0 +1,6 @@ + + Redirection test + This is a test page for the SimpleTest PHP unit tester + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/network_confirm.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/network_confirm.php new file mode 100644 index 0000000..a9fb318 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/network_confirm.php @@ -0,0 +1,71 @@ + 0) { + $_COOKIE = $HTTP_COOKIE_VARS; + } + if (count($HTTP_GET_VARS) > 0) { + $_GET = $HTTP_GET_VARS; + } + if (count($HTTP_POST_VARS) > 0) { + $_POST = $HTTP_POST_VARS; + } + if (!isset($_SERVER)) { + $_SERVER = $HTTP_SERVER_VARS; + } + global $HTTP_RAW_POST_DATA; + + require_once('../page_request.php'); +?> + Simple test target file in folder + + A target for the SimpleTest test suite. +

    Request

    +
    +
    Protocol version
    +
    Request method
    +
    Accept header
    +
    +

    Cookies

    + 0) { + foreach ($_COOKIE as $key => $value) { + print $key . "=[" . $value . "]
    \n"; + } + } + ?> +

    Raw GET data

    + +

    GET data

    + 0) { + foreach ($get as $key => $value) { + if (is_array($value)) { + $value = implode(', ', $value); + } + print $key . "=[" . $value . "]
    \n"; + } + } + ?> +

    Raw POST data

    + +
    +

    POST data

    + 0) { + foreach ($_POST as $key => $value) { + print $key . "=["; + if (is_array($value)) { + print implode(', ', $value); + } else { + print $value; + } + print "]
    \n"; + } + } + ?> + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/show_cookies.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/show_cookies.php new file mode 100644 index 0000000..1135b04 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/path/show_cookies.php @@ -0,0 +1,18 @@ + 0) { + $_COOKIE = $HTTP_COOKIE_VARS; + } +?> + Simple test target file + + A target for the SimpleTest test suite that displays cookies. +

    Cookies

    + 0) { + foreach ($_COOKIE as $key => $value) { + print $key . "=" . $value . ";"; + } + } + ?> + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/.htaccess b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/.htaccess new file mode 100644 index 0000000..7e89c37 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/.htaccess @@ -0,0 +1,5 @@ +AuthName "Test of basic authentication" +AuthType Basic +AuthUserFile /home/marcus/projects/lastcraft/www/test/protected/.htpasswd +require valid-user + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/.htpasswd b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/.htpasswd new file mode 100644 index 0000000..f40e1f2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/.htpasswd @@ -0,0 +1 @@ +test:wOGY3sAo.zsek diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/1.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/1.html new file mode 100644 index 0000000..cdc3e0b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/1.html @@ -0,0 +1,6 @@ + + 1 + + 2 + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/2.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/2.html new file mode 100644 index 0000000..fea1449 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/2.html @@ -0,0 +1,6 @@ + + 2 + + 3 + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/3.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/3.html new file mode 100644 index 0000000..fdd1380 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/3.html @@ -0,0 +1,6 @@ + + 3 + + 1 + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/htaccess b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/htaccess new file mode 100644 index 0000000..866def1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/htaccess @@ -0,0 +1,4 @@ +AuthName "SimpleTest basic authentication" +AuthType Basic +AuthUserFile /web/guide/lastcraft/public_html/test/protected/.htpasswd +require valid-user diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/local_redirect.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/local_redirect.php new file mode 100644 index 0000000..8535711 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/local_redirect.php @@ -0,0 +1,6 @@ + + Redirection test + This is a test page for the SimpleTest PHP unit tester + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/network_confirm.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/network_confirm.php new file mode 100644 index 0000000..e0f8a6e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/protected/network_confirm.php @@ -0,0 +1,71 @@ + 0) { + $_COOKIE = $HTTP_COOKIE_VARS; + } + if (count($HTTP_GET_VARS) > 0) { + $_GET = $HTTP_GET_VARS; + } + if (count($HTTP_POST_VARS) > 0) { + $_POST = $HTTP_POST_VARS; + } + if (!isset($_SERVER)) { + $_SERVER = $HTTP_SERVER_VARS; + } + global $HTTP_RAW_POST_DATA; + + require_once('../page_request.php'); +?> + Simple test target file + + A target for the SimpleTest test suite. +

    Request

    +
    +
    Protocol version
    +
    Request method
    +
    Accept header
    +
    +

    Cookies

    + 0) { + foreach ($_COOKIE as $key => $value) { + print $key . "=[" . $value . "]
    \n"; + } + } + ?> +

    Raw GET data

    + +

    GET data

    + 0) { + foreach ($get as $key => $value) { + if (is_array($value)) { + $value = implode(', ', $value); + } + print $key . "=[" . $value . "]
    \n"; + } + } + ?> +

    Raw POST data

    + +
    +

    POST data

    + 0) { + foreach ($_POST as $key => $value) { + print $key . "=["; + if (is_array($value)) { + print implode(', ', $value); + } else { + print $value; + } + print "]
    \n"; + } + } + ?> + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/redirect.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/redirect.php new file mode 100644 index 0000000..14c23fa --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/redirect.php @@ -0,0 +1,6 @@ + + Redirection test + This is a test page for the SimpleTest PHP unit tester + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/savant_style_form.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/savant_style_form.html new file mode 100644 index 0000000..f510555 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/savant_style_form.html @@ -0,0 +1,20 @@ + + Test of form submission with Savant style controls + +
    + Checkbox A + + + +
    + Radio B + + + + + +
    + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/search.png b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/search.png new file mode 100644 index 0000000000000000000000000000000000000000..342d1d3b0a10634bc212fd28cada640388100966 GIT binary patch literal 1259 zcmVUy%R+00(qQO+^RP1{x0v5pJA0hX4Qsc}YY; zRCt`#SWieJR~Y}zkWCg;$P1RPLJmejH9BQ>%PmWoZ70bvuCn3Zq;j|EfIOp%=;hdA_ zdFtg5XSivaq( zT$+@UeBY#Ob#`g9$0AO!#50+(tF$Tjh zkVqupI1UWMh=j)6+#CR)TrQ*0XhdkaTuy!0Gz$Cs`;jpE;>)j~>pFh;{yVi-E|*mZ z1Hi?_g_0?iN&tXtHrr{w;z@K--V%$&A`TA^@uPWwS1;GFzP=veSy@?8-z$|0YPA{w zz_KhDhJoALTR4u>b#})D2LQ;hGyp^#=@;Rs7VB6D*LCsB&p+YS%QdwZ1ObkYj=B;X zcua1?FmP~ifX&TK0Nsvgn${(E<9Y~!0G#vpb}sIMLYo0V?;J)s=Qut&1?L=$F?{{a zw~AJ&RG{lR^7*{F8O}L`5Ro&^&dva!YrmI4fBx}10AOotOYI3Ez&Y>fSlk5xPcMef z1Pl|t9ky-9R>d%hFE1OB?jOp8Xti2uk|83JQpOGiVUY-B+pA)G6%1|Y94@4kWLXw@ zo=2LLk~+gm2!ZM8X#mka6XIRHs-0G^*HzD|R4TZ-x>9{CF64UY6+%R0IOoV_v#3_9 zks@T8Cg$em9$&h>2MY2MLXc^is*mZjvoqM)+3C8yK?3I-tE;O>vkYFm_#DY(5_&S3 z!rIzer0)z8IOoXc^8kR!+ysV)N1*FEv>*uR?(Pnbn>h zU~Fs*j4|YLIn2(^U~Ft0x~?OkX&OdGMldxs1pr91jQYQ$*MR(~fH8(N%OJzjn4O)$ z=;&wA^~YgKqqmJE2m(AjG~v1~UcdeeuIu8)_4-!&zJCU#S*EY^!)aw=VgjS1qZk?* zLL%`rZz#ur$L8t#KJM@D@#f9neJKQhhlhVYi2wQXR9||Ahez=2SpvyqD&iCX{0j;} VqtuINB%uHR002ovPDHLkV1mi4QoaBH literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/self.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/self.php new file mode 100644 index 0000000..2759f64 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/self.php @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/self_form.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/self_form.php new file mode 100644 index 0000000..7428d2b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/self_form.php @@ -0,0 +1,21 @@ + 0) { + $_GET = $HTTP_GET_VARS; + } +?> + Test of form self submission + +
    + +
    +

    []

    +

    []

    +

    []

    +
    + + + +
    + + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/set_cookies.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/set_cookies.php new file mode 100644 index 0000000..a4a8a26 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/set_cookies.php @@ -0,0 +1,20 @@ + + SimpleTest testing links + +

    + A target for the + SimpleTest + test suite. + All it does is set some cookies which you can see + here. +

    + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/slow_page.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/slow_page.php new file mode 100644 index 0000000..c1aef31 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/slow_page.php @@ -0,0 +1,6 @@ + + Slow page + This page takes at least two seconds + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/temp/.stop_cvs_removing_temp b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/temp/.stop_cvs_removing_temp new file mode 100644 index 0000000..e69de29 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/timestamp.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/timestamp.php new file mode 100644 index 0000000..3117c48 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/timestamp.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/upload_form.html b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/upload_form.html new file mode 100644 index 0000000..23d3a87 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/upload_form.html @@ -0,0 +1,11 @@ + + Test of file upload + +
    + +
    +
    + +
    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/upload_handler.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/upload_handler.php new file mode 100644 index 0000000..7680b88 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/site/upload_handler.php @@ -0,0 +1,18 @@ + + Test of file upload + +

    +

    + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/socket_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/socket_test.php new file mode 100644 index 0000000..729adda --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/socket_test.php @@ -0,0 +1,25 @@ +assertFalse($error->isError()); + $error->setError('Ouch'); + $this->assertTrue($error->isError()); + $this->assertEqual($error->getError(), 'Ouch'); + } + + function testClearingError() { + $error = new SimpleStickyError(); + $error->setError('Ouch'); + $this->assertTrue($error->isError()); + $error->clearError(); + $this->assertFalse($error->isError()); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/collector/collectable.1 b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/collector/collectable.1 new file mode 100644 index 0000000..e69de29 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/collector/collectable.2 b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/collector/collectable.2 new file mode 100644 index 0000000..e69de29 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/empty_test_file.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/empty_test_file.php new file mode 100644 index 0000000..31e3f7b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/empty_test_file.php @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/latin1_sample b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/latin1_sample new file mode 100644 index 0000000..1903525 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/latin1_sample @@ -0,0 +1 @@ +@櫻 \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/spl_examples.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/spl_examples.php new file mode 100644 index 0000000..45add35 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/spl_examples.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/supplementary_upload_sample.txt b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/supplementary_upload_sample.txt new file mode 100644 index 0000000..d8aa9e8 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/supplementary_upload_sample.txt @@ -0,0 +1 @@ +Some more text content \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/test1.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/test1.php new file mode 100644 index 0000000..b414586 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/test1.php @@ -0,0 +1,7 @@ +assertEqual(3,1+2, "pass1"); + } +} +?> diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/upload_sample.txt b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/upload_sample.txt new file mode 100644 index 0000000..ec98d7c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/support/upload_sample.txt @@ -0,0 +1 @@ +Sample for testing file upload \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/tag_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/tag_test.php new file mode 100644 index 0000000..5e8a377 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/tag_test.php @@ -0,0 +1,554 @@ + '1', 'b' => '')); + $this->assertEqual($tag->getTagName(), 'title'); + $this->assertIdentical($tag->getAttribute('a'), '1'); + $this->assertIdentical($tag->getAttribute('b'), ''); + $this->assertIdentical($tag->getAttribute('c'), false); + $this->assertIdentical($tag->getContent(), ''); + } + + function testTitleContent() { + $tag = new SimpleTitleTag(array()); + $this->assertTrue($tag->expectEndTag()); + $tag->addContent('Hello'); + $tag->addContent('World'); + $this->assertEqual($tag->getText(), 'HelloWorld'); + } + + function testMessyTitleContent() { + $tag = new SimpleTitleTag(array()); + $this->assertTrue($tag->expectEndTag()); + $tag->addContent('Hello'); + $tag->addContent('World'); + $this->assertEqual($tag->getText(), 'HelloWorld'); + } + + function testTagWithNoEnd() { + $tag = new SimpleTextTag(array()); + $this->assertFalse($tag->expectEndTag()); + } + + function testAnchorHref() { + $tag = new SimpleAnchorTag(array('href' => 'http://here/')); + $this->assertEqual($tag->getHref(), 'http://here/'); + + $tag = new SimpleAnchorTag(array('href' => '')); + $this->assertIdentical($tag->getAttribute('href'), ''); + $this->assertIdentical($tag->getHref(), ''); + + $tag = new SimpleAnchorTag(array()); + $this->assertIdentical($tag->getAttribute('href'), false); + $this->assertIdentical($tag->getHref(), ''); + } + + function testIsIdMatchesIdAttribute() { + $tag = new SimpleAnchorTag(array('href' => 'http://here/', 'id' => 7)); + $this->assertIdentical($tag->getAttribute('id'), '7'); + $this->assertTrue($tag->isId(7)); + } +} + +class TestOfWidget extends UnitTestCase { + + function testTextEmptyDefault() { + $tag = new SimpleTextTag(array('type' => 'text')); + $this->assertIdentical($tag->getDefault(), ''); + $this->assertIdentical($tag->getValue(), ''); + } + + function testSettingOfExternalLabel() { + $tag = new SimpleTextTag(array('type' => 'text')); + $tag->setLabel('it'); + $this->assertTrue($tag->isLabel('it')); + } + + function testTextDefault() { + $tag = new SimpleTextTag(array('value' => 'aaa')); + $this->assertEqual($tag->getDefault(), 'aaa'); + $this->assertEqual($tag->getValue(), 'aaa'); + } + + function testSettingTextValue() { + $tag = new SimpleTextTag(array('value' => 'aaa')); + $tag->setValue('bbb'); + $this->assertEqual($tag->getValue(), 'bbb'); + $tag->resetValue(); + $this->assertEqual($tag->getValue(), 'aaa'); + } + + function testFailToSetHiddenValue() { + $tag = new SimpleTextTag(array('value' => 'aaa', 'type' => 'hidden')); + $this->assertFalse($tag->setValue('bbb')); + $this->assertEqual($tag->getValue(), 'aaa'); + } + + function testSubmitDefaults() { + $tag = new SimpleSubmitTag(array('type' => 'submit')); + $this->assertIdentical($tag->getName(), false); + $this->assertEqual($tag->getValue(), 'Submit'); + $this->assertFalse($tag->setValue('Cannot set this')); + $this->assertEqual($tag->getValue(), 'Submit'); + $this->assertEqual($tag->getLabel(), 'Submit'); + + $encoding = new MockSimpleMultipartEncoding(); + $encoding->expectNever('add'); + $tag->write($encoding); + } + + function testPopulatedSubmit() { + $tag = new SimpleSubmitTag( + array('type' => 'submit', 'name' => 's', 'value' => 'Ok!')); + $this->assertEqual($tag->getName(), 's'); + $this->assertEqual($tag->getValue(), 'Ok!'); + $this->assertEqual($tag->getLabel(), 'Ok!'); + + $encoding = new MockSimpleMultipartEncoding(); + $encoding->expectOnce('add', array('s', 'Ok!')); + $tag->write($encoding); + } + + function testImageSubmit() { + $tag = new SimpleImageSubmitTag( + array('type' => 'image', 'name' => 's', 'alt' => 'Label')); + $this->assertEqual($tag->getName(), 's'); + $this->assertEqual($tag->getLabel(), 'Label'); + + $encoding = new MockSimpleMultipartEncoding(); + $encoding->expectAt(0, 'add', array('s.x', 20)); + $encoding->expectAt(1, 'add', array('s.y', 30)); + $tag->write($encoding, 20, 30); + } + + function testImageSubmitTitlePreferredOverAltForLabel() { + $tag = new SimpleImageSubmitTag( + array('type' => 'image', 'name' => 's', 'alt' => 'Label', 'title' => 'Title')); + $this->assertEqual($tag->getLabel(), 'Title'); + } + + function testButton() { + $tag = new SimpleButtonTag( + array('type' => 'submit', 'name' => 's', 'value' => 'do')); + $tag->addContent('I am a button'); + $this->assertEqual($tag->getName(), 's'); + $this->assertEqual($tag->getValue(), 'do'); + $this->assertEqual($tag->getLabel(), 'I am a button'); + + $encoding = new MockSimpleMultipartEncoding(); + $encoding->expectOnce('add', array('s', 'do')); + $tag->write($encoding); + } +} + +class TestOfTextArea extends UnitTestCase { + + function testDefault() { + $tag = new SimpleTextAreaTag(array('name' => 'a')); + $tag->addContent('Some text'); + $this->assertEqual($tag->getName(), 'a'); + $this->assertEqual($tag->getDefault(), 'Some text'); + } + + function testWrapping() { + $tag = new SimpleTextAreaTag(array('cols' => '10', 'wrap' => 'physical')); + $tag->addContent("Lot's of text that should be wrapped"); + $this->assertEqual( + $tag->getDefault(), + "Lot's of\r\ntext that\r\nshould be\r\nwrapped"); + $tag->setValue("New long text\r\nwith two lines"); + $this->assertEqual( + $tag->getValue(), + "New long\r\ntext\r\nwith two\r\nlines"); + } + + function testWrappingRemovesLeadingcariageReturn() { + $tag = new SimpleTextAreaTag(array('cols' => '20', 'wrap' => 'physical')); + $tag->addContent("\rStuff"); + $this->assertEqual($tag->getDefault(), 'Stuff'); + $tag->setValue("\nNew stuff\n"); + $this->assertEqual($tag->getValue(), "New stuff\r\n"); + } + + function testBreaksAreNewlineAndCarriageReturn() { + $tag = new SimpleTextAreaTag(array('cols' => '10')); + $tag->addContent("Some\nText\rwith\r\nbreaks"); + $this->assertEqual($tag->getValue(), "Some\r\nText\r\nwith\r\nbreaks"); + } +} + +class TestOfCheckbox extends UnitTestCase { + + function testCanSetCheckboxToNamedValueWithBooleanTrue() { + $tag = new SimpleCheckboxTag(array('name' => 'a', 'value' => 'A')); + $this->assertEqual($tag->getValue(), false); + $tag->setValue(true); + $this->assertIdentical($tag->getValue(), 'A'); + } +} + +class TestOfSelection extends UnitTestCase { + + function testEmpty() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $this->assertIdentical($tag->getValue(), ''); + } + + function testSingle() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $option = new SimpleOptionTag(array()); + $option->addContent('AAA'); + $tag->addTag($option); + $this->assertEqual($tag->getValue(), 'AAA'); + } + + function testSingleDefault() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $option = new SimpleOptionTag(array('selected' => '')); + $option->addContent('AAA'); + $tag->addTag($option); + $this->assertEqual($tag->getValue(), 'AAA'); + } + + function testSingleMappedDefault() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $option = new SimpleOptionTag(array('selected' => '', 'value' => 'aaa')); + $option->addContent('AAA'); + $tag->addTag($option); + $this->assertEqual($tag->getValue(), 'aaa'); + } + + function testStartsWithDefault() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $a = new SimpleOptionTag(array()); + $a->addContent('AAA'); + $tag->addTag($a); + $b = new SimpleOptionTag(array('selected' => '')); + $b->addContent('BBB'); + $tag->addTag($b); + $c = new SimpleOptionTag(array()); + $c->addContent('CCC'); + $tag->addTag($c); + $this->assertEqual($tag->getValue(), 'BBB'); + } + + function testSettingOption() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $a = new SimpleOptionTag(array()); + $a->addContent('AAA'); + $tag->addTag($a); + $b = new SimpleOptionTag(array('selected' => '')); + $b->addContent('BBB'); + $tag->addTag($b); + $c = new SimpleOptionTag(array()); + $c->addContent('CCC'); + $tag->setValue('AAA'); + $this->assertEqual($tag->getValue(), 'AAA'); + } + + function testSettingMappedOption() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $a = new SimpleOptionTag(array('value' => 'aaa')); + $a->addContent('AAA'); + $tag->addTag($a); + $b = new SimpleOptionTag(array('value' => 'bbb', 'selected' => '')); + $b->addContent('BBB'); + $tag->addTag($b); + $c = new SimpleOptionTag(array('value' => 'ccc')); + $c->addContent('CCC'); + $tag->addTag($c); + $tag->setValue('AAA'); + $this->assertEqual($tag->getValue(), 'aaa'); + $tag->setValue('ccc'); + $this->assertEqual($tag->getValue(), 'ccc'); + } + + function testSelectionDespiteSpuriousWhitespace() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $a = new SimpleOptionTag(array()); + $a->addContent(' AAA '); + $tag->addTag($a); + $b = new SimpleOptionTag(array('selected' => '')); + $b->addContent(' BBB '); + $tag->addTag($b); + $c = new SimpleOptionTag(array()); + $c->addContent(' CCC '); + $tag->addTag($c); + $this->assertEqual($tag->getValue(), ' BBB '); + $tag->setValue('AAA'); + $this->assertEqual($tag->getValue(), ' AAA '); + } + + function testFailToSetIllegalOption() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $a = new SimpleOptionTag(array()); + $a->addContent('AAA'); + $tag->addTag($a); + $b = new SimpleOptionTag(array('selected' => '')); + $b->addContent('BBB'); + $tag->addTag($b); + $c = new SimpleOptionTag(array()); + $c->addContent('CCC'); + $tag->addTag($c); + $this->assertFalse($tag->setValue('Not present')); + $this->assertEqual($tag->getValue(), 'BBB'); + } + + function testNastyOptionValuesThatLookLikeFalse() { + $tag = new SimpleSelectionTag(array('name' => 'a')); + $a = new SimpleOptionTag(array('value' => '1')); + $a->addContent('One'); + $tag->addTag($a); + $b = new SimpleOptionTag(array('value' => '0')); + $b->addContent('Zero'); + $tag->addTag($b); + $this->assertIdentical($tag->getValue(), '1'); + $tag->setValue('Zero'); + $this->assertIdentical($tag->getValue(), '0'); + } + + function testBlankOption() { + $tag = new SimpleSelectionTag(array('name' => 'A')); + $a = new SimpleOptionTag(array()); + $tag->addTag($a); + $b = new SimpleOptionTag(array()); + $b->addContent('b'); + $tag->addTag($b); + $this->assertIdentical($tag->getValue(), ''); + $tag->setValue('b'); + $this->assertIdentical($tag->getValue(), 'b'); + $tag->setValue(''); + $this->assertIdentical($tag->getValue(), ''); + } + + function testMultipleDefaultWithNoSelections() { + $tag = new MultipleSelectionTag(array('name' => 'a', 'multiple' => '')); + $a = new SimpleOptionTag(array()); + $a->addContent('AAA'); + $tag->addTag($a); + $b = new SimpleOptionTag(array()); + $b->addContent('BBB'); + $tag->addTag($b); + $this->assertIdentical($tag->getDefault(), array()); + $this->assertIdentical($tag->getValue(), array()); + } + + function testMultipleDefaultWithSelections() { + $tag = new MultipleSelectionTag(array('name' => 'a', 'multiple' => '')); + $a = new SimpleOptionTag(array('selected' => '')); + $a->addContent('AAA'); + $tag->addTag($a); + $b = new SimpleOptionTag(array('selected' => '')); + $b->addContent('BBB'); + $tag->addTag($b); + $this->assertIdentical($tag->getDefault(), array('AAA', 'BBB')); + $this->assertIdentical($tag->getValue(), array('AAA', 'BBB')); + } + + function testSettingMultiple() { + $tag = new MultipleSelectionTag(array('name' => 'a', 'multiple' => '')); + $a = new SimpleOptionTag(array('selected' => '')); + $a->addContent('AAA'); + $tag->addTag($a); + $b = new SimpleOptionTag(array()); + $b->addContent('BBB'); + $tag->addTag($b); + $c = new SimpleOptionTag(array('selected' => '', 'value' => 'ccc')); + $c->addContent('CCC'); + $tag->addTag($c); + $this->assertIdentical($tag->getDefault(), array('AAA', 'ccc')); + $this->assertTrue($tag->setValue(array('BBB', 'ccc'))); + $this->assertIdentical($tag->getValue(), array('BBB', 'ccc')); + $this->assertTrue($tag->setValue(array())); + $this->assertIdentical($tag->getValue(), array()); + } + + function testFailToSetIllegalOptionsInMultiple() { + $tag = new MultipleSelectionTag(array('name' => 'a', 'multiple' => '')); + $a = new SimpleOptionTag(array('selected' => '')); + $a->addContent('AAA'); + $tag->addTag($a); + $b = new SimpleOptionTag(array()); + $b->addContent('BBB'); + $tag->addTag($b); + $this->assertFalse($tag->setValue(array('CCC'))); + $this->assertTrue($tag->setValue(array('AAA', 'BBB'))); + $this->assertFalse($tag->setValue(array('AAA', 'CCC'))); + } +} + +class TestOfRadioGroup extends UnitTestCase { + + function testEmptyGroup() { + $group = new SimpleRadioGroup(); + $this->assertIdentical($group->getDefault(), false); + $this->assertIdentical($group->getValue(), false); + $this->assertFalse($group->setValue('a')); + } + + function testReadingSingleButtonGroup() { + $group = new SimpleRadioGroup(); + $group->addWidget(new SimpleRadioButtonTag( + array('value' => 'A', 'checked' => ''))); + $this->assertIdentical($group->getDefault(), 'A'); + $this->assertIdentical($group->getValue(), 'A'); + } + + function testReadingMultipleButtonGroup() { + $group = new SimpleRadioGroup(); + $group->addWidget(new SimpleRadioButtonTag( + array('value' => 'A'))); + $group->addWidget(new SimpleRadioButtonTag( + array('value' => 'B', 'checked' => ''))); + $this->assertIdentical($group->getDefault(), 'B'); + $this->assertIdentical($group->getValue(), 'B'); + } + + function testFailToSetUnlistedValue() { + $group = new SimpleRadioGroup(); + $group->addWidget(new SimpleRadioButtonTag(array('value' => 'z'))); + $this->assertFalse($group->setValue('a')); + $this->assertIdentical($group->getValue(), false); + } + + function testSettingNewValueClearsTheOldOne() { + $group = new SimpleRadioGroup(); + $group->addWidget(new SimpleRadioButtonTag( + array('value' => 'A'))); + $group->addWidget(new SimpleRadioButtonTag( + array('value' => 'B', 'checked' => ''))); + $this->assertTrue($group->setValue('A')); + $this->assertIdentical($group->getValue(), 'A'); + } + + function testIsIdMatchesAnyWidgetInSet() { + $group = new SimpleRadioGroup(); + $group->addWidget(new SimpleRadioButtonTag( + array('value' => 'A', 'id' => 'i1'))); + $group->addWidget(new SimpleRadioButtonTag( + array('value' => 'B', 'id' => 'i2'))); + $this->assertFalse($group->isId('i0')); + $this->assertTrue($group->isId('i1')); + $this->assertTrue($group->isId('i2')); + } + + function testIsLabelMatchesAnyWidgetInSet() { + $group = new SimpleRadioGroup(); + $button1 = new SimpleRadioButtonTag(array('value' => 'A')); + $button1->setLabel('one'); + $group->addWidget($button1); + $button2 = new SimpleRadioButtonTag(array('value' => 'B')); + $button2->setLabel('two'); + $group->addWidget($button2); + $this->assertFalse($group->isLabel('three')); + $this->assertTrue($group->isLabel('one')); + $this->assertTrue($group->isLabel('two')); + } +} + +class TestOfTagGroup extends UnitTestCase { + + function testReadingMultipleCheckboxGroup() { + $group = new SimpleCheckboxGroup(); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'A'))); + $group->addWidget(new SimpleCheckboxTag( + array('value' => 'B', 'checked' => ''))); + $this->assertIdentical($group->getDefault(), 'B'); + $this->assertIdentical($group->getValue(), 'B'); + } + + function testReadingMultipleUncheckedItems() { + $group = new SimpleCheckboxGroup(); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'A'))); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'B'))); + $this->assertIdentical($group->getDefault(), false); + $this->assertIdentical($group->getValue(), false); + } + + function testReadingMultipleCheckedItems() { + $group = new SimpleCheckboxGroup(); + $group->addWidget(new SimpleCheckboxTag( + array('value' => 'A', 'checked' => ''))); + $group->addWidget(new SimpleCheckboxTag( + array('value' => 'B', 'checked' => ''))); + $this->assertIdentical($group->getDefault(), array('A', 'B')); + $this->assertIdentical($group->getValue(), array('A', 'B')); + } + + function testSettingSingleValue() { + $group = new SimpleCheckboxGroup(); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'A'))); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'B'))); + $this->assertTrue($group->setValue('A')); + $this->assertIdentical($group->getValue(), 'A'); + $this->assertTrue($group->setValue('B')); + $this->assertIdentical($group->getValue(), 'B'); + } + + function testSettingMultipleValues() { + $group = new SimpleCheckboxGroup(); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'A'))); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'B'))); + $this->assertTrue($group->setValue(array('A', 'B'))); + $this->assertIdentical($group->getValue(), array('A', 'B')); + } + + function testSettingNoValue() { + $group = new SimpleCheckboxGroup(); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'A'))); + $group->addWidget(new SimpleCheckboxTag(array('value' => 'B'))); + $this->assertTrue($group->setValue(false)); + $this->assertIdentical($group->getValue(), false); + } + + function testIsIdMatchesAnyIdInSet() { + $group = new SimpleCheckboxGroup(); + $group->addWidget(new SimpleCheckboxTag(array('id' => 1, 'value' => 'A'))); + $group->addWidget(new SimpleCheckboxTag(array('id' => 2, 'value' => 'B'))); + $this->assertFalse($group->isId(0)); + $this->assertTrue($group->isId(1)); + $this->assertTrue($group->isId(2)); + } +} + +class TestOfUploadWidget extends UnitTestCase { + + function testValueIsFilePath() { + $upload = new SimpleUploadTag(array('name' => 'a')); + $upload->setValue(dirname(__FILE__) . '/support/upload_sample.txt'); + $this->assertEqual($upload->getValue(), dirname(__FILE__) . '/support/upload_sample.txt'); + } + + function testSubmitsFileContents() { + $encoding = new MockSimpleMultipartEncoding(); + $encoding->expectOnce('attach', array( + 'a', + 'Sample for testing file upload', + 'upload_sample.txt')); + $upload = new SimpleUploadTag(array('name' => 'a')); + $upload->setValue(dirname(__FILE__) . '/support/upload_sample.txt'); + $upload->write($encoding); + } +} + +class TestOfLabelTag extends UnitTestCase { + + function testLabelShouldHaveAnEndTag() { + $label = new SimpleLabelTag(array()); + $this->assertTrue($label->expectEndTag()); + } + + function testContentIsTextOnly() { + $label = new SimpleLabelTag(array()); + $label->addContent('Here are words'); + $this->assertEqual($label->getText(), 'Here are words'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/unit_tester_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/unit_tester_test.php new file mode 100644 index 0000000..ce9850f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/unit_tester_test.php @@ -0,0 +1,61 @@ +assertTrue($this->assertTrue(true)); + } + + function testAssertFalseReturnsAssertionAsBoolean() { + $this->assertTrue($this->assertFalse(false)); + } + + function testAssertEqualReturnsAssertionAsBoolean() { + $this->assertTrue($this->assertEqual(5, 5)); + } + + function testAssertIdenticalReturnsAssertionAsBoolean() { + $this->assertTrue($this->assertIdentical(5, 5)); + } + + function testCoreAssertionsDoNotThrowErrors() { + $this->assertIsA($this, 'UnitTestCase'); + $this->assertNotA($this, 'WebTestCase'); + } + + function testReferenceAssertionOnObjects() { + $a = new ReferenceForTesting(); + $b = $a; + $this->assertSame($a, $b); + } + + function testReferenceAssertionOnScalars() { + $a = 25; + $b = &$a; + $this->assertReference($a, $b); + } + + function testCloneOnObjects() { + $a = new ReferenceForTesting(); + $b = new ReferenceForTesting(); + $this->assertClone($a, $b); + } + + function TODO_testCloneOnScalars() { + $a = 25; + $b = 25; + $this->assertClone($a, $b); + } + + function testCopyOnScalars() { + $a = 25; + $b = 25; + $this->assertCopy($a, $b); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/unit_tests.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/unit_tests.php new file mode 100644 index 0000000..43c36a3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/unit_tests.php @@ -0,0 +1,46 @@ +TestSuite('Unit tests'); + $path = dirname(__FILE__); + $this->addFile($path . '/errors_test.php'); + $this->addFile($path . '/exceptions_test.php'); + $this->addFile($path . '/autorun_test.php'); + $this->addFile($path . '/compatibility_test.php'); + $this->addFile($path . '/simpletest_test.php'); + $this->addFile($path . '/dumper_test.php'); + $this->addFile($path . '/expectation_test.php'); + $this->addFile($path . '/unit_tester_test.php'); + $this->addFile($path . '/reflection_php5_test.php'); + $this->addFile($path . '/mock_objects_test.php'); + $this->addFile($path . '/interfaces_test.php'); + $this->addFile($path . '/collector_test.php'); + $this->addFile($path . '/adapter_test.php'); + $this->addFile($path . '/socket_test.php'); + $this->addFile($path . '/encoding_test.php'); + $this->addFile($path . '/url_test.php'); + $this->addFile($path . '/cookies_test.php'); + $this->addFile($path . '/http_test.php'); + $this->addFile($path . '/authentication_test.php'); + $this->addFile($path . '/user_agent_test.php'); + $this->addFile($path . '/parser_test.php'); + $this->addFile($path . '/tag_test.php'); + $this->addFile($path . '/form_test.php'); + $this->addFile($path . '/page_test.php'); + $this->addFile($path . '/frames_test.php'); + $this->addFile($path . '/browser_test.php'); + $this->addFile($path . '/web_tester_test.php'); + $this->addFile($path . '/shell_tester_test.php'); + $this->addFile($path . '/xml_test.php'); + $this->addFile($path . '/../extensions/testdox/test.php'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/url_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/url_test.php new file mode 100644 index 0000000..666ab1e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/url_test.php @@ -0,0 +1,496 @@ +assertEqual($url->getScheme(), ''); + $this->assertEqual($url->getHost(), ''); + $this->assertEqual($url->getScheme('http'), 'http'); + $this->assertEqual($url->getHost('localhost'), 'localhost'); + $this->assertEqual($url->getPath(), ''); + } + + function testBasicParsing() { + $url = new SimpleUrl('https://www.lastcraft.com/test/'); + $this->assertEqual($url->getScheme(), 'https'); + $this->assertEqual($url->getHost(), 'www.lastcraft.com'); + $this->assertEqual($url->getPath(), '/test/'); + } + + function testRelativeUrls() { + $url = new SimpleUrl('../somewhere.php'); + $this->assertEqual($url->getScheme(), false); + $this->assertEqual($url->getHost(), false); + $this->assertEqual($url->getPath(), '../somewhere.php'); + } + + function testParseBareParameter() { + $url = new SimpleUrl('?a'); + $this->assertEqual($url->getPath(), ''); + $this->assertEqual($url->getEncodedRequest(), '?a'); + $url->addRequestParameter('x', 'X'); + $this->assertEqual($url->getEncodedRequest(), '?a=&x=X'); + } + + function testParseEmptyParameter() { + $url = new SimpleUrl('?a='); + $this->assertEqual($url->getPath(), ''); + $this->assertEqual($url->getEncodedRequest(), '?a='); + $url->addRequestParameter('x', 'X'); + $this->assertEqual($url->getEncodedRequest(), '?a=&x=X'); + } + + function testParseParameterPair() { + $url = new SimpleUrl('?a=A'); + $this->assertEqual($url->getPath(), ''); + $this->assertEqual($url->getEncodedRequest(), '?a=A'); + $url->addRequestParameter('x', 'X'); + $this->assertEqual($url->getEncodedRequest(), '?a=A&x=X'); + } + + function testParseMultipleParameters() { + $url = new SimpleUrl('?a=A&b=B'); + $this->assertEqual($url->getEncodedRequest(), '?a=A&b=B'); + $url->addRequestParameter('x', 'X'); + $this->assertEqual($url->getEncodedRequest(), '?a=A&b=B&x=X'); + } + + function testParsingParameterMixture() { + $url = new SimpleUrl('?a=A&b=&c'); + $this->assertEqual($url->getEncodedRequest(), '?a=A&b=&c'); + $url->addRequestParameter('x', 'X'); + $this->assertEqual($url->getEncodedRequest(), '?a=A&b=&c=&x=X'); + } + + function testAddParametersFromScratch() { + $url = new SimpleUrl(''); + $url->addRequestParameter('a', 'A'); + $this->assertEqual($url->getEncodedRequest(), '?a=A'); + $url->addRequestParameter('b', 'B'); + $this->assertEqual($url->getEncodedRequest(), '?a=A&b=B'); + $url->addRequestParameter('a', 'aaa'); + $this->assertEqual($url->getEncodedRequest(), '?a=A&b=B&a=aaa'); + } + + function testClearingParameters() { + $url = new SimpleUrl(''); + $url->addRequestParameter('a', 'A'); + $url->clearRequest(); + $this->assertIdentical($url->getEncodedRequest(), ''); + } + + function testEncodingParameters() { + $url = new SimpleUrl(''); + $url->addRequestParameter('a', '?!"\'#~@[]{}:;<>,./|$%^&*()_+-='); + $this->assertIdentical( + $request = $url->getEncodedRequest(), + '?a=%3F%21%22%27%23%7E%40%5B%5D%7B%7D%3A%3B%3C%3E%2C.%2F%7C%A3%24%25%5E%26%2A%28%29_%2B-%3D'); + } + + function testDecodingParameters() { + $url = new SimpleUrl('?a=%3F%21%22%27%23%7E%40%5B%5D%7B%7D%3A%3B%3C%3E%2C.%2F%7C%A3%24%25%5E%26%2A%28%29_%2B-%3D'); + $this->assertEqual( + $url->getEncodedRequest(), + '?a=' . urlencode('?!"\'#~@[]{}:;<>,./|$%^&*()_+-=')); + } + + function testUrlInQueryDoesNotConfuseParsing() { + $url = new SimpleUrl('wibble/login.php?url=http://www.google.com/moo/'); + $this->assertFalse($url->getScheme()); + $this->assertFalse($url->getHost()); + $this->assertEqual($url->getPath(), 'wibble/login.php'); + $this->assertEqual($url->getEncodedRequest(), '?url=http://www.google.com/moo/'); + } + + function testSettingCordinates() { + $url = new SimpleUrl(''); + $url->setCoordinates('32', '45'); + $this->assertIdentical($url->getX(), 32); + $this->assertIdentical($url->getY(), 45); + $this->assertEqual($url->getEncodedRequest(), ''); + } + + function testParseCordinates() { + $url = new SimpleUrl('?32,45'); + $this->assertIdentical($url->getX(), 32); + $this->assertIdentical($url->getY(), 45); + } + + function testClearingCordinates() { + $url = new SimpleUrl('?32,45'); + $url->setCoordinates(); + $this->assertIdentical($url->getX(), false); + $this->assertIdentical($url->getY(), false); + } + + function testParsingParameterCordinateMixture() { + $url = new SimpleUrl('?a=A&b=&c?32,45'); + $this->assertIdentical($url->getX(), 32); + $this->assertIdentical($url->getY(), 45); + $this->assertEqual($url->getEncodedRequest(), '?a=A&b=&c'); + } + + function testParsingParameterWithBadCordinates() { + $url = new SimpleUrl('?a=A&b=&c?32'); + $this->assertIdentical($url->getX(), false); + $this->assertIdentical($url->getY(), false); + $this->assertEqual($url->getEncodedRequest(), '?a=A&b=&c?32'); + } + + function testPageSplitting() { + $url = new SimpleUrl('./here/../there/somewhere.php'); + $this->assertEqual($url->getPath(), './here/../there/somewhere.php'); + $this->assertEqual($url->getPage(), 'somewhere.php'); + $this->assertEqual($url->getBasePath(), './here/../there/'); + } + + function testAbsolutePathPageSplitting() { + $url = new SimpleUrl("http://host.com/here/there/somewhere.php"); + $this->assertEqual($url->getPath(), "/here/there/somewhere.php"); + $this->assertEqual($url->getPage(), "somewhere.php"); + $this->assertEqual($url->getBasePath(), "/here/there/"); + } + + function testSplittingUrlWithNoPageGivesEmptyPage() { + $url = new SimpleUrl('/here/there/'); + $this->assertEqual($url->getPath(), '/here/there/'); + $this->assertEqual($url->getPage(), ''); + $this->assertEqual($url->getBasePath(), '/here/there/'); + } + + function testPathNormalisation() { + $url = new SimpleUrl(); + $this->assertEqual( + $url->normalisePath('https://host.com/I/am/here/../there/somewhere.php'), + 'https://host.com/I/am/there/somewhere.php'); + } + + // regression test for #1535407 + function testPathNormalisationWithSinglePeriod() { + $url = new SimpleUrl(); + $this->assertEqual( + $url->normalisePath('https://host.com/I/am/here/./../there/somewhere.php'), + 'https://host.com/I/am/there/somewhere.php'); + } + + // regression test for #1852413 + function testHostnameExtractedFromUContainingAtSign() { + $url = new SimpleUrl("http://localhost/name@example.com"); + $this->assertEqual($url->getScheme(), "http"); + $this->assertEqual($url->getUsername(), ""); + $this->assertEqual($url->getPassword(), ""); + $this->assertEqual($url->getHost(), "localhost"); + $this->assertEqual($url->getPath(), "/name@example.com"); + } + + function testHostnameInLocalhost() { + $url = new SimpleUrl("http://localhost/name/example.com"); + $this->assertEqual($url->getScheme(), "http"); + $this->assertEqual($url->getUsername(), ""); + $this->assertEqual($url->getPassword(), ""); + $this->assertEqual($url->getHost(), "localhost"); + $this->assertEqual($url->getPath(), "/name/example.com"); + } + + function testUsernameAndPasswordAreUrlDecoded() { + $url = new SimpleUrl('http://' . urlencode('test@test') . + ':' . urlencode('$!@*&%') . '@www.lastcraft.com'); + $this->assertEqual($url->getUsername(), 'test@test'); + $this->assertEqual($url->getPassword(), '$!@*&%'); + } + + function testBlitz() { + $this->assertUrl( + "https://username:password@www.somewhere.com:243/this/that/here.php?a=1&b=2#anchor", + array("https", "username", "password", "www.somewhere.com", 243, "/this/that/here.php", "com", "?a=1&b=2", "anchor"), + array("a" => "1", "b" => "2")); + $this->assertUrl( + "username:password@www.somewhere.com/this/that/here.php?a=1", + array(false, "username", "password", "www.somewhere.com", false, "/this/that/here.php", "com", "?a=1", false), + array("a" => "1")); + $this->assertUrl( + "username:password@somewhere.com:243?1,2", + array(false, "username", "password", "somewhere.com", 243, "/", "com", "", false), + array(), + array(1, 2)); + $this->assertUrl( + "https://www.somewhere.com", + array("https", false, false, "www.somewhere.com", false, "/", "com", "", false)); + $this->assertUrl( + "username@www.somewhere.com:243#anchor", + array(false, "username", false, "www.somewhere.com", 243, "/", "com", "", "anchor")); + $this->assertUrl( + "/this/that/here.php?a=1&b=2?3,4", + array(false, false, false, false, false, "/this/that/here.php", false, "?a=1&b=2", false), + array("a" => "1", "b" => "2"), + array(3, 4)); + $this->assertUrl( + "username@/here.php?a=1&b=2", + array(false, "username", false, false, false, "/here.php", false, "?a=1&b=2", false), + array("a" => "1", "b" => "2")); + } + + function testAmbiguousHosts() { + $this->assertUrl( + "tigger", + array(false, false, false, false, false, "tigger", false, "", false)); + $this->assertUrl( + "/tigger", + array(false, false, false, false, false, "/tigger", false, "", false)); + $this->assertUrl( + "//tigger", + array(false, false, false, "tigger", false, "/", false, "", false)); + $this->assertUrl( + "//tigger/", + array(false, false, false, "tigger", false, "/", false, "", false)); + $this->assertUrl( + "tigger.com", + array(false, false, false, "tigger.com", false, "/", "com", "", false)); + $this->assertUrl( + "me.net/tigger", + array(false, false, false, "me.net", false, "/tigger", "net", "", false)); + } + + function testAsString() { + $this->assertPreserved('https://www.here.com'); + $this->assertPreserved('http://me:secret@www.here.com'); + $this->assertPreserved('http://here/there'); + $this->assertPreserved('http://here/there?a=A&b=B'); + $this->assertPreserved('http://here/there?a=1&a=2'); + $this->assertPreserved('http://here/there?a=1&a=2?9,8'); + $this->assertPreserved('http://host?a=1&a=2'); + $this->assertPreserved('http://host#stuff'); + $this->assertPreserved('http://me:secret@www.here.com/a/b/c/here.html?a=A?7,6'); + $this->assertPreserved('http://www.here.com/?a=A__b=B'); + $this->assertPreserved('http://www.example.com:8080/'); + } + + function assertUrl($raw, $parts, $params = false, $coords = false) { + if (! is_array($params)) { + $params = array(); + } + $url = new SimpleUrl($raw); + $this->assertIdentical($url->getScheme(), $parts[0], "[$raw] scheme -> %s"); + $this->assertIdentical($url->getUsername(), $parts[1], "[$raw] username -> %s"); + $this->assertIdentical($url->getPassword(), $parts[2], "[$raw] password -> %s"); + $this->assertIdentical($url->getHost(), $parts[3], "[$raw] host -> %s"); + $this->assertIdentical($url->getPort(), $parts[4], "[$raw] port -> %s"); + $this->assertIdentical($url->getPath(), $parts[5], "[$raw] path -> %s"); + $this->assertIdentical($url->getTld(), $parts[6], "[$raw] tld -> %s"); + $this->assertIdentical($url->getEncodedRequest(), $parts[7], "[$raw] encoded -> %s"); + $this->assertIdentical($url->getFragment(), $parts[8], "[$raw] fragment -> %s"); + if ($coords) { + $this->assertIdentical($url->getX(), $coords[0], "[$raw] x -> %s"); + $this->assertIdentical($url->getY(), $coords[1], "[$raw] y -> %s"); + } + } + + function testUrlWithTwoSlashesInPath() { + $url = new SimpleUrl('/article/categoryedit/insert//'); + $this->assertEqual($url->getPath(), '/article/categoryedit/insert//'); + } + + function assertPreserved($string) { + $url = new SimpleUrl($string); + $this->assertEqual($url->asString(), $string); + } +} + +class TestOfAbsoluteUrls extends UnitTestCase { + + function testDirectoriesAfterFilename() { + $string = '../../index.php/foo/bar'; + $url = new SimpleUrl($string); + $this->assertEqual($url->asString(), $string); + + $absolute = $url->makeAbsolute('http://www.domain.com/some/path/'); + $this->assertEqual($absolute->asString(), 'http://www.domain.com/index.php/foo/bar'); + } + + function testMakingAbsolute() { + $url = new SimpleUrl('../there/somewhere.php'); + $this->assertEqual($url->getPath(), '../there/somewhere.php'); + $absolute = $url->makeAbsolute('https://host.com:1234/I/am/here/'); + $this->assertEqual($absolute->getScheme(), 'https'); + $this->assertEqual($absolute->getHost(), 'host.com'); + $this->assertEqual($absolute->getPort(), 1234); + $this->assertEqual($absolute->getPath(), '/I/am/there/somewhere.php'); + } + + function testMakingAnEmptyUrlAbsolute() { + $url = new SimpleUrl(''); + $this->assertEqual($url->getPath(), ''); + $absolute = $url->makeAbsolute('http://host.com/I/am/here/page.html'); + $this->assertEqual($absolute->getScheme(), 'http'); + $this->assertEqual($absolute->getHost(), 'host.com'); + $this->assertEqual($absolute->getPath(), '/I/am/here/page.html'); + } + + function testMakingAnEmptyUrlAbsoluteWithMissingPageName() { + $url = new SimpleUrl(''); + $this->assertEqual($url->getPath(), ''); + $absolute = $url->makeAbsolute('http://host.com/I/am/here/'); + $this->assertEqual($absolute->getScheme(), 'http'); + $this->assertEqual($absolute->getHost(), 'host.com'); + $this->assertEqual($absolute->getPath(), '/I/am/here/'); + } + + function testMakingAShortQueryUrlAbsolute() { + $url = new SimpleUrl('?a#b'); + $this->assertEqual($url->getPath(), ''); + $absolute = $url->makeAbsolute('http://host.com/I/am/here/'); + $this->assertEqual($absolute->getScheme(), 'http'); + $this->assertEqual($absolute->getHost(), 'host.com'); + $this->assertEqual($absolute->getPath(), '/I/am/here/'); + $this->assertEqual($absolute->getEncodedRequest(), '?a'); + $this->assertEqual($absolute->getFragment(), 'b'); + } + + function testMakingADirectoryUrlAbsolute() { + $url = new SimpleUrl('hello/'); + $this->assertEqual($url->getPath(), 'hello/'); + $this->assertEqual($url->getBasePath(), 'hello/'); + $this->assertEqual($url->getPage(), ''); + $absolute = $url->makeAbsolute('http://host.com/I/am/here/page.html'); + $this->assertEqual($absolute->getPath(), '/I/am/here/hello/'); + } + + function testMakingARootUrlAbsolute() { + $url = new SimpleUrl('/'); + $this->assertEqual($url->getPath(), '/'); + $absolute = $url->makeAbsolute('http://host.com/I/am/here/page.html'); + $this->assertEqual($absolute->getPath(), '/'); + } + + function testMakingARootPageUrlAbsolute() { + $url = new SimpleUrl('/here.html'); + $absolute = $url->makeAbsolute('http://host.com/I/am/here/page.html'); + $this->assertEqual($absolute->getPath(), '/here.html'); + } + + function testCarryAuthenticationFromRootPage() { + $url = new SimpleUrl('here.html'); + $absolute = $url->makeAbsolute('http://test:secret@host.com/'); + $this->assertEqual($absolute->getPath(), '/here.html'); + $this->assertEqual($absolute->getUsername(), 'test'); + $this->assertEqual($absolute->getPassword(), 'secret'); + } + + function testMakingCoordinateUrlAbsolute() { + $url = new SimpleUrl('?1,2'); + $this->assertEqual($url->getPath(), ''); + $absolute = $url->makeAbsolute('http://host.com/I/am/here/'); + $this->assertEqual($absolute->getScheme(), 'http'); + $this->assertEqual($absolute->getHost(), 'host.com'); + $this->assertEqual($absolute->getPath(), '/I/am/here/'); + $this->assertEqual($absolute->getX(), 1); + $this->assertEqual($absolute->getY(), 2); + } + + function testMakingAbsoluteAppendedPath() { + $url = new SimpleUrl('./there/somewhere.php'); + $absolute = $url->makeAbsolute('https://host.com/here/'); + $this->assertEqual($absolute->getPath(), '/here/there/somewhere.php'); + } + + function testMakingAbsoluteBadlyFormedAppendedPath() { + $url = new SimpleUrl('there/somewhere.php'); + $absolute = $url->makeAbsolute('https://host.com/here/'); + $this->assertEqual($absolute->getPath(), '/here/there/somewhere.php'); + } + + function testMakingAbsoluteHasNoEffectWhenAlreadyAbsolute() { + $url = new SimpleUrl('https://test:secret@www.lastcraft.com:321/stuff/?a=1#f'); + $absolute = $url->makeAbsolute('http://host.com/here/'); + $this->assertEqual($absolute->getScheme(), 'https'); + $this->assertEqual($absolute->getUsername(), 'test'); + $this->assertEqual($absolute->getPassword(), 'secret'); + $this->assertEqual($absolute->getHost(), 'www.lastcraft.com'); + $this->assertEqual($absolute->getPort(), 321); + $this->assertEqual($absolute->getPath(), '/stuff/'); + $this->assertEqual($absolute->getEncodedRequest(), '?a=1'); + $this->assertEqual($absolute->getFragment(), 'f'); + } + + function testMakingAbsoluteCarriesAuthenticationWhenAlreadyAbsolute() { + $url = new SimpleUrl('https://www.lastcraft.com'); + $absolute = $url->makeAbsolute('http://test:secret@host.com/here/'); + $this->assertEqual($absolute->getHost(), 'www.lastcraft.com'); + $this->assertEqual($absolute->getUsername(), 'test'); + $this->assertEqual($absolute->getPassword(), 'secret'); + } + + function testMakingHostOnlyAbsoluteDoesNotCarryAnyOtherInformation() { + $url = new SimpleUrl('http://www.lastcraft.com'); + $absolute = $url->makeAbsolute('https://host.com:81/here/'); + $this->assertEqual($absolute->getScheme(), 'http'); + $this->assertEqual($absolute->getHost(), 'www.lastcraft.com'); + $this->assertIdentical($absolute->getPort(), false); + $this->assertEqual($absolute->getPath(), '/'); + } +} + +class TestOfFrameUrl extends UnitTestCase { + + function testTargetAttachment() { + $url = new SimpleUrl('http://www.site.com/home.html'); + $this->assertIdentical($url->getTarget(), false); + $url->setTarget('A frame'); + $this->assertIdentical($url->getTarget(), 'A frame'); + } +} + +/** + * @note Based off of http://www.mozilla.org/quality/networking/testing/filetests.html + */ +class TestOfFileUrl extends UnitTestCase { + + function testMinimalUrl() { + $url = new SimpleUrl('file:///'); + $this->assertEqual($url->getScheme(), 'file'); + $this->assertIdentical($url->getHost(), false); + $this->assertEqual($url->getPath(), '/'); + } + + function testUnixUrl() { + $url = new SimpleUrl('file:///fileInRoot'); + $this->assertEqual($url->getScheme(), 'file'); + $this->assertIdentical($url->getHost(), false); + $this->assertEqual($url->getPath(), '/fileInRoot'); + } + + function testDOSVolumeUrl() { + $url = new SimpleUrl('file:///C:/config.sys'); + $this->assertEqual($url->getScheme(), 'file'); + $this->assertIdentical($url->getHost(), false); + $this->assertEqual($url->getPath(), '/C:/config.sys'); + } + + function testDOSVolumePromotion() { + $url = new SimpleUrl('file://C:/config.sys'); + $this->assertEqual($url->getScheme(), 'file'); + $this->assertIdentical($url->getHost(), false); + $this->assertEqual($url->getPath(), '/C:/config.sys'); + } + + function testDOSBackslashes() { + $url = new SimpleUrl('file:///C:\config.sys'); + $this->assertEqual($url->getScheme(), 'file'); + $this->assertIdentical($url->getHost(), false); + $this->assertEqual($url->getPath(), '/C:/config.sys'); + } + + function testDOSDirnameAfterFile() { + $url = new SimpleUrl('file://C:\config.sys'); + $this->assertEqual($url->getScheme(), 'file'); + $this->assertIdentical($url->getHost(), false); + $this->assertEqual($url->getPath(), '/C:/config.sys'); + } + +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/user_agent_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/user_agent_test.php new file mode 100644 index 0000000..030abeb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/user_agent_test.php @@ -0,0 +1,348 @@ +headers = new MockSimpleHttpHeaders(); + $this->response = new MockSimpleHttpResponse(); + $this->response->setReturnValue('isError', false); + $this->response->returns('getHeaders', new MockSimpleHttpHeaders()); + $this->request = new MockSimpleHttpRequest(); + $this->request->returns('fetch', $this->response); + } + + function testGetRequestWithoutIncidentGivesNoErrors() { + $url = new SimpleUrl('http://test:secret@this.com/page.html'); + $url->addRequestParameters(array('a' => 'A', 'b' => 'B')); + + $agent = new MockRequestUserAgent(); + $agent->returns('createHttpRequest', $this->request); + $agent->__construct(); + + $response = $agent->fetchResponse( + new SimpleUrl('http://test:secret@this.com/page.html'), + new SimpleGetEncoding(array('a' => 'A', 'b' => 'B'))); + $this->assertFalse($response->isError()); + } +} + +class TestOfAdditionalHeaders extends UnitTestCase { + + function testAdditionalHeaderAddedToRequest() { + $response = new MockSimpleHttpResponse(); + $response->setReturnReference('getHeaders', new MockSimpleHttpHeaders()); + + $request = new MockSimpleHttpRequest(); + $request->setReturnReference('fetch', $response); + $request->expectOnce( + 'addHeaderLine', + array('User-Agent: SimpleTest')); + + $agent = new MockRequestUserAgent(); + $agent->setReturnReference('createHttpRequest', $request); + $agent->__construct(); + $agent->addHeader('User-Agent: SimpleTest'); + $response = $agent->fetchResponse(new SimpleUrl('http://this.host/'), new SimpleGetEncoding()); + } +} + +class TestOfBrowserCookies extends UnitTestCase { + + private function createStandardResponse() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue("isError", false); + $response->setReturnValue("getContent", "stuff"); + $response->setReturnReference("getHeaders", new MockSimpleHttpHeaders()); + return $response; + } + + private function createCookieSite($header_lines) { + $headers = new SimpleHttpHeaders($header_lines); + $response = new MockSimpleHttpResponse(); + $response->setReturnValue("isError", false); + $response->setReturnReference("getHeaders", $headers); + $response->setReturnValue("getContent", "stuff"); + $request = new MockSimpleHttpRequest(); + $request->setReturnReference("fetch", $response); + return $request; + } + + private function createMockedRequestUserAgent(&$request) { + $agent = new MockRequestUserAgent(); + $agent->setReturnReference('createHttpRequest', $request); + $agent->__construct(); + return $agent; + } + + function testCookieJarIsSentToRequest() { + $jar = new SimpleCookieJar(); + $jar->setCookie('a', 'A'); + + $request = new MockSimpleHttpRequest(); + $request->returns('fetch', $this->createStandardResponse()); + $request->expectOnce('readCookiesFromJar', array($jar, '*')); + + $agent = $this->createMockedRequestUserAgent($request); + $agent->setCookie('a', 'A'); + $agent->fetchResponse( + new SimpleUrl('http://this.com/this/path/page.html'), + new SimpleGetEncoding()); + } + + function testNoCookieJarIsSentToRequestWhenCookiesAreDisabled() { + $request = new MockSimpleHttpRequest(); + $request->returns('fetch', $this->createStandardResponse()); + $request->expectNever('readCookiesFromJar'); + + $agent = $this->createMockedRequestUserAgent($request); + $agent->setCookie('a', 'A'); + $agent->ignoreCookies(); + $agent->fetchResponse( + new SimpleUrl('http://this.com/this/path/page.html'), + new SimpleGetEncoding()); + } + + function testReadingNewCookie() { + $request = $this->createCookieSite('Set-cookie: a=AAAA'); + $agent = $this->createMockedRequestUserAgent($request); + $agent->fetchResponse( + new SimpleUrl('http://this.com/this/path/page.html'), + new SimpleGetEncoding()); + $this->assertEqual($agent->getCookieValue("this.com", "this/path/", "a"), "AAAA"); + } + + function testIgnoringNewCookieWhenCookiesDisabled() { + $request = $this->createCookieSite('Set-cookie: a=AAAA'); + $agent = $this->createMockedRequestUserAgent($request); + $agent->ignoreCookies(); + $agent->fetchResponse( + new SimpleUrl('http://this.com/this/path/page.html'), + new SimpleGetEncoding()); + $this->assertIdentical($agent->getCookieValue("this.com", "this/path/", "a"), false); + } + + function testOverwriteCookieThatAlreadyExists() { + $request = $this->createCookieSite('Set-cookie: a=AAAA'); + $agent = $this->createMockedRequestUserAgent($request); + $agent->setCookie('a', 'A'); + $agent->fetchResponse( + new SimpleUrl('http://this.com/this/path/page.html'), + new SimpleGetEncoding()); + $this->assertEqual($agent->getCookieValue("this.com", "this/path/", "a"), "AAAA"); + } + + function testClearCookieBySettingExpiry() { + $request = $this->createCookieSite('Set-cookie: a=b'); + $agent = $this->createMockedRequestUserAgent($request); + + $agent->setCookie("a", "A", "this/path/", "Wed, 25-Dec-02 04:24:21 GMT"); + $agent->fetchResponse( + new SimpleUrl('http://this.com/this/path/page.html'), + new SimpleGetEncoding()); + $this->assertIdentical( + $agent->getCookieValue("this.com", "this/path/", "a"), + "b"); + $agent->restart("Wed, 25-Dec-02 04:24:20 GMT"); + $this->assertIdentical( + $agent->getCookieValue("this.com", "this/path/", "a"), + false); + } + + function testAgeingAndClearing() { + $request = $this->createCookieSite('Set-cookie: a=A; expires=Wed, 25-Dec-02 04:24:21 GMT; path=/this/path'); + $agent = $this->createMockedRequestUserAgent($request); + + $agent->fetchResponse( + new SimpleUrl('http://this.com/this/path/page.html'), + new SimpleGetEncoding()); + $agent->restart("Wed, 25-Dec-02 04:24:20 GMT"); + $this->assertIdentical( + $agent->getCookieValue("this.com", "this/path/", "a"), + "A"); + $agent->ageCookies(2); + $agent->restart("Wed, 25-Dec-02 04:24:20 GMT"); + $this->assertIdentical( + $agent->getCookieValue("this.com", "this/path/", "a"), + false); + } + + function testReadingIncomingAndSettingNewCookies() { + $request = $this->createCookieSite('Set-cookie: a=AAA'); + $agent = $this->createMockedRequestUserAgent($request); + + $this->assertNull($agent->getBaseCookieValue("a", false)); + $agent->fetchResponse( + new SimpleUrl('http://this.com/this/path/page.html'), + new SimpleGetEncoding()); + $agent->setCookie("b", "BBB", "this.com", "this/path/"); + $this->assertEqual( + $agent->getBaseCookieValue("a", new SimpleUrl('http://this.com/this/path/page.html')), + "AAA"); + $this->assertEqual( + $agent->getBaseCookieValue("b", new SimpleUrl('http://this.com/this/path/page.html')), + "BBB"); + } +} + +class TestOfHttpRedirects extends UnitTestCase { + + function createRedirect($content, $redirect) { + $headers = new MockSimpleHttpHeaders(); + $headers->setReturnValue('isRedirect', (boolean)$redirect); + $headers->setReturnValue('getLocation', $redirect); + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('getContent', $content); + $response->setReturnReference('getHeaders', $headers); + $request = new MockSimpleHttpRequest(); + $request->setReturnReference('fetch', $response); + return $request; + } + + function testDisabledRedirects() { + $agent = new MockRequestUserAgent(); + $agent->returns( + 'createHttpRequest', + $this->createRedirect('stuff', 'there.html')); + $agent->expectOnce('createHttpRequest'); + $agent->__construct(); + $agent->setMaximumRedirects(0); + $response = $agent->fetchResponse(new SimpleUrl('here.html'), new SimpleGetEncoding()); + $this->assertEqual($response->getContent(), 'stuff'); + } + + function testSingleRedirect() { + $agent = new MockRequestUserAgent(); + $agent->returnsAt( + 0, + 'createHttpRequest', + $this->createRedirect('first', 'two.html')); + $agent->returnsAt( + 1, + 'createHttpRequest', + $this->createRedirect('second', 'three.html')); + $agent->expectCallCount('createHttpRequest', 2); + $agent->__construct(); + + $agent->setMaximumRedirects(1); + $response = $agent->fetchResponse(new SimpleUrl('one.html'), new SimpleGetEncoding()); + $this->assertEqual($response->getContent(), 'second'); + } + + function testDoubleRedirect() { + $agent = new MockRequestUserAgent(); + $agent->returnsAt( + 0, + 'createHttpRequest', + $this->createRedirect('first', 'two.html')); + $agent->returnsAt( + 1, + 'createHttpRequest', + $this->createRedirect('second', 'three.html')); + $agent->returnsAt( + 2, + 'createHttpRequest', + $this->createRedirect('third', 'four.html')); + $agent->expectCallCount('createHttpRequest', 3); + $agent->__construct(); + + $agent->setMaximumRedirects(2); + $response = $agent->fetchResponse(new SimpleUrl('one.html'), new SimpleGetEncoding()); + $this->assertEqual($response->getContent(), 'third'); + } + + function testSuccessAfterRedirect() { + $agent = new MockRequestUserAgent(); + $agent->returnsAt( + 0, + 'createHttpRequest', + $this->createRedirect('first', 'two.html')); + $agent->returnsAt( + 1, + 'createHttpRequest', + $this->createRedirect('second', false)); + $agent->returnsAt( + 2, + 'createHttpRequest', + $this->createRedirect('third', 'four.html')); + $agent->expectCallCount('createHttpRequest', 2); + $agent->__construct(); + + $agent->setMaximumRedirects(2); + $response = $agent->fetchResponse(new SimpleUrl('one.html'), new SimpleGetEncoding()); + $this->assertEqual($response->getContent(), 'second'); + } + + function testRedirectChangesPostToGet() { + $agent = new MockRequestUserAgent(); + $agent->returnsAt( + 0, + 'createHttpRequest', + $this->createRedirect('first', 'two.html')); + $agent->expectAt(0, 'createHttpRequest', array('*', new IsAExpectation('SimplePostEncoding'))); + $agent->returnsAt( + 1, + 'createHttpRequest', + $this->createRedirect('second', 'three.html')); + $agent->expectAt(1, 'createHttpRequest', array('*', new IsAExpectation('SimpleGetEncoding'))); + $agent->expectCallCount('createHttpRequest', 2); + $agent->__construct(); + $agent->setMaximumRedirects(1); + $response = $agent->fetchResponse(new SimpleUrl('one.html'), new SimplePostEncoding()); + } +} + +class TestOfBadHosts extends UnitTestCase { + + private function createSimulatedBadHost() { + $response = new MockSimpleHttpResponse(); + $response->setReturnValue('isError', true); + $response->setReturnValue('getError', 'Bad socket'); + $response->setReturnValue('getContent', false); + $request = new MockSimpleHttpRequest(); + $request->setReturnReference('fetch', $response); + return $request; + } + + function testUntestedHost() { + $request = $this->createSimulatedBadHost(); + $agent = new MockRequestUserAgent(); + $agent->setReturnReference('createHttpRequest', $request); + $agent->__construct(); + $response = $agent->fetchResponse( + new SimpleUrl('http://this.host/this/path/page.html'), + new SimpleGetEncoding()); + $this->assertTrue($response->isError()); + } +} + +class TestOfAuthorisation extends UnitTestCase { + + function testAuthenticateHeaderAdded() { + $response = new MockSimpleHttpResponse(); + $response->setReturnReference('getHeaders', new MockSimpleHttpHeaders()); + + $request = new MockSimpleHttpRequest(); + $request->returns('fetch', $response); + $request->expectOnce( + 'addHeaderLine', + array('Authorization: Basic ' . base64_encode('test:secret'))); + + $agent = new MockRequestUserAgent(); + $agent->returns('createHttpRequest', $request); + $agent->__construct(); + $response = $agent->fetchResponse( + new SimpleUrl('http://test:secret@this.host'), + new SimpleGetEncoding()); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/utf8_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/utf8_test.php new file mode 100644 index 0000000..8dc8f81 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/utf8_test.php @@ -0,0 +1,78 @@ +addPattern("eé"); + $this->assertTrue($regex->match("eéêè", $match)); + $this->assertEqual($match, "eé"); + } + + function testWithTextInLatin1() { + $regex = &new ParallelRegex(false); + $regex->addPattern(utf8_decode("eé")); + $this->assertTrue($regex->match(utf8_decode("eéêè"), $match)); + $this->assertEqual($match, utf8_decode("eé")); + } + + function &createParser() { + $parser = &new MockSimpleHtmlSaxParser(); + $parser->setReturnValue('acceptStartToken', true); + $parser->setReturnValue('acceptEndToken', true); + $parser->setReturnValue('acceptAttributeToken', true); + $parser->setReturnValue('acceptEntityToken', true); + $parser->setReturnValue('acceptTextToken', true); + $parser->setReturnValue('ignore', true); + return $parser; + } + + function testTagWithAttributesInUTF8() { + $parser = &$this->createParser(); + $parser->expectOnce('acceptTextToken', array('label', '*')); + $parser->expectAt(0, 'acceptStartToken', array('expectAt(1, 'acceptStartToken', array('href', '*')); + $parser->expectAt(2, 'acceptStartToken', array('>', '*')); + $parser->expectCallCount('acceptStartToken', 3); + $parser->expectAt(0, 'acceptAttributeToken', array('= "', '*')); + $parser->expectAt(1, 'acceptAttributeToken', array('hère.html', '*')); + $parser->expectAt(2, 'acceptAttributeToken', array('"', '*')); + $parser->expectCallCount('acceptAttributeToken', 3); + $parser->expectOnce('acceptEndToken', array('', '*')); + $lexer = &new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse('label')); + } + + function testTagWithAttributesInLatin1() { + $parser = &$this->createParser(); + $parser->expectOnce('acceptTextToken', array('label', '*')); + $parser->expectAt(0, 'acceptStartToken', array('expectAt(1, 'acceptStartToken', array('href', '*')); + $parser->expectAt(2, 'acceptStartToken', array('>', '*')); + $parser->expectCallCount('acceptStartToken', 3); + $parser->expectAt(0, 'acceptAttributeToken', array('= "', '*')); + $parser->expectAt(1, 'acceptAttributeToken', array(utf8_decode('hère.html'), '*')); + $parser->expectAt(2, 'acceptAttributeToken', array('"', '*')); + $parser->expectCallCount('acceptAttributeToken', 3); + $parser->expectOnce('acceptEndToken', array('', '*')); + $lexer = &new SimpleHtmlLexer($parser); + $this->assertTrue($lexer->parse(utf8_decode('label'))); + } +} + +class TestOfUrlithDifferentCharset extends UnitTestCase { + function testUsernameAndPasswordInUTF8() { + $url = new SimpleUrl('http://pÈrick:penËt@www.lastcraft.com'); + $this->assertEqual($url->getUsername(), 'pÈrick'); + $this->assertEqual($url->getPassword(), 'penËt'); + } +} + +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/visual/visual_errors.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/visual/visual_errors.php new file mode 100644 index 0000000..15c0ebf --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/visual/visual_errors.php @@ -0,0 +1,65 @@ +dump('Four exceptions...'); + trigger_error('Default'); + trigger_error('Error', E_USER_ERROR); + trigger_error('Warning', E_USER_WARNING); + trigger_error('Notice', E_USER_NOTICE); + } + + function testErrorTrap() { + $this->dump('Pass...'); + $this->expectError(); + trigger_error('Error'); + } + + function testUnusedErrorExpectationsCauseFailures() { + $this->dump('Two failures...'); + $this->expectError('Some error'); + $this->expectError(); + } + + function testErrorTextIsSentImmediately() { + $this->dump('One failure...'); + $this->expectError('Error'); + trigger_error('Error almost'); + $this->dump('This should lie between the two errors'); + trigger_error('Error after'); + } +} + +class VisualTestOfExceptions extends UnitTestCase { + function skip() { + $this->skipUnless(version_compare(phpversion(), '5') >= 0); + } + + function testExceptionTrap() { + $this->dump('One exception...'); + $this->ouch(); + $this->fail('Should not be here'); + } + + function testExceptionExpectationShowsErrorWhenNoException() { + $this->dump('One failure...'); + $this->expectException('SomeException'); + $this->expectException('LaterException'); + } + + function testExceptionExpectationShowsPassWhenException() { + $this->dump('Pass...'); + $this->expectException(); + $this->ouch(); + } + + function ouch() { + eval('throw new Exception("Ouch!");'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/visual_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/visual_test.php new file mode 100644 index 0000000..5bde610 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/visual_test.php @@ -0,0 +1,495 @@ +a = $a; + } + } + + class PassingUnitTestCaseOutput extends UnitTestCase { + + function testOfResults() { + $this->pass('Pass'); + } + + function testTrue() { + $this->assertTrue(true); + } + + function testFalse() { + $this->assertFalse(false); + } + + function testExpectation() { + $expectation = &new EqualExpectation(25, 'My expectation message: %s'); + $this->assert($expectation, 25, 'My assert message : %s'); + } + + function testNull() { + $this->assertNull(null, "%s -> Pass"); + $this->assertNotNull(false, "%s -> Pass"); + } + + function testType() { + $this->assertIsA("hello", "string", "%s -> Pass"); + $this->assertIsA($this, "PassingUnitTestCaseOutput", "%s -> Pass"); + $this->assertIsA($this, "UnitTestCase", "%s -> Pass"); + } + + function testTypeEquality() { + $this->assertEqual("0", 0, "%s -> Pass"); + } + + function testNullEquality() { + $this->assertNotEqual(null, 1, "%s -> Pass"); + $this->assertNotEqual(1, null, "%s -> Pass"); + } + + function testIntegerEquality() { + $this->assertNotEqual(1, 2, "%s -> Pass"); + } + + function testStringEquality() { + $this->assertEqual("a", "a", "%s -> Pass"); + $this->assertNotEqual("aa", "ab", "%s -> Pass"); + } + + function testHashEquality() { + $this->assertEqual(array("a" => "A", "b" => "B"), array("b" => "B", "a" => "A"), "%s -> Pass"); + } + + function testWithin() { + $this->assertWithinMargin(5, 5.4, 0.5, "%s -> Pass"); + } + + function testOutside() { + $this->assertOutsideMargin(5, 5.6, 0.5, "%s -> Pass"); + } + + function testStringIdentity() { + $a = "fred"; + $b = $a; + $this->assertIdentical($a, $b, "%s -> Pass"); + } + + function testTypeIdentity() { + $a = "0"; + $b = 0; + $this->assertNotIdentical($a, $b, "%s -> Pass"); + } + + function testNullIdentity() { + $this->assertNotIdentical(null, 1, "%s -> Pass"); + $this->assertNotIdentical(1, null, "%s -> Pass"); + } + + function testHashIdentity() { + } + + function testObjectEquality() { + $this->assertEqual(new TestDisplayClass(4), new TestDisplayClass(4), "%s -> Pass"); + $this->assertNotEqual(new TestDisplayClass(4), new TestDisplayClass(5), "%s -> Pass"); + } + + function testObjectIndentity() { + $this->assertIdentical(new TestDisplayClass(false), new TestDisplayClass(false), "%s -> Pass"); + $this->assertNotIdentical(new TestDisplayClass(false), new TestDisplayClass(0), "%s -> Pass"); + } + + function testReference() { + $a = "fred"; + $b = &$a; + $this->assertReference($a, $b, "%s -> Pass"); + } + + function testCloneOnDifferentObjects() { + $a = "fred"; + $b = $a; + $c = "Hello"; + $this->assertClone($a, $b, "%s -> Pass"); + } + + function testPatterns() { + $this->assertPattern('/hello/i', "Hello there", "%s -> Pass"); + $this->assertNoPattern('/hello/', "Hello there", "%s -> Pass"); + } + + function testLongStrings() { + $text = ""; + for ($i = 0; $i < 10; $i++) { + $text .= "0123456789"; + } + $this->assertEqual($text, $text); + } + } + + class FailingUnitTestCaseOutput extends UnitTestCase { + + function testOfResults() { + $this->fail('Fail'); // Fail. + } + + function testTrue() { + $this->assertTrue(false); // Fail. + } + + function testFalse() { + $this->assertFalse(true); // Fail. + } + + function testExpectation() { + $expectation = &new EqualExpectation(25, 'My expectation message: %s'); + $this->assert($expectation, 24, 'My assert message : %s'); // Fail. + } + + function testNull() { + $this->assertNull(false, "%s -> Fail"); // Fail. + $this->assertNotNull(null, "%s -> Fail"); // Fail. + } + + function testType() { + $this->assertIsA(14, "string", "%s -> Fail"); // Fail. + $this->assertIsA(14, "TestOfUnitTestCaseOutput", "%s -> Fail"); // Fail. + $this->assertIsA($this, "TestReporter", "%s -> Fail"); // Fail. + } + + function testTypeEquality() { + $this->assertNotEqual("0", 0, "%s -> Fail"); // Fail. + } + + function testNullEquality() { + $this->assertEqual(null, 1, "%s -> Fail"); // Fail. + $this->assertEqual(1, null, "%s -> Fail"); // Fail. + } + + function testIntegerEquality() { + $this->assertEqual(1, 2, "%s -> Fail"); // Fail. + } + + function testStringEquality() { + $this->assertNotEqual("a", "a", "%s -> Fail"); // Fail. + $this->assertEqual("aa", "ab", "%s -> Fail"); // Fail. + } + + function testHashEquality() { + $this->assertEqual(array("a" => "A", "b" => "B"), array("b" => "B", "a" => "Z"), "%s -> Fail"); + } + + function testWithin() { + $this->assertWithinMargin(5, 5.6, 0.5, "%s -> Fail"); // Fail. + } + + function testOutside() { + $this->assertOutsideMargin(5, 5.4, 0.5, "%s -> Fail"); // Fail. + } + + function testStringIdentity() { + $a = "fred"; + $b = $a; + $this->assertNotIdentical($a, $b, "%s -> Fail"); // Fail. + } + + function testTypeIdentity() { + $a = "0"; + $b = 0; + $this->assertIdentical($a, $b, "%s -> Fail"); // Fail. + } + + function testNullIdentity() { + $this->assertIdentical(null, 1, "%s -> Fail"); // Fail. + $this->assertIdentical(1, null, "%s -> Fail"); // Fail. + } + + function testHashIdentity() { + $this->assertIdentical(array("a" => "A", "b" => "B"), array("b" => "B", "a" => "A"), "%s -> fail"); // Fail. + } + + function testObjectEquality() { + $this->assertNotEqual(new TestDisplayClass(4), new TestDisplayClass(4), "%s -> Fail"); // Fail. + $this->assertEqual(new TestDisplayClass(4), new TestDisplayClass(5), "%s -> Fail"); // Fail. + } + + function testObjectIndentity() { + $this->assertNotIdentical(new TestDisplayClass(false), new TestDisplayClass(false), "%s -> Fail"); // Fail. + $this->assertIdentical(new TestDisplayClass(false), new TestDisplayClass(0), "%s -> Fail"); // Fail. + } + + function testReference() { + $a = "fred"; + $b = &$a; + $this->assertClone($a, $b, "%s -> Fail"); // Fail. + } + + function testCloneOnDifferentObjects() { + $a = "fred"; + $b = $a; + $c = "Hello"; + $this->assertClone($a, $c, "%s -> Fail"); // Fail. + } + + function testPatterns() { + $this->assertPattern('/hello/', "Hello there", "%s -> Fail"); // Fail. + $this->assertNoPattern('/hello/i', "Hello there", "%s -> Fail"); // Fail. + } + + function testLongStrings() { + $text = ""; + for ($i = 0; $i < 10; $i++) { + $text .= "0123456789"; + } + $this->assertEqual($text . $text, $text . "a" . $text); // Fail. + } +} + + class Dummy { + function Dummy() { + } + + function a() { + } + } + Mock::generate('Dummy'); + + class TestOfMockObjectsOutput extends UnitTestCase { + + function testCallCounts() { + $dummy = &new MockDummy(); + $dummy->expectCallCount('a', 1, 'My message: %s'); + $dummy->a(); + $dummy->a(); + } + + function testMinimumCallCounts() { + $dummy = &new MockDummy(); + $dummy->expectMinimumCallCount('a', 2, 'My message: %s'); + $dummy->a(); + $dummy->a(); + } + + function testEmptyMatching() { + $dummy = &new MockDummy(); + $dummy->expect('a', array()); + $dummy->a(); + $dummy->a(null); // Fail. + } + + function testEmptyMatchingWithCustomMessage() { + $dummy = &new MockDummy(); + $dummy->expect('a', array(), 'My expectation message: %s'); + $dummy->a(); + $dummy->a(null); // Fail. + } + + function testNullMatching() { + $dummy = &new MockDummy(); + $dummy->expect('a', array(null)); + $dummy->a(null); + $dummy->a(); // Fail. + } + + function testBooleanMatching() { + $dummy = &new MockDummy(); + $dummy->expect('a', array(true, false)); + $dummy->a(true, false); + $dummy->a(true, true); // Fail. + } + + function testIntegerMatching() { + $dummy = &new MockDummy(); + $dummy->expect('a', array(32, 33)); + $dummy->a(32, 33); + $dummy->a(32, 34); // Fail. + } + + function testFloatMatching() { + $dummy = &new MockDummy(); + $dummy->expect('a', array(3.2, 3.3)); + $dummy->a(3.2, 3.3); + $dummy->a(3.2, 3.4); // Fail. + } + + function testStringMatching() { + $dummy = &new MockDummy(); + $dummy->expect('a', array('32', '33')); + $dummy->a('32', '33'); + $dummy->a('32', '34'); // Fail. + } + + function testEmptyMatchingWithCustomExpectationMessage() { + $dummy = &new MockDummy(); + $dummy->expect( + 'a', + array(new EqualExpectation('A', 'My part expectation message: %s')), + 'My expectation message: %s'); + $dummy->a('A'); + $dummy->a('B'); // Fail. + } + + function testArrayMatching() { + $dummy = &new MockDummy(); + $dummy->expect('a', array(array(32), array(33))); + $dummy->a(array(32), array(33)); + $dummy->a(array(32), array('33')); // Fail. + } + + function testObjectMatching() { + $a = new Dummy(); + $a->a = 'a'; + $b = new Dummy(); + $b->b = 'b'; + $dummy = &new MockDummy(); + $dummy->expect('a', array($a, $b)); + $dummy->a($a, $b); + $dummy->a($a, $a); // Fail. + } + + function testBigList() { + $dummy = &new MockDummy(); + $dummy->expect('a', array(false, 0, 1, 1.0)); + $dummy->a(false, 0, 1, 1.0); + $dummy->a(true, false, 2, 2.0); // Fail. + } + } + + class TestOfPastBugs extends UnitTestCase { + + function testMixedTypes() { + $this->assertEqual(array(), null, "%s -> Pass"); + $this->assertIdentical(array(), null, "%s -> Fail"); // Fail. + } + + function testMockWildcards() { + $dummy = &new MockDummy(); + $dummy->expect('a', array('*', array(33))); + $dummy->a(array(32), array(33)); + $dummy->a(array(32), array('33')); // Fail. + } + } + + class TestOfVisualShell extends ShellTestCase { + + function testDump() { + $this->execute('ls'); + $this->dumpOutput(); + $this->execute('dir'); + $this->dumpOutput(); + } + + function testDumpOfList() { + $this->execute('ls'); + $this->dump($this->getOutputAsList()); + } + } + + class PassesAsWellReporter extends HtmlReporter { + + protected function getCss() { + return parent::getCss() . ' .pass { color: darkgreen; }'; + } + + function paintPass($message) { + parent::paintPass($message); + print "Pass: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode(" -> ", $breadcrumb); + print " -> " . htmlentities($message) . "
    \n"; + } + + function paintSignal($type, &$payload) { + print "$type: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode(" -> ", $breadcrumb); + print " -> " . htmlentities(serialize($payload)) . "
    \n"; + } + } + + class TestOfSkippingNoMatterWhat extends UnitTestCase { + function skip() { + $this->skipIf(true, 'Always skipped -> %s'); + } + + function testFail() { + $this->fail('This really shouldn\'t have happened'); + } + } + + class TestOfSkippingOrElse extends UnitTestCase { + function skip() { + $this->skipUnless(false, 'Always skipped -> %s'); + } + + function testFail() { + $this->fail('This really shouldn\'t have happened'); + } + } + + class TestOfSkippingTwiceOver extends UnitTestCase { + function skip() { + $this->skipIf(true, 'First reason -> %s'); + $this->skipIf(true, 'Second reason -> %s'); + } + + function testFail() { + $this->fail('This really shouldn\'t have happened'); + } + } + + class TestThatShouldNotBeSkipped extends UnitTestCase { + function skip() { + $this->skipIf(false); + $this->skipUnless(true); + } + + function testFail() { + $this->fail('We should see this message'); + } + + function testPass() { + $this->pass('We should see this message'); + } + } + + $test = &new TestSuite('Visual test with 46 passes, 47 fails and 0 exceptions'); + $test->add(new PassingUnitTestCaseOutput()); + $test->add(new FailingUnitTestCaseOutput()); + $test->add(new TestOfMockObjectsOutput()); + $test->add(new TestOfPastBugs()); + $test->add(new TestOfVisualShell()); + $test->add(new TestOfSkippingNoMatterWhat()); + $test->add(new TestOfSkippingOrElse()); + $test->add(new TestOfSkippingTwiceOver()); + $test->add(new TestThatShouldNotBeSkipped()); + + if (isset($_GET['xml']) || in_array('xml', (isset($argv) ? $argv : array()))) { + $reporter = new XmlReporter(); + } elseif (TextReporter::inCli()) { + $reporter = new TextReporter(); + } else { + $reporter = new PassesAsWellReporter(); + } + if (isset($_GET['dry']) || in_array('dry', (isset($argv) ? $argv : array()))) { + $reporter->makeDry(); + } + exit ($test->run($reporter) ? 0 : 1); +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/web_tester_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/web_tester_test.php new file mode 100644 index 0000000..8c3bf1a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/web_tester_test.php @@ -0,0 +1,155 @@ +assertTrue($expectation->test('a')); + $this->assertTrue($expectation->test(array('a'))); + $this->assertFalse($expectation->test('A')); + } + + function testMatchesInteger() { + $expectation = new FieldExpectation('1'); + $this->assertTrue($expectation->test('1')); + $this->assertTrue($expectation->test(1)); + $this->assertTrue($expectation->test(array('1'))); + $this->assertTrue($expectation->test(array(1))); + } + + function testNonStringFailsExpectation() { + $expectation = new FieldExpectation('a'); + $this->assertFalse($expectation->test(null)); + } + + function testUnsetFieldCanBeTestedFor() { + $expectation = new FieldExpectation(false); + $this->assertTrue($expectation->test(false)); + } + + function testMultipleValuesCanBeInAnyOrder() { + $expectation = new FieldExpectation(array('a', 'b')); + $this->assertTrue($expectation->test(array('a', 'b'))); + $this->assertTrue($expectation->test(array('b', 'a'))); + $this->assertFalse($expectation->test(array('a', 'a'))); + $this->assertFalse($expectation->test('a')); + } + + function testSingleItemCanBeArrayOrString() { + $expectation = new FieldExpectation(array('a')); + $this->assertTrue($expectation->test(array('a'))); + $this->assertTrue($expectation->test('a')); + } +} + +class TestOfHeaderExpectations extends UnitTestCase { + + function testExpectingOnlyTheHeaderName() { + $expectation = new HttpHeaderExpectation('a'); + $this->assertIdentical($expectation->test(false), false); + $this->assertIdentical($expectation->test('a: A'), true); + $this->assertIdentical($expectation->test('A: A'), true); + $this->assertIdentical($expectation->test('a: B'), true); + $this->assertIdentical($expectation->test(' a : A '), true); + } + + function testHeaderValueAsWell() { + $expectation = new HttpHeaderExpectation('a', 'A'); + $this->assertIdentical($expectation->test(false), false); + $this->assertIdentical($expectation->test('a: A'), true); + $this->assertIdentical($expectation->test('A: A'), true); + $this->assertIdentical($expectation->test('A: a'), false); + $this->assertIdentical($expectation->test('a: B'), false); + $this->assertIdentical($expectation->test(' a : A '), true); + $this->assertIdentical($expectation->test(' a : AB '), false); + } + + function testHeaderValueWithColons() { + $expectation = new HttpHeaderExpectation('a', 'A:B:C'); + $this->assertIdentical($expectation->test('a: A'), false); + $this->assertIdentical($expectation->test('a: A:B'), false); + $this->assertIdentical($expectation->test('a: A:B:C'), true); + $this->assertIdentical($expectation->test('a: A:B:C:D'), false); + } + + function testMultilineSearch() { + $expectation = new HttpHeaderExpectation('a', 'A'); + $this->assertIdentical($expectation->test("aa: A\r\nb: B\r\nc: C"), false); + $this->assertIdentical($expectation->test("aa: A\r\na: A\r\nb: B"), true); + } + + function testMultilineSearchWithPadding() { + $expectation = new HttpHeaderExpectation('a', ' A '); + $this->assertIdentical($expectation->test("aa:A\r\nb:B\r\nc:C"), false); + $this->assertIdentical($expectation->test("aa:A\r\na:A\r\nb:B"), true); + } + + function testPatternMatching() { + $expectation = new HttpHeaderExpectation('a', new PatternExpectation('/A/')); + $this->assertIdentical($expectation->test('a: A'), true); + $this->assertIdentical($expectation->test('A: A'), true); + $this->assertIdentical($expectation->test('A: a'), false); + $this->assertIdentical($expectation->test('a: B'), false); + $this->assertIdentical($expectation->test(' a : A '), true); + $this->assertIdentical($expectation->test(' a : AB '), true); + } + + function testCaseInsensitivePatternMatching() { + $expectation = new HttpHeaderExpectation('a', new PatternExpectation('/A/i')); + $this->assertIdentical($expectation->test('a: a'), true); + $this->assertIdentical($expectation->test('a: B'), false); + $this->assertIdentical($expectation->test(' a : A '), true); + $this->assertIdentical($expectation->test(' a : BAB '), true); + $this->assertIdentical($expectation->test(' a : bab '), true); + } + + function testUnwantedHeader() { + $expectation = new NoHttpHeaderExpectation('a'); + $this->assertIdentical($expectation->test(''), true); + $this->assertIdentical($expectation->test('stuff'), true); + $this->assertIdentical($expectation->test('b: B'), true); + $this->assertIdentical($expectation->test('a: A'), false); + $this->assertIdentical($expectation->test('A: A'), false); + } + + function testMultilineUnwantedSearch() { + $expectation = new NoHttpHeaderExpectation('a'); + $this->assertIdentical($expectation->test("aa:A\r\nb:B\r\nc:C"), true); + $this->assertIdentical($expectation->test("aa:A\r\na:A\r\nb:B"), false); + } + + function testLocationHeaderSplitsCorrectly() { + $expectation = new HttpHeaderExpectation('Location', 'http://here/'); + $this->assertIdentical($expectation->test('Location: http://here/'), true); + } +} + +class TestOfTextExpectations extends UnitTestCase { + + function testMatchingSubString() { + $expectation = new TextExpectation('wanted'); + $this->assertIdentical($expectation->test(''), false); + $this->assertIdentical($expectation->test('Wanted'), false); + $this->assertIdentical($expectation->test('wanted'), true); + $this->assertIdentical($expectation->test('the wanted text is here'), true); + } + + function testNotMatchingSubString() { + $expectation = new NoTextExpectation('wanted'); + $this->assertIdentical($expectation->test(''), true); + $this->assertIdentical($expectation->test('Wanted'), true); + $this->assertIdentical($expectation->test('wanted'), false); + $this->assertIdentical($expectation->test('the wanted text is here'), false); + } +} + +class TestOfGenericAssertionsInWebTester extends WebTestCase { + function testEquality() { + $this->assertEqual('a', 'a'); + $this->assertNotEqual('a', 'A'); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/xml_test.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/xml_test.php new file mode 100644 index 0000000..f99e0dc --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test/xml_test.php @@ -0,0 +1,187 @@ + 2)); + $this->assertEqual($nesting->getSize(), 2); + } +} + +class TestOfXmlStructureParsing extends UnitTestCase { + function testValidXml() { + $listener = new MockSimpleScorer(); + $listener->expectNever('paintGroupStart'); + $listener->expectNever('paintGroupEnd'); + $listener->expectNever('paintCaseStart'); + $listener->expectNever('paintCaseEnd'); + $parser = new SimpleTestXmlParser($listener); + $this->assertTrue($parser->parse("\n")); + $this->assertTrue($parser->parse("\n")); + $this->assertTrue($parser->parse("\n")); + } + + function testEmptyGroup() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintGroupStart', array('a_group', 7)); + $listener->expectOnce('paintGroupEnd', array('a_group')); + $parser = new SimpleTestXmlParser($listener); + $parser->parse("\n"); + $parser->parse("\n"); + $this->assertTrue($parser->parse("\n")); + $this->assertTrue($parser->parse("a_group\n")); + $this->assertTrue($parser->parse("\n")); + $parser->parse("\n"); + } + + function testEmptyCase() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintCaseStart', array('a_case')); + $listener->expectOnce('paintCaseEnd', array('a_case')); + $parser = new SimpleTestXmlParser($listener); + $parser->parse("\n"); + $parser->parse("\n"); + $this->assertTrue($parser->parse("\n")); + $this->assertTrue($parser->parse("a_case\n")); + $this->assertTrue($parser->parse("\n")); + $parser->parse("\n"); + } + + function testEmptyMethod() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintCaseStart', array('a_case')); + $listener->expectOnce('paintCaseEnd', array('a_case')); + $listener->expectOnce('paintMethodStart', array('a_method')); + $listener->expectOnce('paintMethodEnd', array('a_method')); + $parser = new SimpleTestXmlParser($listener); + $parser->parse("\n"); + $parser->parse("\n"); + $parser->parse("\n"); + $parser->parse("a_case\n"); + $this->assertTrue($parser->parse("\n")); + $this->assertTrue($parser->parse("a_method\n")); + $this->assertTrue($parser->parse("\n")); + $parser->parse("\n"); + $parser->parse("\n"); + } + + function testNestedGroup() { + $listener = new MockSimpleScorer(); + $listener->expectAt(0, 'paintGroupStart', array('a_group', 7)); + $listener->expectAt(1, 'paintGroupStart', array('b_group', 3)); + $listener->expectCallCount('paintGroupStart', 2); + $listener->expectAt(0, 'paintGroupEnd', array('b_group')); + $listener->expectAt(1, 'paintGroupEnd', array('a_group')); + $listener->expectCallCount('paintGroupEnd', 2); + + $parser = new SimpleTestXmlParser($listener); + $parser->parse("\n"); + $parser->parse("\n"); + + $this->assertTrue($parser->parse("\n")); + $this->assertTrue($parser->parse("a_group\n")); + $this->assertTrue($parser->parse("\n")); + $this->assertTrue($parser->parse("b_group\n")); + $this->assertTrue($parser->parse("\n")); + $this->assertTrue($parser->parse("\n")); + $parser->parse("\n"); + } +} + +class AnyOldSignal { + public $stuff = true; +} + +class TestOfXmlResultsParsing extends UnitTestCase { + + function sendValidStart(&$parser) { + $parser->parse("\n"); + $parser->parse("\n"); + $parser->parse("\n"); + $parser->parse("a_case\n"); + $parser->parse("\n"); + $parser->parse("a_method\n"); + } + + function sendValidEnd(&$parser) { + $parser->parse("\n"); + $parser->parse("\n"); + $parser->parse("\n"); + } + + function testPass() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintPass', array('a_message')); + $parser = new SimpleTestXmlParser($listener); + $this->sendValidStart($parser); + $this->assertTrue($parser->parse("a_message\n")); + $this->sendValidEnd($parser); + } + + function testFail() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintFail', array('a_message')); + $parser = new SimpleTestXmlParser($listener); + $this->sendValidStart($parser); + $this->assertTrue($parser->parse("a_message\n")); + $this->sendValidEnd($parser); + } + + function testException() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintError', array('a_message')); + $parser = new SimpleTestXmlParser($listener); + $this->sendValidStart($parser); + $this->assertTrue($parser->parse("a_message\n")); + $this->sendValidEnd($parser); + } + + function testSkip() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintSkip', array('a_message')); + $parser = new SimpleTestXmlParser($listener); + $this->sendValidStart($parser); + $this->assertTrue($parser->parse("a_message\n")); + $this->sendValidEnd($parser); + } + + function testSignal() { + $signal = new AnyOldSignal(); + $signal->stuff = "Hello"; + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintSignal', array('a_signal', $signal)); + $parser = new SimpleTestXmlParser($listener); + $this->sendValidStart($parser); + $this->assertTrue($parser->parse( + "\n")); + $this->sendValidEnd($parser); + } + + function testMessage() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintMessage', array('a_message')); + $parser = new SimpleTestXmlParser($listener); + $this->sendValidStart($parser); + $this->assertTrue($parser->parse("a_message\n")); + $this->sendValidEnd($parser); + } + + function testFormattedMessage() { + $listener = new MockSimpleScorer(); + $listener->expectOnce('paintFormattedMessage', array("\na\tmessage\n")); + $parser = new SimpleTestXmlParser($listener); + $this->sendValidStart($parser); + $this->assertTrue($parser->parse("\n")); + $this->sendValidEnd($parser); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test_case.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test_case.php new file mode 100644 index 0000000..1666548 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/test_case.php @@ -0,0 +1,655 @@ +label = $label; + } + } + + /** + * Accessor for the test name for subclasses. + * @return string Name of the test. + * @access public + */ + function getLabel() { + return $this->label ? $this->label : get_class($this); + } + + /** + * This is a placeholder for skipping tests. In this + * method you place skipIf() and skipUnless() calls to + * set the skipping state. + * @access public + */ + function skip() { + } + + /** + * Will issue a message to the reporter and tell the test + * case to skip if the incoming flag is true. + * @param string $should_skip Condition causing the tests to be skipped. + * @param string $message Text of skip condition. + * @access public + */ + function skipIf($should_skip, $message = '%s') { + if ($should_skip && ! $this->should_skip) { + $this->should_skip = true; + $message = sprintf($message, 'Skipping [' . get_class($this) . ']'); + $this->reporter->paintSkip($message . $this->getAssertionLine()); + } + } + + /** + * Accessor for the private variable $_shoud_skip + * @access public + */ + function shouldSkip() { + return $this->should_skip; + } + + /** + * Will issue a message to the reporter and tell the test + * case to skip if the incoming flag is false. + * @param string $shouldnt_skip Condition causing the tests to be run. + * @param string $message Text of skip condition. + * @access public + */ + function skipUnless($shouldnt_skip, $message = false) { + $this->skipIf(! $shouldnt_skip, $message); + } + + /** + * Used to invoke the single tests. + * @return SimpleInvoker Individual test runner. + * @access public + */ + function createInvoker() { + return new SimpleExceptionTrappingInvoker( + new SimpleErrorTrappingInvoker(new SimpleInvoker($this))); + } + + /** + * Uses reflection to run every method within itself + * starting with the string "test" unless a method + * is specified. + * @param SimpleReporter $reporter Current test reporter. + * @return boolean True if all tests passed. + * @access public + */ + function run($reporter) { + $context = SimpleTest::getContext(); + $context->setTest($this); + $context->setReporter($reporter); + $this->reporter = $reporter; + $started = false; + foreach ($this->getTests() as $method) { + if ($reporter->shouldInvoke($this->getLabel(), $method)) { + $this->skip(); + if ($this->should_skip) { + break; + } + if (! $started) { + $reporter->paintCaseStart($this->getLabel()); + $started = true; + } + $invoker = $this->reporter->createInvoker($this->createInvoker()); + $invoker->before($method); + $invoker->invoke($method); + $invoker->after($method); + } + } + if ($started) { + $reporter->paintCaseEnd($this->getLabel()); + } + unset($this->reporter); + return $reporter->getStatus(); + } + + /** + * Gets a list of test names. Normally that will + * be all internal methods that start with the + * name "test". This method should be overridden + * if you want a different rule. + * @return array List of test names. + * @access public + */ + function getTests() { + $methods = array(); + foreach (get_class_methods(get_class($this)) as $method) { + if ($this->isTest($method)) { + $methods[] = $method; + } + } + return $methods; + } + + /** + * Tests to see if the method is a test that should + * be run. Currently any method that starts with 'test' + * is a candidate unless it is the constructor. + * @param string $method Method name to try. + * @return boolean True if test method. + * @access protected + */ + protected function isTest($method) { + if (strtolower(substr($method, 0, 4)) == 'test') { + return ! SimpleTestCompatibility::isA($this, strtolower($method)); + } + return false; + } + + /** + * Announces the start of the test. + * @param string $method Test method just started. + * @access public + */ + function before($method) { + $this->reporter->paintMethodStart($method); + $this->observers = array(); + } + + /** + * Sets up unit test wide variables at the start + * of each test method. To be overridden in + * actual user test cases. + * @access public + */ + function setUp() { + } + + /** + * Clears the data set in the setUp() method call. + * To be overridden by the user in actual user test cases. + * @access public + */ + function tearDown() { + } + + /** + * Announces the end of the test. Includes private clean up. + * @param string $method Test method just finished. + * @access public + */ + function after($method) { + for ($i = 0; $i < count($this->observers); $i++) { + $this->observers[$i]->atTestEnd($method, $this); + } + $this->reporter->paintMethodEnd($method); + } + + /** + * Sets up an observer for the test end. + * @param object $observer Must have atTestEnd() + * method. + * @access public + */ + function tell($observer) { + $this->observers[] = &$observer; + } + + /** + * @deprecated + */ + function pass($message = "Pass") { + if (! isset($this->reporter)) { + trigger_error('Can only make assertions within test methods'); + } + $this->reporter->paintPass( + $message . $this->getAssertionLine()); + return true; + } + + /** + * Sends a fail event with a message. + * @param string $message Message to send. + * @access public + */ + function fail($message = "Fail") { + if (! isset($this->reporter)) { + trigger_error('Can only make assertions within test methods'); + } + $this->reporter->paintFail( + $message . $this->getAssertionLine()); + return false; + } + + /** + * Formats a PHP error and dispatches it to the + * reporter. + * @param integer $severity PHP error code. + * @param string $message Text of error. + * @param string $file File error occoured in. + * @param integer $line Line number of error. + * @access public + */ + function error($severity, $message, $file, $line) { + if (! isset($this->reporter)) { + trigger_error('Can only make assertions within test methods'); + } + $this->reporter->paintError( + "Unexpected PHP error [$message] severity [$severity] in [$file line $line]"); + } + + /** + * Formats an exception and dispatches it to the + * reporter. + * @param Exception $exception Object thrown. + * @access public + */ + function exception($exception) { + $this->reporter->paintException($exception); + } + + /** + * For user defined expansion of the available messages. + * @param string $type Tag for sorting the signals. + * @param mixed $payload Extra user specific information. + */ + function signal($type, $payload) { + if (! isset($this->reporter)) { + trigger_error('Can only make assertions within test methods'); + } + $this->reporter->paintSignal($type, $payload); + } + + /** + * Runs an expectation directly, for extending the + * tests with new expectation classes. + * @param SimpleExpectation $expectation Expectation subclass. + * @param mixed $compare Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assert($expectation, $compare, $message = '%s') { + if ($expectation->test($compare)) { + return $this->pass(sprintf( + $message, + $expectation->overlayMessage($compare, $this->reporter->getDumper()))); + } else { + return $this->fail(sprintf( + $message, + $expectation->overlayMessage($compare, $this->reporter->getDumper()))); + } + } + + /** + * Uses a stack trace to find the line of an assertion. + * @return string Line number of first assert* + * method embedded in format string. + * @access public + */ + function getAssertionLine() { + $trace = new SimpleStackTrace(array('assert', 'expect', 'pass', 'fail', 'skip')); + return $trace->traceMethod(); + } + + /** + * Sends a formatted dump of a variable to the + * test suite for those emergency debugging + * situations. + * @param mixed $variable Variable to display. + * @param string $message Message to display. + * @return mixed The original variable. + * @access public + */ + function dump($variable, $message = false) { + $dumper = $this->reporter->getDumper(); + $formatted = $dumper->dump($variable); + if ($message) { + $formatted = $message . "\n" . $formatted; + } + $this->reporter->paintFormattedMessage($formatted); + return $variable; + } + + /** + * Accessor for the number of subtests including myelf. + * @return integer Number of test cases. + * @access public + */ + function getSize() { + return 1; + } +} + +/** + * Helps to extract test cases automatically from a file. + */ +class SimpleFileLoader { + + /** + * Builds a test suite from a library of test cases. + * The new suite is composed into this one. + * @param string $test_file File name of library with + * test case classes. + * @return TestSuite The new test suite. + * @access public + */ + function load($test_file) { + $existing_classes = get_declared_classes(); + $existing_globals = get_defined_vars(); + include_once($test_file); + $new_globals = get_defined_vars(); + $this->makeFileVariablesGlobal($existing_globals, $new_globals); + $new_classes = array_diff(get_declared_classes(), $existing_classes); + if (empty($new_classes)) { + $new_classes = $this->scrapeClassesFromFile($test_file); + } + $classes = $this->selectRunnableTests($new_classes); + return $this->createSuiteFromClasses($test_file, $classes); + } + + /** + * Imports new variables into the global namespace. + * @param hash $existing Variables before the file was loaded. + * @param hash $new Variables after the file was loaded. + * @access private + */ + protected function makeFileVariablesGlobal($existing, $new) { + $globals = array_diff(array_keys($new), array_keys($existing)); + foreach ($globals as $global) { + $_GLOBALS[$global] = $new[$global]; + } + } + + /** + * Lookup classnames from file contents, in case the + * file may have been included before. + * Note: This is probably too clever by half. Figuring this + * out after a failed test case is going to be tricky for us, + * never mind the user. A test case should not be included + * twice anyway. + * @param string $test_file File name with classes. + * @access private + */ + protected function scrapeClassesFromFile($test_file) { + preg_match_all('~^\s*class\s+(\w+)(\s+(extends|implements)\s+\w+)*\s*\{~mi', + file_get_contents($test_file), + $matches ); + return $matches[1]; + } + + /** + * Calculates the incoming test cases. Skips abstract + * and ignored classes. + * @param array $candidates Candidate classes. + * @return array New classes which are test + * cases that shouldn't be ignored. + * @access public + */ + function selectRunnableTests($candidates) { + $classes = array(); + foreach ($candidates as $class) { + if (TestSuite::getBaseTestCase($class)) { + $reflection = new SimpleReflection($class); + if ($reflection->isAbstract()) { + SimpleTest::ignore($class); + } else { + $classes[] = $class; + } + } + } + return $classes; + } + + /** + * Builds a test suite from a class list. + * @param string $title Title of new group. + * @param array $classes Test classes. + * @return TestSuite Group loaded with the new + * test cases. + * @access public + */ + function createSuiteFromClasses($title, $classes) { + if (count($classes) == 0) { + $suite = new BadTestSuite($title, "No runnable test cases in [$title]"); + return $suite; + } + SimpleTest::ignoreParentsIfIgnored($classes); + $suite = new TestSuite($title); + foreach ($classes as $class) { + if (! SimpleTest::isIgnored($class)) { + $suite->add($class); + } + } + return $suite; + } +} + +/** + * This is a composite test class for combining + * test cases and other RunnableTest classes into + * a group test. + * @package SimpleTest + * @subpackage UnitTester + */ +class TestSuite { + private $label; + private $test_cases; + + /** + * Sets the name of the test suite. + * @param string $label Name sent at the start and end + * of the test. + * @access public + */ + function TestSuite($label = false) { + $this->label = $label; + $this->test_cases = array(); + } + + /** + * Accessor for the test name for subclasses. If the suite + * wraps a single test case the label defaults to the name of that test. + * @return string Name of the test. + * @access public + */ + function getLabel() { + if (! $this->label) { + return ($this->getSize() == 1) ? + get_class($this->test_cases[0]) : get_class($this); + } else { + return $this->label; + } + } + + /** + * Adds a test into the suite by instance or class. The class will + * be instantiated if it's a test suite. + * @param SimpleTestCase $test_case Suite or individual test + * case implementing the + * runnable test interface. + * @access public + */ + function add($test_case) { + if (! is_string($test_case)) { + $this->test_cases[] = $test_case; + } elseif (TestSuite::getBaseTestCase($test_case) == 'testsuite') { + $this->test_cases[] = new $test_case(); + } else { + $this->test_cases[] = $test_case; + } + } + + /** + * Builds a test suite from a library of test cases. + * The new suite is composed into this one. + * @param string $test_file File name of library with + * test case classes. + * @access public + */ + function addFile($test_file) { + $extractor = new SimpleFileLoader(); + $this->add($extractor->load($test_file)); + } + + /** + * Delegates to a visiting collector to add test + * files. + * @param string $path Path to scan from. + * @param SimpleCollector $collector Directory scanner. + * @access public + */ + function collect($path, $collector) { + $collector->collect($this, $path); + } + + /** + * Invokes run() on all of the held test cases, instantiating + * them if necessary. + * @param SimpleReporter $reporter Current test reporter. + * @access public + */ + function run($reporter) { + $reporter->paintGroupStart($this->getLabel(), $this->getSize()); + for ($i = 0, $count = count($this->test_cases); $i < $count; $i++) { + if (is_string($this->test_cases[$i])) { + $class = $this->test_cases[$i]; + $test = new $class(); + $test->run($reporter); + unset($test); + } else { + $this->test_cases[$i]->run($reporter); + } + } + $reporter->paintGroupEnd($this->getLabel()); + return $reporter->getStatus(); + } + + /** + * Number of contained test cases. + * @return integer Total count of cases in the group. + * @access public + */ + function getSize() { + $count = 0; + foreach ($this->test_cases as $case) { + if (is_string($case)) { + if (! SimpleTest::isIgnored($case)) { + $count++; + } + } else { + $count += $case->getSize(); + } + } + return $count; + } + + /** + * Test to see if a class is derived from the + * SimpleTestCase class. + * @param string $class Class name. + * @access public + */ + static function getBaseTestCase($class) { + while ($class = get_parent_class($class)) { + $class = strtolower($class); + if ($class == 'simpletestcase' || $class == 'testsuite') { + return $class; + } + } + return false; + } +} + +/** + * This is a failing group test for when a test suite hasn't + * loaded properly. + * @package SimpleTest + * @subpackage UnitTester + */ +class BadTestSuite { + private $label; + private $error; + + /** + * Sets the name of the test suite and error message. + * @param string $label Name sent at the start and end + * of the test. + * @access public + */ + function BadTestSuite($label, $error) { + $this->label = $label; + $this->error = $error; + } + + /** + * Accessor for the test name for subclasses. + * @return string Name of the test. + * @access public + */ + function getLabel() { + return $this->label; + } + + /** + * Sends a single error to the reporter. + * @param SimpleReporter $reporter Current test reporter. + * @access public + */ + function run($reporter) { + $reporter->paintGroupStart($this->getLabel(), $this->getSize()); + $reporter->paintFail('Bad TestSuite [' . $this->getLabel() . + '] with error [' . $this->error . ']'); + $reporter->paintGroupEnd($this->getLabel()); + return $reporter->getStatus(); + } + + /** + * Number of contained test cases. Always zero. + * @return integer Total count of cases in the group. + * @access public + */ + function getSize() { + return 0; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/Expectations.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/Expectations.pkg new file mode 100644 index 0000000..3ea6ec4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/Expectations.pkg @@ -0,0 +1,319 @@ + + + +Expectations + + + {@toc} + + +More control over mock objects + + The default behaviour of the + {@link mock objects.html mock objects} + in + {@link http://sourceforge.net/projects/simpletest/ SimpleTest} + is either an identical match on the argument or to allow any argument at all. + For almost all tests this is sufficient. + Sometimes, though, you want to weaken a test case. + + + One place where a test can be too tightly coupled is with + text matching. + Suppose we have a component that outputs a helpful error + message when something goes wrong. + You want to test that the correct error was sent, but the actual + text may be rather long. + If you test for the text exactly, then every time the exact wording + of the message changes, you will have to go back and edit the test suite. + + + For example, suppose we have a news service that has failed + to connect to its remote source. + +class NewsService { + ... + function publish(&$writer) { + if (! $this->isConnected()) { + $writer->write('Cannot connect to news service "' . + $this->_name . '" at this time. ' . + 'Please try again later.'); + } + ... + } +} + + Here it is sending its content to a + Writer class. + We could test this behaviour with a + MockWriter like so... + +class TestOfNewsService extends UnitTestCase { + ... + function testConnectionFailure() { + $writer = &new MockWriter($this); + $writer->expectOnce('write', array( + 'Cannot connect to news service ' . + '"BBC News" at this time. ' . + 'Please try again later.')); + + $service = &new NewsService('BBC News'); + $service->publish($writer); + + $writer->tally(); + } +} + + This is a good example of a brittle test. + If we decide to add additional instructions, such as + suggesting an alternative news source, we will break + our tests even though no underlying functionality + has been altered. + + + To get around this, we would like to do a regular expression + test rather than an exact match. + We can actually do this with... + +class TestOfNewsService extends UnitTestCase { + ... + function testConnectionFailure() { + $writer = &new MockWriter($this); + $writer->expectOnce( + 'write', + array(new WantedPatternExpectation('/cannot connect/i'))); + + $service = &new NewsService('BBC News'); + $service->publish($writer); + + $writer->tally(); + } +} + + Instead of passing in the expected parameter to the + MockWriter we pass an + expectation class called + WantedPatternExpectation. + The mock object is smart enough to recognise this as special + and to treat it differently. + Rather than simply comparing the incoming argument to this + object, it uses the expectation object itself to + perform the test. + + + The WantedPatternExpectation takes + the regular expression to match in its constructor. + Whenever a comparison is made by the MockWriter + against this expectation class, it will do a + preg_match() with this pattern. + With our test case above, as long as "cannot connect" + appears in the text of the string, the mock will issue a pass + to the unit tester. + The rest of the text does not matter. + + + The possible expectation classes are... + + + + +EqualExpectation + +An equality, rather than the stronger identity comparison + + + +NotEqualExpectation + +An inequality comparison + + + +IndenticalExpectation + +The default mock object check which must match exactly + + + +NotIndenticalExpectation + +Inverts the mock object logic + + + +WantedPatternExpectation + +Uses a Perl Regex to match a string + + + +NoUnwantedPatternExpectation + +Passes only if failing a Perl Regex + + + +IsAExpectation + +Checks the type or class name only + + + +NotAExpectation + +Opposite of the IsAExpectation + + + + +MethodExistsExpectation + +Checks a method is available on an object + + +
    + Most take the expected value in the constructor. + The exceptions are the pattern matchers, which take a regular expression, + and the IsAExpectation and NotAExpectation which takes a type + or class name as a string. +
    +
    + +Using expectations to control stubs + + The expectation classes can be used not just for sending assertions + from mock objects, but also for selecting behaviour for either + the + {@link mock objects.html mock objects} + or the + {@link server stubs.html server stubs}. + Anywhere a list of arguments is given, a list of expectation objects + can be inserted instead. + + + Suppose we want an authorisation server stub to simulate a successful login + only if it receives a valid session object. + We can do this as follows... + +Stub::generate('Authorisation'); + +$authorisation = new StubAuthorisation(); +$authorisation->setReturnValue( + 'isAllowed', + true, + array(new IsAExpectation('Session', 'Must be a session'))); +$authorisation->setReturnValue('isAllowed', false); + + We have set the default stub behaviour to return false when + isAllowed is called. + When we call the method with a single parameter that + is a Session object, it will return true. + We have also added a second parameter as a message. + This will be displayed as part of the mock object + failure message if this expectation is the cause of + a failure. + + + This kind of sophistication is rarely useful, but is included for + completeness. + + + +Creating your own expectations + + The expectation classes have a very simple structure. + So simple that it is easy to create your own versions for + commonly used test logic. + + + As an example here is the creation of a class to test for + valid IP addresses. + In order to work correctly with the stubs and mocks the new + expectation class should extend + SimpleExpectation... + +class ValidIp extends SimpleExpectation { + + function test($ip) { + return (ip2long($ip) != -1); + } + + function testMessage($ip) { + return "Address [$ip] should be a valid IP address"; + } +} + + There are only two methods to implement. + The test() method should + evaluate to true if the expectation is to pass, and + false otherwise. + The testMessage() method + should simply return some helpful text explaining the test + that was carried out. + + + This class can now be used in place of the earlier expectation + classes. + + + +Under the bonnet of the unit tester + + The {@link http://sourceforge.net/projects/simpletest/ SimpleTest unit testing framework} + also uses the expectation classes internally for the + {@link UnitTestCase class.html UnitTestCase class}. + We can also take advantage of these mechanisms to reuse our + homebrew expectation classes within the test suites directly. + + + The most crude way of doing this is to use the + SimpleTest::assertExpectation() method to + test against it directly... + +class TestOfNetworking extends UnitTestCase { + ... + function testGetValidIp() { + $server = &new Server(); + $this->assertExpectation( + new ValidIp(), + $server->getIp(), + 'Server IP address->%s'); + } +} + + This is a little untidy compared with our usual + assert...() syntax. + + + For such a simple case we would normally create a + separate assertion method on our test case rather + than bother using the expectation class. + If we pretend that our expectation is a little more + complicated for a moment, so that we want to reuse it, + we get... + +class TestOfNetworking extends UnitTestCase { + ... + function assertValidIp($ip, $message = '%s') { + $this->assertExpectation(new ValidIp(), $ip, $message); + } + + function testGetValidIp() { + $server = &new Server(); + $this->assertValidIp( + $server->getIp(), + 'Server IP address->%s'); + } +} + + It is unlikely we would ever need this degree of control + over the testing machinery. + It is rare to need the expectations for more than pattern + matching. + Also, complex expectation classes could make the tests + harder to read and debug. + These mechanisms are really of most use to authors of systems + that will extend the test framework to create their own tool set. + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/FormTesting.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/FormTesting.pkg new file mode 100644 index 0000000..e9a4330 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/FormTesting.pkg @@ -0,0 +1,218 @@ + + + +Testing forms + + + {@toc} + + +Submitting a simple form + + When a page is fetched by the WebTestCase + using get() or + post() the page content is + automatically parsed. + This results in any form controls that are inside <form> tags + being available from within the test case. + For example, if we have this snippet of HTML... +
    +<form>
    +    <input type="text" name="a" value="A default" />
    +    <input type="submit" value="Go" />
    +</form>
    +
    + Which looks like this... +
    + +
    + + +
    +
    + + We can navigate to this code, via the + {@link http://www.lastcraft.com/form_testing_documentation.php LastCraft} + site, with the following test... + +class SimpleFormTests extends WebTestCase { + + function testDefaultValue() { + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertField('a', 'A default'); + } +} + + Immediately after loading the page all of the HTML controls are set at + their default values just as they would appear in the web browser. + The assertion tests that a HTML widget exists in the page with the + name "a" and that it is currently set to the value + "A default" + + + We could submit the form straight away, but first we'll change + the value of the text field and only then submit it... + +class SimpleFormTests extends WebTestCase { + + function testDefaultValue() { + $this->get('http://www.my-site.com/'); + $this->assertField('a', 'A default'); + $this->setField('a', 'New value'); + $this->clickSubmit('Go'); + } +} + + Because we didn't specify a method attribute on the form tag, and + didn't specify an action either, the test case will follow + the usual browser behaviour of submitting the form data as a GET + request back to the same location. + SimpleTest tries to emulate typical browser behaviour as much as possible, + rather than attempting to catch missing attributes on tags. + This is because the target of the testing framework is the PHP application + logic, not syntax or other errors in the HTML code. + For HTML errors, other tools such as + {@link http://www.w3.org/People/Raggett/tidy/ HTMLTidy} should be used. + + + If a field is not present in any form, or if an option is unavailable, + then WebTestCase::setField() will return + false. + For example, suppose we wish to verify that a "Superuser" + option is not present in this form... +
    +<strong>Select type of user to add:</strong>
    +<select name="type">
    +    <option>Subscriber</option>
    +    <option>Author</option>
    +    <option>Administrator</option>
    +</select>
    +
    + Which looks like... +
    + +
    + Select type of user to add: + +
    +
    + + The following test will confirm it... + +class SimpleFormTests extends WebTestCase { + ... + function testNoSuperuserChoiceAvailable() { + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertFalse($this->setField('type', 'Superuser')); + } +} + + The selection will not be changed on a failure to set + a widget value. + + + Here is the full list of widgets currently supported... +
      +
    • Text fields, including hidden and password fields.
    • +
    • Submit buttons including the button tag, although not yet reset buttons
    • +
    • Text area. This includes text wrapping behaviour.
    • +
    • Checkboxes, including multiple checkboxes in the same form.
    • +
    • Drop down selections, including multiple selects.
    • +
    • Radio buttons.
    • +
    • Images.
    • +
    +
    + + Although most standard HTML widgets are catered for by SimpleTest's + built in parser, it is unlikely that JavaScript will be implemented + anytime soon. + +
    + +Fields with multiple values + + SimpleTest can cope with two types of multivalue controls: Multiple + selection drop downs, and multiple checkboxes with the same name + within a form. + The multivalue nature of these means that setting and testing + are slightly different. + Using checkboxes as an example... +
    +<form class="demo">
    +    <strong>Create privileges allowed:</strong>
    +    <input type="checkbox" name="crud" value="c" checked><br>
    +    <strong>Retrieve privileges allowed:</strong>
    +    <input type="checkbox" name="crud" value="r" checked><br>
    +    <strong>Update privileges allowed:</strong>
    +    <input type="checkbox" name="crud" value="u" checked><br>
    +    <strong>Destroy privileges allowed:</strong>
    +    <input type="checkbox" name="crud" value="d" checked><br>
    +    <input type="submit" value="Enable Privileges">
    +</form>
    +
    + Which renders as... +
    + +
    + Create privileges allowed: + +
    + Retrieve privileges allowed: + +
    + Update privileges allowed: + +
    + Destroy privileges allowed: + +
    + +
    +
    + + If we wish to disable all but the retrieval privileges and + submit this information we can do it like this... + +class SimpleFormTests extends WebTestCase { + ... + function testDisableNastyPrivileges() { + $this->get('http://www.lastcraft.com/form_testing_documentation.php'); + $this->assertField('crud', array('c', 'r', 'u', 'd')); + $this->setField('crud', array('r')); + $this->clickSubmit('Enable Privileges'); + } +} + + Instead of setting the field to a single value, we give it a list + of values. + We do the same when testing expected values. + We can then write other test code to confirm the effect of this, perhaps + by logging in as that user and attempting an update. + + + Raw posting + + + If you want to test a form handler, but have not yet written + or do not have access to the form itself, you can create a + form submission by hand. + +class SimpleFormTests extends WebTestCase { + ... + function testAttemptedHack() { + $this->post( + 'http://www.my-site.com/add_user.php', + array('type' => 'superuser')); + $this->assertNoUnwantedPattern('/user created/i'); + } +} + + By adding data to the WebTestCase::post() + method, we are attempting to fetch the page as a form submission. + +
    +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/GroupTests.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/GroupTests.pkg new file mode 100644 index 0000000..a695f5d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/GroupTests.pkg @@ -0,0 +1,297 @@ + + + +Group tests + + + {@toc} + + +Grouping tests + + To run test cases as part of a group the test cases should really + be placed in files without the runner code... + +<?php + require_once('../classes/io.php'); + + class FileTester extends UnitTestCase { + ... + } + + class SocketTester extends UnitTestCase { + ... + } +?> + + As many cases as needed can appear in a single file. + They should include any code they need, such as the library + being tested, but none of the simple test libraries. + + + If you have extended any test cases, you can include them + as well. + +<?php + require_once('../classes/io.php'); + + class MyFileTestCase extends UnitTestCase { + ... + } + SimpleTestOptions::ignore('MyFileTestCase'); + + class FileTester extends MyFileTestCase { + ... + } + + class SocketTester extends UnitTestCase { + ... + } +?> + + The FileTester class does + not contain any actual tests, but is a base class for other + test cases. + For this reason we use the + SimpleTestOptions::ignore() directive + to tell the upcoming group test to ignore it. + This directive can appear anywhere in the file and works + when a whole file of test cases is loaded (see below). + We will call this sample file_test.php. + + + Next we create a group test file, called say group_test.php. + You will think of a better name I am sure. + We will add the test file using a safe method... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + require_once('file_test.php'); + + $test = &new GroupTest('All file tests'); + $test->addTestCase(new FileTestCase()); + $test->run(new HtmlReporter()); +?> + + This instantiates the test case before the test suite is + run. + This could get a little expensive with a large number of test + cases, so another method is provided that will only + instantiate the class when it is needed... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + require_once('file_test.php'); + + $test = &new GroupTest('All file tests'); + $test->addTestClass('FileTestCase'); + $test->run(new HtmlReporter()); +?> + + The problem with this method is that for every test case + that we add we will have + to require_once() the test code + file and manually instantiate each and every test case. + We can save a lot of typing with... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + + $test = &new GroupTest('All file tests'); + $test->addTestFile('file_test.php'); + $test->run(new HtmlReporter()); +?&gt; + + What happens here is that the GroupTest + class has done the require_once() + for us. + It then checks to see if any new test case classes + have been created by the new file and automatically adds + them to the group test. + Now all we have to do is add each new file. + + + There are two things that could go wrong and which require care... +
      +
    1. + The file could already have been parsed by PHP and so no + new classes will have been added. You should make + sure that the test cases are only included in this file + and no others. +
    2. +
    3. + New test case extension classes that get included will be + placed in the group test and run also. + You will need to add a SimpleTestOptions::ignore() + directive for these classes or make sure that they are included + before the GroupTest::addTestFile() + line. +
    4. +
    +
    +
    + +Higher groupings + + The above method places all of the test cases into one large group. + For larger projects though this may not be flexible enough; you + may want to group the tests in all sorts of ways. + + + To get a more flexible group test we can subclass + GroupTest and then instantiate it as needed... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + + class FileGroupTest extends GroupTest { + function FileGroupTest() { + $this->GroupTest('All file tests'); + $this->addTestFile('file_test.php'); + } + } +?> + + This effectively names the test in the constructor and then + adds our test cases and a single group below. + Of course we can add more than one group at this point. + We can now invoke the tests from a separate runner file... + +<?php + require_once('file_group_test.php'); + + $test = &new FileGroupTest(); + $test->run(new HtmlReporter()); +?> + + ...or we can group them into even larger group tests... + +<?php + require_once('file_group_test.php'); + + $test = &new BigGroupTest('Big group'); + $test->addTestCase(new FileGroupTest()); + $test->addTestCase(...); + $test->run(new HtmlReporter()); +?> + + If we still wish to run the original group test and we + don't want all of these little runner files, we can + put the test runner code around guard bars when we create + each group. + +<?php + class FileGroupTest extends GroupTest { + function FileGroupTest() { + $this->GroupTest('All file tests'); + $test->addTestFile('file_test.php'); + } + } + + if (! defined('RUNNER')) { + define('RUNNER', true); + $test = &new FileGroupTest(); + $test->run(new HtmlReporter()); + } +?> + + This approach requires the guard to be set when including + the group test file, but this is still less hassle than + lots of separate runner files. + You include the same guard on the top level tests to make sure + that run() will run once only + from the top level script that has been invoked. + +<?php + define('RUNNER', true); + require_once('file_group_test.php'); + + $test = &new BigGroupTest('Big group'); + $test->addTestCase(new FileGroupTest()); + $test->addTestCase(...); + $test->run(new HtmlReporter()); +?> + + As with the normal test cases, a GroupTest can + be loaded with the GroupTest::addTestFile() method. + +<?php + define('RUNNER', true); + + $test = &new BigGroupTest('Big group'); + $test->addTestFile('file_group_test.php'); + $test->addTestFile(...); + $test->run(new HtmlReporter()); +?> + + + + +Integrating legacy test cases + + If you already have unit tests for your code or are extending external + classes that have tests, it is unlikely that all of the test cases + are in SimpleTest format. + Fortunately it is possible to incorporate test cases from other + unit testers directly into SimpleTest group tests. + + + Say we have the following + {@link http://sourceforge.net/projects/phpunit PhpUnit} + test case in the file config_test.php... + +class ConfigFileTest extends TestCase { + function ConfigFileTest() { + $this->TestCase('Config file test'); + } + + function testContents() { + $config = new ConfigFile('test.conf'); + $this->assertRegexp('/me/', $config->getValue('username')); + } +} + + The group test can recognise this as long as we include + the appropriate adapter class before we add the test + file... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + require_once('simpletest/adapters/phpunit_test_case.php'); + + $test = &new GroupTest('All file tests'); + $test->addTestFile('config_test.php'); + $test->run(new HtmlReporter()); +?> + + There are only two adapters, the other is for the + {@link http://pear.php.net/manual/en/package.php.phpunit.php PEAR} + 1.0 unit tester... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + require_once('simpletest/adapters/pear_test_case.php'); + + $test = &new GroupTest('All file tests'); + $test->addTestFile('some_pear_test_cases.php'); + $test->run(new HtmlReporter()); +?> + + The PEAR test cases can be freely mixed with SimpleTest + ones even in the same test file, + but you cannot use SimpleTest assertions in the legacy + test case versions. + This is done as a check that you are not accidently making + your test cases completely dependent on SimpleTest. + You may want to do a PEAR release of your library for example + which would mean shipping it with valid PEAR::PhpUnit test + cases. + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/MockObjects.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/MockObjects.pkg new file mode 100644 index 0000000..b22413a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/MockObjects.pkg @@ -0,0 +1,663 @@ + + + +Mock objects + + + {@toc} + + +What are mock objects? + + Mock objects have two roles during a test case: actor and critic. + + + The actor behaviour is to simulate objects that are difficult to + set up or time consuming to set up for a test. + The classic example is a database connection. + Setting up a test database at the start of each test would slow + testing to a crawl and would require the installation of the + database engine and test data on the test machine. + If we can simulate the connection and return data of our + choosing we not only win on the pragmatics of testing, but can + also feed our code spurious data to see how it responds. + We can simulate databases being down or other extremes + without having to create a broken database for real. + In other words, we get greater control of the test environment. + + + If mock objects only behaved as actors they would simply be + known as {@link server stubs.html server stubs}. + + + However, the mock objects not only play a part (by supplying chosen + return values on demand) they are also sensitive to the + messages sent to them (via expectations). + By setting expected parameters for a method call they act + as a guard that the calls upon them are made correctly. + If expectations are not met they save us the effort of + writing a failed test assertion by performing that duty on our + behalf. + In the case of an imaginary database connection they can + test that the query, say SQL, was correctly formed by + the object that is using the connection. + Set them up with fairly tight expectations and you will + hardly need manual assertions at all. + + + +Creating mock objects + + In the same way that we create server stubs, all we need is an + existing class, say a database connection that looks like this... + +class DatabaseConnection { + function DatabaseConnection() { + } + + function query() { + } + + function selectQuery() { + } +} + + The class does not need to have been implemented yet. + To create a mock version of the class we need to include the + mock object library and run the generator... + +require_once('simpletest/unit_tester.php'); +require_once('simpletest/mock_objects.php'); +require_once('database_connection.php'); + +Mock::generate('DatabaseConnection'); + + This generates a clone class called + MockDatabaseConnection. + We can now create instances of the new class within + our test case... + +require_once('simpletest/unit_tester.php'); +require_once('simpletest/mock_objects.php'); +require_once('database_connection.php'); + +Mock::generate('DatabaseConnection'); + +class MyTestCase extends UnitTestCase { + + function testSomething() { + $connection = &new MockDatabaseConnection($this); + } +} + + Unlike the generated stubs the mock constructor needs a reference + to the test case so that it can dispatch passes and failures while + checking its expectations. + This means that mock objects can only be used within test cases. + Despite this their extra power means that stubs are hardly ever used + if mocks are available. + + + Mocks as actors + + + The mock version of a class has all the methods of the original + so that operations like + $connection->query() are still + legal. + As with stubs we can replace the default null return values... + +$connection->setReturnValue('query', 37); + + Now every time we call + $connection->query() we get + the result of 37. + As with the stubs we can set wildcards and we can overload the + wildcard parameter. + We can also add extra methods to the mock when generating it + and choose our own class name... + +Mock::generate('DatabaseConnection', 'MyMockDatabaseConnection', array('setOptions')); + + Here the mock will behave as if the setOptions() + existed in the original class. + This is handy if a class has used the PHP overload() + mechanism to add dynamic methods. + You can create a special mock to simulate this situation. + + + All of the patterns available with server stubs are available + to mock objects... + +class Iterator { + function Iterator() { + } + + function next() { + } +} + + Again, assuming that this iterator only returns text until it + reaches the end, when it returns false, we can simulate it + with... + +Mock::generate('Iterator'); + +class IteratorTest extends UnitTestCase() { + + function testASequence() { + $iterator = &new MockIterator($this); + $iterator->setReturnValue('next', false); + $iterator->setReturnValueAt(0, 'next', 'First string'); + $iterator->setReturnValueAt(1, 'next', 'Second string'); + ... + } +} + + When next() is called on the + mock iterator it will first return "First string", + on the second call "Second string" will be returned + and on any other call false will + be returned. + The sequenced return values take precedence over the constant + return value. + The constant one is a kind of default if you like. + + + A repeat of the stubbed information holder with name/value pairs... + +class Configuration { + function Configuration() { + } + + function getValue($key) { + } +} + + This is a classic situation for using mock objects as + actual configuration will vary from machine to machine, + hardly helping the reliability of our tests if we use it + directly. + The problem though is that all the data comes through the + getValue() method and yet + we want different results for different keys. + Luckily the mocks have a filter system... + +$config = &new MockConfiguration($this); +$config->setReturnValue('getValue', 'primary', array('db_host')); +$config->setReturnValue('getValue', 'admin', array('db_user')); +$config->setReturnValue('getValue', 'secret', array('db_password')); + + The extra parameter is a list of arguments to attempt + to match. + In this case we are trying to match only one argument which + is the look up key. + Now when the mock object has the + getValue() method invoked + like this... + +$config->getValue('db_user') + + ...it will return "admin". + It finds this by attempting to match the calling arguments + to its list of returns one after another until + a complete match is found. + + + There are times when you want a specific object to be + dished out by the mock rather than a copy. + Again this is identical to the server stubs mechanism... + +class Thing { +} + +class Vector { + function Vector() { + } + + function get($index) { + } +} + + In this case you can set a reference into the mock's + return list... + +$thing = new Thing(); +$vector = &new MockVector($this); +$vector->setReturnReference('get', $thing, array(12)); + + With this arrangement you know that every time + $vector->get(12) is + called it will return the same + $thing each time. + + + +Mocks as critics + + Although the server stubs approach insulates your tests from + real world disruption, it is only half the benefit. + You can have the class under test receiving the required + messages, but is your new class sending correct ones? + Testing this can get messy without a mock objects library. + + + By way of example, suppose we have a + SessionPool class that we + want to add logging to. + Rather than grow the original class into something more + complicated, we want to add this behaviour with a decorator (GOF). + The SessionPool code currently looks + like this... + +class SessionPool { + function SessionPool() { + ... + } + + function &findSession($cookie) { + ... + } + ... +} + +class Session { + ... +} +</php> + While our logging code looks like this... +<php> +class Log { + function Log() { + ... + } + + function message() { + ... + } +} + +class LoggingSessionPool { + function LoggingSessionPool(&$session_pool, &$log) { + ... + } + + function &findSession(\$cookie) { + ... + } + ... +} + + Out of all of this, the only class we want to test here + is the LoggingSessionPool. + In particular we would like to check that the + findSession() method is + called with the correct session ID in the cookie and that + it sent the message "Starting session $cookie" + to the logger. + + + Despite the fact that we are testing only a few lines of + production code, here is what we would have to do in a + conventional test case: +
      +
    1. Create a log object.
    2. +
    3. Set a directory to place the log file.
    4. +
    5. Set the directory permissions so we can write the log.
    6. +
    7. Create a SessionPool object.
    8. +
    9. Hand start a session, which probably does lot's of things.
    10. +
    11. Invoke findSession().
    12. +
    13. Read the new Session ID (hope there is an accessor!).
    14. +
    15. Raise a test assertion to confirm that the ID matches the cookie.
    16. +
    17. Read the last line of the log file.
    18. +
    19. Pattern match out the extra logging timestamps, etc.
    20. +
    21. Assert that the session message is contained in the text.
    22. +
    + It is hardly surprising that developers hate writing tests + when they are this much drudgery. + To make things worse, every time the logging format changes or + the method of creating new sessions changes, we have to rewrite + parts of this test even though this test does not officially + test those parts of the system. + We are creating headaches for the writers of these other classes. +
    + + Instead, here is the complete test method using mock object magic... + +Mock::generate('Session'); +Mock::generate('SessionPool'); +Mock::generate('Log'); + +class LoggingSessionPoolTest extends UnitTestCase { + ... + function testFindSessionLogging() { + $session = &new MockSession($this); + $pool = &new MockSessionPool($this); + $pool->setReturnReference('findSession', $session); + $pool->expectOnce('findSession', array('abc')); + + $log = &new MockLog($this); + $log->expectOnce('message', array('Starting session abc')); + + $logging_pool = &new LoggingSessionPool($pool, $log); + $this->assertReference($logging_pool->findSession('abc'), $session); + $pool->tally(); + $log->tally(); + } +} + + We start by creating a dummy session. + We don't have to be too fussy about this as the check + for which session we want is done elsewhere. + We only need to check that it was the same one that came + from the session pool. + + + findSession() is a factory + method the simulation of which is described {@link #stub above}. + The point of departure comes with the first + expectOnce() call. + This line states that whenever + findSession() is invoked on the + mock, it will test the incoming arguments. + If it receives the single argument of a string "abc" + then a test pass is sent to the unit tester, otherwise a fail is + generated. + This was the part where we checked that the right session was asked for. + The argument list follows the same format as the one for setting + return values. + You can have wildcards and sequences and the order of + evaluation is the same. + + + If the call is never made then neither a pass nor a failure will + generated. + To get around this we must tell the mock when the test is over + so that the object can decide if the expectation has been met. + The unit tester assertion for this is triggered by the + tally() call at the end of + the test. + + + We use the same pattern to set up the mock logger. + We tell it that it should have + message() invoked + once only with the argument "Starting session abc". + By testing the calling arguments, rather than the logger output, + we insulate the test from any display changes in the logger. + + + We start to run our tests when we create the new + LoggingSessionPool and feed + it our preset mock objects. + Everything is now under our control. + Finally we confirm that the + $session we gave our decorator + is the one that we get back and tell the mocks to run their + internal call count tests with the + tally() calls. + + + This is still quite a bit of test code, but the code is very + strict. + If it still seems rather daunting there is a lot less of it + than if we tried this without mocks and this particular test, + interactions rather than output, is always more work to set + up. + More often you will be testing more complex situations without + needing this level or precision. + Also some of this can be refactored into a test case + setUp() method. + + + Here is the full list of expectations you can set on a mock object + in {@link http://www.lastcraft.com/simple_test.php SimpleTest}... + + + + + + + + + + +expectArguments($method, $args) + + No + + + +expectArgumentsAt($timing, $method, $args) + + No + + + +expectCallCount($method, $count) + + Yes + + + +expectMaximumCallCount($method, $count) + + No + + + +expectMinimumCallCount($method, $count) + + Yes + + + +expectNever($method) + + No + + + +expectOnce($method, $args) + + Yes + + + +expectAtLeastOnce($method, $args) + + Yes + + +
    ExpectationNeeds tally() +
    + Where the parameters are... +
    +
    $method
    +
    The method name, as a string, to apply the condition to.
    +
    $args
    +
    + The arguments as a list. Wildcards can be included in the same + manner as for setReturn(). + This argument is optional for expectOnce() + and expectAtLeastOnce(). +
    +
    $timing
    +
    + The only point in time to test the condition. + The first call starts at zero. +
    +
    $count
    +
    The number of calls expected.
    +
    + The method expectMaximumCallCount() + is slightly different in that it will only ever generate a failure. + It is silent if the limit is never reached. +
    + + Like the assertions within test cases, all of the expectations + can take a message override as an extra parameter. + Also the original failure message can be embedded in the output + as "%s". + +
    + +Other approaches + + There are three approaches to creating mocks including the one + that SimpleTest employs. + Coding them by hand using a base class, generating them to + a file and dynamically generating them on the fly. + + + Mock objects generated with {@link SimpleTest.html SimpleTest} + are dynamic. + They are created at run time in memory, using + eval(), rather than written + out to a file. + This makes the mocks easy to create, a one liner, + especially compared with hand + crafting them in a parallel class hierarchy. + The problem is that the behaviour is usually set up in the tests + themselves. + If the original objects change the mock versions + that the tests rely on can get out of sync. + This can happen with the parallel hierarchy approach as well, + but is far more quickly detected. + + + The solution, of course, is to add some real integration + tests. + You don't need very many and the convenience gained + from the mocks more than outweighs the small amount of + extra testing. + You cannot trust code that was only tested with mocks. + + + If you are still determined to build static libraries of mocks + because you want to simulate very specific behaviour, you can + achieve the same effect using the SimpleTest class generator. + In your library file, say mocks/connection.php for a + database connection, create a mock and inherit to override + special methods or add presets... + +<?php + require_once('simpletest/mock_objects.php'); + require_once('../classes/connection.php'); + + Mock::generate('Connection', 'BasicMockConnection'); + class MockConnection extends BasicMockConnection { + function MockConnection(&$test, $wildcard = '*') { + $this->BasicMockConnection($test, $wildcard); + $this->setReturn('query', false); + } + } +?> + + The generate call tells the class generator to create + a class called BasicMockConnection + rather than the usual MockConnection. + We then inherit from this to get our version of + MockConnection. + By intercepting in this way we can add behaviour, here setting + the default value of query() to be false. + By using the default name we make sure that the mock class + generator will not recreate a different one when invoked elsewhere in the + tests. + It never creates a class if it already exists. + As long as the above file is included first then all tests + that generated MockConnection should + now be using our one instead. + If we don't get the order right and the mock library + creates one first then the class creation will simply fail. + + + Use this trick if you find you have a lot of common mock behaviour + or you are getting frequent integration problems at later + stages of testing. + + + +I think SimpleTest stinks! + + But at the time of writing it is the only one with mock objects, + so are you stuck with it? + + + No, not at all. + {@link SimpleTest.html SimpleTest} is a toolkit and one of those + tools is the mock objects which can be employed independently. + Suppose you have your own favourite unit tester and all your current + test cases are written using it. + Pretend that you have called your unit tester PHPUnit (everyone else has) + and the core test class looks like this... + +class PHPUnit { + function PHPUnit() { + } + + function assertion($message, $assertion) { + } + ... +} + + All the assertion() method does + is print some fancy output and the boolean assertion parameter determines + whether to print a pass or a failure. + Let's say that it is used like this... + +$unit_test = new PHPUnit(); +$unit_test>assertion('I hope this file exists', file_exists('my_file')); + + How do you use mocks with this? + + + There is a protected method on the base mock class + SimpleMock called + _assertTrue() and + by overriding this method we can use our own assertion format. + We start with a subclass, in say my_mock.php... + +<?php + require_once('simpletest/mock_objects.php'); + + class MyMock extends SimpleMock() { + function MyMock(&$test, $wildcard) { + $this->SimpleMock($test, $wildcard); + } + + function _assertTrue($assertion, $message) { + $test = &$this->getTest(); + $test->assertion($message, $assertion); + } + } +?> + + Now instantiating MyMock will create + an object that speaks the same language as your tester. + The catch is of course that we never create such an object, the + code generator does. + We need just one more line of code to tell the generator to use + your mock instead... + +<?php + require_once('simpletst/mock_objects.php'); + + class MyMock extends SimpleMock() { + function MyMock($test, $wildcard) { + $this->SimpleMock(&$test, $wildcard); + } + + function _assertTrue($assertion, $message , &$test) { + $test->assertion($message, $assertion); + } + } + SimpleTestOptions::setMockBaseClass('MyMock'); +?> + + From now on you just include my_mock.php instead of the + default mock_objects.php version and you can introduce + mock objects into your existing test suite. + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/PartialMock.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/PartialMock.pkg new file mode 100644 index 0000000..1ee147c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/PartialMock.pkg @@ -0,0 +1,361 @@ + + + +Partial mocks + + A partial mock is simply a pattern to alleviate a specific problem + in testing with mock objects, + that of getting mock objects into tight corners. + It's quite a limited tool and possibly not even a good idea. + It is included with SimpleTest because I have found it useful + on more than one occasion and has saved a lot of work at that point. + + + {@toc} + + + +The mock injection problem + + When one object uses another it is very simple to just pass a mock + version in already set up with its expectations. + Things are rather tricker if one object creates another and the + creator is the one you want to test. + This means that the created object should be mocked, but we can + hardly tell our class under test to create a mock instead. + The tested class doesn't even know it is running inside a test + after all. + + + For example, suppose we are building a telnet client and it + needs to create a network socket to pass its messages. + The connection method might look something like... + +<?php + require_once('socket.php'); + + class Telnet { + ... + function &connect($ip, $port, $username, $password) { + $socket = &new Socket($ip, $port); + $socket->read( ... ); + ... + } + } +?> + + We would really like to have a mock object version of the socket + here, what can we do? + + + The first solution is to pass the socket in as a parameter, + forcing the creation up a level. + Having the client handle this is actually a very good approach + if you can manage it and should lead to factoring the creation from + the doing. + In fact, this is one way in which testing with mock objects actually + forces you to code more tightly focused solutions. + They improve your programming. + + + Here this would be... + +<?php + require_once('socket.php'); + + class Telnet { + ... + function &connect(&$socket, $username, $password) { + $socket->read( ... ); + ... + } + } +?> + + This means that the test code is typical for a test involving + mock objects. + +class TelnetTest extends UnitTestCase { + ... + function testConnection() { + $socket = &new MockSocket($this); + ... + $telnet = &new Telnet(); + $telnet->connect($socket, 'Me', 'Secret'); + ... + } +} + + It is pretty obvious though that one level is all you can go. + You would hardly want your top level application creating + every low level file, socket and database connection ever + needed. + It wouldn't know the constructor parameters anyway. + + + The next simplest compromise is to have the created object passed + in as an optional parameter... + +<?php + require_once('socket.php'); + + class Telnet { + ... + function &connect($ip, $port, $username, $password, $socket = false) { + if (!$socket) { + $socket = &new Socket($ip, $port); + } + $socket->read( ... ); + ... + return $socket; + } + } +?> + + For a quick solution this is usually good enough. + The test now looks almost the same as if the parameter + was formally passed... + +class TelnetTest extends UnitTestCase { + ... + function testConnection() { + $socket = &new MockSocket($this); + ... + $telnet = &new Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret', &$socket); + ... + } +} + + The problem with this approach is its untidiness. + There is test code in the main class and parameters passed + in the test case that are never used. + This is a quick and dirty approach, but nevertheless effective + in most situations. + + + The next method is to pass in a factory object to do the creation... + +<?php + require_once('socket.php'); + + class Telnet { + function Telnet(&$network) { + $this->_network = &$network; + } + ... + function &connect($ip, $port, $username, $password) { + $socket = &$this->_network->createSocket($ip, $port); + $socket->read( ... ); + ... + return $socket; + } + } +?> + + This is probably the most highly factored answer as creation + is now moved into a small specialist class. + The networking factory can now be tested separately, but mocked + easily when we are testing the telnet class... + +class TelnetTest extends UnitTestCase { + ... + function testConnection() { + $socket = &new MockSocket($this); + ... + $network = &new MockNetwork($this); + $network->setReturnReference('createSocket', $socket); + $telnet = &new Telnet($network); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} + + The downside is that we are adding a lot more classes to the + library. + Also we are passing a lot of factories around which will + make the code a little less intuitive. + The most flexible solution, but the most complex. + + + Is there a middle ground? + + + +Protected factory method + + There is a way we can circumvent the problem without creating + any new application classes, but it involves creating a subclass + when we do the actual testing. + Firstly we move the socket creation into its own method... + +<?php + require_once('socket.php'); + + class Telnet { + ... + function &connect($ip, $port, $username, $password) { + $socket = &$this->_createSocket($ip, $port); + $socket->read( ... ); + ... + } + + function &_createSocket($ip, $port) { + return new Socket($ip, $port); + } + } +?> + + This is the only change we make to the application code. + + + For the test case we have to create a subclass so that + we can intercept the socket creation... + +class TelnetTestVersion extends Telnet { + var $_mock; + + function TelnetTestVersion(&$mock) { + $this->_mock = &$mock; + $this->Telnet(); + } + + function &_createSocket() { + return $this->_mock; + } +} + + Here I have passed the mock in the constructor, but a + setter would have done just as well. + Note that the mock was set into the object variable + before the constructor was chained. + This is necessary in case the constructor calls + connect(). + Otherwise it could get a null value from + _createSocket(). + + + After the completion of all of this extra work the + actual test case is fairly easy. + We just test our new class instead... + +class TelnetTest extends UnitTestCase { + ... + function testConnection() { + $socket = &new MockSocket($this); + ... + $telnet = &new TelnetTestVersion($socket); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} + + The new class is very simple of course. + It just sets up a return value, rather like a mock. + It would be nice if it also checked the incoming parameters + as well. + Just like a mock. + It seems we are likely to do this often, can + we automate the subclass creation? + + + +A partial mock + + Of course the answer is "yes" or I would have stopped writing + this by now! + The previous test case was a lot of work, but we can + generate the subclass using a similar approach to the mock objects. + + + Here is the partial mock version of the test... + +Mock::generatePartial( + 'Telnet', + 'TelnetTestVersion', + array('_createSocket')); + +class TelnetTest extends UnitTestCase { + ... + function testConnection() { + $socket = &new MockSocket($this); + ... + $telnet = &new TelnetTestVersion($this); + $telnet->setReturnReference('_createSocket', $socket); + $telnet->Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + } +} + + The partial mock is a subclass of the original with + selected methods "knocked out" with test + versions. + The generatePartial() call + takes three parameters: the class to be subclassed, + the new test class name and a list of methods to mock. + + + Instantiating the resulting objects is slightly tricky. + The only constructor parameter of a partial mock is + the unit tester reference. + As with the normal mock objects this is needed for sending + test results in response to checked expectations. + + + The original constructor is not run yet. + This is necessary in case the constructor is going to + make use of the as yet unset mocked methods. + We set any return values at this point and then run the + constructor with its normal parameters. + This three step construction of "new", followed + by setting up the methods, followed by running the constructor + proper is what distinguishes the partial mock code. + + + Apart from construction, all of the mocked methods have + the same features as mock objects and all of the unmocked + methods behave as before. + We can set expectations very easily... + +class TelnetTest extends UnitTestCase { + ... + function testConnection() { + $socket = &new MockSocket($this); + ... + $telnet = &new TelnetTestVersion($this); + $telnet->setReturnReference('_createSocket', $socket); + $telnet->expectOnce('_createSocket', array('127.0.0.1', 21)); + $telnet->Telnet(); + $telnet->connect('127.0.0.1', 21, 'Me', 'Secret'); + ... + $telnet->tally(); + } +} + + + + +Testing less than a class + + The mocked out methods don't have to be factory methods, + they could be any sort of method. + In this way partial mocks allow us to take control of any part of + a class except the constructor. + We could even go as far as to mock every method + except one we actually want to test. + + + This last situation is all rather hypothetical, as I haven't + tried it. + I am open to the possibility, but a little worried that + forcing object granularity may be better for the code quality. + I personally use partial mocks as a way of overriding creation + or for occasional testing of the TemplateMethod pattern. + + + It's all going to come down to the coding standards of your + project to decide which mechanism you use. + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/Reporting.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/Reporting.pkg new file mode 100644 index 0000000..c60531e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/Reporting.pkg @@ -0,0 +1,450 @@ + + + +Reporting + + SimpleTest pretty much follows the MVC pattern + (Model-View-Controller). + The reporter classes are the view and the model is your + test cases and their hiearchy. + The controller is mostly hidden from the user of + SimpleTest unless you want to change how the test cases + are actually run, in which case it is possible to + override the runner objects from within the test case. + As usual with MVC, the controller is mostly undefined + and there are other places to control the test run. + + + {@toc} + + + +Reporting results in HTML + + The default test display is minimal in the extreme. + It reports success and failure with the conventional red and + green bars and shows a breadcrumb trail of test groups + for every failed assertion. + Here's a fail... +
    +

    File test

    + Fail: createnewfile->True assertion failed.
    +
    1/1 test cases complete. + 0 passes, 1 fails and 0 exceptions.
    +
    + And here all tests passed... +
    +

    File test

    +
    1/1 test cases complete. + 1 passes, 0 fails and 0 exceptions.
    +
    + The good news is that there are several points in the display + hiearchy for subclassing. +
    + + For web page based displays there is the + HtmlReporter class with the following + signature... + +class HtmlReporter extends SimpleReporter { + public HtmlReporter($encoding) { ... } + public makeDry(boolean $is_dry) { ... } + public void paintHeader(string $test_name) { ... } + public void sendNoCacheHeaders() { ... } + public void paintFooter(string $test_name) { ... } + public void paintGroupStart(string $test_name, integer $size) { ... } + public void paintGroupEnd(string $test_name) { ... } + public void paintCaseStart(string $test_name) { ... } + public void paintCaseEnd(string $test_name) { ... } + public void paintMethodStart(string $test_name) { ... } + public void paintMethodEnd(string $test_name) { ... } + public void paintFail(string $message) { ... } + public void paintPass(string $message) { ... } + public void paintError(string $message) { ... } + public void paintException(string $message) { ... } + public void paintMessage(string $message) { ... } + public void paintFormattedMessage(string $message) { ... } + protected string _getCss() { ... } + public array getTestList() { ... } + public integer getPassCount() { ... } + public integer getFailCount() { ... } + public integer getExceptionCount() { ... } + public integer getTestCaseCount() { ... } + public integer getTestCaseProgress() { ... } +} + + Here is what some of these methods mean. First the display methods + that you will probably want to override... +
      +
    • + HtmlReporter(string $encoding) +
      + is the constructor. + Note that the unit test sets up the link to the display + rather than the other way around. + The display is a mostly passive receiver of test events. + This allows easy adaption of the display for other test + systems beside unit tests, such as monitoring servers. + The encoding is the character encoding you wish to + display the test output in. + In order to correctly render debug output when + using the web tester, this should match the encoding + of the site you are trying to test. + The available character set strings are described in + the PHP {@link http://www.php.net/manual/en/function.htmlentities.php html_entities()} + function. +
    • +
    • + void paintHeader(string $test_name) +
      + is called once at the very start of the test when the first + start event arrives. + The first start event is usually delivered by the top level group + test and so this is where $test_name + comes from. + It paints the page titles, CSS, body tag, etc. + It returns nothing (void). +
    • +
    • + void paintFooter(string $test_name) +
      + Called at the very end of the test to close any tags opened + by the page header. + By default it also displays the red/green bar and the final + count of results. + Actually the end of the test happens when a test end event + comes in with the same name as the one that started it all + at the same level. + The tests nest you see. + Closing the last test finishes the display. +
    • +
    • + void paintMethodStart(string $test_name) +
      + is called at the start of each test method. + The name normally comes from method name. + The other test start events behave the same way except + that the group test one tells the reporter how large + it is in number of held test cases. + This is so that the reporter can display a progress bar + as the runner churns through the test cases. +
    • +
    • + void paintMethodEnd(string $test_name) +
      + backs out of the test started with the same name. +
    • +
    • + void paintFail(string $message) +
      + paints a failure. + By default it just displays the word fail, a breadcrumbs trail + showing the current test nesting and the message issued by + the assertion. +
    • +
    • + void paintPass(string $message) +
      + by default does nothing. +
    • +
    • + string _getCss() +
      + Returns the CSS styles as a string for the page header + method. + Additional styles have to be appended here if you are + not overriding the page header. + You will want to use this method in an overriden page header + if you want to include the original CSS. +
    • +
    + There are also some accessors to get information on the current + state of the test suite. + Use these to enrich the display... +
      +
    • + array getTestList() +
      + is the first convenience method for subclasses. + Lists the current nesting of the tests as a list + of test names. + The first, most deeply nested test, is first in the + list and the current test method will be last. +
    • +
    • + integer getPassCount() +
      + returns the number of passes chalked up so far. + Needed for the display at the end. +
    • +
    • + integer getFailCount() +
      + is likewise the number of fails so far. +
    • +
    • + integer getExceptionCount() +
      + is likewise the number of errors so far. +
    • +
    • + integer getTestCaseCount() +
      + is the total number of test cases in the test run. + This includes the grouping tests themselves. +
    • +
    • + integer getTestCaseProgress() +
      + is the number of test cases completed so far. +
    • +
    + One simple modification is to get the HtmlReporter to display + the passes as well as the failures and errors... + +class ShowPasses extends HtmlReporter { + + function paintPass($message) { + parent::paintPass($message); + print "&<span class=\"pass\">Pass</span>: "; + $breadcrumb = $this->getTestList(); + array_shift($breadcrumb); + print implode("-&gt;", $breadcrumb); + print "-&gt;$message<br />\n"; + } + + function _getCss() { + return parent::_getCss() . ' .pass { color: green; }'; + } +} + +
    + + One method that was glossed over was the makeDry() + method. + If you run this method, with no parameters, on the reporter + before the test suite is run no actual test methods + will be called. + You will still get the events of entering and leaving the + test methods and test cases, but no passes or failures etc, + because the test code will not actually be executed. + + + The reason for this is to allow for more sophistcated + GUI displays that allow the selection of individual test + cases. + In order to build a list of possible tests they need a + report on the test structure for drawing, say a tree view + of the test suite. + With a reporter set to dry run that just sends drawing events + this is easily accomplished. + +
    + +Extending the reporter + + Rather than simply modifying the existing display, you might want to + produce a whole new HTML look, or even generate text or XML. + Rather than override every method in + HtmlReporter we can take one + step up the class hiearchy to SimpleReporter + in the simple_test.php source file. + + + A do nothing display, a blank canvas for your own creation, would + be... + +require_once('simpletest/simple_test.php'); + +class MyDisplay extends SimpleReporter { + + function paintHeader($test_name) { + } + + function paintFooter($test_name) { + } + + function paintStart($test_name, $size) { + parent::paintStart($test_name, $size); + } + + function paintEnd($test_name, $size) { + parent::paintEnd($test_name, $size); + } + + function paintPass($message) { + parent::paintPass($message); + } + + function paintFail($message) { + parent::paintFail($message); + } +} + + No output would come from this class until you add it. + + + +The command line reporter + + SimpleTest also ships with a minimal command line reporter. + The interface mimics JUnit to some extent, but paints the + failure messages as they arrive. + To use the command line reporter simply substitute it + for the HTML version... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + + $test = &new GroupTest('File test'); + $test->addTestFile('tests/file_test.php'); + $test->run(new TextReporter()); +?> + + Then invoke the test suite from the command line... +
    +php file_test.php
    +
    + You will need the command line version of PHP installed + of course. + A passing test suite looks like this... +
    +File test
    +OK
    +Test cases run: 1/1, Failures: 0, Exceptions: 0
    +
    + A failure triggers a display like this... +
    +File test
    +1) True assertion failed.
    +	in createnewfile
    +FAILURES!!!
    +Test cases run: 1/1, Failures: 1, Exceptions: 0
    +
    +
    + + One of the main reasons for using a command line driven + test suite is of using the tester as part of some automated + process. + To function properly in shell scripts the test script should + return a non-zero exit code on failure. + If a test suite fails the value false + is returned from the SimpleTest::run() + method. + We can use that result to exit the script with the desired return + code... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + + $test = &new GroupTest('File test'); + $test->addTestFile('tests/file_test.php'); + exit ($test->run(new TextReporter()) ? 0 : 1); +?> + + Of course we don't really want to create two test scripts, + a command line one and a web browser one, for each test suite. + The command line reporter includes a method to sniff out the + run time environment... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + + $test = &new GroupTest('File test'); + $test->addTestFile('tests/file_test.php'); + if (TextReporter::inCli()) { + exit ($test->run(new TextReporter()) ? 0 : 1); + } + $test->run(new HtmlReporter()); +?> + + This is the form used within SimpleTest itself. + +
    + +Remote testing + + SimpleTest ships with an XmlReporter class + used for internal communication. + When run the output looks like... +
    +<?xml version="1.0"?>
    +<run>
    +  <group size="4">
    +    <name>Remote tests</name>
    +    <group size="4">
    +      <name>Visual test with 48 passes, 48 fails and 4 exceptions</name>
    +      <case>
    +        <name>testofunittestcaseoutput</name>
    +        <test>
    +          <name>testofresults</name>
    +          <pass>This assertion passed</pass>
    +          <fail>This assertion failed</fail>
    +        </test>
    +        <test>
    +          ...
    +        </test>
    +      </case>
    +    </group>
    +  </group>
    +</run>
    +
    + You can make use of this format with the parser + supplied as part of SimpleTest itself. + This is called SimpleTestXmlParser and + resides in xml.php within the SimpleTest package... + +<?php + require_once('simpletest/xml.php'); + + ... + $parser = &new SimpleTestXmlParser(new HtmlReporter()); + $parser->parse($test_output); +?> + + The $test_output should be the XML format + from the XML reporter, and could come from say a command + line run of a test case. + The parser sends events to the reporter just like any + other test run. + There are some odd occasions where this is actually useful. +
    + + A problem with large test suites is thet they can exhaust + the default 8Mb memory limit on a PHP process. + By having the test groups output in XML and run in + separate processes, the output can be reparsed to + aggregate the results into a much smaller footprint top level + test. + + + Because the XML output can come from anywhere, this opens + up the possibility of aggregating test runs from remote + servers. + A test case already exists to do this within the SimpleTest + framework, but it is currently experimental... + +<?php + require_once('../remote.php'); + require_once('../reporter.php'); + + $test_url = ...; + $dry_url = ...; + + $test = &new GroupTest('Remote tests'); + $test->addTestCase(new RemoteTestCase($test_url, $dry_url)); + $test->run(new HtmlReporter()); +?> + + The RemoteTestCase takes the actual location + of the test runner, basically a web page in XML format. + It also takes the URL of a reporter set to do a dry run. + This is so that progress can be reported upward correctly. + The RemoteTestCase can be added to test suites + just like any other group test. + +
    +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/ServerStubs.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/ServerStubs.pkg new file mode 100644 index 0000000..96073b5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/ServerStubs.pkg @@ -0,0 +1,323 @@ + + + +Server stubs + + + {@toc} + + +What are server stubs? + + This was originally a pattern named by Robert Binder (Testing + object-oriented systems: models, patterns, and tools, + Addison-Wesley) in 1999. + A server stub is a simulation of an object or component. + It should exactly replace a component in a system for test + or prototyping purposes, but remain lightweight. + This allows tests to run more quickly, or if the simulated + class has not been written, to run at all. + + + +Creating server stubs + + All we need is an existing class, say a database connection + that looks like this... + +class DatabaseConnection { + function DatabaseConnection() { + } + + function query() { + } + + function selectQuery() { + } +} + + The class does not need to have been implemented yet. + To create a stub version of the class we need to include the + server stub library and run the generator... + +require_once('simpletest/mock_objects.php'); +require_once('database_connection.php'); +Stub::generate('DatabaseConnection'); + + This generates a clone class called + StubDatabaseConnection. + We can now create instances of the new class within + our prototype script... + +require_once('simpletest/mock_objects.php'); +require_once('database_connection.php'); +Stub::generate('DatabaseConnection'); + +$connection = new StubDatabaseConnection(); + + + The stub version of a class has all the methods of the original + so that operations like + $connection->query() are still + legal. + The return value will be null, + but we can change that with... + +$connection->setReturnValue('query', 37) + + Now every time we call + $connection->query() we get + the result of 37. + We can set the return value to anything, say a hash of + imaginary database results or a list of persistent objects. + Parameters are irrelevant here, we always get the same + values back each time once they have been set up this way. + That may not sound like a convincing replica of a + database connection, but for the half a dozen lines of + a test method it is usually all you need. + + + +Simulation patterns + + Things aren't always that simple though. + One common problem is iterators, where constantly returning + the same value could cause an endless loop in the object + being tested. + For these we need to set up sequences of values. + Let's say we have a simple iterator that looks like this... + +class Iterator { + function Iterator() { + } + + function next() { + } +} + + This is about the simplest iterator you could have. + Assuming that this iterator only returns text until it + reaches the end, when it returns false, we can simulate it + with... + +Stub::generate('Iterator'); + +$iterator = new StubIterator(); +$iterator->setReturnValue('next', false); +$iterator->setReturnValueAt(0, 'next', 'First string'); +$iterator->setReturnValueAt(1, 'next', 'Second string'); + + When next() is called on the + stub iterator it will first return "First string", + on the second call "Second string" will be returned + and on any other call false will + be returned. + The sequenced return values take precedence over the constant + return value. + The constant one is a kind of default if you like. + + + Another tricky situation is an overloaded + get() operation. + An example of this is an information holder with name/value pairs. + Say we have a configuration class like... + +class Configuration { + function Configuration() { + } + + function getValue($key) { + } +} + + This is a classic situation for using stub objects as + actual configuration will vary from machine to machine, + hardly helping the reliability of our tests if we use it + directly. + The problem though is that all the data comes through the + getValue() method and yet + we want different results for different keys. + Luckily the stubs have a filter system... + +Stub::generate('Configuration'); + +$config = &new StubConfiguration(); +$config->setReturnValue('getValue', 'primary', array('db_host')); +$config->setReturnValue('getValue', 'admin', array('db_user')); +$config->setReturnValue('getValue', 'secret', array('db_password')); + + The extra parameter is a list of arguments to attempt + to match. + In this case we are trying to match only one argument which + is the look up key. + Now when the server stub has the + getValue() method invoked + like this... + +$config->getValue('db_user'); + + ...it will return "admin". + It finds this by attempting to match the calling arguments + to its list of returns one after another until + a complete match is found. + + + You can set a default argument argument like so... + +$config->setReturnValue('getValue', false, array('*')); + + This is not the same as setting the return value without + any argument requirements like this... + +$config->setReturnValue('getValue', false); + + In the first case it will accept any single argument, + but exactly one is required. + In the second case any number of arguments will do and + it acts as a catchall after all other matches. + Note that if we add further single parameter options after + the wildcard in the first case, they will be ignored as the wildcard + will match first. + With complex parameter lists the ordering could be important + or else desired matches could be masked by earlier wildcard + ones. + Declare the most specific matches first if you are not sure. + + + There are times when you want a specific object to be + dished out by the stub rather than just a copy. + The PHP copy semantics force us to use a different method + for this. + You might be simulating a container for example... + +class Thing { +} + +class Vector { + function Vector() { + } + + function get($index) { + } +} + + In this case you can set a reference into the stub's + return list... + +Stub::generate('Vector'); + +$thing = new Thing(); +$vector = &new StubVector(); +$vector->setReturnReference('get', $thing, array(12)); + + With this arrangement you know that every time + $vector->get(12) is + called it will return the same + $thing each time. + + + These three factors, timing, parameters and whether to copy, + can be combined orthogonally. + For example... + +$complex = &new StubComplexThing(); +$stuff = new Stuff(); +$complex->setReturnReferenceAt(3, 'get', $stuff, array('*', 1)); + + This will return the $stuff only on the third + call and only if two parameters were set the second of + which must be the integer 1. + That should cover most simple prototyping situations. + + + A final tricky case is one object creating another, known + as a factory pattern. + Suppose that on a successful query to our imaginary + database, a result set is returned as an iterator with + each call to next() giving + one row until false. + This sounds like a simulation nightmare, but in fact it can all + be stubbed using the mechanics above. + + + Here's how... + +Stub::generate('DatabaseConnection'); +Stub::generate('ResultIterator'); + +class DatabaseTest extends UnitTestCase { + + function testUserFinder() { + $result = &new StubResultIterator(); + $result->setReturnValue('next', false); + $result->setReturnValueAt(0, 'next', array(1, 'tom')); + $result->setReturnValueAt(1, 'next', array(3, 'dick')); + $result->setReturnValueAt(2, 'next', array(6, 'harry')); + + $connection = &new StubDatabaseConnection(); + $connection->setReturnValue('query', false); + $connection->setReturnReference( + 'query', + $result, + array('select id, name from users')); + + $finder = &new UserFinder($connection); + $this->assertIdentical( + $finder->findNames(), + array('tom', 'dick', 'harry')); + } +} + + Now only if our + $connection is called with the correct + query() will the + $result be returned that is + itself exhausted after the third call to next(). + This should be enough + information for our UserFinder class, + the class actually + being tested here, to come up with goods. + A very precise test and not a real database in sight. + + + +Stub creation options + + There are some additional options when creating stubs. + At the generation stage we can change the class name... + +Stub::generate('Iterator', 'MyStubIterator'); +$iterator = &new MyStubIterator(); + + + This is not very useful in itself as there would be no difference + in this class and the default except for the name. + However we can also add additional methods not found in the + original interface... + +class Iterator { +} +Stub::generate('Iterator', 'PrototypeIterator', array('next', 'isError')); +$iterator = &new PrototypeIterator(); +$iterator->setReturnValue('next', 0); + + + The next() and + isError() methods can now have + return values set just as if they existed in the original class. + + + One other esoteric way of customising the stubs is to change + the default wildcard used for parameter matching. + +Stub::generate('Connection'); +$iterator = &new StubConnection('wild'); +$iterator->setReturnValue('query', array('id' => 33), array('wild')); + + + The only reason to do this is if you genuinely wanted to test + against the literal string "*" and didn't want it + interpreted as "any". + + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/SimpleTest.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/SimpleTest.pkg new file mode 100644 index 0000000..7def579 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/SimpleTest.pkg @@ -0,0 +1,387 @@ + + + +Overview + + + + + + Marcus Baker + + Primary Developer +{@link mailto:marcus@lastcraft.com marcus@lastcraft.com} + + + + Harry Fuecks + + Packager +{@link mailto:harryf@users.sourceforge.net harryf@users.sourceforge.net} + + + + Jason Sweat + + Documentation +{@link mailto:jsweat_php@yahoo.com jsweat_php@yahoo.com} + + + + + {@toc} + + +What is SimpleTest? + + The heart of SimpleTest is a testing framework built around + test case classes. + These are written as extensions of base test case classes, + each extended with methods that actually contain test code. + Top level test scripts then invoke the run() + methods on every one of these test cases in order. + Each test method is written to invoke various assertions that + the developer expects to be true such as + assertEqual(). + If the expectation is correct, then a successful result is dispatched to the + observing test reporter, but any failure triggers an alert + and a description of the mismatch. + + + A {@link test case.html test case} looks like this... + +<?php +class MyTestCase extends UnitTestCase { + + function testLog() { + $log = &new Log('my.log'); + $log->message('Hello'); + $this->assertTrue(file_exists('my.log')); + } +} +?> + + + + These tools are designed for the developer. + Tests are written in the PHP language itself more or less + as the application itself is built. + The advantage of using PHP itself as the testing language is that + there are no new languages to learn, testing can start straight away, + and the developer can test any part of the code. + Basically, all parts that can be accessed by the application code can also be + accessed by the test code if they are in the same language. + + + The simplest type of test case is the + {@link UnitTestCase.html UnitTestCase}. + This class of test case includes standard tests for equality, + references and pattern matching. + All these test the typical expectations of what you would + expect the result of a function or method to be. + This is by far the most common type of test in the daily + routine of development, making up about 95% of test cases. + + + The top level task of a web application though is not to + produce correct output from its methods and objects, but + to generate web pages. + The {@link WebTestCase.html WebTestCase} class tests web + pages. + It simulates a web browser requesting a page, complete with + cookies, proxies, secure connections, authentication, forms, frames and most + navigation elements. + With this type of test case, the developer can assert that + information is present in the page and that forms and + sessions are handled correctly. + + + A {@link WebTestCase.html WebTestCase} looks like this... + +<?php +class MySiteTest extends WebTestCase { + + function testHomePage() { + $this->get('http://www.my-site.com/index.php'); + $this->assertTitle('My Home Page'); + $this->clickLink('Contact'); + $this->assertTitle('Contact me'); + $this->assertWantedPattern('/Email me at/'); + } +} +?> + + + + +Feature list + + The following is a very rough outline of past and future features + and their expected point of release. + I am afraid it is liable to change without warning as meeting the + milestones rather depends on time available. + Green stuff has been coded, but not necessarily released yet. + If you have a pressing need for a green but unreleased feature + then you should check-out the code from sourceforge CVS directly. + A released feature is marked as "Done". + + + + + + + + + + + Unit test case + Core test case class and assertions + Done + + + Html display + Simplest possible display + Done + + + Autoloading of test cases + + Reading a file with test cases and loading them into a + group test automatically + + Done + + + Mock objects code generator + + Objects capable of simulating other objects removing + test dependencies + + Done + + + Server stubs + + Mocks without expectations to be used outside of test cases, + e.g. for prototyping + + Done + + + Integration of other unit testers + + The ability to read and simulate test cases from PHPUnit + and PEAR::PhpUnit + + Done + + + Web test case + Basic pattern matching of fetched pages + Done + + + HTML parsing of pages + Allows link following and title tag matching + Done + + + Partial mocks + + Mocking parts of a class for testing less than a class + or for complex simulations + + Done + + + Web cookie handling + Correct handling of cookies when fetching pages + Done + + + Following redirects + Page fetching automatically follows 300 redirects + Done + + + Form parsing + Ability to submit simple forms and read default form values + Done + + + Command line interface + Test display without the need of a web browser + Done + + + Exposure of expectation classes + Can create precise tests with mocks as well as test cases + Done + + + XML output and parsing + + Allows multi host testing and the integration of acceptance + testing extensions + + Done + + + Command line test case + Allows testing of utilities and file handling + Done + + + PHP Documentor compatibility + Fully generated class level documentation + Done + + + Browser interface + + Exposure of lower level web browser interface for more + detailed test cases + + Done + + + HTTP authentication + + Fetching protected web pages with basic authentication + only + + Done + + + Browser navigation buttons + Back, forward and retry + Done + + + SSL support + Can connect to https: pages + Done + + + Proxy support + Can connect via. common proxies + Done + + + Frames support + Handling of frames in web test cases + Done + + + Improved display + Better web GUI with tree display of test cases + 1.1 + + + Localisation + Messages abstracted and code generated from XML + 1.1 + + + File upload testing + Can simulate the input type file tag + 1.1 + + + Mocking interfaces + Can generate mock objects to interfaces as well as classes + 2.0 + + + Testing exceptions + Similar to testing PHP errors + 2.0 + + + XPath searching of elements + Can make use of HTML tidy for faster and more flexible content matching + 2.0 + + +
    FeatureDescriptionRelease
    + PHP5 migraton will start straight after the version 1.1 series, + whereupon PHP4 will no longer be supported. + SimpleTest is currently compatible with PHP5, but will not + make use of all of the new features until version 2. +
    +
    + +Web resources for testing + + Process is at least as important as tools. + The type of process that makes the heaviest use of a developer's + testing tool is of course + {@link http://www.extremeprogramming.org/ Extreme Programming}. + This is one of the + {@link http://www.agilealliance.com/articles/index Agile Methodologies} + which combine various practices to "flatten the cost curve" of software development. + More extreme still is {@link http://www.testdriven.com/modules/news/ Test Driven Development}, + where you very strictly adhere to the rule of no coding until you have a test. + If you're more of a planner or believe that experience trumps evolution, + you may prefer the + {@link http://www.therationaledge.com/content/dec_01/f_spiritOfTheRUP_pk.html RUP} approach. + I haven't tried it, but even I can see that you will need test tools (see figure 9). + + + Most unit testers clone {@link http://www.junit.org/ JUnit} to some degree, + as far as the interface at least. There is a wealth of information on the + JUnit site including the + {@link http://junit.sourceforge.net/doc/faq/faq.htm FAQ} + which contains plenty of general advice on testing. + Once you get bitten by the bug you will certainly appreciate the phrase + {@link http://junit.sourceforge.net/doc/testinfected/testing.htm test infected} + coined by Eric Gamma. + If you are still reviewing which unit tester to use the main choices + are {@link http://phpunit.sourceforge.net/ PHPUnit} + and {@link http://pear.php.net/manual/en/package.php.phpunit.php Pear PHP::PHPUnit}. + They currently lack a lot of features found in + {@link http://www.lastcraft.com/simple_test.php SimpleTest}, but the PEAR + version at least has been upgraded for PHP5 and is recommended if you are porting + existing {@link http://www.junit.org/ JUnit} test cases. + + + Library writers don't seem to ship tests with their code very often + which is a shame. + Library code that includes tests can be more safely refactored and + the test code can act as additional documentation in a fairly standard + form. + This can save trawling the source code for clues when problems occour, + especially when upgrading such a library. + Libraries using SimpleTest for their unit testing include + {@link http://wact.sourceforge.net/ WACT} and + {@link http://sourceforge.net/projects/htmlsax PEAR::XML_HTMLSax}. + + + There is currently a sad lack of material on mock objects, which is a shame + as unit testing without them is a lot more work. + The {@link http://www.sidewize.com/company/mockobjects.pdf original mock objects paper} + is very Java focused, but still worth a read. + As a new technology there are plenty of discussions and debate on how to use mocks, + often on Wikis such as + {@link http://xpdeveloper.com/cgi-bin/oldwiki.cgi?MockObjects Extreme Tuesday} + or {@link http://www.mockobjects.com/wiki/MocksObjectsPaper www.mockobjects.com} + or {@link http://c2.com/cgi/wiki?MockObject the original C2 Wiki}. + Injecting mocks into a class is the main area of debate for which this + {@link http://www-106.ibm.com/developerworks/java/library/j-mocktest.html paper on IBM} + makes a good starting point. + + + There are plenty of web testing tools, but most are written in Java and + tutorials and advice are rather thin on the ground. + The only hope is to look at the documentation for + {@link http://httpunit.sourceforge.net/ HTTPUnit}, + {@link http://htmlunit.sourceforge.net/ HTMLUnit} + or {@link http://jwebunit.sourceforge.net/ JWebUnit} and hope for clues. + There are some XML driven test frameworks, but again most + require Java to run. + As SimpleTest does not support JavaScript you would probably + have to look at these tools anyway if you have highly dynamic + pages. + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/SimpleTest.pkg.ini b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/SimpleTest.pkg.ini new file mode 100644 index 0000000..695548d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/SimpleTest.pkg.ini @@ -0,0 +1,10 @@ +[Linked Tutorials] +UnitTestCase +GroupTests +ServerStubs +MockObjects +PartialMock +Reporting +Expectations +WebTester +FormTesting \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/UnitTestCase.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/UnitTestCase.pkg new file mode 100644 index 0000000..3f48c5f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/UnitTestCase.pkg @@ -0,0 +1,405 @@ + + + +Unit tester + + + {@toc} + + +Unit test cases + + The core system is a regression testing framework built around + test cases. + A sample test case looks like this... + +class FileTestCase extends UnitTestCase { +} + + If no test name is supplied when chaining the constructor then + the class name will be taken instead. + This will be the name displayed in the test results. + + + Actual tests are added as methods in the test case whose names + by default start with the string "test" and + when the test case is invoked all such methods are run in + the order that PHP introspection finds them. + As many test methods can be added as needed. + For example... + +require_once('../classes/writer.php'); + +class FileTestCase extends UnitTestCase { + function FileTestCase() { + $this->UnitTestCase('File test'); + } + + function setUp() { + @unlink('../temp/test.txt'); + } + + function tearDown() { + @unlink('../temp/test.txt'); + } + + function testCreation() { + $writer = &new FileWriter('../temp/test.txt'); + $writer->write('Hello'); + $this->assertTrue(file_exists('../temp/test.txt'), 'File created'); + } +} + + The constructor is optional and usually omitted. + Without a name, the class name is taken as the name of the test case. + + + Our only test method at the moment is testCreation() + where we check that a file has been created by our + Writer object. + We could have put the unlink() + code into this method as well, but by placing it in + setUp() and + tearDown() we can use it with + other test methods that we add. + + + The setUp() method is run + just before each and every test method. + tearDown() is run just after + each and every test method. + + + You can place some test case set up into the constructor to + be run once for all the methods in the test case, but + you risk test inteference that way. + This way is slightly slower, but it is safer. + Note that if you come from a JUnit background this will not + be the behaviour you are used to. + JUnit surprisingly reinstantiates the test case for each test + method to prevent such interference. + SimpleTest requires the end user to use setUp(), but + supplies additional hooks for library writers. + + + The means of reporting test results (see below) are by a + visiting display class + that is notified by various assert...() + methods. + Here is the full list for the UnitTestCase + class, the default for SimpleTest... + + + + +assertTrue($x) + +Fail if $x is false + + + +assertFalse($x) + +Fail if $x is true + + + +assertNull($x) + +Fail if $x is set + + + +assertNotNull($x) + +Fail if $x not set + + + +assertIsA($x, $t) + +Fail if $x is not the class or type $t + + + +assertNotA($x, $t) + +Fail if $x is of the class or type $t + + + +assertEqual($x, $y) + +Fail if $x == $y is false + + + +assertNotEqual($x, $y) + +Fail if $x == $y is true + + + +assertIdentical($x, $y) + +Fail if $x == $y is false or a type mismatch + + + +assertNotIdentical($x, $y) + +Fail if $x == $y is true and types match + + + +assertReference($x, $y) + +Fail unless $x and $y are the same variable + + + +assertCopy($x, $y) + +Fail if $x and $y are the same variable + + + +assertWantedPattern($p, $x) + +Fail unless the regex $p matches $x + + + +assertNoUnwantedPattern($p, $x) + +Fail if the regex $p matches $x + + + +assertNoErrors() + +Fail if any PHP error occoured + + + +assertError($x) + +Fail if no PHP error or incorrect message + + + +assertErrorPattern($p) + +Fail unless the error matches the regex $p + + +
    + All assertion methods can take an optional description to + label the displayed result with. + If omitted a default message is sent instead which is usually + sufficient. + This default message can still be embedded in your own message + if you include "%s" within the string. + All the assertions return true on a pass or false on failure. +
    + + Some examples... + +$variable = null; +$this->assertNull($variable, 'Should be cleared'); + + ...will pass and normally show no message. + If you have + {@link http://www.lastcraft.com/display_subclass_tutorial.php set up the tester to display passes} + as well then the message will be displayed as is. + +$this->assertIdentical(0, false, 'Zero is not false [%s]'); + + This will fail as it performs a type + check as well as a comparison between the two values. + The "%s" part is replaced by the default + error message that would have been shown if we had not + supplied our own. + This also allows us to nest test messages. + +$a = 1; +$b = $a; +$this->assertReference($a, $b); + + Will fail as the variable $a is a copy of $b. + +$this->assertWantedPattern('/hello/i', 'Hello world'); + + This will pass as using a case insensitive match the string + hello is contained in Hello world. + +trigger_error('Disaster'); +trigger_error('Catastrophe'); +$this->assertError(); +$this->assertError('Catastrophe'); +$this->assertNoErrors(); + + This one takes some explanation as in fact they all pass! + + + PHP errors in SimpleTest are trapped and placed in a queue. + Here the first error check catches the "Disaster" + message without checking the text and passes. + This removes the error from the queue. + The next error check tests not only the existence of the error, + but also the text which here matches so another pass. + With the queue now empty the last test will pass as well. + If any unchecked errors are left at the end of a test method then + an exception will be reported in the test. + Note that SimpleTest cannot catch compile time PHP errors. + + + The test cases also have some convenience methods for debugging + code or extending the suite... + + + + +setUp() + +Runs this before each test method + + + +tearDown() + +Runs this after each test method + + + +pass() + +Sends a test pass + + + +fail() + +Sends a test failure + + + +error() + +Sends an exception event + + + +sendMessage() + +Sends a status message to those displays that support it + + + +signal($type, $payload) + +Sends a user defined message to the test reporter + + + +dump($var) + +Does a formatted print_r() for quick and dirty debugging + + + +swallowErrors() + +Clears the error queue + + +
    +
    +
    + +Extending test cases + + Of course additional test methods can be added to create + specific types of test case too so as to extend framework... + +require_once('simpletest/unit_tester.php'); + +class FileTester extends UnitTestCase { + function FileTester($name = false) { + $this->UnitTestCase($name); + } + + function assertFileExists($filename, $message = '%s') { + $this->assertTrue( + file_exists($filename), + sprintf($message, 'File [$filename] existence check')); + } +} + + Here the SimpleTest library is held in a folder called + simpletest that is local. + Substitute your own path for this. + + + This new case can be now be inherited just like + a normal test case... + +class FileTestCase extends FileTester { + + function setUp() { + @unlink('../temp/test.txt'); + } + + function tearDown() { + @unlink('../temp/test.txt'); + } + + function testCreation() { + $writer = &new FileWriter('../temp/test.txt'); + $writer->write('Hello'); + $this->assertFileExists('../temp/test.txt'); + } +} + + + + If you want a test case that does not have all of the + UnitTestCase assertions, + only your own and assertTrue(), + you need to extend the SimpleTestCase + class instead. + It is found in simple_test.php rather than + unit_tester.php. + See {@link later.html later} if you + want to incorporate other unit tester's + test cases in your test suites. + + + +Running a single test case + + You won't often run single test cases except when bashing + away at a module that is having difficulty and you don't + want to upset the main test suite. + Here is the scaffolding needed to run the a lone test case... + +<?php + require_once('simpletest/unit_tester.php'); + require_once('simpletest/reporter.php'); + require_once('../classes/writer.php'); + + class FileTestCase extends UnitTestCase { + function FileTestCase() { + $this->UnitTestCase('File test'); + } + } + + $test = &new FileTestCase(); + $test->run(new HtmlReporter()); +?> + + This script will run as is, but will output zero passes + and zero failures until test methods are added. + + +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/WebTester.pkg b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/WebTester.pkg new file mode 100644 index 0000000..1ceb5cc --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/tutorials/SimpleTest/WebTester.pkg @@ -0,0 +1,610 @@ + + + +Web tester + + + {@toc} + + +Fetching a page + + Testing classes is all very well, but PHP is predominately + a language for creating functionality within web pages. + How do we test the front end presentation role of our PHP + applications? + Well the web pages are just text, so we should be able to + examine them just like any other test data. + + + This leads to a tricky issue. + If we test at too low a level, testing for matching tags + in the page with pattern matching for example, our tests will + be brittle. + The slightest change in layout could break a large number of + tests. + If we test at too high a level, say using mock versions of a + template engine, then we lose the ability to automate some classes + of test. + For example, the interaction of forms and navigation will + have to be tested manually. + These types of test are extremely repetitive and error prone. + + + SimpleTest includes a special form of test case for the testing + of web page actions. + The WebTestCase includes facilities + for navigation, content and cookie checks and form handling. + Usage of these test cases is similar to the + {@link UnitTestCase.html UnitTestCase}... + +class TestOfLastcraft extends WebTestCase { +} + + Here we are about to test the + {@link http://www/lastcraft.com/ Last Craft} site itself. + If this test case is in a file called lastcraft_test.php + then it can be loaded in a runner script just like unit tests... + +<?php + require_once('simpletest/web_tester.php'); + require_once('simpletest/reporter.php'); + + $test = &new GroupTest('Web site tests'); + $test->addTestFile('lastcraft_test.php'); + exit ($test->run(new TextReporter()) ? 0 : 1); +?> + + I am using the text reporter here to more clearly + distinguish the web content from the test output. + + + Nothing is being tested yet. + We can fetch the home page by using the + get() method... + +class TestOfLastcraft extends WebTestCase { + + function testHomepage() { + $this->assertTrue($this->get('http://www.lastcraft.com/')); + } +} + + The get() method will + return true only if page content was successfully + loaded. + It is a simple, but crude way to check that a web page + was actually delivered by the web server. + However that content may be a 404 response and yet + our get() method will still return true. + + + Assuming that the web server for the Last Craft site is up + (sadly not always the case), we should see... +
    +Web site tests
    +OK
    +Test cases run: 1/1, Failures: 0, Exceptions: 0
    +
    + All we have really checked is that any kind of page was + returned. + We don't yet know if it was the right one. +
    +
    + +Testing page content + + To confirm that the page we think we are on is actually the + page we are on, we need to verify the page content. + +class TestOfLastcraft extends WebTestCase { + + function testHomepage() { + $this->get('http://www.lastcraft.com/'); + $this->assertWantedPattern('/why the last craft/i'); + } +} + + The page from the last fetch is held in a buffer in + the test case, so there is no need to refer to it directly. + The pattern match is always made against the buffer. + + + Here is the list of possible content assertions... + + + + +assertTitle($title) + +Pass if title is an exact match + + + +assertWantedPattern($pattern) + +A Perl pattern match against the page content + + + +assertNoUnwantedPattern($pattern) + +A Perl pattern match to not find content + + + +assertWantedText($text) + +Pass if matches visible and "alt" text + + + +assertNoUnwantedText($text) + +Pass if doesn't match visible and "alt" text + + + +assertLink($label) + +Pass if a link with this text is present + + + +assertNoLink($label) + +Pass if no link with this text is present + + + +assertLinkById($id) + +Pass if a link with this id attribute is present + + + +assertNoLinkById($id) + +Pass if no link with this id attribute is present + + + +assertField($name, $value) + +Pass if an input tag with this name has this value + + + +assertFieldById($id, $value) + +Pass if an input tag with this id has this value + + + +assertResponse($codes) + +Pass if HTTP response matches this list + + + +assertMime($types) + +Pass if MIME type is in this list + + + +assertAuthentication($protocol) + +Pass if the current challenge is this protocol + + + +assertNoAuthentication() + +Pass if there is no current challenge + + + +assertRealm($name) + +Pass if the current challenge realm matches + + + +assertHeader($header, $content) + +Pass if a header was fetched matching this value + + + +assertNoUnwantedHeader($header) + +Pass if a header was not fetched + + + +assertHeaderPattern($header, $pattern) + +Pass if a header was fetched matching this Perl regex + + + +assertCookie($name, $value) + +Pass if there is currently a matching cookie + + + +assertNoCookie($name) + +Pass if there is currently no cookie of this name + + +
    + As usual with the SimpleTest assertions, they all return + false on failure and true on pass. + They also allow an optional test message and you can embed + the original test message inside using "%s" inside + your custom message. +
    + + So now we could instead test against the title tag with... + +$this->assertTitle('The Last Craft? Web developer tutorials on PHP, Extreme programming and Object Oriented development'); + + As well as the simple HTML content checks we can check + that the MIME type is in a list of allowed types with... + +$this->assertMime(array('text/plain', 'text/html')); + + More interesting is checking the HTTP response code. + Like the MIME type, we can assert that the response code + is in a list of allowed values... + +class TestOfLastcraft extends WebTestCase { + + function testRedirects() { + $this->get('http://www.lastcraft.com/test/redirect.php'); + $this->assertResponse(200);</strong> + } +} + + Here we are checking that the fetch is successful by + allowing only a 200 HTTP response. + This test will pass, but it is not actually correct to do so. + There is no page, instead the server issues a redirect. + The WebTestCase will + automatically follow up to three such redirects. + The tests are more robust this way and we are usually + interested in the interaction with the pages rather + than their delivery. + If the redirects are of interest then this ability must + be disabled... + +class TestOfLastcraft extends WebTestCase { + + function testHomepage() { + $this->setMaximumRedirects(0); + $this->get('http://www.lastcraft.com/test/redirect.php'); + $this->assertResponse(200); + } +} + + The assertion now fails as expected... +
    +Web site tests
    +1) Expecting response in [200] got [302]
    +	in testhomepage
    +	in testoflastcraft
    +	in lastcraft_test.php
    +FAILURES!!!
    +Test cases run: 1/1, Failures: 1, Exceptions: 0
    +
    + We can modify the test to correctly assert redirects with... + +class TestOfLastcraft extends WebTestCase { + + function testHomepage() { + $this->setMaximumRedirects(0); + $this->get('http://www.lastcraft.com/test/redirect.php'); + $this->assertResponse(array(301, 302, 303, 307)); + } +} + + This now passes. +
    +
    + +Navigating a web site + + Users don't often navigate sites by typing in URLs, but by + clicking links and buttons. + Here we confirm that the contact details can be reached + from the home page... + +class TestOfLastcraft extends WebTestCase { + ... + function testContact() { + $this->get('http://www.lastcraft.com/'); + $this->clickLink('About'); + $this->assertTitle('About Last Craft'); + } +} + + The parameter is the text of the link. + + + If the target is a button rather than an anchor tag, then + clickSubmit() should be used + with the button title... + +$this->clickSubmit('Go!'); + + + + The list of navigation methods is... + + + + +getUrl() + +The current location + + + +get($url, $parameters) + +Send a GET request with these parameters + + + +post($url, $parameters) + +Send a POST request with these parameters + + + +head($url, $parameters) + +Send a HEAD request without replacing the page content + + + +retry() + +Reload the last request + + + +back() + +Like the browser back button + + + +forward() + +Like the browser forward button + + + +authenticate($name, $password) + +Retry after a challenge + + + +restart() + +Restarts the browser as if a new session + + + +getCookie($name) + +Gets the cookie value for the current context + + + +ageCookies($interval) + +Ages current cookies prior to a restart + + + +clearFrameFocus() + +Go back to treating all frames as one page + + + +clickSubmit($label) + +Click the first button with this label + + + +clickSubmitByName($name) + +Click the button with this name attribute + + + +clickSubmitById($id) + +Click the button with this ID attribute + + + +clickImage($label, $x, $y) + +Click an input tag of type image by title or alt text + + + +clickImageByName($name, $x, $y) + +Click an input tag of type image by name + + + +clickImageById($id, $x, $y) + +Click an input tag of type image by ID attribute + + + +submitFormById($id) + +Submit a form without the submit value + + + +clickLink($label, $index) + +Click an anchor by the visible label text + + + +clickLinkById($id) + +Click an anchor by the ID attribute + + + +getFrameFocus() + +The name of the currently selected frame + + + +setFrameFocusByIndex($choice) + +Focus on a frame counting from 1 + + + +setFrameFocus($name) + +Focus on a frame by name + + +
    +
    + + The parameters in the get(), post() or + head() methods are optional. + The HTTP HEAD fetch does not change the browser context, only loads + cookies. + This can be useful for when an image or stylesheet sets a cookie + for crafty robot blocking. + + + The retry(), back() and + forward() commands work as they would on + your web browser. + They use the history to retry pages. + This can be handy for checking the effect of hitting the + back button on your forms. + + + The frame methods need a little explanation. + By default a framed page is treated just like any other. + Content will be searced for throughout the entire frameset, + so clicking a link will work no matter which frame + the anchor tag is in. + You can override this behaviour by focusing on a single + frame. + If you do that, all searches and actions will apply to that + frame alone, such as authentication and retries. + If a link or button is not in a focused frame then it cannot + be clicked. + + + Testing navigation on fixed pages only tells you when you + have broken an entire script. + For highly dynamic pages, such as for bulletin boards, this can + be crucial for verifying the correctness of the application. + For most applications though, the really tricky logic is usually in + the handling of forms and sessions. + Fortunately SimpleTest includes + {@link tools for testing web forms.html tools for testing web forms} + as well. + +
    + +Modifying the request + + Although SimpleTest does not have the goal of testing networking + problems, it does include some methods to modify and debug + the requests it makes. + Here is another method list... + + + + +getTransportError() + +The last socket error + + + +showRequest() + +Dump the outgoing request + + + +showHeaders() + +Dump the incoming headers + + + +showSource() + +Dump the raw HTML page content + + + +ignoreFrames() + +Do not load framesets + + + +setCookie($name, $value) + +Set a cookie from now on + + + +addHeader($header) + +Always add this header to the request + + + +setMaximumRedirects($max) + +Stop after this many redirects + + + +setConnectionTimeout($timeout) + +Kill the connection after this time between bytes + + + +useProxy($proxy, $name, $password) + +Make requests via this proxy URL + + +
    + These methods are principally for debugging. +
    +
    +
    diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/unit_tester.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/unit_tester.php new file mode 100644 index 0000000..513f09a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/unit_tester.php @@ -0,0 +1,402 @@ +assert(new TrueExpectation(), $result, $message); + } + + /** + * Will be true on false and vice versa. False + * is the PHP definition of false, so that null, + * empty strings, zero and an empty array all count + * as false. + * @param boolean $result Pass on false. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertFalse($result, $message = '%s') { + return $this->assert(new FalseExpectation(), $result, $message); + } + + /** + * Will be true if the value is null. + * @param null $value Supposedly null value. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertNull($value, $message = '%s') { + $dumper = new SimpleDumper(); + $message = sprintf( + $message, + '[' . $dumper->describeValue($value) . '] should be null'); + return $this->assertTrue(! isset($value), $message); + } + + /** + * Will be true if the value is set. + * @param mixed $value Supposedly set value. + * @param string $message Message to display. + * @return boolean True on pass. + * @access public + */ + function assertNotNull($value, $message = '%s') { + $dumper = new SimpleDumper(); + $message = sprintf( + $message, + '[' . $dumper->describeValue($value) . '] should not be null'); + return $this->assertTrue(isset($value), $message); + } + + /** + * Type and class test. Will pass if class + * matches the type name or is a subclass or + * if not an object, but the type is correct. + * @param mixed $object Object to test. + * @param string $type Type name as string. + * @param string $message Message to display. + * @return boolean True on pass. + * @access public + */ + function assertIsA($object, $type, $message = '%s') { + return $this->assert( + new IsAExpectation($type), + $object, + $message); + } + + /** + * Type and class mismatch test. Will pass if class + * name or underling type does not match the one + * specified. + * @param mixed $object Object to test. + * @param string $type Type name as string. + * @param string $message Message to display. + * @return boolean True on pass. + * @access public + */ + function assertNotA($object, $type, $message = '%s') { + return $this->assert( + new NotAExpectation($type), + $object, + $message); + } + + /** + * Will trigger a pass if the two parameters have + * the same value only. Otherwise a fail. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertEqual($first, $second, $message = '%s') { + return $this->assert( + new EqualExpectation($first), + $second, + $message); + } + + /** + * Will trigger a pass if the two parameters have + * a different value. Otherwise a fail. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertNotEqual($first, $second, $message = '%s') { + return $this->assert( + new NotEqualExpectation($first), + $second, + $message); + } + + /** + * Will trigger a pass if the if the first parameter + * is near enough to the second by the margin. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param mixed $margin Fuzziness of match. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertWithinMargin($first, $second, $margin, $message = '%s') { + return $this->assert( + new WithinMarginExpectation($first, $margin), + $second, + $message); + } + + /** + * Will trigger a pass if the two parameters differ + * by more than the margin. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param mixed $margin Fuzziness of match. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertOutsideMargin($first, $second, $margin, $message = '%s') { + return $this->assert( + new OutsideMarginExpectation($first, $margin), + $second, + $message); + } + + /** + * Will trigger a pass if the two parameters have + * the same value and same type. Otherwise a fail. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertIdentical($first, $second, $message = '%s') { + return $this->assert( + new IdenticalExpectation($first), + $second, + $message); + } + + /** + * Will trigger a pass if the two parameters have + * the different value or different type. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertNotIdentical($first, $second, $message = '%s') { + return $this->assert( + new NotIdenticalExpectation($first), + $second, + $message); + } + + /** + * Will trigger a pass if both parameters refer + * to the same object or value. Fail otherwise. + * This will cause problems testing objects under + * E_STRICT. + * TODO: Replace with expectation. + * @param mixed $first Reference to check. + * @param mixed $second Hopefully the same variable. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertReference(&$first, &$second, $message = '%s') { + $dumper = new SimpleDumper(); + $message = sprintf( + $message, + '[' . $dumper->describeValue($first) . + '] and [' . $dumper->describeValue($second) . + '] should reference the same object'); + return $this->assertTrue( + SimpleTestCompatibility::isReference($first, $second), + $message); + } + + /** + * Will trigger a pass if both parameters refer + * to the same object. Fail otherwise. This has + * the same semantics at the PHPUnit assertSame. + * That is, if values are passed in it has roughly + * the same affect as assertIdentical. + * TODO: Replace with expectation. + * @param mixed $first Object reference to check. + * @param mixed $second Hopefully the same object. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertSame($first, $second, $message = '%s') { + $dumper = new SimpleDumper(); + $message = sprintf( + $message, + '[' . $dumper->describeValue($first) . + '] and [' . $dumper->describeValue($second) . + '] should reference the same object'); + return $this->assertTrue($first === $second, $message); + } + + /** + * Will trigger a pass if both parameters refer + * to different objects. Fail otherwise. The objects + * have to be identical though. + * @param mixed $first Object reference to check. + * @param mixed $second Hopefully not the same object. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertClone($first, $second, $message = '%s') { + $dumper = new SimpleDumper(); + $message = sprintf( + $message, + '[' . $dumper->describeValue($first) . + '] and [' . $dumper->describeValue($second) . + '] should not be the same object'); + $identical = new IdenticalExpectation($first); + return $this->assertTrue( + $identical->test($second) && ! ($first === $second), + $message); + } + + /** + * Will trigger a pass if both parameters refer + * to different variables. Fail otherwise. The objects + * have to be identical references though. + * This will fail under E_STRICT with objects. Use + * assertClone() for this. + * @param mixed $first Object reference to check. + * @param mixed $second Hopefully not the same object. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertCopy(&$first, &$second, $message = "%s") { + $dumper = new SimpleDumper(); + $message = sprintf( + $message, + "[" . $dumper->describeValue($first) . + "] and [" . $dumper->describeValue($second) . + "] should not be the same object"); + return $this->assertFalse( + SimpleTestCompatibility::isReference($first, $second), + $message); + } + + /** + * Will trigger a pass if the Perl regex pattern + * is found in the subject. Fail otherwise. + * @param string $pattern Perl regex to look for including + * the regex delimiters. + * @param string $subject String to search in. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertPattern($pattern, $subject, $message = '%s') { + return $this->assert( + new PatternExpectation($pattern), + $subject, + $message); + } + + /** + * Will trigger a pass if the perl regex pattern + * is not present in subject. Fail if found. + * @param string $pattern Perl regex to look for including + * the regex delimiters. + * @param string $subject String to search in. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertNoPattern($pattern, $subject, $message = '%s') { + return $this->assert( + new NoPatternExpectation($pattern), + $subject, + $message); + } + + /** + * Prepares for an error. If the error mismatches it + * passes through, otherwise it is swallowed. Any + * left over errors trigger failures. + * @param SimpleExpectation/string $expected The error to match. + * @param string $message Message on failure. + * @access public + */ + function expectError($expected = false, $message = '%s') { + $queue = SimpleTest::getContext()->get('SimpleErrorQueue'); + $queue->expectError($this->coerceExpectation($expected), $message); + } + + /** + * Prepares for an exception. If the error mismatches it + * passes through, otherwise it is swallowed. Any + * left over errors trigger failures. + * @param SimpleExpectation/Exception $expected The error to match. + * @param string $message Message on failure. + * @access public + */ + function expectException($expected = false, $message = '%s') { + $queue = SimpleTest::getContext()->get('SimpleExceptionTrap'); + $line = $this->getAssertionLine(); + $queue->expectException($expected, $message . $line); + } + + /** + * Creates an equality expectation if the + * object/value is not already some type + * of expectation. + * @param mixed $expected Expected value. + * @return SimpleExpectation Expectation object. + * @access private + */ + protected function coerceExpectation($expected) { + if ($expected == false) { + return new TrueExpectation(); + } + if (SimpleTestCompatibility::isA($expected, 'SimpleExpectation')) { + return $expected; + } + return new EqualExpectation( + is_string($expected) ? str_replace('%', '%%', $expected) : $expected); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/url.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/url.php new file mode 100644 index 0000000..00b0bca --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/url.php @@ -0,0 +1,550 @@ +chompCoordinates($url); + $this->setCoordinates($x, $y); + $this->scheme = $this->chompScheme($url); + if ($this->scheme === 'file') { + // Unescaped backslashes not used in directory separator context + // will get caught by this, but they should have been urlencoded + // anyway so we don't care. If this ends up being a problem, the + // host regexp must be modified to match for backslashes when + // the scheme is file. + $url = str_replace('\\', '/', $url); + } + list($this->username, $this->password) = $this->chompLogin($url); + $this->host = $this->chompHost($url); + $this->port = false; + if (preg_match('/(.*?):(.*)/', $this->host, $host_parts)) { + if ($this->scheme === 'file' && strlen($this->host) === 2) { + // DOS drive was placed in authority; promote it to path. + $url = '/' . $this->host . $url; + $this->host = false; + } else { + $this->host = $host_parts[1]; + $this->port = (integer)$host_parts[2]; + } + } + $this->path = $this->chompPath($url); + $this->request = $this->parseRequest($this->chompRequest($url)); + $this->fragment = (strncmp($url, "#", 1) == 0 ? substr($url, 1) : false); + $this->target = false; + } + + /** + * Extracts the X, Y coordinate pair from an image map. + * @param string $url URL so far. The coordinates will be + * removed. + * @return array X, Y as a pair of integers. + * @access private + */ + protected function chompCoordinates(&$url) { + if (preg_match('/(.*)\?(\d+),(\d+)$/', $url, $matches)) { + $url = $matches[1]; + return array((integer)$matches[2], (integer)$matches[3]); + } + return array(false, false); + } + + /** + * Extracts the scheme part of an incoming URL. + * @param string $url URL so far. The scheme will be + * removed. + * @return string Scheme part or false. + * @access private + */ + protected function chompScheme(&$url) { + if (preg_match('#^([^/:]*):(//)(.*)#', $url, $matches)) { + $url = $matches[2] . $matches[3]; + return $matches[1]; + } + return false; + } + + /** + * Extracts the username and password from the + * incoming URL. The // prefix will be reattached + * to the URL after the doublet is extracted. + * @param string $url URL so far. The username and + * password are removed. + * @return array Two item list of username and + * password. Will urldecode() them. + * @access private + */ + protected function chompLogin(&$url) { + $prefix = ''; + if (preg_match('#^(//)(.*)#', $url, $matches)) { + $prefix = $matches[1]; + $url = $matches[2]; + } + if (preg_match('#^([^/]*)@(.*)#', $url, $matches)) { + $url = $prefix . $matches[2]; + $parts = split(":", $matches[1]); + return array( + urldecode($parts[0]), + isset($parts[1]) ? urldecode($parts[1]) : false); + } + $url = $prefix . $url; + return array(false, false); + } + + /** + * Extracts the host part of an incoming URL. + * Includes the port number part. Will extract + * the host if it starts with // or it has + * a top level domain or it has at least two + * dots. + * @param string $url URL so far. The host will be + * removed. + * @return string Host part guess or false. + * @access private + */ + protected function chompHost(&$url) { + if (preg_match('!^(//)(.*?)(/.*|\?.*|#.*|$)!', $url, $matches)) { + $url = $matches[3]; + return $matches[2]; + } + if (preg_match('!(.*?)(\.\./|\./|/|\?|#|$)(.*)!', $url, $matches)) { + $tlds = SimpleUrl::getAllTopLevelDomains(); + if (preg_match('/[a-z0-9\-]+\.(' . $tlds . ')/i', $matches[1])) { + $url = $matches[2] . $matches[3]; + return $matches[1]; + } elseif (preg_match('/[a-z0-9\-]+\.[a-z0-9\-]+\.[a-z0-9\-]+/i', $matches[1])) { + $url = $matches[2] . $matches[3]; + return $matches[1]; + } + } + return false; + } + + /** + * Extracts the path information from the incoming + * URL. Strips this path from the URL. + * @param string $url URL so far. The host will be + * removed. + * @return string Path part or '/'. + * @access private + */ + protected function chompPath(&$url) { + if (preg_match('/(.*?)(\?|#|$)(.*)/', $url, $matches)) { + $url = $matches[2] . $matches[3]; + return ($matches[1] ? $matches[1] : ''); + } + return ''; + } + + /** + * Strips off the request data. + * @param string $url URL so far. The request will be + * removed. + * @return string Raw request part. + * @access private + */ + protected function chompRequest(&$url) { + if (preg_match('/\?(.*?)(#|$)(.*)/', $url, $matches)) { + $url = $matches[2] . $matches[3]; + return $matches[1]; + } + return ''; + } + + /** + * Breaks the request down into an object. + * @param string $raw Raw request. + * @return SimpleFormEncoding Parsed data. + * @access private + */ + protected function parseRequest($raw) { + $this->raw = $raw; + $request = new SimpleGetEncoding(); + foreach (split("&", $raw) as $pair) { + if (preg_match('/(.*?)=(.*)/', $pair, $matches)) { + $request->add($matches[1], urldecode($matches[2])); + } elseif ($pair) { + $request->add($pair, ''); + } + } + return $request; + } + + /** + * Accessor for protocol part. + * @param string $default Value to use if not present. + * @return string Scheme name, e.g "http". + * @access public + */ + function getScheme($default = false) { + return $this->scheme ? $this->scheme : $default; + } + + /** + * Accessor for user name. + * @return string Username preceding host. + * @access public + */ + function getUsername() { + return $this->username; + } + + /** + * Accessor for password. + * @return string Password preceding host. + * @access public + */ + function getPassword() { + return $this->password; + } + + /** + * Accessor for hostname and port. + * @param string $default Value to use if not present. + * @return string Hostname only. + * @access public + */ + function getHost($default = false) { + return $this->host ? $this->host : $default; + } + + /** + * Accessor for top level domain. + * @return string Last part of host. + * @access public + */ + function getTld() { + $path_parts = pathinfo($this->getHost()); + return (isset($path_parts['extension']) ? $path_parts['extension'] : false); + } + + /** + * Accessor for port number. + * @return integer TCP/IP port number. + * @access public + */ + function getPort() { + return $this->port; + } + + /** + * Accessor for path. + * @return string Full path including leading slash if implied. + * @access public + */ + function getPath() { + if (! $this->path && $this->host) { + return '/'; + } + return $this->path; + } + + /** + * Accessor for page if any. This may be a + * directory name if ambiguious. + * @return Page name. + * @access public + */ + function getPage() { + if (! preg_match('/([^\/]*?)$/', $this->getPath(), $matches)) { + return false; + } + return $matches[1]; + } + + /** + * Gets the path to the page. + * @return string Path less the page. + * @access public + */ + function getBasePath() { + if (! preg_match('/(.*\/)[^\/]*?$/', $this->getPath(), $matches)) { + return false; + } + return $matches[1]; + } + + /** + * Accessor for fragment at end of URL after the "#". + * @return string Part after "#". + * @access public + */ + function getFragment() { + return $this->fragment; + } + + /** + * Sets image coordinates. Set to false to clear + * them. + * @param integer $x Horizontal position. + * @param integer $y Vertical position. + * @access public + */ + function setCoordinates($x = false, $y = false) { + if (($x === false) || ($y === false)) { + $this->x = $this->y = false; + return; + } + $this->x = (integer)$x; + $this->y = (integer)$y; + } + + /** + * Accessor for horizontal image coordinate. + * @return integer X value. + * @access public + */ + function getX() { + return $this->x; + } + + /** + * Accessor for vertical image coordinate. + * @return integer Y value. + * @access public + */ + function getY() { + return $this->y; + } + + /** + * Accessor for current request parameters + * in URL string form. Will return teh original request + * if at all possible even if it doesn't make much + * sense. + * @return string Form is string "?a=1&b=2", etc. + * @access public + */ + function getEncodedRequest() { + if ($this->raw) { + $encoded = $this->raw; + } else { + $encoded = $this->request->asUrlRequest(); + } + if ($encoded) { + return '?' . preg_replace('/^\?/', '', $encoded); + } + return ''; + } + + /** + * Adds an additional parameter to the request. + * @param string $key Name of parameter. + * @param string $value Value as string. + * @access public + */ + function addRequestParameter($key, $value) { + $this->raw = false; + $this->request->add($key, $value); + } + + /** + * Adds additional parameters to the request. + * @param hash/SimpleFormEncoding $parameters Additional + * parameters. + * @access public + */ + function addRequestParameters($parameters) { + $this->raw = false; + $this->request->merge($parameters); + } + + /** + * Clears down all parameters. + * @access public + */ + function clearRequest() { + $this->raw = false; + $this->request = new SimpleGetEncoding(); + } + + /** + * Gets the frame target if present. Although + * not strictly part of the URL specification it + * acts as similarily to the browser. + * @return boolean/string Frame name or false if none. + * @access public + */ + function getTarget() { + return $this->target; + } + + /** + * Attaches a frame target. + * @param string $frame Name of frame. + * @access public + */ + function setTarget($frame) { + $this->raw = false; + $this->target = $frame; + } + + /** + * Renders the URL back into a string. + * @return string URL in canonical form. + * @access public + */ + function asString() { + $path = $this->path; + $scheme = $identity = $host = $port = $encoded = $fragment = ''; + if ($this->username && $this->password) { + $identity = $this->username . ':' . $this->password . '@'; + } + if ($this->getHost()) { + $scheme = $this->getScheme() ? $this->getScheme() : 'http'; + $scheme .= '://'; + $host = $this->getHost(); + } elseif ($this->getScheme() === 'file') { + // Safest way; otherwise, file URLs on Windows have an extra + // leading slash. It might be possible to convert file:// + // URIs to local file paths, but that requires more research. + $scheme = 'file://'; + } + if ($this->getPort() && $this->getPort() != 80 ) { + $port = ':'.$this->getPort(); + } + + if (substr($this->path, 0, 1) == '/') { + $path = $this->normalisePath($this->path); + } + $encoded = $this->getEncodedRequest(); + $fragment = $this->getFragment() ? '#'. $this->getFragment() : ''; + $coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY(); + return "$scheme$identity$host$port$path$encoded$fragment$coords"; + } + + /** + * Replaces unknown sections to turn a relative + * URL into an absolute one. The base URL can + * be either a string or a SimpleUrl object. + * @param string/SimpleUrl $base Base URL. + * @access public + */ + function makeAbsolute($base) { + if (! is_object($base)) { + $base = new SimpleUrl($base); + } + if ($this->getHost()) { + $scheme = $this->getScheme(); + $host = $this->getHost(); + $port = $this->getPort() ? ':' . $this->getPort() : ''; + $identity = $this->getIdentity() ? $this->getIdentity() . '@' : ''; + if (! $identity) { + $identity = $base->getIdentity() ? $base->getIdentity() . '@' : ''; + } + } else { + $scheme = $base->getScheme(); + $host = $base->getHost(); + $port = $base->getPort() ? ':' . $base->getPort() : ''; + $identity = $base->getIdentity() ? $base->getIdentity() . '@' : ''; + } + $path = $this->normalisePath($this->extractAbsolutePath($base)); + $encoded = $this->getEncodedRequest(); + $fragment = $this->getFragment() ? '#'. $this->getFragment() : ''; + $coords = $this->getX() === false ? '' : '?' . $this->getX() . ',' . $this->getY(); + return new SimpleUrl("$scheme://$identity$host$port$path$encoded$fragment$coords"); + } + + /** + * Replaces unknown sections of the path with base parts + * to return a complete absolute one. + * @param string/SimpleUrl $base Base URL. + * @param string Absolute path. + * @access private + */ + protected function extractAbsolutePath($base) { + if ($this->getHost()) { + return $this->path; + } + if (! $this->isRelativePath($this->path)) { + return $this->path; + } + if ($this->path) { + return $base->getBasePath() . $this->path; + } + return $base->getPath(); + } + + /** + * Simple test to see if a path part is relative. + * @param string $path Path to test. + * @return boolean True if starts with a "/". + * @access private + */ + protected function isRelativePath($path) { + return (substr($path, 0, 1) != '/'); + } + + /** + * Extracts the username and password for use in rendering + * a URL. + * @return string/boolean Form of username:password or false. + * @access public + */ + function getIdentity() { + if ($this->username && $this->password) { + return $this->username . ':' . $this->password; + } + return false; + } + + /** + * Replaces . and .. sections of the path. + * @param string $path Unoptimised path. + * @return string Path with dots removed if possible. + * @access public + */ + function normalisePath($path) { + $path = preg_replace('|/\./|', '/', $path); + return preg_replace('|/[^/]+/\.\./|', '/', $path); + } + + /** + * A pipe seperated list of all TLDs that result in two part + * domain names. + * @return string Pipe separated list. + * @access public + */ + static function getAllTopLevelDomains() { + return 'com|edu|net|org|gov|mil|int|biz|info|name|pro|aero|coop|museum'; + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/user_agent.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/user_agent.php new file mode 100644 index 0000000..c7f6536 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/user_agent.php @@ -0,0 +1,328 @@ +cookie_jar = new SimpleCookieJar(); + $this->authenticator = new SimpleAuthenticator(); + } + + /** + * Removes expired and temporary cookies as if + * the browser was closed and re-opened. Authorisation + * has to be obtained again as well. + * @param string/integer $date Time when session restarted. + * If omitted then all persistent + * cookies are kept. + * @access public + */ + function restart($date = false) { + $this->cookie_jar->restartSession($date); + $this->authenticator->restartSession(); + } + + /** + * Adds a header to every fetch. + * @param string $header Header line to add to every + * request until cleared. + * @access public + */ + function addHeader($header) { + $this->additional_headers[] = $header; + } + + /** + * Ages the cookies by the specified time. + * @param integer $interval Amount in seconds. + * @access public + */ + function ageCookies($interval) { + $this->cookie_jar->agePrematurely($interval); + } + + /** + * Sets an additional cookie. If a cookie has + * the same name and path it is replaced. + * @param string $name Cookie key. + * @param string $value Value of cookie. + * @param string $host Host upon which the cookie is valid. + * @param string $path Cookie path if not host wide. + * @param string $expiry Expiry date. + * @access public + */ + function setCookie($name, $value, $host = false, $path = '/', $expiry = false) { + $this->cookie_jar->setCookie($name, $value, $host, $path, $expiry); + } + + /** + * Reads the most specific cookie value from the + * browser cookies. + * @param string $host Host to search. + * @param string $path Applicable path. + * @param string $name Name of cookie to read. + * @return string False if not present, else the + * value as a string. + * @access public + */ + function getCookieValue($host, $path, $name) { + return $this->cookie_jar->getCookieValue($host, $path, $name); + } + + /** + * Reads the current cookies within the base URL. + * @param string $name Key of cookie to find. + * @param SimpleUrl $base Base URL to search from. + * @return string/boolean Null if there is no base URL, false + * if the cookie is not set. + * @access public + */ + function getBaseCookieValue($name, $base) { + if (! $base) { + return null; + } + return $this->getCookieValue($base->getHost(), $base->getPath(), $name); + } + + /** + * Switches off cookie sending and recieving. + * @access public + */ + function ignoreCookies() { + $this->cookies_enabled = false; + } + + /** + * Switches back on the cookie sending and recieving. + * @access public + */ + function useCookies() { + $this->cookies_enabled = true; + } + + /** + * Sets the socket timeout for opening a connection. + * @param integer $timeout Maximum time in seconds. + * @access public + */ + function setConnectionTimeout($timeout) { + $this->connection_timeout = $timeout; + } + + /** + * Sets the maximum number of redirects before + * a page will be loaded anyway. + * @param integer $max Most hops allowed. + * @access public + */ + function setMaximumRedirects($max) { + $this->max_redirects = $max; + } + + /** + * Sets proxy to use on all requests for when + * testing from behind a firewall. Set URL + * to false to disable. + * @param string $proxy Proxy URL. + * @param string $username Proxy username for authentication. + * @param string $password Proxy password for authentication. + * @access public + */ + function useProxy($proxy, $username, $password) { + if (! $proxy) { + $this->proxy = false; + return; + } + if ((strncmp($proxy, 'http://', 7) != 0) && (strncmp($proxy, 'https://', 8) != 0)) { + $proxy = 'http://'. $proxy; + } + $this->proxy = new SimpleUrl($proxy); + $this->proxy_username = $username; + $this->proxy_password = $password; + } + + /** + * Test to see if the redirect limit is passed. + * @param integer $redirects Count so far. + * @return boolean True if over. + * @access private + */ + protected function isTooManyRedirects($redirects) { + return ($redirects > $this->max_redirects); + } + + /** + * Sets the identity for the current realm. + * @param string $host Host to which realm applies. + * @param string $realm Full name of realm. + * @param string $username Username for realm. + * @param string $password Password for realm. + * @access public + */ + function setIdentity($host, $realm, $username, $password) { + $this->authenticator->setIdentityForRealm($host, $realm, $username, $password); + } + + /** + * Fetches a URL as a response object. Will keep trying if redirected. + * It will also collect authentication realm information. + * @param string/SimpleUrl $url Target to fetch. + * @param SimpleEncoding $encoding Additional parameters for request. + * @return SimpleHttpResponse Hopefully the target page. + * @access public + */ + function fetchResponse($url, $encoding) { + if ($encoding->getMethod() != 'POST') { + $url->addRequestParameters($encoding); + $encoding->clear(); + } + $response = $this->fetchWhileRedirected($url, $encoding); + if ($headers = $response->getHeaders()) { + if ($headers->isChallenge()) { + $this->authenticator->addRealm( + $url, + $headers->getAuthentication(), + $headers->getRealm()); + } + } + return $response; + } + + /** + * Fetches the page until no longer redirected or + * until the redirect limit runs out. + * @param SimpleUrl $url Target to fetch. + * @param SimpelFormEncoding $encoding Additional parameters for request. + * @return SimpleHttpResponse Hopefully the target page. + * @access private + */ + protected function fetchWhileRedirected($url, $encoding) { + $redirects = 0; + do { + $response = $this->fetch($url, $encoding); + if ($response->isError()) { + return $response; + } + $headers = $response->getHeaders(); + $location = new SimpleUrl($headers->getLocation()); + $url = $location->makeAbsolute($url); + if ($this->cookies_enabled) { + $headers->writeCookiesToJar($this->cookie_jar, $url); + } + if (! $headers->isRedirect()) { + break; + } + $encoding = new SimpleGetEncoding(); + } while (! $this->isTooManyRedirects(++$redirects)); + return $response; + } + + /** + * Actually make the web request. + * @param SimpleUrl $url Target to fetch. + * @param SimpleFormEncoding $encoding Additional parameters for request. + * @return SimpleHttpResponse Headers and hopefully content. + * @access protected + */ + protected function fetch($url, $encoding) { + $request = $this->createRequest($url, $encoding); + return $request->fetch($this->connection_timeout); + } + + /** + * Creates a full page request. + * @param SimpleUrl $url Target to fetch as url object. + * @param SimpleFormEncoding $encoding POST/GET parameters. + * @return SimpleHttpRequest New request. + * @access private + */ + protected function createRequest($url, $encoding) { + $request = $this->createHttpRequest($url, $encoding); + $this->addAdditionalHeaders($request); + if ($this->cookies_enabled) { + $request->readCookiesFromJar($this->cookie_jar, $url); + } + $this->authenticator->addHeaders($request, $url); + return $request; + } + + /** + * Builds the appropriate HTTP request object. + * @param SimpleUrl $url Target to fetch as url object. + * @param SimpleFormEncoding $parameters POST/GET parameters. + * @return SimpleHttpRequest New request object. + * @access protected + */ + protected function createHttpRequest($url, $encoding) { + return new SimpleHttpRequest($this->createRoute($url), $encoding); + } + + /** + * Sets up either a direct route or via a proxy. + * @param SimpleUrl $url Target to fetch as url object. + * @return SimpleRoute Route to take to fetch URL. + * @access protected + */ + protected function createRoute($url) { + if ($this->proxy) { + return new SimpleProxyRoute( + $url, + $this->proxy, + $this->proxy_username, + $this->proxy_password); + } + return new SimpleRoute($url); + } + + /** + * Adds additional manual headers. + * @param SimpleHttpRequest $request Outgoing request. + * @access private + */ + protected function addAdditionalHeaders(&$request) { + foreach ($this->additional_headers as $header) { + $request->addHeaderLine($header); + } + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/web_tester.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/web_tester.php new file mode 100644 index 0000000..9c3cb06 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/web_tester.php @@ -0,0 +1,1495 @@ +value = $value; + } + + /** + * Tests the expectation. True if it matches + * a string value or an array value in any order. + * @param mixed $compare Comparison value. False for + * an unset field. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + if ($this->value === false) { + return ($compare === false); + } + if ($this->isSingle($this->value)) { + return $this->testSingle($compare); + } + if (is_array($this->value)) { + return $this->testMultiple($compare); + } + return false; + } + + /** + * Tests for valid field comparisons with a single option. + * @param mixed $value Value to type check. + * @return boolean True if integer, string or float. + * @access private + */ + protected function isSingle($value) { + return is_string($value) || is_integer($value) || is_float($value); + } + + /** + * String comparison for simple field with a single option. + * @param mixed $compare String to test against. + * @returns boolean True if matching. + * @access private + */ + protected function testSingle($compare) { + if (is_array($compare) && count($compare) == 1) { + $compare = $compare[0]; + } + if (! $this->isSingle($compare)) { + return false; + } + return ($this->value == $compare); + } + + /** + * List comparison for multivalue field. + * @param mixed $compare List in any order to test against. + * @returns boolean True if matching. + * @access private + */ + protected function testMultiple($compare) { + if (is_string($compare)) { + $compare = array($compare); + } + if (! is_array($compare)) { + return false; + } + sort($compare); + return ($this->value === $compare); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $dumper = $this->getDumper(); + if (is_array($compare)) { + sort($compare); + } + if ($this->test($compare)) { + return "Field expectation [" . $dumper->describeValue($this->value) . "]"; + } else { + return "Field expectation [" . $dumper->describeValue($this->value) . + "] fails with [" . + $dumper->describeValue($compare) . "] " . + $dumper->describeDifference($this->value, $compare); + } + } +} + +/** + * Test for a specific HTTP header within a header block. + * @package SimpleTest + * @subpackage WebTester + */ +class HttpHeaderExpectation extends SimpleExpectation { + private $expected_header; + private $expected_value; + + /** + * Sets the field and value to compare against. + * @param string $header Case insenstive trimmed header name. + * @param mixed $value Optional value to compare. If not + * given then any value will match. If + * an expectation object then that will + * be used instead. + * @param string $message Optiona message override. Can use %s as + * a placeholder for the original message. + */ + function __construct($header, $value = false, $message = '%s') { + parent::__construct($message); + $this->expected_header = $this->normaliseHeader($header); + $this->expected_value = $value; + } + + /** + * Accessor for aggregated object. + * @return mixed Expectation set in constructor. + * @access protected + */ + protected function getExpectation() { + return $this->expected_value; + } + + /** + * Removes whitespace at ends and case variations. + * @param string $header Name of header. + * @param string Trimmed and lowecased header + * name. + * @access private + */ + protected function normaliseHeader($header) { + return strtolower(trim($header)); + } + + /** + * Tests the expectation. True if it matches + * a string value or an array value in any order. + * @param mixed $compare Raw header block to search. + * @return boolean True if header present. + * @access public + */ + function test($compare) { + return is_string($this->findHeader($compare)); + } + + /** + * Searches the incoming result. Will extract the matching + * line as text. + * @param mixed $compare Raw header block to search. + * @return string Matching header line. + * @access protected + */ + protected function findHeader($compare) { + $lines = split("\r\n", $compare); + foreach ($lines as $line) { + if ($this->testHeaderLine($line)) { + return $line; + } + } + return false; + } + + /** + * Compares a single header line against the expectation. + * @param string $line A single line to compare. + * @return boolean True if matched. + * @access private + */ + protected function testHeaderLine($line) { + if (count($parsed = split(':', $line, 2)) < 2) { + return false; + } + list($header, $value) = $parsed; + if ($this->normaliseHeader($header) != $this->expected_header) { + return false; + } + return $this->testHeaderValue($value, $this->expected_value); + } + + /** + * Tests the value part of the header. + * @param string $value Value to test. + * @param mixed $expected Value to test against. + * @return boolean True if matched. + * @access protected + */ + protected function testHeaderValue($value, $expected) { + if ($expected === false) { + return true; + } + if (SimpleExpectation::isExpectation($expected)) { + return $expected->test(trim($value)); + } + return (trim($value) == trim($expected)); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Raw header block to search. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if (SimpleExpectation::isExpectation($this->expected_value)) { + $message = $this->expected_value->overlayMessage($compare, $this->getDumper()); + } else { + $message = $this->expected_header . + ($this->expected_value ? ': ' . $this->expected_value : ''); + } + if (is_string($line = $this->findHeader($compare))) { + return "Searching for header [$message] found [$line]"; + } else { + return "Failed to find header [$message]"; + } + } +} + +/** + * Test for a specific HTTP header within a header block that + * should not be found. + * @package SimpleTest + * @subpackage WebTester + */ +class NoHttpHeaderExpectation extends HttpHeaderExpectation { + private $expected_header; + private $expected_value; + + /** + * Sets the field and value to compare against. + * @param string $unwanted Case insenstive trimmed header name. + * @param string $message Optiona message override. Can use %s as + * a placeholder for the original message. + */ + function __construct($unwanted, $message = '%s') { + parent::__construct($unwanted, false, $message); + } + + /** + * Tests that the unwanted header is not found. + * @param mixed $compare Raw header block to search. + * @return boolean True if header present. + * @access public + */ + function test($compare) { + return ($this->findHeader($compare) === false); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Raw header block to search. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + $expectation = $this->getExpectation(); + if (is_string($line = $this->findHeader($compare))) { + return "Found unwanted header [$expectation] with [$line]"; + } else { + return "Did not find unwanted header [$expectation]"; + } + } +} + +/** + * Test for a text substring. + * @package SimpleTest + * @subpackage UnitTester + */ +class TextExpectation extends SimpleExpectation { + private $substring; + + /** + * Sets the value to compare against. + * @param string $substring Text to search for. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($substring, $message = '%s') { + parent::__construct($message); + $this->substring = $substring; + } + + /** + * Accessor for the substring. + * @return string Text to match. + * @access protected + */ + protected function getSubstring() { + return $this->substring; + } + + /** + * Tests the expectation. True if the text contains the + * substring. + * @param string $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return (strpos($compare, $this->substring) !== false); + } + + /** + * Returns a human readable test message. + * @param mixed $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if ($this->test($compare)) { + return $this->describeTextMatch($this->getSubstring(), $compare); + } else { + $dumper = $this->getDumper(); + return "Text [" . $this->getSubstring() . + "] not detected in [" . + $dumper->describeValue($compare) . "]"; + } + } + + /** + * Describes a pattern match including the string + * found and it's position. + * @param string $substring Text to search for. + * @param string $subject Subject to search. + * @access protected + */ + protected function describeTextMatch($substring, $subject) { + $position = strpos($subject, $substring); + $dumper = $this->getDumper(); + return "Text [$substring] detected at character [$position] in [" . + $dumper->describeValue($subject) . "] in region [" . + $dumper->clipString($subject, 100, $position) . "]"; + } +} + +/** + * Fail if a substring is detected within the + * comparison text. + * @package SimpleTest + * @subpackage UnitTester + */ +class NoTextExpectation extends TextExpectation { + + /** + * Sets the reject pattern + * @param string $substring Text to search for. + * @param string $message Customised message on failure. + * @access public + */ + function __construct($substring, $message = '%s') { + parent::__construct($substring, $message); + } + + /** + * Tests the expectation. False if the substring appears + * in the text. + * @param string $compare Comparison value. + * @return boolean True if correct. + * @access public + */ + function test($compare) { + return ! parent::test($compare); + } + + /** + * Returns a human readable test message. + * @param string $compare Comparison value. + * @return string Description of success + * or failure. + * @access public + */ + function testMessage($compare) { + if ($this->test($compare)) { + $dumper = $this->getDumper(); + return "Text [" . $this->getSubstring() . + "] not detected in [" . + $dumper->describeValue($compare) . "]"; + } else { + return $this->describeTextMatch($this->getSubstring(), $compare); + } + } +} + +/** + * Test case for testing of web pages. Allows + * fetching of pages, parsing of HTML and + * submitting forms. + * @package SimpleTest + * @subpackage WebTester + */ +class WebTestCase extends SimpleTestCase { + private $browser; + private $ignore_errors = false; + + /** + * Creates an empty test case. Should be subclassed + * with test methods for a functional test case. + * @param string $label Name of test case. Will use + * the class name if none specified. + * @access public + */ + function __construct($label = false) { + parent::__construct($label); + } + + /** + * Announces the start of the test. + * @param string $method Test method just started. + * @access public + */ + function before($method) { + parent::before($method); + $this->setBrowser($this->createBrowser()); + } + + /** + * Announces the end of the test. Includes private clean up. + * @param string $method Test method just finished. + * @access public + */ + function after($method) { + $this->unsetBrowser(); + parent::after($method); + } + + /** + * Gets a current browser reference for setting + * special expectations or for detailed + * examination of page fetches. + * @return SimpleBrowser Current test browser object. + * @access public + */ + function getBrowser() { + return $this->browser; + } + + /** + * Gets a current browser reference for setting + * special expectations or for detailed + * examination of page fetches. + * @param SimpleBrowser $browser New test browser object. + * @access public + */ + function setBrowser($browser) { + return $this->browser = $browser; + } + + /** + * Clears the current browser reference to help the + * PHP garbage collector. + * @access public + */ + function unsetBrowser() { + unset($this->browser); + } + + /** + * Creates a new default web browser object. + * Will be cleared at the end of the test method. + * @return TestBrowser New browser. + * @access public + */ + function createBrowser() { + return new SimpleBrowser(); + } + + /** + * Gets the last response error. + * @return string Last low level HTTP error. + * @access public + */ + function getTransportError() { + return $this->browser->getTransportError(); + } + + /** + * Accessor for the currently selected URL. + * @return string Current location or false if + * no page yet fetched. + * @access public + */ + function getUrl() { + return $this->browser->getUrl(); + } + + /** + * Dumps the current request for debugging. + * @access public + */ + function showRequest() { + $this->dump($this->browser->getRequest()); + } + + /** + * Dumps the current HTTP headers for debugging. + * @access public + */ + function showHeaders() { + $this->dump($this->browser->getHeaders()); + } + + /** + * Dumps the current HTML source for debugging. + * @access public + */ + function showSource() { + $this->dump($this->browser->getContent()); + } + + /** + * Dumps the visible text only for debugging. + * @access public + */ + function showText() { + $this->dump(wordwrap($this->browser->getContentAsText(), 80)); + } + + /** + * Simulates the closing and reopening of the browser. + * Temporary cookies will be discarded and timed + * cookies will be expired if later than the + * specified time. + * @param string/integer $date Time when session restarted. + * If ommitted then all persistent + * cookies are kept. Time is either + * Cookie format string or timestamp. + * @access public + */ + function restart($date = false) { + if ($date === false) { + $date = time(); + } + $this->browser->restart($date); + } + + /** + * Moves cookie expiry times back into the past. + * Useful for testing timeouts and expiries. + * @param integer $interval Amount to age in seconds. + * @access public + */ + function ageCookies($interval) { + $this->browser->ageCookies($interval); + } + + /** + * Disables frames support. Frames will not be fetched + * and the frameset page will be used instead. + * @access public + */ + function ignoreFrames() { + $this->browser->ignoreFrames(); + } + + /** + * Switches off cookie sending and recieving. + * @access public + */ + function ignoreCookies() { + $this->browser->ignoreCookies(); + } + + /** + * Skips errors for the next request only. You might + * want to confirm that a page is unreachable for + * example. + * @access public + */ + function ignoreErrors() { + $this->ignore_errors = true; + } + + /** + * Issues a fail if there is a transport error anywhere + * in the current frameset. Only one such error is + * reported. + * @param string/boolean $result HTML or failure. + * @return string/boolean $result Passes through result. + * @access private + */ + protected function failOnError($result) { + if (! $this->ignore_errors) { + if ($error = $this->browser->getTransportError()) { + $this->fail($error); + } + } + $this->ignore_errors = false; + return $result; + } + + /** + * Adds a header to every fetch. + * @param string $header Header line to add to every + * request until cleared. + * @access public + */ + function addHeader($header) { + $this->browser->addHeader($header); + } + + /** + * Sets the maximum number of redirects before + * the web page is loaded regardless. + * @param integer $max Maximum hops. + * @access public + */ + function setMaximumRedirects($max) { + if (! $this->browser) { + trigger_error( + 'Can only set maximum redirects in a test method, setUp() or tearDown()'); + } + $this->browser->setMaximumRedirects($max); + } + + /** + * Sets the socket timeout for opening a connection and + * receiving at least one byte of information. + * @param integer $timeout Maximum time in seconds. + * @access public + */ + function setConnectionTimeout($timeout) { + $this->browser->setConnectionTimeout($timeout); + } + + /** + * Sets proxy to use on all requests for when + * testing from behind a firewall. Set URL + * to false to disable. + * @param string $proxy Proxy URL. + * @param string $username Proxy username for authentication. + * @param string $password Proxy password for authentication. + * @access public + */ + function useProxy($proxy, $username = false, $password = false) { + $this->browser->useProxy($proxy, $username, $password); + } + + /** + * Fetches a page into the page buffer. If + * there is no base for the URL then the + * current base URL is used. After the fetch + * the base URL reflects the new location. + * @param string $url URL to fetch. + * @param hash $parameters Optional additional GET data. + * @return boolean/string Raw page on success. + * @access public + */ + function get($url, $parameters = false) { + return $this->failOnError($this->browser->get($url, $parameters)); + } + + /** + * Fetches a page by POST into the page buffer. + * If there is no base for the URL then the + * current base URL is used. After the fetch + * the base URL reflects the new location. + * @param string $url URL to fetch. + * @param hash $parameters Optional additional GET data. + * @return boolean/string Raw page on success. + * @access public + */ + function post($url, $parameters = false) { + return $this->failOnError($this->browser->post($url, $parameters)); + } + + /** + * Does a HTTP HEAD fetch, fetching only the page + * headers. The current base URL is unchanged by this. + * @param string $url URL to fetch. + * @param hash $parameters Optional additional GET data. + * @return boolean True on success. + * @access public + */ + function head($url, $parameters = false) { + return $this->failOnError($this->browser->head($url, $parameters)); + } + + /** + * Equivalent to hitting the retry button on the + * browser. Will attempt to repeat the page fetch. + * @return boolean True if fetch succeeded. + * @access public + */ + function retry() { + return $this->failOnError($this->browser->retry()); + } + + /** + * Equivalent to hitting the back button on the + * browser. + * @return boolean True if history entry and + * fetch succeeded. + * @access public + */ + function back() { + return $this->failOnError($this->browser->back()); + } + + /** + * Equivalent to hitting the forward button on the + * browser. + * @return boolean True if history entry and + * fetch succeeded. + * @access public + */ + function forward() { + return $this->failOnError($this->browser->forward()); + } + + /** + * Retries a request after setting the authentication + * for the current realm. + * @param string $username Username for realm. + * @param string $password Password for realm. + * @return boolean/string HTML on successful fetch. Note + * that authentication may still have + * failed. + * @access public + */ + function authenticate($username, $password) { + return $this->failOnError( + $this->browser->authenticate($username, $password)); + } + + /** + * Gets the cookie value for the current browser context. + * @param string $name Name of cookie. + * @return string Value of cookie or false if unset. + * @access public + */ + function getCookie($name) { + return $this->browser->getCurrentCookieValue($name); + } + + /** + * Sets a cookie in the current browser. + * @param string $name Name of cookie. + * @param string $value Cookie value. + * @param string $host Host upon which the cookie is valid. + * @param string $path Cookie path if not host wide. + * @param string $expiry Expiry date. + * @access public + */ + function setCookie($name, $value, $host = false, $path = '/', $expiry = false) { + $this->browser->setCookie($name, $value, $host, $path, $expiry); + } + + /** + * Accessor for current frame focus. Will be + * false if no frame has focus. + * @return integer/string/boolean Label if any, otherwise + * the position in the frameset + * or false if none. + * @access public + */ + function getFrameFocus() { + return $this->browser->getFrameFocus(); + } + + /** + * Sets the focus by index. The integer index starts from 1. + * @param integer $choice Chosen frame. + * @return boolean True if frame exists. + * @access public + */ + function setFrameFocusByIndex($choice) { + return $this->browser->setFrameFocusByIndex($choice); + } + + /** + * Sets the focus by name. + * @param string $name Chosen frame. + * @return boolean True if frame exists. + * @access public + */ + function setFrameFocus($name) { + return $this->browser->setFrameFocus($name); + } + + /** + * Clears the frame focus. All frames will be searched + * for content. + * @access public + */ + function clearFrameFocus() { + return $this->browser->clearFrameFocus(); + } + + /** + * Clicks a visible text item. Will first try buttons, + * then links and then images. + * @param string $label Visible text or alt text. + * @return string/boolean Raw page or false. + * @access public + */ + function click($label) { + return $this->failOnError($this->browser->click($label)); + } + + /** + * Checks for a click target. + * @param string $label Visible text or alt text. + * @return boolean True if click target. + * @access public + */ + function assertClickable($label, $message = '%s') { + return $this->assertTrue( + $this->browser->isClickable($label), + sprintf($message, "Click target [$label] should exist")); + } + + /** + * Clicks the submit button by label. The owning + * form will be submitted by this. + * @param string $label Button label. An unlabeled + * button can be triggered by 'Submit'. + * @param hash $additional Additional form values. + * @return boolean/string Page on success, else false. + * @access public + */ + function clickSubmit($label = 'Submit', $additional = false) { + return $this->failOnError( + $this->browser->clickSubmit($label, $additional)); + } + + /** + * Clicks the submit button by name attribute. The owning + * form will be submitted by this. + * @param string $name Name attribute of button. + * @param hash $additional Additional form values. + * @return boolean/string Page on success. + * @access public + */ + function clickSubmitByName($name, $additional = false) { + return $this->failOnError( + $this->browser->clickSubmitByName($name, $additional)); + } + + /** + * Clicks the submit button by ID attribute. The owning + * form will be submitted by this. + * @param string $id ID attribute of button. + * @param hash $additional Additional form values. + * @return boolean/string Page on success. + * @access public + */ + function clickSubmitById($id, $additional = false) { + return $this->failOnError( + $this->browser->clickSubmitById($id, $additional)); + } + + /** + * Checks for a valid button label. + * @param string $label Visible text. + * @return boolean True if click target. + * @access public + */ + function assertSubmit($label, $message = '%s') { + return $this->assertTrue( + $this->browser->isSubmit($label), + sprintf($message, "Submit button [$label] should exist")); + } + + /** + * Clicks the submit image by some kind of label. Usually + * the alt tag or the nearest equivalent. The owning + * form will be submitted by this. Clicking outside of + * the boundary of the coordinates will result in + * a failure. + * @param string $label Alt attribute of button. + * @param integer $x X-coordinate of imaginary click. + * @param integer $y Y-coordinate of imaginary click. + * @param hash $additional Additional form values. + * @return boolean/string Page on success. + * @access public + */ + function clickImage($label, $x = 1, $y = 1, $additional = false) { + return $this->failOnError( + $this->browser->clickImage($label, $x, $y, $additional)); + } + + /** + * Clicks the submit image by the name. Usually + * the alt tag or the nearest equivalent. The owning + * form will be submitted by this. Clicking outside of + * the boundary of the coordinates will result in + * a failure. + * @param string $name Name attribute of button. + * @param integer $x X-coordinate of imaginary click. + * @param integer $y Y-coordinate of imaginary click. + * @param hash $additional Additional form values. + * @return boolean/string Page on success. + * @access public + */ + function clickImageByName($name, $x = 1, $y = 1, $additional = false) { + return $this->failOnError( + $this->browser->clickImageByName($name, $x, $y, $additional)); + } + + /** + * Clicks the submit image by ID attribute. The owning + * form will be submitted by this. Clicking outside of + * the boundary of the coordinates will result in + * a failure. + * @param integer/string $id ID attribute of button. + * @param integer $x X-coordinate of imaginary click. + * @param integer $y Y-coordinate of imaginary click. + * @param hash $additional Additional form values. + * @return boolean/string Page on success. + * @access public + */ + function clickImageById($id, $x = 1, $y = 1, $additional = false) { + return $this->failOnError( + $this->browser->clickImageById($id, $x, $y, $additional)); + } + + /** + * Checks for a valid image with atht alt text or title. + * @param string $label Visible text. + * @return boolean True if click target. + * @access public + */ + function assertImage($label, $message = '%s') { + return $this->assertTrue( + $this->browser->isImage($label), + sprintf($message, "Image with text [$label] should exist")); + } + + /** + * Submits a form by the ID. + * @param string $id Form ID. No button information + * is submitted this way. + * @return boolean/string Page on success. + * @access public + */ + function submitFormById($id) { + return $this->failOnError($this->browser->submitFormById($id)); + } + + /** + * Follows a link by name. Will click the first link + * found with this link text by default, or a later + * one if an index is given. Match is case insensitive + * with normalised space. + * @param string $label Text between the anchor tags. + * @param integer $index Link position counting from zero. + * @return boolean/string Page on success. + * @access public + */ + function clickLink($label, $index = 0) { + return $this->failOnError($this->browser->clickLink($label, $index)); + } + + /** + * Follows a link by id attribute. + * @param string $id ID attribute value. + * @return boolean/string Page on success. + * @access public + */ + function clickLinkById($id) { + return $this->failOnError($this->browser->clickLinkById($id)); + } + + /** + * Tests for the presence of a link label. Match is + * case insensitive with normalised space. + * @param string $label Text between the anchor tags. + * @param mixed $expected Expected URL or expectation object. + * @param string $message Message to display. Default + * can be embedded with %s. + * @return boolean True if link present. + * @access public + */ + function assertLink($label, $expected = true, $message = '%s') { + $url = $this->browser->getLink($label); + if ($expected === true || ($expected !== true && $url === false)) { + return $this->assertTrue($url !== false, sprintf($message, "Link [$label] should exist")); + } + if (! SimpleExpectation::isExpectation($expected)) { + $expected = new IdenticalExpectation($expected); + } + return $this->assert($expected, $url->asString(), sprintf($message, "Link [$label] should match")); + } + + /** + * Tests for the non-presence of a link label. Match is + * case insensitive with normalised space. + * @param string/integer $label Text between the anchor tags + * or ID attribute. + * @param string $message Message to display. Default + * can be embedded with %s. + * @return boolean True if link missing. + * @access public + */ + function assertNoLink($label, $message = '%s') { + return $this->assertTrue( + $this->browser->getLink($label) === false, + sprintf($message, "Link [$label] should not exist")); + } + + /** + * Tests for the presence of a link id attribute. + * @param string $id Id attribute value. + * @param mixed $expected Expected URL or expectation object. + * @param string $message Message to display. Default + * can be embedded with %s. + * @return boolean True if link present. + * @access public + */ + function assertLinkById($id, $expected = true, $message = '%s') { + $url = $this->browser->getLinkById($id); + if ($expected === true) { + return $this->assertTrue($url !== false, sprintf($message, "Link ID [$id] should exist")); + } + if (! SimpleExpectation::isExpectation($expected)) { + $expected = new IdenticalExpectation($expected); + } + return $this->assert($expected, $url->asString(), sprintf($message, "Link ID [$id] should match")); + } + + /** + * Tests for the non-presence of a link label. Match is + * case insensitive with normalised space. + * @param string $id Id attribute value. + * @param string $message Message to display. Default + * can be embedded with %s. + * @return boolean True if link missing. + * @access public + */ + function assertNoLinkById($id, $message = '%s') { + return $this->assertTrue( + $this->browser->getLinkById($id) === false, + sprintf($message, "Link ID [$id] should not exist")); + } + + /** + * Sets all form fields with that label, or name if there + * is no label attached. + * @param string $name Name of field in forms. + * @param string $value New value of field. + * @return boolean True if field exists, otherwise false. + * @access public + */ + function setField($label, $value, $position=false) { + return $this->browser->setField($label, $value, $position); + } + + /** + * Sets all form fields with that name. + * @param string $name Name of field in forms. + * @param string $value New value of field. + * @return boolean True if field exists, otherwise false. + * @access public + */ + function setFieldByName($name, $value, $position=false) { + return $this->browser->setFieldByName($name, $value, $position); + } + + /** + * Sets all form fields with that id. + * @param string/integer $id Id of field in forms. + * @param string $value New value of field. + * @return boolean True if field exists, otherwise false. + * @access public + */ + function setFieldById($id, $value) { + return $this->browser->setFieldById($id, $value); + } + + /** + * Confirms that the form element is currently set + * to the expected value. A missing form will always + * fail. If no value is given then only the existence + * of the field is checked. + * @param string $name Name of field in forms. + * @param mixed $expected Expected string/array value or + * false for unset fields. + * @param string $message Message to display. Default + * can be embedded with %s. + * @return boolean True if pass. + * @access public + */ + function assertField($label, $expected = true, $message = '%s') { + $value = $this->browser->getField($label); + return $this->assertFieldValue($label, $value, $expected, $message); + } + + /** + * Confirms that the form element is currently set + * to the expected value. A missing form element will always + * fail. If no value is given then only the existence + * of the field is checked. + * @param string $name Name of field in forms. + * @param mixed $expected Expected string/array value or + * false for unset fields. + * @param string $message Message to display. Default + * can be embedded with %s. + * @return boolean True if pass. + * @access public + */ + function assertFieldByName($name, $expected = true, $message = '%s') { + $value = $this->browser->getFieldByName($name); + return $this->assertFieldValue($name, $value, $expected, $message); + } + + /** + * Confirms that the form element is currently set + * to the expected value. A missing form will always + * fail. If no ID is given then only the existence + * of the field is checked. + * @param string/integer $id Name of field in forms. + * @param mixed $expected Expected string/array value or + * false for unset fields. + * @param string $message Message to display. Default + * can be embedded with %s. + * @return boolean True if pass. + * @access public + */ + function assertFieldById($id, $expected = true, $message = '%s') { + $value = $this->browser->getFieldById($id); + return $this->assertFieldValue($id, $value, $expected, $message); + } + + /** + * Tests the field value against the expectation. + * @param string $identifier Name, ID or label. + * @param mixed $value Current field value. + * @param mixed $expected Expected value to match. + * @param string $message Failure message. + * @return boolean True if pass + * @access protected + */ + protected function assertFieldValue($identifier, $value, $expected, $message) { + if ($expected === true) { + return $this->assertTrue( + isset($value), + sprintf($message, "Field [$identifier] should exist")); + } + if (! SimpleExpectation::isExpectation($expected)) { + $identifier = str_replace('%', '%%', $identifier); + $expected = new FieldExpectation( + $expected, + "Field [$identifier] should match with [%s]"); + } + return $this->assert($expected, $value, $message); + } + + /** + * Checks the response code against a list + * of possible values. + * @param array $responses Possible responses for a pass. + * @param string $message Message to display. Default + * can be embedded with %s. + * @return boolean True if pass. + * @access public + */ + function assertResponse($responses, $message = '%s') { + $responses = (is_array($responses) ? $responses : array($responses)); + $code = $this->browser->getResponseCode(); + $message = sprintf($message, "Expecting response in [" . + implode(", ", $responses) . "] got [$code]"); + return $this->assertTrue(in_array($code, $responses), $message); + } + + /** + * Checks the mime type against a list + * of possible values. + * @param array $types Possible mime types for a pass. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertMime($types, $message = '%s') { + $types = (is_array($types) ? $types : array($types)); + $type = $this->browser->getMimeType(); + $message = sprintf($message, "Expecting mime type in [" . + implode(", ", $types) . "] got [$type]"); + return $this->assertTrue(in_array($type, $types), $message); + } + + /** + * Attempt to match the authentication type within + * the security realm we are currently matching. + * @param string $authentication Usually basic. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertAuthentication($authentication = false, $message = '%s') { + if (! $authentication) { + $message = sprintf($message, "Expected any authentication type, got [" . + $this->browser->getAuthentication() . "]"); + return $this->assertTrue( + $this->browser->getAuthentication(), + $message); + } else { + $message = sprintf($message, "Expected authentication [$authentication] got [" . + $this->browser->getAuthentication() . "]"); + return $this->assertTrue( + strtolower($this->browser->getAuthentication()) == strtolower($authentication), + $message); + } + } + + /** + * Checks that no authentication is necessary to view + * the desired page. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertNoAuthentication($message = '%s') { + $message = sprintf($message, "Expected no authentication type, got [" . + $this->browser->getAuthentication() . "]"); + return $this->assertFalse($this->browser->getAuthentication(), $message); + } + + /** + * Attempts to match the current security realm. + * @param string $realm Name of security realm. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertRealm($realm, $message = '%s') { + if (! SimpleExpectation::isExpectation($realm)) { + $realm = new EqualExpectation($realm); + } + return $this->assert( + $realm, + $this->browser->getRealm(), + "Expected realm -> $message"); + } + + /** + * Checks each header line for the required value. If no + * value is given then only an existence check is made. + * @param string $header Case insensitive header name. + * @param mixed $value Case sensitive trimmed string to + * match against. An expectation object + * can be used for pattern matching. + * @return boolean True if pass. + * @access public + */ + function assertHeader($header, $value = false, $message = '%s') { + return $this->assert( + new HttpHeaderExpectation($header, $value), + $this->browser->getHeaders(), + $message); + } + + /** + * Confirms that the header type has not been received. + * Only the landing page is checked. If you want to check + * redirect pages, then you should limit redirects so + * as to capture the page you want. + * @param string $header Case insensitive header name. + * @return boolean True if pass. + * @access public + */ + function assertNoHeader($header, $message = '%s') { + return $this->assert( + new NoHttpHeaderExpectation($header), + $this->browser->getHeaders(), + $message); + } + + /** + * Tests the text between the title tags. + * @param string/SimpleExpectation $title Expected title. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertTitle($title = false, $message = '%s') { + if (! SimpleExpectation::isExpectation($title)) { + $title = new EqualExpectation($title); + } + return $this->assert($title, $this->browser->getTitle(), $message); + } + + /** + * Will trigger a pass if the text is found in the plain + * text form of the page. + * @param string $text Text to look for. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertText($text, $message = '%s') { + return $this->assert( + new TextExpectation($text), + $this->browser->getContentAsText(), + $message); + } + + /** + * Will trigger a pass if the text is not found in the plain + * text form of the page. + * @param string $text Text to look for. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertNoText($text, $message = '%s') { + return $this->assert( + new NoTextExpectation($text), + $this->browser->getContentAsText(), + $message); + } + + /** + * Will trigger a pass if the Perl regex pattern + * is found in the raw content. + * @param string $pattern Perl regex to look for including + * the regex delimiters. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertPattern($pattern, $message = '%s') { + return $this->assert( + new PatternExpectation($pattern), + $this->browser->getContent(), + $message); + } + + /** + * Will trigger a pass if the perl regex pattern + * is not present in raw content. + * @param string $pattern Perl regex to look for including + * the regex delimiters. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertNoPattern($pattern, $message = '%s') { + return $this->assert( + new NoPatternExpectation($pattern), + $this->browser->getContent(), + $message); + } + + /** + * Checks that a cookie is set for the current page + * and optionally checks the value. + * @param string $name Name of cookie to test. + * @param string $expected Expected value as a string or + * false if any value will do. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertCookie($name, $expected = false, $message = '%s') { + $value = $this->getCookie($name); + if (! $expected) { + return $this->assertTrue( + $value, + sprintf($message, "Expecting cookie [$name]")); + } + if (! SimpleExpectation::isExpectation($expected)) { + $expected = new EqualExpectation($expected); + } + return $this->assert($expected, $value, "Expecting cookie [$name] -> $message"); + } + + /** + * Checks that no cookie is present or that it has + * been successfully cleared. + * @param string $name Name of cookie to test. + * @param string $message Message to display. + * @return boolean True if pass. + * @access public + */ + function assertNoCookie($name, $message = '%s') { + return $this->assertTrue( + $this->getCookie($name) === null or $this->getCookie($name) === false, + sprintf($message, "Not expecting cookie [$name]")); + } + + /** + * Called from within the test methods to register + * passes and failures. + * @param boolean $result Pass on true. + * @param string $message Message to display describing + * the test state. + * @return boolean True on pass + * @access public + */ + function assertTrue($result, $message = false) { + return $this->assert(new TrueExpectation(), $result, $message); + } + + /** + * Will be true on false and vice versa. False + * is the PHP definition of false, so that null, + * empty strings, zero and an empty array all count + * as false. + * @param boolean $result Pass on false. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertFalse($result, $message = '%s') { + return $this->assert(new FalseExpectation(), $result, $message); + } + + /** + * Will trigger a pass if the two parameters have + * the same value only. Otherwise a fail. This + * is for testing hand extracted text, etc. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertEqual($first, $second, $message = '%s') { + return $this->assert( + new EqualExpectation($first), + $second, + $message); + } + + /** + * Will trigger a pass if the two parameters have + * a different value. Otherwise a fail. This + * is for testing hand extracted text, etc. + * @param mixed $first Value to compare. + * @param mixed $second Value to compare. + * @param string $message Message to display. + * @return boolean True on pass + * @access public + */ + function assertNotEqual($first, $second, $message = '%s') { + return $this->assert( + new NotEqualExpectation($first), + $second, + $message); + } + + /** + * Uses a stack trace to find the line of an assertion. + * @return string Line number of first assert* + * method embedded in format string. + * @access public + */ + function getAssertionLine() { + $trace = new SimpleStackTrace(array('assert', 'click', 'pass', 'fail')); + return $trace->traceMethod(); + } +} +?> \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/xml.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/xml.php new file mode 100644 index 0000000..54fb6f5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/simpletest/xml.php @@ -0,0 +1,647 @@ +namespace = ($namespace ? $namespace . ':' : ''); + $this->indent = $indent; + } + + /** + * Calculates the pretty printing indent level + * from the current level of nesting. + * @param integer $offset Extra indenting level. + * @return string Leading space. + * @access protected + */ + protected function getIndent($offset = 0) { + return str_repeat( + $this->indent, + count($this->getTestList()) + $offset); + } + + /** + * Converts character string to parsed XML + * entities string. + * @param string text Unparsed character data. + * @return string Parsed character data. + * @access public + */ + function toParsedXml($text) { + return str_replace( + array('&', '<', '>', '"', '\''), + array('&', '<', '>', '"', '''), + $text); + } + + /** + * Paints the start of a group test. + * @param string $test_name Name of test that is starting. + * @param integer $size Number of test cases starting. + * @access public + */ + function paintGroupStart($test_name, $size) { + parent::paintGroupStart($test_name, $size); + print $this->getIndent(); + print "<" . $this->namespace . "group size=\"$size\">\n"; + print $this->getIndent(1); + print "<" . $this->namespace . "name>" . + $this->toParsedXml($test_name) . + "namespace . "name>\n"; + } + + /** + * Paints the end of a group test. + * @param string $test_name Name of test that is ending. + * @access public + */ + function paintGroupEnd($test_name) { + print $this->getIndent(); + print "namespace . "group>\n"; + parent::paintGroupEnd($test_name); + } + + /** + * Paints the start of a test case. + * @param string $test_name Name of test that is starting. + * @access public + */ + function paintCaseStart($test_name) { + parent::paintCaseStart($test_name); + print $this->getIndent(); + print "<" . $this->namespace . "case>\n"; + print $this->getIndent(1); + print "<" . $this->namespace . "name>" . + $this->toParsedXml($test_name) . + "namespace . "name>\n"; + } + + /** + * Paints the end of a test case. + * @param string $test_name Name of test that is ending. + * @access public + */ + function paintCaseEnd($test_name) { + print $this->getIndent(); + print "namespace . "case>\n"; + parent::paintCaseEnd($test_name); + } + + /** + * Paints the start of a test method. + * @param string $test_name Name of test that is starting. + * @access public + */ + function paintMethodStart($test_name) { + parent::paintMethodStart($test_name); + print $this->getIndent(); + print "<" . $this->namespace . "test>\n"; + print $this->getIndent(1); + print "<" . $this->namespace . "name>" . + $this->toParsedXml($test_name) . + "namespace . "name>\n"; + } + + /** + * Paints the end of a test method. + * @param string $test_name Name of test that is ending. + * @param integer $progress Number of test cases ending. + * @access public + */ + function paintMethodEnd($test_name) { + print $this->getIndent(); + print "namespace . "test>\n"; + parent::paintMethodEnd($test_name); + } + + /** + * Paints pass as XML. + * @param string $message Message to encode. + * @access public + */ + function paintPass($message) { + parent::paintPass($message); + print $this->getIndent(1); + print "<" . $this->namespace . "pass>"; + print $this->toParsedXml($message); + print "namespace . "pass>\n"; + } + + /** + * Paints failure as XML. + * @param string $message Message to encode. + * @access public + */ + function paintFail($message) { + parent::paintFail($message); + print $this->getIndent(1); + print "<" . $this->namespace . "fail>"; + print $this->toParsedXml($message); + print "namespace . "fail>\n"; + } + + /** + * Paints error as XML. + * @param string $message Message to encode. + * @access public + */ + function paintError($message) { + parent::paintError($message); + print $this->getIndent(1); + print "<" . $this->namespace . "exception>"; + print $this->toParsedXml($message); + print "namespace . "exception>\n"; + } + + /** + * Paints exception as XML. + * @param Exception $exception Exception to encode. + * @access public + */ + function paintException($exception) { + parent::paintException($exception); + print $this->getIndent(1); + print "<" . $this->namespace . "exception>"; + $message = 'Unexpected exception of type [' . get_class($exception) . + '] with message ['. $exception->getMessage() . + '] in ['. $exception->getFile() . + ' line ' . $exception->getLine() . ']'; + print $this->toParsedXml($message); + print "namespace . "exception>\n"; + } + + /** + * Paints the skipping message and tag. + * @param string $message Text to display in skip tag. + * @access public + */ + function paintSkip($message) { + parent::paintSkip($message); + print $this->getIndent(1); + print "<" . $this->namespace . "skip>"; + print $this->toParsedXml($message); + print "namespace . "skip>\n"; + } + + /** + * Paints a simple supplementary message. + * @param string $message Text to display. + * @access public + */ + function paintMessage($message) { + parent::paintMessage($message); + print $this->getIndent(1); + print "<" . $this->namespace . "message>"; + print $this->toParsedXml($message); + print "namespace . "message>\n"; + } + + /** + * Paints a formatted ASCII message such as a + * privateiable dump. + * @param string $message Text to display. + * @access public + */ + function paintFormattedMessage($message) { + parent::paintFormattedMessage($message); + print $this->getIndent(1); + print "<" . $this->namespace . "formatted>"; + print ""; + print "namespace . "formatted>\n"; + } + + /** + * Serialises the event object. + * @param string $type Event type as text. + * @param mixed $payload Message or object. + * @access public + */ + function paintSignal($type, $payload) { + parent::paintSignal($type, $payload); + print $this->getIndent(1); + print "<" . $this->namespace . "signal type=\"$type\">"; + print ""; + print "namespace . "signal>\n"; + } + + /** + * Paints the test document header. + * @param string $test_name First test top level + * to start. + * @access public + * @abstract + */ + function paintHeader($test_name) { + if (! SimpleReporter::inCli()) { + header('Content-type: text/xml'); + } + print "namespace) { + print " xmlns:" . $this->namespace . + "=\"www.lastcraft.com/SimpleTest/Beta3/Report\""; + } + print "?>\n"; + print "<" . $this->namespace . "run>\n"; + } + + /** + * Paints the test document footer. + * @param string $test_name The top level test. + * @access public + * @abstract + */ + function paintFooter($test_name) { + print "namespace . "run>\n"; + } +} + +/** + * Accumulator for incoming tag. Holds the + * incoming test structure information for + * later dispatch to the reporter. + * @package SimpleTest + * @subpackage UnitTester + */ +class NestingXmlTag { + private $name; + private $attributes; + + /** + * Sets the basic test information except + * the name. + * @param hash $attributes Name value pairs. + * @access public + */ + function NestingXmlTag($attributes) { + $this->name = false; + $this->attributes = $attributes; + } + + /** + * Sets the test case/method name. + * @param string $name Name of test. + * @access public + */ + function setName($name) { + $this->name = $name; + } + + /** + * Accessor for name. + * @return string Name of test. + * @access public + */ + function getName() { + return $this->name; + } + + /** + * Accessor for attributes. + * @return hash All attributes. + * @access protected + */ + protected function getAttributes() { + return $this->attributes; + } +} + +/** + * Accumulator for incoming method tag. Holds the + * incoming test structure information for + * later dispatch to the reporter. + * @package SimpleTest + * @subpackage UnitTester + */ +class NestingMethodTag extends NestingXmlTag { + + /** + * Sets the basic test information except + * the name. + * @param hash $attributes Name value pairs. + * @access public + */ + function NestingMethodTag($attributes) { + $this->NestingXmlTag($attributes); + } + + /** + * Signals the appropriate start event on the + * listener. + * @param SimpleReporter $listener Target for events. + * @access public + */ + function paintStart(&$listener) { + $listener->paintMethodStart($this->getName()); + } + + /** + * Signals the appropriate end event on the + * listener. + * @param SimpleReporter $listener Target for events. + * @access public + */ + function paintEnd(&$listener) { + $listener->paintMethodEnd($this->getName()); + } +} + +/** + * Accumulator for incoming case tag. Holds the + * incoming test structure information for + * later dispatch to the reporter. + * @package SimpleTest + * @subpackage UnitTester + */ +class NestingCaseTag extends NestingXmlTag { + + /** + * Sets the basic test information except + * the name. + * @param hash $attributes Name value pairs. + * @access public + */ + function NestingCaseTag($attributes) { + $this->NestingXmlTag($attributes); + } + + /** + * Signals the appropriate start event on the + * listener. + * @param SimpleReporter $listener Target for events. + * @access public + */ + function paintStart(&$listener) { + $listener->paintCaseStart($this->getName()); + } + + /** + * Signals the appropriate end event on the + * listener. + * @param SimpleReporter $listener Target for events. + * @access public + */ + function paintEnd(&$listener) { + $listener->paintCaseEnd($this->getName()); + } +} + +/** + * Accumulator for incoming group tag. Holds the + * incoming test structure information for + * later dispatch to the reporter. + * @package SimpleTest + * @subpackage UnitTester + */ +class NestingGroupTag extends NestingXmlTag { + + /** + * Sets the basic test information except + * the name. + * @param hash $attributes Name value pairs. + * @access public + */ + function NestingGroupTag($attributes) { + $this->NestingXmlTag($attributes); + } + + /** + * Signals the appropriate start event on the + * listener. + * @param SimpleReporter $listener Target for events. + * @access public + */ + function paintStart(&$listener) { + $listener->paintGroupStart($this->getName(), $this->getSize()); + } + + /** + * Signals the appropriate end event on the + * listener. + * @param SimpleReporter $listener Target for events. + * @access public + */ + function paintEnd(&$listener) { + $listener->paintGroupEnd($this->getName()); + } + + /** + * The size in the attributes. + * @return integer Value of size attribute or zero. + * @access public + */ + function getSize() { + $attributes = $this->getAttributes(); + if (isset($attributes['SIZE'])) { + return (integer)$attributes['SIZE']; + } + return 0; + } +} + +/** + * Parser for importing the output of the XmlReporter. + * Dispatches that output to another reporter. + * @package SimpleTest + * @subpackage UnitTester + */ +class SimpleTestXmlParser { + private $listener; + private $expat; + private $tag_stack; + private $in_content_tag; + private $content; + private $attributes; + + /** + * Loads a listener with the SimpleReporter + * interface. + * @param SimpleReporter $listener Listener of tag events. + * @access public + */ + function SimpleTestXmlParser(&$listener) { + $this->listener = &$listener; + $this->expat = &$this->createParser(); + $this->tag_stack = array(); + $this->in_content_tag = false; + $this->content = ''; + $this->attributes = array(); + } + + /** + * Parses a block of XML sending the results to + * the listener. + * @param string $chunk Block of text to read. + * @return boolean True if valid XML. + * @access public + */ + function parse($chunk) { + if (! xml_parse($this->expat, $chunk)) { + trigger_error('XML parse error with ' . + xml_error_string(xml_get_error_code($this->expat))); + return false; + } + return true; + } + + /** + * Sets up expat as the XML parser. + * @return resource Expat handle. + * @access protected + */ + protected function &createParser() { + $expat = xml_parser_create(); + xml_set_object($expat, $this); + xml_set_element_handler($expat, 'startElement', 'endElement'); + xml_set_character_data_handler($expat, 'addContent'); + xml_set_default_handler($expat, 'defaultContent'); + return $expat; + } + + /** + * Opens a new test nesting level. + * @return NestedXmlTag The group, case or method tag + * to start. + * @access private + */ + protected function pushNestingTag($nested) { + array_unshift($this->tag_stack, $nested); + } + + /** + * Accessor for current test structure tag. + * @return NestedXmlTag The group, case or method tag + * being parsed. + * @access private + */ + protected function &getCurrentNestingTag() { + return $this->tag_stack[0]; + } + + /** + * Ends a nesting tag. + * @return NestedXmlTag The group, case or method tag + * just finished. + * @access private + */ + protected function popNestingTag() { + return array_shift($this->tag_stack); + } + + /** + * Test if tag is a leaf node with only text content. + * @param string $tag XML tag name. + * @return @boolean True if leaf, false if nesting. + * @private + */ + protected function isLeaf($tag) { + return in_array($tag, array( + 'NAME', 'PASS', 'FAIL', 'EXCEPTION', 'SKIP', 'MESSAGE', 'FORMATTED', 'SIGNAL')); + } + + /** + * Handler for start of event element. + * @param resource $expat Parser handle. + * @param string $tag Element name. + * @param hash $attributes Name value pairs. + * Attributes without content + * are marked as true. + * @access protected + */ + protected function startElement($expat, $tag, $attributes) { + $this->attributes = $attributes; + if ($tag == 'GROUP') { + $this->pushNestingTag(new NestingGroupTag($attributes)); + } elseif ($tag == 'CASE') { + $this->pushNestingTag(new NestingCaseTag($attributes)); + } elseif ($tag == 'TEST') { + $this->pushNestingTag(new NestingMethodTag($attributes)); + } elseif ($this->isLeaf($tag)) { + $this->in_content_tag = true; + $this->content = ''; + } + } + + /** + * End of element event. + * @param resource $expat Parser handle. + * @param string $tag Element name. + * @access protected + */ + protected function endElement($expat, $tag) { + $this->in_content_tag = false; + if (in_array($tag, array('GROUP', 'CASE', 'TEST'))) { + $nesting_tag = $this->popNestingTag(); + $nesting_tag->paintEnd($this->listener); + } elseif ($tag == 'NAME') { + $nesting_tag = &$this->getCurrentNestingTag(); + $nesting_tag->setName($this->content); + $nesting_tag->paintStart($this->listener); + } elseif ($tag == 'PASS') { + $this->listener->paintPass($this->content); + } elseif ($tag == 'FAIL') { + $this->listener->paintFail($this->content); + } elseif ($tag == 'EXCEPTION') { + $this->listener->paintError($this->content); + } elseif ($tag == 'SKIP') { + $this->listener->paintSkip($this->content); + } elseif ($tag == 'SIGNAL') { + $this->listener->paintSignal( + $this->attributes['TYPE'], + unserialize($this->content)); + } elseif ($tag == 'MESSAGE') { + $this->listener->paintMessage($this->content); + } elseif ($tag == 'FORMATTED') { + $this->listener->paintFormattedMessage($this->content); + } + } + + /** + * Content between start and end elements. + * @param resource $expat Parser handle. + * @param string $text Usually output messages. + * @access protected + */ + protected function addContent($expat, $text) { + if ($this->in_content_tag) { + $this->content .= $text; + } + return true; + } + + /** + * XML and Doctype handler. Discards all such content. + * @param resource $expat Parser handle. + * @param string $default Text of default content. + * @access protected + */ + protected function defaultContent($expat, $default) { + } +} +?> diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay.php new file mode 100644 index 0000000..b167915 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay.php @@ -0,0 +1,261 @@ +. + + */ + +//require 'Yay/Expectations.php'; +//require 'Yay/Matchers/OptionalMatcher.php'; +//require 'Yay/Matchers/AnyMatcher.php'; +//require 'Yay/Matchers/IdenticalMatcher.php'; +//require 'Yay/Matchers/EqualMatcher.php'; +//require 'Yay/Matchers/PatternMatcher.php'; +//require 'Yay/Matchers/ReferenceMatcher.php'; +//require 'Yay/Matchers/BoundsMatcher.php'; +//require 'Yay/Actions/ReturnValueAction.php'; +//require 'Yay/Actions/ReturnReferenceAction.php'; +//require 'Yay/Actions/ThrowAction.php'; +//require 'Yay/Actions/CallbackAction.php'; + +/** + * A convenience factory class. + * @author Chris Corbyn + * @package Yay + */ +class Yay +{ + + /** + * The classpath used for autoloading. + * @var string + * @access private + */ + private static $CLASSPATH = '.'; + + // -- Expectations + + /** + * Create a new Expectations builder instance. + * @return Yay_Expectations + */ + public static function expectations() + { + return new Yay_Expectations(); + } + + // -- Matchers + + /** + * Create a new Optional matcher, optionally wrapping $value. + * @param string $value, optional + * @return Yay_Matchers_OptionalMatcher + */ + public static function optional($value = null) + { + return new Yay_Matchers_OptionalMatcher($value); + } + + /** + * Create a new Any matcher, optionally constrained to $type. + * @param string $type, optional + * @return Yay_Matchers_AnyMatcher + */ + public static function any($type = null) + { + return new Yay_Matchers_AnyMatcher($type, true); + } + + /** + * Create a negated Any matcher, optionally constrained to $type. + * @param string $type, optional + * @return Yay_Matchers_AnyMatcher + */ + public static function none($type = null) + { + return new Yay_Matchers_AnyMatcher($type, false); + } + + /** + * Create a new Identical matcher for $value. + * @param mixed $value + * @return Yay_Matchers_IdenticalMatcher + */ + public static function identical($value) + { + return new Yay_Matchers_IdenticalMatcher($value, true); + } + + /** + * Create a negated Identical matcher for $value. + * @param mixed $value + * @return Yay_Matchers_IdenticalMatcher + */ + public static function notIdentical($value) + { + return new Yay_Matchers_IdenticalMatcher($value, false); + } + + /** + * Create a new Equal matcher for $value. + * @param mixed $value + * @return Yay_Matchers_EqualMatcher + */ + public static function equal($value) + { + return new Yay_Matchers_EqualMatcher($value, true); + } + + /** + * Create a negated Equal matcher for $value. + * @param mixed $value + * @return Yay_Matchers_EqualMatcher + */ + public static function notEqual($value) + { + return new Yay_Matchers_EqualMatcher($value, false); + } + + /** + * Create a new Pattern matcher for $pattern. + * @param string $pattern + * @return Yay_Matchers_IsAMatcher + */ + public static function pattern($pattern) + { + return new Yay_Matchers_PatternMatcher($pattern, true); + } + + /** + * Create a negated Pattern matcher for $pattern. + * @param string $pattern + * @return Yay_Matchers_IsAMatcher + */ + public static function noPattern($pattern) + { + return new Yay_Matchers_PatternMatcher($pattern, false); + } + + /** + * Create a new Reference matcher for $ref. + * @param mixed $ref + * @return Yay_Matchers_ReferenceMatcher + */ + public static function reference(&$ref) + { + return new Yay_Matchers_ReferenceMatcher($ref, true); + } + + /** + * Create a negated Reference matcher for $ref. + * @param mixed $ref + * @return Yay_Matchers_ReferenceMatcher + */ + public static function noReference(&$ref) + { + return new Yay_Matchers_ReferenceMatcher($ref, false); + } + + /** + * Create a new Bounds matcher for boundaries between $lower and $upper. + * @param mixed $lower + * @param mixed $upper + * @return Yay_Matchers_BoundsMatcher + */ + public static function bounds($lower, $upper) + { + return new Yay_Matchers_BoundsMatcher($lower, $upper, true); + } + + /** + * Create a negated Bounds matcher for boundaries outside $lower and $upper. + * @param mixed $lower + * @param mixed $upper + * @return Yay_Matchers_BoundsMatcher + */ + public static function outside($lower, $upper) + { + return new Yay_Matchers_BoundsMatcher($lower, $upper, false); + } + + // -- Actions + + /** + * Create a new ReturnValueAction with $value. + * @param mixed $value + * @return Yay_Actions_ReturnValueAction + */ + public static function returnValue($value) + { + return new Yay_Actions_ReturnValueAction($value); + } + + /** + * Create a new ReturnReferenceAction with &$ref. + * @param mixed $ref + * @return Yay_Actions_ReturnReferenceAction + */ + public static function returnReference(&$ref) + { + return new Yay_Actions_ReturnReferenceAction($ref); + } + + /** + * Create a new ThrowAction with $e. + * @param Exception $ref + * @return Yay_Actions_ThrowAction + */ + public static function throwException(Exception $e) + { + return new Yay_Actions_ThrowAction($e); + } + + /** + * Create a new CallbackAction with $callback. + * @param callback $callback + * @return Yay_Actions_CallbackAction + */ + public static function call($callback) + { + return new Yay_Actions_CallbackAction($callback); + } + + /** + * Set the classpath for autoloading. + * @param string $path + */ + public static function setClassPath($path) + { + self::$CLASSPATH = $path; + } + + /** + * Static autoloader registered in bootstrap file. + * @param string $class + */ + public static function autoload($class) + { + if (substr($class, 0, 3) != 'Yay') + { + return; + } + $file = str_replace('_', '/', $class) . '.php'; + $path = self::$CLASSPATH . '/' . $file; + if (is_file($path)) + { + require_once $path; + } + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Action.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Action.php new file mode 100644 index 0000000..d7b3a01 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Action.php @@ -0,0 +1,37 @@ +. + + */ + +//require 'Yay/Invocation.php'; +//require 'Yay/SelfDescribing.php'; + +/** + * An Action performed when an expected Invocation occurs. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_Action extends Yay_SelfDescribing +{ + + /** + * Mimmick the method Invocation and return a value. + * @param Yay_Invocation $invocation + * @return mixed + */ + public function &invoke(Yay_Invocation $invocation); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/CallbackAction.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/CallbackAction.php new file mode 100644 index 0000000..8611441 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/CallbackAction.php @@ -0,0 +1,66 @@ +. + + */ + +//require 'Yay/Action.php'; +//require 'Yay/Description.php'; + +/** + * An Action which delegates to a callback. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Actions_CallbackAction implements Yay_Action +{ + + /** + * The callback to invoke. + * @var callback + * @access private + */ + private $_callback; + + /** + * Create a new CallbackAction for $callback. + * @param callback $callback + */ + public function __construct($callback) + { + $this->_callback = $callback; + } + + /** + * Mimmick the method Invocation and return a value. + * @param Yay_Invocation $invocation + * @return mixed + */ + public function &invoke(Yay_Invocation $invocation) + { + $ret = call_user_func($this->_callback, $invocation); + return $ret; + } + + /** + * Describe this Expectation to $description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $description->appendText(' Runs a callback;'); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ReturnReferenceAction.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ReturnReferenceAction.php new file mode 100644 index 0000000..e96394d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ReturnReferenceAction.php @@ -0,0 +1,64 @@ +. + + */ + +//require 'Yay/Action.php'; + +/** + * An Action which returns a reference. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Actions_ReturnReferenceAction implements Yay_Action +{ + + /** + * The reference to return. + * @var mixed + * @access private + */ + private $_ref; + + /** + * Create a new ReturnReferenceAction for &$ref. + * @param mixed $ref + */ + public function __construct(&$ref) + { + $this->_ref =& $ref; + } + + /** + * Mimmick the method Invocation and return the reference. + * @param Yay_Invocation $invocation + * @return mixed + */ + public function &invoke(Yay_Invocation $invocation) + { + return $this->_ref; + } + + /** + * Describe this Expectation to $description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $description->appendText(' Returns a reference;'); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ReturnValueAction.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ReturnValueAction.php new file mode 100644 index 0000000..c749a1d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ReturnValueAction.php @@ -0,0 +1,100 @@ +. + + */ + +//require 'Yay/Action.php'; + +/** + * An Action which returns a specified value. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Actions_ReturnValueAction implements Yay_Action +{ + + /** + * The value to return. + * @var mixed + * @access private + */ + private $_value; + + /** + * Create a new ReturnValueAction for $value. + * @param mixed $value + */ + public function __construct($value) + { + $this->_value = $value; + } + + /** + * Mimmick the method Invocation and return a value. + * @param Yay_Invocation $invocation + * @return mixed + */ + public function &invoke(Yay_Invocation $invocation) + { + $value = $this->_value; + return $value; + } + + /** + * Describe this Expectation to $description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $description->appendText(sprintf(' Returns %s;', $this->_describeValue('%s [%s]'))); + } + + private function _describeValue($format) + { + $description = ''; + $value = $this->_value; + if (is_int($value)) + { + $description = sprintf($format, 'int', $value); + } + elseif (is_float($value)) + { + $description = sprintf($format, 'float', preg_replace('/^(.{8}).+/', '$1..', $value)); + } + elseif (is_numeric($value)) + { + $description = sprintf($format, 'number', preg_replace('/^(.{8}).+/', '$1..', $value)); + } + elseif (is_string($value)) + { + $description = sprintf($format, 'string', preg_replace('/^(.{8}).+/', '$1..', $value)); + } + elseif (is_object($value)) + { + $description = sprintf($format, 'object', get_class($value)); + } + elseif (is_array($value)) + { + $description = sprintf($format, 'array', count($value) . ' items'); + } + else + { + $description = sprintf($format, gettype($value), preg_replace('/^(.{8}).+/', '$1..', (string) $value)); + } + return $description; + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ThrowAction.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ThrowAction.php new file mode 100644 index 0000000..bdec7c8 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Actions/ThrowAction.php @@ -0,0 +1,66 @@ +. + + */ + +//require 'Yay/Action.php'; + +/** + * An Action which throws an Exception. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Actions_ThrowAction implements Yay_Action +{ + + /** + * The Exception to throw. + * @var Exception + * @access private + */ + private $_e; + + /** + * Create a new ThrowAction for $e. + * @param Exception $e + */ + public function __construct(Exception $e) + { + $this->_e = $e; + } + + /** + * Mimmick the method Invocation and throw an Exception. + * @param Yay_Invocation $invocation + * @throws Exception + */ + public function &invoke(Yay_Invocation $invocation) + { + throw $this->_e; + } + + /** + * Describe this Expectation to $description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $description->appendText( + sprintf(' Throws %s;', get_class($this->_e)) + ); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Description.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Description.php new file mode 100644 index 0000000..561e2a2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Description.php @@ -0,0 +1,45 @@ +. + + */ + +/** + * A Description container for error messages. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_Description +{ + + /** + * Append an existing Description to this Description. + * @param Yay_Description + */ + public function appendDescription(Yay_Description $description); + + /** + * Append text content to this Description. + * @param string $text + */ + public function appendText($text); + + /** + * Get this description back as a formatted string. + * @return string + */ + public function toString(); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectation.php new file mode 100644 index 0000000..de155f9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectation.php @@ -0,0 +1,88 @@ +. + + */ + +//require 'Yay/MockObject.php'; +//require 'Yay/Invocation.php'; +//require 'Yay/Action.php'; +//require 'Yay/SelfDescribing.php'; +//require 'Yay/State.php'; +//require 'Yay/StatePredicate.php'; +//require 'Yay/Sequence.php'; + +/** + * An Invocation expectation. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_Expectation extends Yay_SelfDescribing +{ + + /** + * Specify the MockObject which the Invocation will occur. + * This method should return the mock object in record mode. + * @param Yay_MockObject $mock + * @return Yay_MockObject + */ + public function of(Yay_MockObject $mock); + + /** + * Notify the Expectation of an Invocation and check if it matches. + * @param Yay_Invocation $invocation + * @return boolean + */ + public function isExpected(Yay_Invocation $invocation); + + /** + * Specify the Action to run if a match occurs. + * @param Yay_Action $action + */ + public function will(Yay_Action $action); + + /** + * Only be expected when in the given State predicate. + * @param Yay_StatePredicate $predicate + */ + public function when(Yay_StatePredicate $predicate); + + /** + * Activate the given $state if a match occurs. + * @param Yay_State $state + */ + public function then(Yay_State $state); + + /** + * Constrain this expectation to be valid only if invoked in the given sequence. + * @param Yay_Sequence $sequence + */ + public function inSequence(Yay_Sequence $sequence); + + /** + * Test if all conditions of the Invocation are satisfied. + * @return boolean + */ + public function isSatisfied(); + + /** + * Get the Action for the given Invocation. + * This may have been specified by a will() clause. + * @param Yay_Invocation $invocation + * @return Yay_Action + */ + public function getAction(Yay_Invocation $invocation); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/ExpectationProvider.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/ExpectationProvider.php new file mode 100644 index 0000000..8b90202 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/ExpectationProvider.php @@ -0,0 +1,33 @@ +. + + */ + +/** + * An Invocation expectation provider. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_ExpectationProvider +{ + + /** + * Returns the Expectations. + * @return array of Yay_Expectation + */ + public function getExpectations(); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations.php new file mode 100644 index 0000000..9759a7a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations.php @@ -0,0 +1,306 @@ +. + + */ + +//require 'Yay/Expectation.php'; +//require 'Yay/InvocationRecorder.php'; +//require 'Yay/InvocationProxy.php'; +//require 'Yay/Invocation.php'; +//require 'Yay/State.php'; +//require 'Yay/StatePredicate.php'; +//require 'Yay/Sequence.php'; +//require 'Yay/Expectations/ExactlyExpectation.php'; +//require 'Yay/Expectations/AtLeastExpectation.php'; +//require 'Yay/Expectations/AtMostExpectation.php'; +//require 'Yay/Expectations/BetweenExpectation.php'; +//require 'Yay/Action.php'; +//require 'Yay/Actions/ReturnValueAction.php'; +//require 'Yay/Actions/ReturnReferenceAction.php'; +//require 'Yay/Actions/ThrowAction.php'; +//require 'Yay/Actions/CallbackAction.php'; + +/** + * A group of expectations which can be specified in a fluid manner. + * Generally speaking this is where all expectations should be made for the sake + * of abstraction. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Expectations implements Yay_InvocationRecorder +{ + + /** + * The Expectation stack. + * @var array + * @access private + */ + private $_expectations = array(); + + /** + * The current Expectation to proxy any recording to. + * @var Yay_Expectation + * @access private + */ + private $_currentEndpoint; + + /** + * Create a new instance of Expectations. + * @return Yay_Expectations + */ + final public static function create() + { + return new self(); + } + + /** + * Expect one Invocation on the $mock object. + * Returns the mock object in record mode. + * @param Yay_MockObject $mock + * @return Yay_Expectations + */ + public function one(Yay_MockObject $mock) + { + return $this->exactly(1)->of($mock); + } + + /** + * Expect exactly $n Invocations on a mock object specified with a following + * of() clause. + * Example: Expectations::create()->exactly(2)->of($mock); + * @param int $n + * @return Yay_Expectations + */ + public function exactly($n) + { + return $this->_setEndpoint(new Yay_Expectations_ExactlyExpectation($n)); + } + + /** + * Expect at least $n Invocations on a mock object specified with a following + * of() clause. + * Example: Expectations::create()->atLeast(2)->of($mock); + * @param int $n + * @return Yay_Expectations + */ + public function atLeast($n) + { + return $this->_setEndpoint(new Yay_Expectations_AtLeastExpectation($n)); + } + + /** + * Expect at most $n Invocations on a mock object specified with a following + * of() clause. + * Example: Expectations::create()->atMost(2)->of($mock); + * @param int $n + * @return Yay_Expectations + */ + public function atMost($n) + { + return $this->_setEndpoint(new Yay_Expectations_AtMostExpectation($n)); + } + + /** + * Expect at between $min and $max Invocations on a mock object specified + * with a following of() clause. + * Example: Expectations::create()->atLeast(2)->of($mock); + * @param int $n + * @return Yay_Expectations + */ + public function between($min, $max) + { + return $this->_setEndpoint(new Yay_Expectations_BetweenExpectation($min, $max)); + } + + /** + * Ignore Invocations on the $mock object specified. + * @param Yay_MockObject $mock + * @return Yay_Expectations + */ + public function ignoring(Yay_MockObject $mock) + { + return $this->atLeast(0)->of($mock); + } + + /** + * Allow Invocations on the $mock object specified. + * This does exactly the same thing as ignoring() but it allows a semantically + * different meaning in the test case. + * @param Yay_MockObject $mock + * @return Yay_Expectations + */ + public function allowing(Yay_MockObject $mock) + { + return $this->ignoring($mock); + } + + /** + * Deny Invocations on the $mock object specified. + * @param Yay_MockObject $mock + * @return Yay_Expectations + */ + public function never(Yay_MockObject $mock) + { + return $this->exactly(0)->of($mock); + } + + /** + * Specify the MockObject which the Invocation will occur. + * This method returns the mock object in record mode. + * @param Yay_MockObject $mock + * @return Yay_InvocationProxy + */ + public function of(Yay_MockObject $mock) + { + $this->_getEndpoint()->of($mock); + return new Yay_InvocationProxy($this, $mock); + } + + /** + * Specify the Action to run if a match occurs. + * @param Yay_Action $action + */ + public function will(Yay_Action $action) + { + $this->_getEndpoint()->will($action); + return $this; + } + + /** + * Only be expected when in the given State predicate. + * @param Yay_StatePredicate $predicate + */ + public function when(Yay_StatePredicate $predicate) + { + $this->_getEndpoint()->when($predicate); + return $this; + } + + /** + * Activate the given $state if a match occurs. + * @param Yay_State $state + */ + public function then(Yay_State $state) + { + $this->_getEndpoint()->then($state); + return $this; + } + + /** + * Constrain the current expectation to occur in the given sequence. + * @param Yay_Sequence $seq + */ + public function inSequence(Yay_Sequence $seq) + { + $this->_getEndpoint()->inSequence($seq); + return $this; + } + + /** + * A wrapper for will(Yay::returnValue($value)). + * @param mixed $value + */ + public function returns($value) + { + $this->_getEndpoint()->will(new Yay_Actions_ReturnValueAction($value)); + return $this; + } + + /** + * A wrapper for will(Yay::returnReference($ref)). + * @param mixed $ref + */ + public function returnsReference(&$ref) + { + $this->_getEndpoint()->will(new Yay_Actions_ReturnReferenceAction($ref)); + return $this; + } + + /** + * A wrapper for will(Yay::throwException($e)). + * @param Exception $e + */ + public function throws(Exception $e) + { + $this->_getEndpoint()->will(new Yay_Actions_ThrowAction($e)); + return $this; + } + + /** + * A wrapper for will(Yay::call($callback)). + * @param callback $callback + */ + public function calls($callback) + { + $this->_getEndpoint()->will(new Yay_Actions_CallbackAction($callback)); + return $this; + } + + /** + * Record any Invocations on the MockObject whilst it's in record mode. + * @param Yay_Invocation $invocation + */ + public function recordInvocation(Yay_Invocation $invocation) + { + $this->_getEndpoint()->recordInvocation($invocation); + } + + /** + * Returns the Expectation stack. + * @return Yay_Expectation + */ + public function getExpectations() + { + return $this->_expectations; + } + + // -- Private methods + + /** + * Apply a new Expectation to the stack and tag it as the endpoint for recording. + * @param Yay_Expectation $expectation + * @return Yay_Expectations + * @access private + */ + private function _setEndpoint(Yay_Expectation $expectation) + { + $this->_expectations[] = $expectation; + $this->_currentEndpoint = $expectation; + return $this; + } + + /** + * Gets the current endpoint (current expectation). + * @return Yay_Expectation + * @access private + */ + private function _getEndpoint() + { + if (!isset($this->_currentEndpoint)) + { + throw new BadMethodCallException( + 'No cardinality clause has yet been made. First call one(), atLeast(), ' . + 'atMost(), exactly(), between(), ignoring(), allowing() or never() ' . + 'before performing this operation.' + ); + } + else + { + return $this->_currentEndpoint; + } + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AbstractExpectation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AbstractExpectation.php new file mode 100644 index 0000000..b32a29a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AbstractExpectation.php @@ -0,0 +1,345 @@ +. + + */ + +//require 'Yay/Mockery.php'; +//require 'Yay/Expectation.php'; +//require 'Yay/ExpectationProvider.php'; +//require 'Yay/Invocation.php'; +//require 'Yay/InvocationRecorder.php'; +//require 'Yay/InvocationProxy.php'; +//require 'Yay/Action.php'; +//require 'Yay/Matcher.php'; +//require 'Yay/Matchers/IdenticalMatcher.php'; +//require 'Yay/State.php'; +//require 'Yay/StatePredicate.php'; +//require 'Yay/Sequence.php'; +//require 'Yay/Description.php'; +//require 'Yay/MockGenerator.php'; + +/** + * A base Expectation which other Expectations extend. + * @author Chris Corbyn + * @package Yay + */ +abstract class Yay_Expectations_AbstractExpectation + implements Yay_Expectation, Yay_InvocationRecorder +{ + + /** + * The object to expect Invocations from. + * @var Yay_MockObject + * @access private + */ + private $_object; + + /** + * The method name to expect Invocations on. + * @var string + * @access private + */ + private $_method; + + /** + * The argument Matchers. + * @var array + * @access private + */ + private $_matchers = array(); + + /** + * The Action to use if matched. + * @var Yay_Action + * @access private + */ + private $_action; + + /** + * A state predicate to check for. + * @var Yay_StatePredicate + * @access private + */ + private $_statePredicate; + + /** + * A state to effect if matched. + * @var Yay_State + * @access private + */ + private $_state; + + /** + * The ID wanted to be valid in the Sequence. + * @var int + * @access private + */ + private $_wantedSequenceId; + + /** + * The Sequence to check for validity (if any). + * @var Yay_Sequence + * @access private + */ + private $_sequence; + + /** + * Invoked when the expectation matches so any counters can be incremented + * for example. + * @param Yay_Invocation $invocation + */ + abstract public function notifyMatchedInvocation(Yay_Invocation $invocation); + + /** + * Describe the boundaries of how many invocations can occur. + * @param Yay_Description $description + */ + abstract public function describeBounds(Yay_Description $description); + + /** + * Describe the current status of this expectation. + * @param Yay_Description $description + */ + abstract public function describeSatisfaction(Yay_Description $description); + + /** + * Specify the MockObject which the Invocation will occur. + * This method returns the mock object in record mode. + * @param Yay_MockObject $mock + * @return Yay_InvocationProxy + */ + public function of(Yay_MockObject $mock) + { + $this->_object = $mock; + return new Yay_InvocationProxy($this, $mock); + } + + /** + * Notify the Expectation of an Invocation and check if it matches. + * @param Yay_Invocation $invocation + * @return boolean + */ + public function isExpected(Yay_Invocation $invocation) + { + $matches = true; + $object = $invocation->getObject(); + if ($object === $this->_object) + { + if (isset($this->_statePredicate)) + { + $matches = $this->_statePredicate->isActive(); + } + + if ($matches && isset($this->_method)) + { + if ($this->_method == $invocation->getMethod()) + { + $args =& $invocation->getArguments(); + foreach ($this->_matchers as $i => $m) + { + if (!array_key_exists($i, $args)) + { + if ($m->isOptional()) + { + break; + } + else + { + $matches = false; + break; + } + } + else + { + if (!$m->matches($args[$i])) + { + $matches = false; + break; + } + } + } + } + else + { + $matches = false; + } + } + + if ($matches && isset($this->_sequence)) + { + $matches = $this->_sequence->isInSequence($this->_wantedSequenceId); + } + } + else + { + $matches = false; + } + + if ($matches) + { + $this->notifyMatchedInvocation($invocation); + } + + return $matches; + } + + /** + * Specify the Action to run if a match occurs. + * @param Yay_Action $action + */ + public function will(Yay_Action $action) + { + $this->_action = $action; + return $this; + } + + /** + * Only be expected when in the given State predicate. + * @param Yay_StatePredicate $predicate + */ + public function when(Yay_StatePredicate $predicate) + { + $this->_statePredicate = $predicate; + return $this; + } + + /** + * Activate the given $state if a match occurs. + * @param Yay_State $state + */ + public function then(Yay_State $state) + { + $this->_state = $state; + return $this; + } + + /** + * Constrain this expectation to be valid only if invoked in the given sequence. + * @param Yay_Sequence $sequence + */ + public function inSequence(Yay_Sequence $sequence) + { + $this->_wantedSequenceId = $sequence->requestSequenceId(); + $this->_sequence = $sequence; + return $this; + } + + /** + * Get the Action for the given Invocation. + * This may have been specified by a will() clause. + * @param Yay_Invocation $invocation + * @return Yay_Action + */ + public function getAction(Yay_Invocation $invocation) + { + if (isset($this->_state)) + { + $this->_state->activate(); + } + return $this->_action; + } + + /** + * Record any Invocations on the MockObject whilst it's in record mode. + * @param Yay_Invocation $invocation + */ + public function recordInvocation(Yay_Invocation $invocation) + { + $this->_method = $invocation->getMethod(); + $matchers =& $invocation->getArguments(); + foreach ($matchers as $matcher) + { + if ($matcher instanceof Yay_Matcher) + { + $this->_matchers[] = $matcher; + } + else + { + $this->_matchers[] = new Yay_Matchers_IdenticalMatcher($matcher); + } + } + } + + /** + * Returns the Expectations. + * @return array of Yay_Expectation + */ + public function getExpectations() + { + return array($this); + } + + /** + * Describe this Expectation to $description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $this->describeBounds($description); + + $description->appendText(sprintf(' of %s;', $this->_getInvocationSignature())); + + if (isset($this->_sequence)) + { + $description->appendText(' in'); + $this->_sequence->describeTo($description); + } + + if (isset($this->_statePredicate)) + { + $description->appendText(' when'); + $this->_statePredicate->describeTo($description); + } + + if (isset($this->_action)) + { + $this->_action->describeTo($description); + } + + $this->describeSatisfaction($description); + } + + // -- Private methods + + private function _getInvocationSignature() + { + $class = Yay_MockGenerator::getInstance() + ->reverseNamingScheme(get_class($this->_object)); + if (isset($this->_method)) + { + $method = $this->_method; + } + else + { + $method = ''; + } + if (!empty($this->_matchers)) + { + $args = array(); + foreach ($this->_matchers as $matcher) + { + $args[] = $matcher->describeMatch('%s [%s]'); + } + $params = implode(', ', $args); + } + else + { + $params = ''; + } + return sprintf('%s::%s(%s)', $class, $method, $params); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AtLeastExpectation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AtLeastExpectation.php new file mode 100644 index 0000000..eb167be --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AtLeastExpectation.php @@ -0,0 +1,101 @@ +. + + */ + +//require 'Yay/Expectations/AbstractExpectation.php'; +//require 'Yay/Invocation.php'; + +/** + * An Expectation which wants at least a set number of matching Invocations. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Expectations_AtLeastExpectation + extends Yay_Expectations_AbstractExpectation +{ + + /** + * The expected Invocation count. + * @var int + * @access private + */ + private $_count = 0; + + /** + * The number of matched Invocations. + * @var int + * @access private + */ + private $_matched = 0; + + /** + * Create a new AtLeastExpectation expecting at least $n Invocations. + * @param int $n + */ + public function __construct($n) + { + $this->_count = $n; + } + + /** + * Test if all conditions of the Invocation are satisfied. + * @return boolean + */ + public function isSatisfied() + { + return ($this->_matched >= $this->_count); + } + + /** + * Increment the match counter by 1. + * @param Yay_Invocation $invocation + */ + public function notifyMatchedInvocation(Yay_Invocation $invocation) + { + $this->_matched++; + } + + /** + * Describe the boundaries of how many invocations can occur. + * @param Yay_Description $description + */ + public function describeBounds(Yay_Description $description) + { + if ($this->_count > 0) + { + $description->appendText(sprintf('At least %d', $this->_count)); + } + else + { + $description->appendText('Any number'); + } + } + + /** + * Describe the current status of this expectation. + * @param Yay_Description $description + */ + public function describeSatisfaction(Yay_Description $description) + { + if ($this->_matched >= $this->_count) + { + $description->appendText(' already'); + } + $description->appendText(sprintf(' occurred %d times', $this->_matched)); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AtMostExpectation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AtMostExpectation.php new file mode 100644 index 0000000..61d22fc --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/AtMostExpectation.php @@ -0,0 +1,117 @@ +. + + */ + +//require 'Yay/Expectations/AbstractExpectation.php'; +//require 'Yay/Invocation.php'; + +/** + * An Expectation which wants up to a set number of matching Invocations. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Expectations_AtMostExpectation + extends Yay_Expectations_AbstractExpectation +{ + + /** + * The expected Invocation count. + * @var int + * @access private + */ + private $_count = 0; + + /** + * The number of matched Invocations. + * @var int + * @access private + */ + private $_matched = 0; + + /** + * Create a new AtMostExpectation expecting at most $n Invocations. + * @param int $n + */ + public function __construct($n) + { + $this->_count = $n; + } + + /** + * Test if this Invocation is one that was expected by this Expectation. + * @param Yay_Invocation $invocation + * @return boolean + */ + public function isExpected(Yay_Invocation $invocation) + { + return parent::isExpected($invocation) && ($this->_matched <= $this->_count); + } + + /** + * Test if all conditions of the Invocation are satisfied. + * @return boolean + */ + public function isSatisfied() + { + return true; + } + + /** + * Increment the match counter by 1. + * @param Yay_Invocation $invocation + */ + public function notifyMatchedInvocation(Yay_Invocation $invocation) + { + $this->_matched++; + } + + /** + * Describe the boundaries of how many invocations can occur. + * @param Yay_Description $description + */ + public function describeBounds(Yay_Description $description) + { + if ($this->_count > 0) + { + $description->appendText(sprintf('At most %d', $this->_count)); + } + else + { + $description->appendText('No invocations'); + } + } + + /** + * Describe the current status of this expectation. + * @param Yay_Description $description + */ + public function describeSatisfaction(Yay_Description $description) + { + if ($this->_matched >= $this->_count) + { + $description->appendText(' already'); + } + $description->appendText( + sprintf( + ' occurred %d times', + (($this->_matched < $this->_count) + ? $this->_matched + : $this->_count) + )); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/BetweenExpectation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/BetweenExpectation.php new file mode 100644 index 0000000..0368746 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/BetweenExpectation.php @@ -0,0 +1,118 @@ +. + + */ + +//require 'Yay/Expectations/AbstractExpectation.php'; +//require 'Yay/Invocation.php'; + +/** + * An Expectation which allows a boundary for a number of matching Invocations. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Expectations_BetweenExpectation + extends Yay_Expectations_AbstractExpectation +{ + + /** + * The minimum Invocation count. + * @var int + * @access private + */ + private $_min = 0; + + /** + * The maximum Invocation count. + * @var int + * @access private + */ + private $_max = 0; + + /** + * The number of matched Invocations. + * @var int + * @access private + */ + private $_matched = 0; + + /** + * Create a new BetweenExpectation expecting between $min and $max Invocations. + * @param int $n + */ + public function __construct($min, $max) + { + $this->_min = $min; + $this->_max = $max; + } + + /** + * Test if this Invocation is one that was expected by this Expectation. + * @param Yay_Invocation $invocation + * @return boolean + */ + public function isExpected(Yay_Invocation $invocation) + { + return parent::isExpected($invocation) && ($this->_matched <= $this->_max); + } + + /** + * Test if all conditions of the Invocation are satisfied. + * @return boolean + */ + public function isSatisfied() + { + return ($this->_matched >= $this->_min); + } + + /** + * Increment the match counter by 1. + * @param Yay_Invocation $invocation + */ + public function notifyMatchedInvocation(Yay_Invocation $invocation) + { + $this->_matched++; + } + + /** + * Describe the boundaries of how many invocations can occur. + * @param Yay_Description $description + */ + public function describeBounds(Yay_Description $description) + { + $description->appendText(sprintf('Between %d and %d', $this->_min, $this->_max)); + } + + /** + * Describe the current status of this expectation. + * @param Yay_Description $description + */ + public function describeSatisfaction(Yay_Description $description) + { + if ($this->_matched >= $this->_min) + { + $description->appendText(' already'); + } + $description->appendText( + sprintf( + ' occurred %d times', + (($this->_matched < $this->_max) + ? $this->_matched + : $this->_max) + )); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/ExactlyExpectation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/ExactlyExpectation.php new file mode 100644 index 0000000..243fe46 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Expectations/ExactlyExpectation.php @@ -0,0 +1,117 @@ +. + + */ + +//require 'Yay/Expectations/AbstractExpectation.php'; +//require 'Yay/Invocation.php'; + +/** + * An Expectation which wants an exact number of matching Invocations. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Expectations_ExactlyExpectation + extends Yay_Expectations_AbstractExpectation +{ + + /** + * The expected Invocation count. + * @var int + * @access private + */ + private $_count = 0; + + /** + * The number of matched Invocations. + * @var int + * @access private + */ + private $_matched = 0; + + /** + * Create a new ExactlyExpectation expecting $n Invocations. + * @param int $n + */ + public function __construct($n) + { + $this->_count = $n; + } + + /** + * Test if this Invocation is one that was expected by this Expectation. + * @param Yay_Invocation $invocation + * @return boolean + */ + public function isExpected(Yay_Invocation $invocation) + { + return parent::isExpected($invocation) && ($this->_matched <= $this->_count); + } + + /** + * Test if all conditions of the Invocation are satisfied. + * @return boolean + */ + public function isSatisfied() + { + return ($this->_matched >= $this->_count); + } + + /** + * Increment the match counter by 1. + * @param Yay_Invocation $invocation + */ + public function notifyMatchedInvocation(Yay_Invocation $invocation) + { + $this->_matched++; + } + + /** + * Describe the boundaries of how many invocations can occur. + * @param Yay_Description $description + */ + public function describeBounds(Yay_Description $description) + { + if ($this->_count > 0) + { + $description->appendText(sprintf('Exactly %d', $this->_count)); + } + else + { + $description->appendText('No invocations'); + } + } + + /** + * Describe the current status of this expectation. + * @param Yay_Description $description + */ + public function describeSatisfaction(Yay_Description $description) + { + if ($this->_matched >= $this->_count) + { + $description->appendText(' already'); + } + $description->appendText( + sprintf( + ' occurred %d times', + (($this->_matched < $this->_count) + ? $this->_matched + : $this->_count) + )); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Invocation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Invocation.php new file mode 100644 index 0000000..d382157 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Invocation.php @@ -0,0 +1,49 @@ +. + + */ + +//require 'Yay/SelfDescribing.php'; + +/** + * A representation of a Method invocation. + * This is a container for the object the method was invoked on, the method- + * name and the arguments in the invocation. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_Invocation extends Yay_SelfDescribing +{ + + /** + * Get the object which this Invocation occured on. + * @return object + */ + public function getObject(); + + /** + * Get the method name of the invoked method. + * @return string + */ + public function getMethod(); + + /** + * Get the argument list in the Invocation. + * @return array + */ + public function &getArguments(); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationHandler.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationHandler.php new file mode 100644 index 0000000..a669fe5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationHandler.php @@ -0,0 +1,36 @@ +. + + */ + +//require 'Yay/Invocation.php'; + +/** + * Listens for Invocations and returns a suitable value. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_InvocationHandler +{ + + /** + * Handle the given $invocation and return a value for it. + * @param Yay_Invocation $invocation + * @return mixed + */ + public function &handleInvocation(Yay_Invocation $invocation); + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationProxy.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationProxy.php new file mode 100644 index 0000000..e8d0aa9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationProxy.php @@ -0,0 +1,90 @@ +. + + */ + +//require 'Yay/ExpectationProvider.php'; +//require 'Yay/InvocationRecorder.php'; +//require 'Yay/MockObject.php'; +//require 'Yay/SimpleInvocation.php'; + +/** + * Proxies Invocations on a Mock object to the recorder. + * @author Chris Corbyn + * @package Yay + */ +class Yay_InvocationProxy implements Yay_ExpectationProvider +{ + + /** + * The InvocationRecorder which is using this InvocationProxy. + * @var Yay_InvocationRecorder + * @access private + */ + private $_recorder; + + /** + * The Mock object where Invocations are recorded from. + * @var Yay_MockObject + * @access private + */ + private $_mock; + + /** + * Create a new InvocationProxy for $recorder and $mock. + * @param Yay_InvocationRecorder $recorder + * @param Yay_MockObject $mock + */ + public function __construct(Yay_InvocationRecorder $recorder, Yay_MockObject $mock) + { + $this->_recorder = $recorder; + $this->_mock = $mock; + } + + /** + * Direct all invocations to the recorder. + * @param string $method + * @param array $args + * @return Yay_InvocationRecorder + */ + public function __call($method, $args) + { + if (is_callable(array($this->_mock, $method))) + { + $invocation = new Yay_SimpleInvocation($this->_mock, $method, $args); + $this->_recorder->recordInvocation($invocation); + return $this->_recorder; + } + elseif (is_callable(array($this->_recorder, $method))) + { + return call_user_func_array(array($this->_recorder, $method), $args); + } + else + { + throw new BadMethodCallException('Mock method ' . $method . ' does not exist'); + } + } + + /** + * Returns the Expectation list. + * @return array of Yay_Expectation + */ + public function getExpectations() + { + return $this->__call(__FUNCTION__, array()); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationRecorder.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationRecorder.php new file mode 100644 index 0000000..f3abed3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/InvocationRecorder.php @@ -0,0 +1,36 @@ +. + + */ + +//require 'Yay/Invocation.php'; +//require 'Yay/ExpectationProvider.php'; + +/** + * Listens for Invocations and provides expectations based on them. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_InvocationRecorder extends Yay_ExpectationProvider +{ + + /** + * Record the given $invocation. + * @param Yay_Invocation $invocation + */ + public function recordInvocation(Yay_Invocation $invocation); + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matcher.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matcher.php new file mode 100644 index 0000000..5dc3e74 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matcher.php @@ -0,0 +1,48 @@ +. + + */ + +/** + * The Matcher interface for comparing arguments. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_Matcher +{ + + /** + * Compare the $argument with whatever is expected to match it. + * @param mixed $argument + * @return boolean + */ + public function matches(&$argument); + + /** + * Returns true if the argument doesn't need to be present. + * @return boolean + */ + public function isOptional(); + + /** + * Writes the match description as a string following $format. + * $format is a sprintf() string with %s, $s as $matcherName, $value respectively. + * @param string $format + * @return string + */ + public function describeMatch($format); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/AnyMatcher.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/AnyMatcher.php new file mode 100644 index 0000000..8592ba3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/AnyMatcher.php @@ -0,0 +1,85 @@ +. + + */ + +//require 'Yay/Matcher.php'; + +/** + * Allows anything to match. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Matchers_AnyMatcher implements Yay_Matcher +{ + + /** + * A type to compare with. + * @var string + * @access private + */ + private $_type; + + /** + * The desired result. + * @var boolean + * @access private + */ + private $_result; + + /** + * Create a new AnyMatcher, optionally constrained only to objects of $type. + * @param string $type, optional + * @param boolean $result + */ + public function __construct($type = null, $result = true) + { + $this->_type = $type; + $this->_result = $result; + } + + /** + * Always returns true where no type is given, and where the type matches otherwise. + * @param mixed $value + * @return boolean + */ + public function matches(&$value) + { + $return = (is_null($this->_type) || ($value instanceof $this->_type)); + return (($this->_result && $return) || (!$this->_result && !$return)); + } + + /** + * Returns true if the argument doesn't need to be present. + * @return boolean + */ + public function isOptional() + { + return false; + } + + /** + * Writes the match description as a string following $format. + * $format is a sprintf() string with %s, $s as $matcherName, $value respectively. + * @param string $format + * @return string + */ + public function describeMatch($format) + { + return 'ANYTHING'; + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/BoundsMatcher.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/BoundsMatcher.php new file mode 100644 index 0000000..57aef64 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/BoundsMatcher.php @@ -0,0 +1,94 @@ +. + + */ + +//require 'Yay/Matcher.php'; + +/** + * Compares values to test if they are within given boundaries. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Matchers_BoundsMatcher implements Yay_Matcher +{ + + /** + * The upper bound. + * @var mixed + * @access private + */ + private $_upper; + + /** + * The lower bound. + * @var mixed + * @access private + */ + private $_lower; + + /** + * The desired result. + * @var boolean + * @access private + */ + private $_result; + + /** + * Create a new BoundsMatcher between $lower and $upper. + * @param mixed $lower + * @param mixed $upper + * @param boolean $result which is wanted + */ + public function __construct($lower, $upper, $result = true) + { + $this->_upper = $upper; + $this->_lower = $lower; + $this->_result = $result; + } + + /** + * Compare $value with the boundaries and return true if it is within them. + * @param mixed $value + * @return boolean + */ + public function matches(&$value) + { + $return = ($value <= $this->_upper && $value >= $this->_lower); + return (($this->_result && $return) || (!$this->_result && !$return)); + } + + /** + * Returns true if the argument doesn't need to be present. + * @return boolean + */ + public function isOptional() + { + return false; + } + + /** + * Writes the match description as a string following $format. + * $format is a sprintf() string with %s, $s as $matcherName, $value respectively. + * @param string $format + * @return string + */ + public function describeMatch($format) + { + return sprintf($format, 'between', $this->_min . ' and ' . $this->_max); + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/EqualMatcher.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/EqualMatcher.php new file mode 100644 index 0000000..1d4f25d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/EqualMatcher.php @@ -0,0 +1,50 @@ +. + + */ + +//require 'Yay/Matchers/IdenticalMatcher.php'; + +/** + * Compares values for equality. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Matchers_EqualMatcher extends Yay_Matchers_IdenticalMatcher +{ + + /** + * Create a new EqualMatcher expecting $expected. + * @param mixed $expected + * @param boolean $result to be expected + */ + public function __construct($expected, $result = true) + { + parent::__construct($expected, $result); + } + + /** + * Compare $value with the expected value and return true if it is equal. + * @param mixed $value + * @return boolean + */ + public function matches(&$value) + { + $return = (($this->_expected == $value) && ($value == $this->_expected)); + return (($this->_result && $return) || (!$this->_result && !$return)); + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/IdenticalMatcher.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/IdenticalMatcher.php new file mode 100644 index 0000000..c227b67 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/IdenticalMatcher.php @@ -0,0 +1,116 @@ +. + + */ + +//require 'Yay/Matcher.php'; + +/** + * Compares values for value and type. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Matchers_IdenticalMatcher implements Yay_Matcher +{ + + /** + * The expected value. + * @var mixed + * @access protected + */ + protected $_expected; + + /** + * The expected return value. + * @var boolean + * @access protected + */ + protected $_result; + + /** + * Create a new IdenticalMatcher expecting $expected. + * @param mixed $expected + * @param boolean $result to be expected + */ + public function __construct($expected, $result = true) + { + $this->_expected = $expected; + $this->_result = $result; + } + + /** + * Compare $value with the expected value and return true if it matches in + * type and in value. + * @param mixed $value + * @return boolean + */ + public function matches(&$value) + { + $return = (($this->_expected === $value) && ($value === $this->_expected)); + return (($this->_result && $return) || (!$this->_result && !$return)); + } + + /** + * Returns true if the argument doesn't need to be present. + * @return boolean + */ + public function isOptional() + { + return false; + } + + /** + * Writes the match description as a string following $format. + * $format is a sprintf() string with %s, $s as $matcherName, $value respectively. + * @param string $format + * @return string + */ + public function describeMatch($format) + { + $description = ''; + $value = $this->_expected; + if (is_int($value)) + { + $description = sprintf($format, 'int', $value); + } + elseif (is_float($value)) + { + $description = sprintf($format, 'float', preg_replace('/^(.{8}).+/', '$1..', $value)); + } + elseif (is_numeric($value)) + { + $description = sprintf($format, 'number', preg_replace('/^(.{8}).+/', '$1..', $value)); + } + elseif (is_string($value)) + { + $description = sprintf($format, 'string', preg_replace('/^(.{8}).+/', '$1..', $value)); + } + elseif (is_object($value)) + { + $description = sprintf($format, 'object', get_class($value)); + } + elseif (is_array($value)) + { + $description = sprintf($format, 'array', count($value) . ' items'); + } + else + { + $description = sprintf($format, gettype($value), preg_replace('/^(.{8}).+/', '$1..', (string) $value)); + } + return $description; + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/OptionalMatcher.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/OptionalMatcher.php new file mode 100644 index 0000000..a348d57 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/OptionalMatcher.php @@ -0,0 +1,103 @@ +. + + */ + +//require 'Yay/Matcher.php'; +//require 'Yay/Matchers/IdenticalMatcher.php'; + +/** + * Wraps Matchers and makes them Optional. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Matchers_OptionalMatcher implements Yay_Matcher +{ + + /** + * A matcher to delegate to. + * @var Yay_Matcher + * @access private + */ + private $_matcher; + + /** + * Create a new OptionalMatcher, optionally wrapping $value. + * @param mixed $value, optional + */ + public function __construct($value = null) + { + if (isset($value)) + { + if ($value instanceof Yay_Matcher) + { + $this->_matcher = $value; + } + else + { + $this->_matcher = new Yay_Matchers_IdenticalMatcher($value); + } + } + } + + /** + * Returns true if no matcher set, otherwise it delegates to the given Matcher. + * @param mixed $value + * @return boolean + */ + public function matches(&$value) + { + if (isset($this->_matcher)) + { + $matches = $this->_matcher->matches($value); + } + else + { + $matches = true; + } + return $matches; + } + + /** + * Returns true if the argument doesn't need to be present. + * @return boolean + */ + public function isOptional() + { + return true; + } + + /** + * Writes the match description as a string following $format. + * $format is a sprintf() string with %s, $s as $matcherName, $value respectively. + * @param string $format + * @return string + */ + public function describeMatch($format) + { + $name = 'optional'; + if (isset($this->_matcher)) + { + $value = $this->_matcher->describeMatch($format); + } + else + { + $value = '*'; + } + return sprintf($format, $name, $value); + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/PatternMatcher.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/PatternMatcher.php new file mode 100644 index 0000000..4f4043f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/PatternMatcher.php @@ -0,0 +1,88 @@ +. + + */ + +//require 'Yay/Matcher.php'; + +/** + * Compares values against a PCRE pattern. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Matchers_PatternMatcher implements Yay_Matcher +{ + + /** + * The expected pattern. + * @var string + * @access private + */ + private $_pattern; + + /** + * The desired return value. + * @var boolean + * @access private + */ + private $_result; + + /** + * Create a new PatternMatcher expecting $pattern. + * @param string $pattern + * @param boolean $result to be expected + */ + public function __construct($pattern, $result = true) + { + $this->_pattern = $pattern; + $this->_result = $result; + } + + /** + * Compare $value with the expected pattern and return true if it matches. + * @param string $value + * @return boolean + */ + public function matches(&$value) + { + $return = ( + (is_string($value) || is_numeric($value)) + && preg_match($this->_pattern, $value) + ); + return (($this->_result && $return) || (!$this->_result && !$return)); + } + + /** + * Returns true if the argument doesn't need to be present. + * @return boolean + */ + public function isOptional() + { + return false; + } + + /** + * Writes the match description as a string following $format. + * $format is a sprintf() string with %s, $s as $matcherName, $value respectively. + * @param string $format + * @return string + */ + public function describeMatch($format) + { + return sprintf($format, 'pattern', $this->_pattern); + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/ReferenceMatcher.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/ReferenceMatcher.php new file mode 100644 index 0000000..cae6a08 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Matchers/ReferenceMatcher.php @@ -0,0 +1,104 @@ +. + + */ + +//require 'Yay/Matcher.php'; + +/** + * Compares values to see if they reference one another. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Matchers_ReferenceMatcher implements Yay_Matcher +{ + + /** + * The expected reference. + * @var mixed + * @access private + */ + private $_ref; + + /** + * The desired return value. + * @var boolean + * @access private + */ + private $_result; + + /** + * Create a new IdenticalMatcher expecting $expected. + * @param mixed $expected + * @param boolean $result to be expected + */ + public function __construct(&$ref, $result = true) + { + $this->_ref =& $ref; + $this->_result = $result; + } + + /** + * Compare $ref with the expected reference and return true if it is the same reference. + * @param mixed $ref + * @return boolean + */ + public function matches(&$ref) + { + if (is_object($ref)) + { + $isRef = ($this->_ref === $ref); + } + else + { + if ($this->_ref === $ref) + { + $copy = $ref; + $randomString = uniqid('yay'); + $ref = $randomString; + $isRef = ($this->_ref === $ref); + $ref = $copy; + } + else + { + $isRef = false; + } + } + + return (($this->_result && $isRef) || (!$this->_result && !$isRef)); + } + + /** + * Returns true if the argument doesn't need to be present. + * @return boolean + */ + public function isOptional() + { + return false; + } + + /** + * Writes the match description as a string following $format. + * $format is a sprintf() string with %s, $s as $matcherName, $value respectively. + * @param string $format + * @return string + */ + public function describeMatch($format) + { + return '[reference]'; + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/MockGenerator.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/MockGenerator.php new file mode 100644 index 0000000..b3a9c78 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/MockGenerator.php @@ -0,0 +1,323 @@ +. + + */ + +/** + * Generates the code for a Mock object. + * This lives as a singleton for a few reasons. + * @author Chris Corbyn + * @package Yay + */ +class Yay_MockGenerator +{ + + /** The name of the Mock object interface */ + const MOCK_INTERFACE = 'Yay_MockObject'; + + /** Prefixed to types to create a Mock name */ + const MOCK_PREFIX = 'Yay_MockObjects_'; + + /** Singleton instance */ + private static $_instance = null; + + /** + * The path a template which draws a Mock. + * @var string + * @access private + */ + private $_template; + + /** + * A map of mocked type hints to their concrete class names. + * @var array + * @access private + */ + private $_mocked = array(); + + /** + * Constructor cannot be used. + */ + private function __construct() + { + } + + /** + * Get a singleton instance of this MockGenerator. + * @return Yay_MockGenerator + */ + public static function getInstance() + { + if (is_null(self::$_instance)) + { + self::$_instance = new self(); + } + return self::$_instance; + } + + /** + * Set the path to a template which can draw a mock class. + * @param string $path + */ + public function setMockTemplate($path) + { + $this->_template = $path; + } + + /** + * Produce class code for a MockObject of $typeHint and return its concrete name. + * @param string $typeHint + * @return string + */ + public function generateMock($typeHint) + { + if (!$className = $this->_getConcreteMockName($typeHint)) + { + $className = $this->_materializeMockCode($typeHint); + } + return $className; + } + + /** + * Use a fixed naming scheme to make a mock class name from $typeHint. + * @param string $typeHint + * @return string + */ + public function applyNamingScheme($typeHint) + { + return self::MOCK_PREFIX . $typeHint; + } + + /** + * Remove any adjustments that were made to an original type hint. + * @param string $typeHint + * @return string + */ + public function reverseNamingScheme($typeHint) + { + $len = strlen(self::MOCK_PREFIX); + if (substr($typeHint, 0, $len) == self::MOCK_PREFIX) + { + $typeHint = substr($typeHint, $len); + } + return $typeHint; + } + + // -- Private methods + + /** + * Try to lookup a mocked concrete class name for $typeHint. + * @param string $typeHint + * @return string + * @access private + */ + private function _getConcreteMockName($typeHint) + { + if (array_key_exists($typeHint, $this->_mocked)) + { + return $this->_mocked[$typeHint]; + } + } + + /** + * Produce the mock object code and return its name. + * @param string $typeHint + * @return string + * @access private + */ + private function _materializeMockCode($typeHint) + { + $reflector = new ReflectionClass($typeHint); + $mockData = array( + 'className' => $this->applyNamingScheme($typeHint), + 'extends' => $this->_getSuperclass($reflector), + 'interfaces' => $this->_getInterfaces($reflector), + 'methods' => $this->_getMethods($reflector) + ); + + extract($mockData); + $code = include($this->_template); + eval($code); + + $this->_mocked[$typeHint] = $mockData['className']; + return $mockData['className']; + } + + /** + * Get all known interfaces for $reflector. + * @param ReflectionClass $reflector + * @return array + * @access private + */ + private function _getInterfaces(ReflectionClass $reflector) + { + $interfaces = array(); + if ($reflector->isInterface()) + { + if ($reflector->getName() != self::MOCK_INTERFACE) + { + $interfaces[] = $reflector->getName(); + } + } + else + { + foreach ($reflector->getInterfaces() as $interfaceReflector) + { + if ($interfaceReflector->getName() != self::MOCK_INTERFACE) + { + $interfaces[] = $interfaceReflector->getName(); + } + } + } + return $interfaces; + } + + /** + * Get the superclass this mock object needs to extend. + * @param ReflectionClass $reflector + * @return string + * @access private + */ + private function _getSuperclass(ReflectionClass $reflector) + { + if ($this->_canExtend($reflector)) + { + $superclass = $reflector->getName(); + } + else + { + $superclass = ''; + } + return $superclass; + } + + /** + * Get all methods from $reflector. + * @param ReflectionClass $reflector + * @return array + * @access private + */ + private function _getMethods(ReflectionClass $reflector) + { + $methods = array(); + foreach ($reflector->getMethods() as $reflectionMethod) + { + if ($reflectionMethod->isConstructor() + || $reflectionMethod->getName() == '__clone') + { + continue; + } + if ($reflectionMethod->isPublic() || $reflectionMethod->isProtected()) + { + $methods[] = array( + 'name' => $reflectionMethod->getName(), + 'access' => $reflectionMethod->isPublic() ? 'public' : 'protected', + 'modifiers' => $reflectionMethod->isStatic() ? 'static' : '', + 'returnReference' => $reflectionMethod->returnsReference(), + 'parameters' => $this->_getParameters($reflectionMethod) + ); + } + } + return $methods; + } + + /** + * Get all parameters for $method. + * @param ReflectionMethod $method + * @return array + * @access private + */ + private function _getParameters(ReflectionMethod $method) + { + $parameters = array(); + foreach ($method->getParameters() as $reflectionParameter) + { + $hint = ''; + if ($reflectionParameter->isArray()) + { + $hint = 'array'; + } + elseif ($c = $reflectionParameter->getClass()) + { + $hint = $c->getName(); + } + $parameters[] = array( + 'hint' => $hint, + 'byReference' => $reflectionParameter->isPassedByReference(), + 'optional' => $reflectionParameter->isOptional() + ); + } + return $parameters; + } + + /** + * Determine if the reflector for the given class is safe to extend. + * @param ReflectionClass $reflector + * @return boolean + * @access private + */ + private function _canExtend(ReflectionClass $reflector) + { + $canExtend = true; + $warning = false; + if ($reflector->isInterface()) + { + $canExtend = false; + } + else + { + if ($constructor = $reflector->getConstructor()) + { + if ($constructor->isPrivate() || $constructor->isFinal()) + { + $canExtend = false; + $warning = 'has a private or final constructor'; + } + } + elseif ($reflector->isFinal()) + { + $canExtend = false; + $warning = 'is declared final'; + } + else + { + foreach ($reflector->getMethods() as $method) + { + if (($method->isPublic() || $method->isProtected()) && $method->isFinal()) + { + $canExtend = false; + $warning = 'contains final methods'; + } + } + } + } + if ($warning) + { + trigger_error( + sprintf('The type [%s] to be mocked %s.' . + ' Mocking classes which cannot be fully overridden results' . + ' in a loss of class type. It is safe to supress this warning if you' . + ' are aware of the conflict.', + $reflector->getName(), + $warning + ), + E_USER_WARNING + ); + } + return $canExtend; + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/MockObject.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/MockObject.php new file mode 100644 index 0000000..3c65de0 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/MockObject.php @@ -0,0 +1,25 @@ +. + + */ + +/** + * A tag placed on any MockObjects generated in the context of YayMock. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_MockObject { +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Mockery.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Mockery.php new file mode 100644 index 0000000..38d2410 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Mockery.php @@ -0,0 +1,183 @@ +. + + */ + +//require 'Yay/MockGenerator.php'; +//require 'Yay/SimpleInvocation.php'; +//require 'Yay/SimpleDescription.php'; +//require 'Yay/InvocationHandler.php'; +//require 'Yay/MockObject.php'; +//require 'Yay/ExpectationProvider.php'; +//require 'Yay/NotSatisfiedException.php'; +//require 'Yay/StateMachine.php'; +//require 'Yay/SimpleSequence.php'; + +/** + * The main Yay context. + * Handles the generation of MockObjects and the Invocation of methods. + * @author Chris Corbyn + * @package Yay + */ +class Yay_Mockery implements Yay_InvocationHandler +{ + + /** + * The Expectation stack which is being checked. + * @var array + * @access private + */ + private $_expectations = array(); + + /** + * Invocations which are not expected by any Expectations get caught here. + * @var array + * @access private + */ + private $_unexpectedInvocations = array(); + + /** + * A mock class generator. + * @var Yay_MockGenerator + * @access private + */ + private $_generator; + + /** + * Create a new Mockery. + */ + public function __construct() + { + $this->_generator = Yay_MockGenerator::getInstance(); + } + + /** + * Create a MockObject matching $typeHint. + * If the $typeHint is an interface the Mock will implement the interface + * and maintain the method signatures from that interface. + * If the $typeHint is a class name the Mock will extend the class overriding + * all public methods (HOWEVER, if the class contains final methods it is not + * possible to override all methods and hence, the mock will have no specific + * type. + * @param string $typeHint + * @return Yay_MockObject + */ + public function mock($typeHint) + { + $className = $this->_generator->generateMock($typeHint); + $reflector = new ReflectionClass($className); + return $reflector->newInstance($this); + } + + /** + * Specify an Expectation (or Expectations) to check. + * @param Yay_ExpectationProvider $provider + */ + public function checking(Yay_ExpectationProvider $provider) + { + foreach ($provider->getExpectations() as $expectation) + { + $this->_expectations[] = $expectation; + } + } + + /** + * Get a state machine named $name. + * @param string $name + * @return Yay_States + */ + public function states($name) + { + return new Yay_StateMachine($name); + } + + /** + * Create a new Sequence named $name. + * @param string $name + * @return Yay_Sequence + */ + public function sequence($name) + { + return new Yay_SimpleSequence($name); + } + + /** + * Used by YayMock internally (ignore this method!). + */ + public function &handleInvocation(Yay_Invocation $invocation) + { + $ret = null; + $expected = false; + foreach ($this->_expectations as $expectation) + { + if ($expectation->isExpected($invocation)) + { + $expected = true; + if ($action = $expectation->getAction($invocation)) + { + $ret =& $action->invoke($invocation); + } + break; + } + } + if (!$expected) + { + $this->_unexpectedInvocations[] = $invocation; + } + return $ret; + } + + /** + * Assert that all Expectations are satisfied. + * Throws an Exception of type Yay_NotSatisfiedException if any Expecations + * are not satisfied. + * @throws Yay_NotSatisfiedException + */ + public function assertIsSatisfied() + { + $description = new Yay_SimpleDescription(); + $satisfied = true; + foreach ($this->_unexpectedInvocations as $invocation) + { + $description->appendText('Unexpected invocation'); + $invocation->describeTo($description); + $description->appendText(PHP_EOL); + $satisfied = false; + } + if (!$satisfied) + { + $description->appendText(PHP_EOL); + } + foreach ($this->_expectations as $expectation) + { + if (!$expectation->isSatisfied()) + { + $description->appendText('* '); + $satisfied = false; + } + $expectation->describeTo($description); + $description->appendText(PHP_EOL); + } + if (!$satisfied) + { + throw new Yay_NotSatisfiedException( + 'Not all expectations were satisfied or a method was invoked unexpectedly.' . + PHP_EOL . PHP_EOL . $description->toString() . PHP_EOL + ); + } + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/NotSatisfiedException.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/NotSatisfiedException.php new file mode 100644 index 0000000..8a76daa --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/NotSatisfiedException.php @@ -0,0 +1,36 @@ +. + + */ + +/** + * The Exception thrown by Context::assertIsSatisfied() if assertion fails. + * @author Chris Corbyn + * @package Yay + */ +class Yay_NotSatisfiedException extends Exception +{ + + /** + * Create a new NotSatisfiedException with $message. + * @param string $message + */ + public function __construct($message) + { + parent::__construct($message); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SelfDescribing.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SelfDescribing.php new file mode 100644 index 0000000..186249a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SelfDescribing.php @@ -0,0 +1,35 @@ +. + + */ + +//require 'Yay/Description.php'; + +/** + * Components implementing this can describe what they do to a Description instance. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_SelfDescribing +{ + + /** + * Write a description of this self describing object to Description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Sequence.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Sequence.php new file mode 100644 index 0000000..225b2a5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/Sequence.php @@ -0,0 +1,43 @@ +. + + */ + +//require 'Yay/SelfDescribing.php'; + +/** + * Provides a means for Expectations to verify they are called in the correct order. + * This allows Invocations to be forced in a particular order. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_Sequence extends Yay_SelfDescribing +{ + + /** + * Ask for a new Sequence Id and register the new sequence. + * @return int $id + */ + public function requestSequenceId(); + + /** + * Check if the sequence has progressed far enough for this sequence ID to be used. + * @param int $id + * @return boolean + */ + public function isInSequence($sequenceId); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleDescription.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleDescription.php new file mode 100644 index 0000000..f86b4b7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleDescription.php @@ -0,0 +1,63 @@ +. + + */ + +//require 'Yay/Description.php'; + +/** + * A basic Description container for error messages. + * @author Chris Corbyn + * @package Yay + */ +class Yay_SimpleDescription implements Yay_Description +{ + + /** + * An internal text buffer. + * @var string + * @access private + */ + private $_text = ''; + + /** + * Append an existing Description to this Description. + * @param Yay_Description + */ + public function appendDescription(Yay_Description $description) + { + $this->_text .= $description->toString(); + } + + /** + * Append text content to this Description. + * @param string $text + */ + public function appendText($text) + { + $this->_text .= $text; + } + + /** + * Get this description back as a formatted string. + * @return string + */ + public function toString() + { + return $this->_text; + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleInvocation.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleInvocation.php new file mode 100644 index 0000000..012b568 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleInvocation.php @@ -0,0 +1,163 @@ +. + + */ + +//require 'Yay/Invocation.php'; +//require 'Yay/MockGenerator.php'; + +/** + * The standard implementation of the Invocation interface. + * @author Chris Corbyn + * @package Yay + */ +class Yay_SimpleInvocation implements Yay_Invocation +{ + + /** + * The Object on which the Inovation occurred. + * @var object + * @access private + */ + private $_object; + + /** + * The method name invoked. + * @var string + * @access private + */ + private $_method; + + /** + * The arguments in the Invocation. + * @var array + * @access private + */ + private $_arguments; + + /** + * Create a new SimpleInvocation with the given details. + * @param object $object + * @param string $method + * @param array &$arguments + */ + public function __construct($object, $method, array &$arguments) + { + $this->_object = $object; + //Massage __call() overloading so the interface is tested correctly + if ($method == '__call') + { + $method = array_shift($arguments); + $args =& array_shift($arguments); + $arguments =& $args; + } + $this->_method = $method; + $this->_arguments =& $arguments; + } + + /** + * Get the object which this Invocation occured on. + * @return object + */ + public function getObject() + { + return $this->_object; + } + + /** + * Get the method name of the invoked method. + * @return string + */ + public function getMethod() + { + return $this->_method; + } + + /** + * Get the argument list in the Invocation. + * @return array + */ + public function &getArguments() + { + return $this->_arguments; + } + + /** + * Describe this Invocation to $description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $description->appendText(sprintf(' of %s;', $this->_getInvocationSignature())); + } + + // -- Private methods + + private function _getInvocationSignature() + { + $class = Yay_MockGenerator::getInstance() + ->reverseNamingScheme(get_class($this->_object)); + if (!empty($this->_arguments)) + { + $args = array(); + foreach ($this->_arguments as $arg) + { + $args[] = $this->_describeArgument($arg, '%s [%s]'); + } + $params = implode(', ', $args); + } + else + { + $params = ''; + } + return sprintf('%s::%s(%s)', $class, $this->_method, $params); + } + + private function _describeArgument($arg, $format) + { + $description = ''; + if (is_int($arg)) + { + $description = sprintf($format, 'int', $arg); + } + elseif (is_float($arg)) + { + $description = sprintf($format, 'float', preg_replace('/^(.{8}).+/', '$1..', $arg)); + } + elseif (is_numeric($arg)) + { + $description = sprintf($format, 'number', preg_replace('/^(.{8}).+/', '$1..', $arg)); + } + elseif (is_string($arg)) + { + $description = sprintf($format, 'string', preg_replace('/^(.{8}).+/', '$1..', $arg)); + } + elseif (is_object($arg)) + { + $description = sprintf($format, 'object', get_class($arg)); + } + elseif (is_array($arg)) + { + $description = sprintf($format, 'array', count($arg) . ' items'); + } + else + { + $description = sprintf($format, gettype($arg), preg_replace('/^(.{8}).+/', '$1..', (string) $arg)); + } + return $description; + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleSequence.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleSequence.php new file mode 100644 index 0000000..016c30a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleSequence.php @@ -0,0 +1,108 @@ +. + + */ + +/** + * Provides a means for Expectations to verify they are called in the correct order. + * This allows Invocations to be forced in a particular order. + * @author Chris Corbyn + * @package Yay + */ +class Yay_SimpleSequence implements Yay_Sequence +{ + + /** + * The name of this sequence. + * @var string + * @access private + */ + private $_name; + + /** + * The list of sequence IDs expected. + * @var array + * @access private + */ + private $_sequenceIds = array(); + + /** + * An internal sequence counter. + * @var int + * @access private + */ + private $_counter = 0; + + /** + * The current position in the sequence. + * @var int + * @access private + */ + private $_currentId = null; + + /** + * Create a new Sequence with $name. + * @param string $name + */ + public function __construct($name) + { + $this->_name = $name; + } + + /** + * Ask for a new Sequence Id and register the new sequence. + * @return int $id + */ + public function requestSequenceId() + { + $id = $this->_counter++; + $this->_sequenceIds[] = $id; + return $id; + } + + /** + * Check if the sequence has progressed far enough for this sequence ID to be used. + * @param int $id + * @return boolean + */ + public function isInSequence($sequenceId) + { + if ($this->_currentId === $sequenceId) + { + $inSequence = true; + } + elseif (current($this->_sequenceIds) === $sequenceId) + { + $this->_currentId = array_shift($this->_sequenceIds); + $inSequence = true; + } + else + { + $inSequence = false; + } + return $inSequence; + } + + /** + * Write a description of this self describing object to Description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $description->appendText(sprintf(' sequence %s;', $this->_name)); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleState.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleState.php new file mode 100644 index 0000000..18c7621 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleState.php @@ -0,0 +1,49 @@ +. + + */ + +//require 'Yay/State.php'; +//require 'Yay/States.php'; +//require 'Yay/SimpleStatePredicate.php'; + +/** + * A State from a State machine. + * @author Chris Corbyn + * @package Yay + */ +class Yay_SimpleState extends Yay_SimpleStatePredicate implements Yay_State +{ + + /** + * Create a new State for $stateMachine to be $stateName. + * @param Yay_States $stateMachine + * @param string $stateName + */ + public function __construct(Yay_States $stateMachine, $stateName) + { + parent::__construct($stateMachine, $stateName, true); + } + + /** + * Make this State active. + */ + public function activate() + { + $this->_stateMachine->become($this->_stateName); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleStatePredicate.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleStatePredicate.php new file mode 100644 index 0000000..6c9458c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/SimpleStatePredicate.php @@ -0,0 +1,88 @@ +. + + */ + +//require 'Yay/StatePredicate.php'; +//require 'Yay/States.php'; + +/** + * An expectation about what State a state machine is in. + * @author Chris Corbyn + * @package Yay + */ +class Yay_SimpleStatePredicate implements Yay_StatePredicate +{ + + /** + * The state machine which this predicate checks. + * @var Yay_States + * @access private + */ + protected $_stateMachine; + + /** + * The state name to check for in the state machine. + * @var string + * @access private + */ + protected $_stateName; + + /** + * True if the state is wanted, false otherwise. + * @var boolean + * @access private + */ + private $_is = true; + + /** + * Create a new StatePredicate. + * @param Yay_States $stateMachine + * @param string $stateName to expect + * @param boolean $is (negation point) + */ + public function __construct(Yay_States $stateMachine, $stateName, $is = true) + { + $this->_stateMachine = $stateMachine; + $this->_stateName = $stateName; + $this->_is = $is; + } + + /** + * Return true if the state machine is in this state. + * @return boolean + */ + public function isActive() + { + return (($this->_is && $this->_stateMachine->getCurrentState() == $this->_stateName) + || (!$this->_is && $this->_stateMachine->getCurrentState() != $this->_stateName)); + } + + /** + * Write a description of this self describing object to Description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $this->_stateMachine->describeTo($description); + $description->appendText(sprintf( + ' %s %s;', + ($this->_is ? 'is' : 'is not'), + $this->_stateName + )); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/State.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/State.php new file mode 100644 index 0000000..045e8bb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/State.php @@ -0,0 +1,34 @@ +. + + */ + +//require 'Yay/StatePredicate.php'; + +/** + * A State from a State machine. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_State extends Yay_StatePredicate +{ + + /** + * Make this State active. + */ + public function activate(); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/StateMachine.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/StateMachine.php new file mode 100644 index 0000000..2a9128a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/StateMachine.php @@ -0,0 +1,113 @@ +. + + */ + +//require 'Yay/State.php'; +//require 'Yay/SimpleState.php'; +//require 'Yay/StatePredicate.php'; +//require 'Yay/SimpleStatePredicate.php'; + +/** + * A basic state machine. + * @author Chris Corbyn + * @package Yay + */ +class Yay_StateMachine implements Yay_States +{ + + /** + * The name of this state machine. + * @var string + * @access private + */ + private $_name; + + /** + * The current state. + * @var string + * @access private + */ + private $_state; + + /** + * Create a new State machine with $name. + * @param string $name + */ + public function __construct($name) + { + $this->_name = $name; + } + + /** + * Set the initial state of this state machine. + * @param string $stateName + * @return Yay_States + */ + public function startsAs($stateName) + { + $this->become($stateName); + return $this; + } + + /** + * Get the state which puts the state machine into the named state. + * @param string $stateName + * @return Yay_State + */ + public function is($stateName) + { + return new Yay_SimpleState($this, $stateName); + } + + /** + * Get the predicate which indicates the state machine is NOT in the named state. + * @param string $stateName + * @return Yay_StatePredicate + */ + public function isNot($stateName) + { + return new Yay_SimpleStatePredicate($this, $stateName, false); + } + + /** + * Become the named state. + * @param string $stateName + */ + public function become($stateName) + { + $this->_state = $stateName; + } + + /** + * Get the name of the current state. + * @return string + */ + public function getCurrentState() + { + return $this->_state; + } + + /** + * Write a description of this self describing object to Description. + * @param Yay_Description $description + */ + public function describeTo(Yay_Description $description) + { + $description->appendText(sprintf(' %s', $this->_name)); + } + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/StatePredicate.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/StatePredicate.php new file mode 100644 index 0000000..5941d76 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/StatePredicate.php @@ -0,0 +1,35 @@ +. + + */ + +//require 'Yay/SelfDescribing.php'; + +/** + * An expectation about what State a state machine is in. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_StatePredicate extends Yay_SelfDescribing +{ + + /** + * Return true if the state machine is in this state. + * @return boolean + */ + public function isActive(); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/States.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/States.php new file mode 100644 index 0000000..c021c4f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/classes/Yay/States.php @@ -0,0 +1,62 @@ +. + + */ + +//require 'Yay/SelfDescribing.php'; + +/** + * A basic state machine. + * @author Chris Corbyn + * @package Yay + */ +interface Yay_States extends Yay_SelfDescribing +{ + + /** + * Set the initial state of this state machine. + * @param string $stateName + * @return Yay_States + */ + public function startsAs($stateName); + + /** + * Get the state which puts the state machine into the named state. + * @param string $stateName + * @return Yay_State + */ + public function is($stateName); + + /** + * Get the predicate which indicates the state machine is NOT in the named state. + * @param string $stateName + * @return Yay_StatePredicate + */ + public function isNot($stateName); + + /** + * Become the named state. + * @param string $stateName + */ + public function become($stateName); + + /** + * Get the name of the current state. + * @return string + */ + public function getCurrentState(); + +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/mock.tpl.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/mock.tpl.php new file mode 100644 index 0000000..937699e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/mock.tpl.php @@ -0,0 +1,69 @@ +. + + */ + +?> + +class + + implements + + Yay_MockObject +{ + + private $_yayInvocationHandler; + + public function __construct(Yay_InvocationHandler $invocationHandler) + { + $this->_yayInvocationHandler = $invocationHandler; + } + + + function ( $param): ?> + 0) echo ','; ?> + + $arg_ + + ) + { + $value = null; + if (isset($this->_yayInvocationHandler)) + { + $args = array(); + for ($i = 0; $i < func_num_args(); ++$i) + { + $argName = 'arg_' . $i; + $args[] =& ${$argName}; + } + $invocation = new Yay_SimpleInvocation($this, __FUNCTION__, $args); + $value =& $this->_yayInvocationHandler->handleInvocation($invocation); + } + return $value; + } + + + public function __clone() + { + $this->_yayInvocationHandler = null; + } + +} + + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/yay_convenience.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/yay_convenience.php new file mode 100644 index 0000000..c145103 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/yay_convenience.php @@ -0,0 +1,176 @@ +. + + */ + +/** + * Provides non-namespaced classes and functions for brevity. + * Including this script is entirely optional. + * @author Chris Corbyn + * @package Yay + */ + +// Classes + +/** + * Allow occurences of Yay_Expectations::create() to be replaced with Expectations::create(). + */ +class Expectations extends Yay_Expectations { } + +/** + * Allows occurences of new Yay_Mockery() to be replaced with new Mockery(). + */ +class Mockery extends Yay_Mockery { } + +//Argument matchers + +/** + * Allows Yay::optional() to be called as optional(). + */ +function optional($value = null) +{ + return Yay::optional($value); +} + +/** + * Allows Yay::any() to be called as any(). + */ +function any($type = null) +{ + return Yay::any($type); +} + +/** + * Allows Yay::none() to be called as none(). + */ +function none($type = null) +{ + return Yay::none($type); +} + +/** + * Allows Yay::identical() to be called as identical(). + */ +function identical($value) +{ + return Yay::identical($value); +} + +/** + * Allows Yay::notIdentical() to be called as notIdentical(). + */ +function notIdentical($value) +{ + return Yay::notIdentical($value); +} + +/** + * Allows Yay::equal() to be called as equal(). + */ +function equal($value) +{ + return Yay::equal($value); +} + +/** + * Allows Yay::notEqual() to be called as notEqual(). + */ +function notEqual($value) +{ + return Yay::notEqual($value); +} + +/** + * Allows Yay::pattern() to be called as pattern(). + */ +function pattern($pattern) +{ + return Yay::pattern($pattern); +} + +/** + * Allows Yay::noPattern() to be called as noPattern(). + */ +function noPattern($pattern) +{ + return Yay::noPattern($pattern); +} + +/** + * Allows Yay::bounds() to be called as bounds(). + */ +function bounds($a, $b) +{ + return Yay::bounds($a, $b); +} + +/** + * Allows Yay::outside() to be called as outside(). + */ +function outside($a, $b) +{ + return Yay::outside($a, $b); +} + +/** + * Allows Yay::reference() to be called as reference(). + */ +function reference(&$ref) +{ + return Yay::reference($ref); +} + +/** + * Allows Yay::noReference() to be called as noReference(). + */ +function noReference(&$ref) +{ + return Yay::noReference($ref); +} + +//Actions + +/** + * Allows Yay::returnValue() to be called as returnValue(). + */ +function returnValue($value) +{ + return Yay::returnValue($value); +} + +/** + * Allows Yay::returnReference() to be called as returnReference(). + */ +function returnReference(&$ref) +{ + return Yay::returnReference($ref); +} + +/** + * Allows Yay::throwException() to be called as throwException(). + */ +function throwException(Exception $e) +{ + return Yay::throwException($e); +} + +/** + * Allows Yay::call() to be called as call(). + */ +function call($callback) +{ + return Yay::call($callback); +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/yay_mock.php b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/yay_mock.php new file mode 100644 index 0000000..7c76922 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/lib/yaymock/yay_mock.php @@ -0,0 +1,29 @@ +. + + */ + +/** + * YayMock include and bootstrap file. + * @author Chris Corbyn + */ + +require_once dirname(__FILE__) . '/classes/Yay.php'; +Yay::setClassPath(dirname(__FILE__) . '/classes'); +spl_autoload_register(array('Yay', 'autoload')); +Yay_MockGenerator::getInstance()->setMockTemplate(dirname(__FILE__) . '/mock.tpl.php'); + +//EOF diff --git a/vendor/swiftmailer/swiftmailer/test-suite/run.php b/vendor/swiftmailer/swiftmailer/test-suite/run.php new file mode 100644 index 0000000..fa67634 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/run.php @@ -0,0 +1,56 @@ +get('//./root/cimv2:Win32_Process.Handle="' . getmypid() . '"') + ->executablePath; + } +} + +$runner = new Sweety_Runner_CliRunner( + explode(PATH_SEPARATOR, SWEETY_TEST_PATH), + $exe . ' ' . $argv[0] + ); + +$name = !empty($argv[1]) ? $argv[1] : 'All Tests'; +$runner->setReporter(new Sweety_Reporter_CliReporter(sprintf('%s - %s', SWEETY_SUITE_NAME, $name))); + +$runner->setIgnoredClassRegex(SWEETY_IGNORED_CLASSES); + +$locators = preg_split('/\s*,\s*/', SWEETY_TEST_LOCATOR); +foreach ($locators as $locator) +{ + $runner->registerTestLocator(new $locator()); +} + +if (!empty($argv[1]) && !preg_match('~!?/.*?/~', $argv[1])) +{ + $testName = $argv[1]; + $format = !empty($argv[2]) ? $argv[2] : Sweety_Runner::REPORT_TEXT; + + $runner->runTestCase($testName, $format); +} +else +{ + $runner->runAllTests(); +} + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/sweety.js b/vendor/swiftmailer/swiftmailer/test-suite/sweety.js new file mode 100644 index 0000000..663ff94 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/sweety.js @@ -0,0 +1,471 @@ +/* + JavaScript wrapper around REST API in Sweety. + */ + +/** + * A convenience class for using XPath. + * @author Chris Corbyn + * @constructor + */ +function SweetyXpath() { + + /** + * Get the first node matching the given expression. + * @param {String} expr + * @param {Element} node + * @returns Element + */ + this.getFirstNode = function getFirstNode(expr, node) { + var firstNode = _getRootNode(node).evaluate( + expr, node, _getNsResolver(node), XPathResult.FIRST_ORDERED_NODE_TYPE, null); + return firstNode.singleNodeValue; + }, + + /** + * Get all nodes matching the given expression. + * The returned result is a Node Snapshot. + * @param {String} expr + * @param {Element} node + * @returns Element[] + */ + this.getNodes = function getNodes(expr, node) { + var nodes = _getRootNode(node).evaluate( + expr, node, _getNsResolver(node), XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + + var nodeSet = new Array(); + for (var i = 0, len = nodes.snapshotLength; i < len; i++) { + nodeSet.push(nodes.snapshotItem(i)); + } + return nodeSet; + }, + + /** + * Get the string value of the node matching the given expression. + * @param {String} expr + * @param {Element} node + * @returns String + */ + this.getValue = function getValue(expr, node) { + return _getRootNode(node).evaluate( + expr, node, _getNsResolver(node), XPathResult.STRING_TYPE, null).stringValue; + } + + /** + * Get the root node from which run evaluate. + * @param {Element} node + * @returns Element + */ + var _getRootNode = function _getRootNode(node) { + if (node.ownerDocument && node.ownerDocument.evaluate) { + return node.ownerDocument; + } else { + if (node.evaluate) { + return node; + } else { + return document; + } + } + } + + /** + * Get the NS Resolver used when searching. + * @param {Element} node + * @returns Element + */ + var _getNsResolver = function _getNsResolver(node) { + if (!document.createNSResolver) { + return null; + } + + if (node.ownerDocument) { + return document.createNSResolver(node.ownerDocument.documentElement); + } else { + return document.createNSResolver(node.documentElement); + } + } + +} + +/** + * The reporter interface so Sweety can tell the UI what's happening. + * @author Chris Corbyn + * @constructor + */ +function SweetyReporter() { //Interface/Base Class + + var _this = this; + + /** + * Create a sub-reporter for an individual test case. + * @param {String} testCaseName + * @returns SweetyReporter + */ + this.getReporterFor = function getReporterFor(testCaseName) { + return _this; + } + + /** + * Start reporting. + */ + this.start = function start() { + } + + /** + * Handle a skipped test case. + * @param {String} message + * @param {String} path + */ + this.reportSkip = function reportSkip(message, path) { + } + + /** + * Handle a passing assertion. + * @param {String} message + * @param {String} path + */ + this.reportPass = function reportPass(message, path) { + } + + /** + * Handle a failing assertion. + * @param {String} message + * @param {String} path + */ + this.reportFail = function reportFail(message, path) { + } + + /** + * Handle an unexpected exception. + * @param {String} message + * @param {String} path + */ + this.reportException = function reportException(message, path) { + } + + /** + * Handle miscellaneous test output. + * @param {String} output + * @param {String} path + */ + this.reportOutput = function reportOutput(output, path) { + } + + /** + * Finish reporting. + */ + this.finish = function finish() { + } + +} + + +/** + * Represents a single test case being run. + * @author Chris Corbyn + * @constructor + */ +function SweetyTestCaseRun(testClass, reporter) { + + var _this = this; + + /** The XMLHttpRequest used in testing */ + var _req; + + /** XPath handler */ + var _xpath = new SweetyXpath(); + + /** Callback function for completion event */ + this.oncompletion = function oncompletion() { + } + + /** + * Run this test. + */ + this.run = function run() { + if (!reporter.isStarted()) { + reporter.start(); + } + _req = _createHttpRequest(); + + if (!_req) { + return; + } + + _req.open("GET", "?test=" + testClass + "&format=xml", true); + _req.onreadystatechange = _handleXml; + _req.send(null); + } + + /** + * Get an XmlHttpRequest instance, cross browser compatible. + * @return Object + */ + var _createHttpRequest = function _createHttpRequest() { + var req = false; + + if (window.XMLHttpRequest && !(window.ActiveXObject)) { + try { + req = new XMLHttpRequest(); + } catch(e) { + req = false; + } + } else if (window.ActiveXObject) { + try { + req = new ActiveXObject("Msxml2.XMLHTTP"); + } catch(e) { + try { + req = new ActiveXObject("Microsoft.XMLHTTP"); + } catch(e) { + req = false; + } + } + } + + return req; + } + + /** + * Handle the XML response from the test. + */ + var _handleXml = function _handleXml() { + if (_req.readyState == 4) { + try { + + var xml = _req.responseXML; + var txt = _req.responseText.replace(/[\r\n]+/g, ""). + replace(/^(.+)<\?xml.*$/, "$1"); + + //Test case was skipped + var skipElements = xml.getElementsByTagName('skip'); + if (!skipElements || 1 != skipElements.length) + { + var runElements = xml.getElementsByTagName('run'); + //Invalid document, an error probably occured + if (!runElements || 1 != runElements.length) { + reporter.reportException( + "Invalid XML response: " + + _stripTags(txt.replace(/^\s*<\?xml.+<\/(?:name|pass|fail|exception)>/g, "")), testClass); + } else { + var everything = runElements.item(0); + _parseResults(everything, testClass); + reporter.finish(); + } + } + else + { + reporter.reportSkip(_textValueOf(skipElements.item(0)), testClass); + reporter.finish(); + } + } catch (ex) { + //Invalid document or an error occurred. + reporter.reportException( + "Invalid XML response: " + + _stripTags(txt.replace(/^\s*<\?xml.+<\/(?:name|pass|fail|exception)>/g, "")), testClass); + } + + //Invoke the callback + _this.oncompletion(); + } + } + + /** + * Cross browser method for reading the value of a node in XML. + * @param {Element} node + * @returns String + */ + var _textValueOf = function _textValueOf(node) { + if (!node.textContent && node.text) { + return node.text; + } else { + return node.textContent; + } + } + + var _stripTags = function _stripTags(txt) { + txt = txt.replace(/[\r\n]+/g, ""); + return txt.replace( + /<\/?(?:a|b|br|p|strong|u|i|em|span|div|ul|ol|li|table|thead|tbody|th|td|tr)\b.*?\/?>/g, + ""); + } + + /** + * Parse an arbitrary message output. + * @param {Element} node + * @param {String} path + */ + var _parseMessage = function _parseMessage(node, path) { + reporter.reportOutput(_textValueOf(node), path); + } + + /** + * Parse formatted text output (such as a dump()). + * @param {Element} node + * @param {String} path + */ + var _parseFormatted = function _parseFormatted(node, path) { + reporter.reportOutput(_textValueOf(node), path); + } + + /** + * Parse failing test assertion. + * @param {Element} node + * @param {String} path + */ + var _parseFail = function _parseFail(node, path) { + reporter.reportFail(_textValueOf(node), path); + } + + /** + * Parse an Exception. + * @param {Element} node + * @param {String} path + */ + var _parseException = function _parseException(node, path) { + reporter.reportException(_textValueOf(node), path); + } + + /** + * Parse passing test assertion. + * @param {Element} node + * @param {String} path + */ + var _parsePass = function _parsePass(node, path) { + reporter.reportPass(_textValueOf(node), path); + } + + /** + * Parse an entire test case + * @param {Element} node + * @param {String} path + */ + var _parseTestCase = function _parseTestCase(node, path) { + var testMethodNodes = _xpath.getNodes("./test", node); + + for (var x in testMethodNodes) { + var testMethodNode = testMethodNodes[x]; + var testMethodName = _xpath.getValue("./name", testMethodNode); + + var formattedNodes = _xpath.getNodes("./formatted", testMethodNode); + for (var i in formattedNodes) { + var formattedNode = formattedNodes[i]; + _parseFormatted(formattedNode, path + " -> " + testMethodName); + } + + var messageNodes = _xpath.getNodes("./message", testMethodNode); + for (var i in messageNodes) { + var messageNode = messageNodes[i]; + _parseMessage(messageNode, path + " -> " + testMethodName); + } + + var failNodes = _xpath.getNodes("./fail", testMethodNode); + for (var i in failNodes) { + var failNode = failNodes[i]; + _parseFail(failNode, path + " -> " + testMethodName); + } + + var exceptionNodes = _xpath.getNodes("./exception", testMethodNode); + for (var i in exceptionNodes) { + var exceptionNode = exceptionNodes[i]; + _parseException(exceptionNode, path + " -> " + testMethodName); + } + + var passNodes = _xpath.getNodes("./pass", testMethodNode); + for (var i in passNodes) { + var passNode = passNodes[i]; + _parsePass(passNode, path + " -> " + testMethodName); + } + } + } + + /** + * Parse an entire grouped or single test case. + * @param {Element} node + * @param {String} path + */ + var _parseResults = function _parseResults(node, path) { + var groupNodes = _xpath.getNodes("./group", node); + + if (0 != groupNodes.length) { + for (var i in groupNodes) { + var groupNode = groupNodes[i]; + var groupName = _xpath.getValue("./name", groupNode); + _parseResults(groupNode, path + " -> " + groupName); + } + } else { + var caseNodes = _xpath.getNodes("./case", node); + for (var i in caseNodes) { + var caseNode = caseNodes[i]; + _parseTestCase(caseNode, path); + } + } + } + +} + +/** + * Runs a list of test cases. + * @author Chris Corbyn + * @constructor + */ +function SweetyTestRunner() { + + var _this = this; + + SweetyTestRunner._currentInstance = _this; + + /** True if the test runner has been stopped */ + var _cancelled = false; + + /** + * Invoked to cause the test runner to stop execution at the next available + * opportunity. If XML is being parsed in another thread, or an AJAX request + * is in progress the test runner will wait until the next test. + * @param {Boolean} cancel + */ + this.cancelTesting = function cancelTesting(cancel) { + _cancelled = cancel; + } + + /** + * Run the given list of test cases. + * @param {String[]} tests + * @param {SweetyReporter} reporter + */ + this.runTests = function runTests(tests, reporter) { + if (!reporter.isStarted()) { + reporter.start(); + } + + if (_cancelled || !tests || !tests.length) { + _cancelled = false; + reporter.finish(); + return; + } + + var testCase = tests.shift(); + + var caseReporter = reporter.getReporterFor(testCase); + + var testRun = new SweetyTestCaseRun(testCase, caseReporter); + + //Repeat until no tests remaining in list + // Ok, I know, I know I'll try to eradicate this lazy use of recursion + testRun.oncompletion = function() { + _this.runTests(tests, reporter); + }; + + testRun.run(); + } + +} + +/** Active instance */ +SweetyTestRunner._currentInstance = null; + +/** + * Fetches the currently running instance of the TestRunner. + * @returns SweetyTestRunner + */ +SweetyTestRunner.getCurrentInstance = function getCurrentInstance() { + return this._currentInstance; +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/css/main.css b/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/css/main.css new file mode 100644 index 0000000..3f6e630 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/css/main.css @@ -0,0 +1,203 @@ +/** Page structure **/ +/*------------------*/ + +ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input { + margin: 0; padding: 0; +} + +body { + font-size: 0.8em; + font-family: arial,sans-serif; + background: #fff; + padding: 8px; +} + +img { + border: 0; +} + +input { + margin-bottom: 8px; + padding: 4px; + font-size: 16px; + width: 100px; +} + +input.sweety-text { + border: 2px solid #000; + width: 268px; + background-color: #fff; +} + +input.sweety-disabled { + background: #eee; + border: 2px solid #888; +} + +input.sweety-waiting { + background-image: url(../images/loading.gif); + background-position: 98% 50%; + background-repeat: no-repeat; +} + +input.sweety-check { + width: 12px !important; + height: 12px !important; + margin: 1px !important; + padding: 1px !important; +} + +h1 { + margin-bottom: 1em; +} + +div#sweety-page { + width: 100%; +} + +div#sweety-testlist { + float: left; + width: 400px; + background: #aaa; +} + +div#sweety-output { + margin-left: 400px; +} + +div#sweety-results { + padding: 8px; + font-size: 1.4em; +} + +div#sweety-messages { + margin-top: 8px; + padding-top: 8px; + border-top: 1px solid #777; +} + +div#sweety-smoke-images { + margin-top: 8px; + padding-top: 8px; +} + +div#sweety-smoke-images img { + width: 150px; + height: 120px; + margin-right: 8px; +} + +div.sweety-clear { + width: 100%; + clear: both; +} + +/** Look and feel **/ +/*-----------------*/ + +input#sweety-filter { + visibility: hidden; +} + +div#sweety-communication { + float: right; + display: none; +} + +pre.sweety-raw-output { + display: block; + background: #ddd; + padding: 4px; + margin: 4px; +} + +div.sweety-pad { + padding: 8px; +} + +div.sweety-message { + padding: 4px; + margin: 4px; +} + +div.sweety-test-path { + padding-left: 2em; + font-style: italic; + color: #777; +} + +div.sweety-test { + font-size: 12px; + margin-bottom: 2px; + margin-left: 12px; + padding: 2px; +} + +div.sweety-test img { + float: right; + margin-right: 4px; +} + +div.sweety-package-header { + font-size: 12px; + margin-bottom: 2px; + border-bottom: 2px solid #444; + padding: 2px; +} + +div.sweety-package-header span.sweety-test-package { + font-weight: normal; +} + +div.sweety-package-header img { + margin: 0 2px; +} + +span.sweety-pkg-count { + display: block; + float: right; + padding-right: 2px; +} + +img.sweety-group-icon { + float: right; + margin: 4px !important; +} + +.sweety-pkg-idle { + background: #cacaca; +} + +span.sweety-test-package { + display: block; + font-size: 10px; + padding-left: 1em; +} + +.sweety-idle { + background: #eee; +} + +.sweety-running { + background: #ffff33 !important; +} + +.sweety-pass { + background: #00aa00 !important; + color: #fff; +} + +.sweety-fail { + background: #ee0000 !important; + color: #fff; +} + +.sweety-fail-text { + color: #ee0000; +} + +.sweety-skip-text { + color: #4444dd; + font-weight: bold; + text-decoration: underline; +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/darr.gif b/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/darr.gif new file mode 100644 index 0000000000000000000000000000000000000000..d4349a76a1ccb4f175f9ecb44661b44f2a7398d1 GIT binary patch literal 57 zcmZ?wbhEHbf|1&T!DE?#tk_-$wAOa-Mz@$BecV%U*z#^8s qn<9Es3d{R+XBxHLV`-XjVv@x4rI%l=Qj3{n?8lkD{3R4!*R!3S%~lfaCLLKl zRY}l^si!74*W1RJn`>9bM%_I1!R?_PMa!6nIW4hizx)2)_qzAL@4wzj$%)|+nQUOg zHUP%hVzEH$#=`m*RQ(lZm{<2Ko0c$qwIv?LVBUo4r2}Ia`Y~L8$}E~~zq0`iYoM8i zQ^!F!ZysNVibXh)-S*4k!}V=u;~I2YpnSnR@edfyP`?W1HR#=il)bj9T=mGN(;yZP z?K*0YSij5g=o;bujG+(1w>$9GE07wl?p;w_-v)KMh)nnVtN7YT*C4xmBx@-|rx3gu z53xvA(a-9C7B`6xU2Au%k#MV>Qm@ry|Gsm43J3O%*lCWyQ3QvPL*6CHFb*HbG2a_G zwdlpZyvF%OD44FA$2s?~y!9-z^dV#*h(`_u^(nWWJwLf6XyEfrNZg6??`m#t;KCW4 zerwYP6m>04v@c`r3_d!xNXxN-HxQ)Qoc{6e zQa750pRiea6Vy0Ec*e$vD?BK}n*>P6l^ zFcJnb_$>@)Jx?(>%^JjDx?}on{leX=Vc)&>&eW9PO9rP2G4+U77wa*ES$$8M=^bF@|=vocZIwg-wgU=^){ECDyMkMozRw6S9^lN^_(y(G=lxIh@jX zz?=ADKjGC7Mo5j%N$W!i&(HT!E`>;lx?nL;s}R=&?I8?-gh(Gi2&?x}s{B1J`cW$7 z?!*O|8&Tm)2+Dl~W!?n8)QeIgbtTSwx)7g9Ty$a{QM`xX7KsSwPle9sJP3}~ol@w= zCO#3ch>!WKv#w6W85hE_fJZPjT#DM6kQIVZ@Y}b$OAW#z5QODEmZy0q8{{wh)8$pok;M)% zk;U@r)&$z4QTvyM$3@Ya$1Ahkp$Ry5vaTcEkT~YP|GoPUwA`czE&;E0XV2b#1Puz+ zK#7}IaH-zs1!H&w_>}R4nUxtFrC%~jd{Ar6*;lOOgd|nbi#w(EH21J<1PDx3^bUS8dxi3>l==`ribkOMoOz@?4k0 zVxOe9bc*;`$naXaJs0au7}Asn9CWA1R@utUsn1;h`Om3k`&uxr)`OkD!Dq&WKPG1$ zPM`ib`Np@CzjT@#A3l}&2Y+td-}p2asN9<%@2%0Jb0ZLBbJPCZyy8~uh$ixeMWqcoCWujOy1r%7t9URLkq$6C%R&Z;VP0k!Oo(FvFLYzq)9tGm4VPxh z=31pIki(|u{ID3a=JET^1N)FGCV{<=>4wfJe9M9H9f2B8iMvfSJ%=1e=;TtOur-=kHX4VxrS(W1_v@|vEEC_PRpd)P% z)Sfx51OqgncW6rKtn=f7sGUFG@GhDMSz#vZaepIzTP=-XQDU=55_){;sQRPAZ9bVU)-yJK-U|N$*S&qr_}IhH7pyNe%XTx#5lGD z)Sj0!S2XEXd%QX*-{?}60}lMB<~8V$vfwz)3U^G&-c?L{R_rmarGc(j@X&E1xj_-| zM)!BW-*oZ|fis+*`sCf_p$Y*o6XjQ!0$EEllm%g-FRPL-?o^fMMoFV~(c;Bm*8p)` zibR?Gt=`fnstKMutOqegQ3mn1JL{TG6U0a&TPqNYLpTbBLO)xrp3*n@%U^!K7?(*` U^6aw9y&x)uG?OcIBPV=5rvpnyXn23|qNsQ{9(jJc5P4PhiHqJ#qoui1MHW9$t| ztWOLgdCS@RL{a1dD)nRX`A?FE-@3i^)Pw!+gZt0hYIi^J?0egv+Wpm~uRr|w-CE(J#Y24V=CRym z(xY!SuN_Xl{pQ7IrIF;&xx~@Wdv^{k+Hx{yjeP3N=hBhW-g{q6eV^hQ4>h-(eeUpQ zTNCf3oBThIE0xt)ziMS|b)dd%o;QOcZmvHV4GkbDO^2jq0@?`#_;92n+8K*v^u&7; zRb74EENeDbR6Lce*vT5}`}-^17WaO4(tPlcbKY=Yk<)Z*e*Ud@9M4~Pa^d_VFUE?h z8(cJ9zQpb*e5df5qEm9T^7d<~^P}b2**Ra}4?8PoXN}q}m6sG3UtemuS&1%Qy`Hvl z2HVml*RL!oExBgTh-Ifo+snCXyg`gcy0({8>=nv{fTR48ZKI>r`>0HFc45Oacee!k z7p$uRKMk981Cd4ZD!%#YhzDd;JpAq1E-~}Hr*EVN?`{zfevolP_m!>eF&sWHo>RA# zUAu8*P1egB&K)Yh?xVxt%gc4aV0&ZxvL?gmgJ2}fKM@?i>k(hgX3s3DvhMNV>ADNA zx8*VuC%HQfi(4Dw$VElR&k432C7XVsn7pC8_I*}5)_}DZ-=`-AmgM$kTdJDc+#5Rk zxZnKE{_2yjwEKvwO!}rlsC?y1(i;pXD#za|ZYegj(Z@Z3FiKFJBU4F56!Q ztJ>_q_CS}cTi5H5OZ*Jw2fn5aEoGmq_EfJ~pkwIu-Zz*NFZ|k0HCp1;^IO%>#^)s&HZy<9h~cJpBf@2Jw%zn3TSeGb{2xH8Me>NmkwA!201{Rg;-l2 z4IO#*|F-K9geKmgH>k~ef=rPEv>Ax`7p&tdtRB&jqdFMMt};)BWs)!*GQe;Is$;c; zk_KcEV-bQz4*<{rS=eEQi5)_p;MON7$_h0*b`1?B2Gm@ps??J>1A@-^Fuf{HwS&4= zg6JR%X1Z#hY?Bt)Nn#BF$U#u!V0o%jV}U&uO(*5#EqXPS78DT2bO8kj^3WJ|hGQ|K zfiBe3;lh}Wqmp)gd{9;K40bL8z^#V>LMzb3paxjGc;Mt!zL~%|-Bi8m`z*pw3$jVl za+1_&;(5|q9)M_^XP~_&KF}K-RI4Ao(!JSwvZ6ixF}3pWeQA?&n---5}zDhww(0(+q*(O1alSz!|N z*?1-q=Mr`vQdAP^yX^6V06Qc#J2P-k<2zM(wSb$}$7HeSfdR(!r0tFv8EvzrZ_0I2 zO5?O^E|Jorf%7RM4~*yM$I@CF)moZKwanEO(2!wdjF3?eYZ^;8ITi&(It|}J3bA$o z1}2;d$R@f0r1?lx#Z%2+t=|lgBi)}c2N~D}9o?XdhF0j=K}W(S6--(M9bpEvxyWn; zkq!tWozO(vqZHfSnWs^YZq8)O(i_eopw4L{270nM9fD-N|24%{V*F?MAwwzxAWz*H a+oaG_sP?M^QkcF_(t*<#irGR~-|{y@REX37 literal 0 HcmV?d00001 diff --git a/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/rarr.gif b/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/images/rarr.gif new file mode 100644 index 0000000000000000000000000000000000000000..b2d4d95dfd6709375c7dbbd437ff6c52c186f361 GIT binary patch literal 59 zcmZ?wbhEHb " + _pkgs[unescape(nvp[0])]); + } + } + + var _pkgFor = function _pkgFor(testName) { + return testName.replace(/_?[^_]+$/, ""); + } + +} + +//Create an instance of the UI Manager for usage +var sweetyUI = new SweetyUIManager(); + + +/** + * A filter to hide/show test cases in the list. + * @author Chris Corbyn + * @consructor + */ +function SweetyFilter() { + + var _this = this; + + /** Asynchronous page timer (so nothing happens whilst typing) */ + var _timer; + + /** The sweety-filter element, lazy loaded */ + var _filter = null; + + /** + * Update the display once the search is complete. + */ + this.repaintUI = function repaintUI() { + sweetyUI.initialize(); + sweetyUI.paintSearchComplete(); + } + + /** + * Search for matching test cases. + */ + this.search = function search() { + sweetyUI.paintSearching(); + + var query = _getFilterInput().value.toLowerCase(); + var queryBits = query.split(/[^\!a-zA-Z0-9_]+/g); + + //Cancel searching if still typing + try { + window.clearTimeout(_timer); + } catch (e) { } + + for (var testCase in sweetyTestCases) { + for (var i in queryBits) { + var testFor = queryBits[i]; + var isNegated = ("!" == testFor.charAt(0)); + if (isNegated) { + testFor = testFor.substring(1); + } + + if (!isNegated && 0 > testCase.toLowerCase().indexOf(testFor)) { + sweetyTestCases[testCase] = false; + break; + } else if (isNegated && 0 < testCase.toLowerCase().indexOf(testFor)) { + sweetyTestCases[testCase] = false; + break; + } else { + sweetyTestCases[testCase] = true; + } + } + } + + //Only apply the search in 500ms, since user may be typing + _timer = window.setTimeout(_this.repaintUI, 500); + } + + /** + * Get a lazy loaded reference to the input element. + * @return HTMLInputElement + */ + var _getFilterInput = function _getFilterInput() { + if (!_filter) { + _filter = document.getElementById("sweety-filter"); + } + return _filter; + } + +} + +//Create a new instance of the filter +var sweetyFilter = new SweetyFilter(); + +/** + * The reporter which gathers aggregate results and displays a summary. + * @author Chris Corbyn + * @constructor + * @param {Boolean} reportPkgs if package status should be reported + */ +function SweetyTemplateAggregateReporter(testCaseList, reportPkgs) { + + var _this = this; + + /** True if this reporter instance is running now */ + var _started = false; + + /** Aggregate totals */ + var _aggregates = { cases : 0, run: 0, passes : 0, fails : 0, exceptions : 0 }; + + /** Aggregates per-package */ + var _pkgs = { }; + + /** Currently running package */ + var _currentPkg; + + /** + * Creates a reporter for the given testCase. + * @param {String} testCase + * @returns SweetyReporter + */ + this.getReporterFor = function getReporterFor(testCase) { + _aggregates.cases++; + + if (reportPkgs) { + var pkg = _getPkgName(testCase); + sweetyUI.paintPkgRunning(pkg); + + _pkgs[pkg].cases++; + + if (_currentPkg && _currentPkg != pkg) { + _updatePkgStatus(_currentPkg); + } + + _currentPkg = pkg; + } + + sweetyUI.paintNumCases(_aggregates.cases); + + var reporter = new SweetyTemplateCaseReporter(testCase, _this); + return reporter; + } + + /** + * Updates the UI with the new aggregate totals. + */ + this.notifyEnded = function notifyEnded(testCase) { + _aggregates.run++; + + if (reportPkgs) { + var pkg = _getPkgName(testCase); + _pkgs[pkg].run++; + } + + //Update the UI with new totals + sweetyUI.paintNumRun(_aggregates.run); + sweetyUI.paintNumPasses(_aggregates.passes); + sweetyUI.paintNumFails(_aggregates.fails); + sweetyUI.paintNumExceptions(_aggregates.exceptions); + } + + /** + * Returns true if this reporter instance is running. + * @returns Boolean + */ + this.isStarted = function isStarted() { + return _started; + } + + /** + * Start reporting. + */ + this.start = function start() { + _started = true; + + if (reportPkgs) + { + for (var i = 0, len = testCaseList.length; i < len; i++) { + var testCase = testCaseList[i]; + var pkg = _getPkgName(testCase); + if (typeof _pkgs[pkg] == "undefined") { + _pkgs[pkg] = { cases : 0, run : 0, passes : 0, fails : 0, exceptions : 0 }; + } + } + } + + sweetyUI.allowInteractivity(false); + sweetyUI.paintNetworking(true); + sweetyUI.paintAllRunning(); + } + + /** + * Report a skipped test case. + * @param {String} message + * @param {String} path + */ + this.reportSkip = function reportSkip(message, path) { + sweetyUI.paintSkip(message, path); + } + + /** + * Report a passing assertion. + * @param {String} message + * @param {String} path + */ + this.reportPass = function reportPass(message, path) { + _aggregates.passes++; + + if (reportPkgs) { + _pkgs[_currentPkg].passes++; + } + } + + /** + * Report a failing assertion. + * @param {String} message + * @param {String} path + */ + this.reportFail = function reportFail(message, path) { + _aggregates.fails++; + + if (reportPkgs) { + _pkgs[_currentPkg].fails++; + } + + sweetyUI.paintFail(message, path); + } + + /** + * Report an unexpected exception. + * @param {String} message + * @param {String} path + */ + this.reportException = function reportException(message, path) { + _aggregates.exceptions++; + + if (reportPkgs) { + _pkgs[_currentPkg].exceptions++; + } + + sweetyUI.paintException(message, path); + } + + /** + * Handle test case output from something like a dump(). + * @param {String} output + * @param {String} path + */ + this.reportOutput = function reportOutput(output, path) { + sweetyUI.paintOutput(output, path); + } + + /** + * End reporting. + * This method is used to come to a conclusion about the test results in the UI. + */ + this.finish = function finish() { + _started = false; + + if (reportPkgs) { + _updatePkgStatus(_currentPkg); + } + + sweetyUI.allowInteractivity(true); + + sweetyUI.paintNetworking(false); + + if ((!_aggregates.fails && !_aggregates.exceptions) + && (_aggregates.cases == _aggregates.run)) { + sweetyUI.paintConclusionPassed(); + } else { + sweetyUI.paintConclusionFailed(); + } + + var incompleteCount = _aggregates.cases - _aggregates.run; + + //Check if all tests actually got fully parsed (i.e. finished) + if (0 < incompleteCount) { + sweetyUI.paintMessage( + incompleteCount + " test case(s) did not complete." + + " This may be because invalid XML was output during the test run" + + " and/or because an error occured." + + " Incomplete test cases are shown in yellow. Click the HTML link " + + "next to the test for more detail."); + } + } + + var _getPkgName = function _getPkgName(testCase) { + return testCase.replace(/_?[^_]+$/, ""); + } + + var _updatePkgStatus = function _updatePkgStatus(pkg) { + if ((!_pkgs[pkg].fails && !_pkgs[pkg].exceptions) + && (_pkgs[pkg].cases == _pkgs[pkg].run)) { + sweetyUI.paintPkgPassed(pkg); + } else if (_pkgs[pkg].cases == _pkgs[pkg].run) { + sweetyUI.paintPkgFailed(pkg); + } + } + +} +SweetyTemplateAggregateReporter.prototype = new SweetyReporter(); + +/** + * The reporter class per-test case. + * @author Chris Corbyn + * @consructor + */ +function SweetyTemplateCaseReporter(testCase, reporter) { + + var _this = this; + + /** Aggregate totals */ + var _aggregates = { passes : 0, fails : 0, exceptions : 0 }; + + /** The DIV element showing this test case */ + var _testCaseDiv = document.getElementById(testCase); + + /** True only if this reporter is running */ + var _started = false; + + /** + * Stubbed only to return itself. + * @returns SweetyReporter + */ + this.getReporterFor = function getReporterFor(testCase) { + return _this; + } + + /** + * Returns true when the reporter is started. + * @returns Boolean + */ + this.isStarted = function isStarted() { + return _started; + } + + /** + * Start reporting. + */ + this.start = function start() { + _started = true; + sweetyUI.paintTestCaseRunning(testCase); + } + + /** + * Report a skipped test case. + * @param {String} message + * @param {String} path + */ + this.reportSkip = function reportSkip(message, path) { + reporter.reportSkip(message, path); + } + + /** + * Report a passing assertion. + * @param {String} message + * @param {String} path + */ + this.reportPass = function reportPass(message, path) { + _aggregates.passes++; + reporter.reportPass(message, path); + } + + /** + * Report a failing assertion. + * @param {String} message + * @param {String} path + */ + this.reportFail = function reportFail(message, path) { + _aggregates.fails++; + reporter.reportFail(message, path); + } + + /** + * Report an unexpected exception. + * @param {String} message + * @param {String} path + */ + this.reportException = function reportException(message, path) { + _aggregates.exceptions++; + reporter.reportException(message, path); + } + + /** + * Handle output from a test case in the form of something like a dump(). + * @param {String} output + * @param {string} path + */ + this.reportOutput = function reportOutput(output, path) { + reporter.reportOutput(output, path); + } + + /** + * End reporting. + */ + this.finish = function finish() { + _started = false; + + if (!_aggregates.fails && !_aggregates.exceptions) { + sweetyUI.paintTestCasePassed(testCase); + } else { + sweetyUI.paintTestCaseFailed(testCase); + } + + reporter.notifyEnded(testCase); + } + +} +SweetyTemplateCaseReporter.prototype = new SweetyReporter(); + +/** + * Wraps the invokation of SweetyTestRunner. + * @author Chris Corbyn + * @constructor + */ +function SweetyTestWrapper() { + + var _this = this; + + /** + * Run a single test case. + * @param {String} testClass + */ + this.runTestCase = function runTestCase(testClass) { + var testCaseList = new Array(); + testCaseList.push(testClass); + + var reporter = new SweetyTemplateAggregateReporter(testCaseList); + + var runner = new SweetyTestRunner(); + runner.runTests(testCaseList, reporter); + } + + /** + * Run all selected test cases. + */ + this.runAll = function runAll(pkg) { + var pkgRegex; + if (pkg) { + pkgRegex = new RegExp("^" + pkg + "_[^_]+$"); + } + + var testCaseList = new Array(); + + for (var testCase in sweetyTestCases) { + if (!sweetyTestCases[testCase] || (pkg && !testCase.match(pkgRegex))) { + continue; + } + testCaseList.push(testCase); + } + + var reporter = new SweetyTemplateAggregateReporter(testCaseList, true); + + var runner = new SweetyTestRunner(); + runner.runTests(testCaseList, reporter); + } + +} + +//Create an instance of the test runner for usage +var sweetyRunner = new SweetyTestWrapper(); + +if (typeof document.onreadystatechange != "undefined") { //IE 6/7 + document.onreadystatechange = function() { + if (document.readyState == "complete") { + sweetyUI.restore(); sweetyUI.initialize(); + } + }; +} else { //Fallback + window.onload = function() { + sweetyUI.restore(); sweetyUI.initialize(); + }; + + try { //FF + document.addEventListener("DOMContentLoaded", window.onload, false); + } catch (e) { + } +} diff --git a/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/suite-ui-noajax.tpl.php b/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/suite-ui-noajax.tpl.php new file mode 100644 index 0000000..b9d3ef1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/suite-ui-noajax.tpl.php @@ -0,0 +1,155 @@ + + + + <?php echo $suiteName; ?> - No AJAX + + + +
    + +
    + +
    + +
    + +
    + + +
    + + +
    + + + + + +
    + Not available + Tests + + + +
    + + +
    + +
    + + As XML + As HTML + Run + + + checked="checked" + /> + + + + + + + +
    + +
    + + + +
    + +
    + +
    + +
    + +
    + +
    + +

    - No AJAX

    + +
    + / + test cases complete: + passes, + fails and + exceptions. +
    + +
    + +
    + Skip: + +
    + in +
    +
    + +
    + Fail: +
    + in +
    +
    + +
    + Exception: + +
    + in +
    +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + +
    + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/suite-ui.tpl.php b/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/suite-ui.tpl.php new file mode 100644 index 0000000..90aa84c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/templates/sweety/suite-ui.tpl.php @@ -0,0 +1,132 @@ + + + + + <?php echo $suiteName; ?> + + + + + + + + +
    + +
    + +
    + +
    + +
    + + +
    + + +
    + + + + + +
    + + Toggle Display + Tests + + + +
    + + +
    + +
    + + As XML + As HTML + Run + + + checked="checked" + /> + + + + + + + +
    + +
    + + + +
    + +
    + +
    + +
    + +
    + +
    + +
    + Communicating +
    + +

    + +
    + 0/0 + test cases complete: + 0 passes, + 0 fails and + 0 exceptions. +
    + +
    +
    + +
    +
    + +
    + +
    + +
    + +
    + + diff --git a/vendor/swiftmailer/swiftmailer/test-suite/xpath-legacy.js b/vendor/swiftmailer/swiftmailer/test-suite/xpath-legacy.js new file mode 100644 index 0000000..38c3627 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/test-suite/xpath-legacy.js @@ -0,0 +1,2764 @@ +/* JavaScript-XPath 0.1.5 + * (c) 2007 Cybozu Labs, Inc. + * + * JavaScript-XPath is freely distributable under the terms of an MIT-style license. + * For details, see the JavaScript-XPath web site: http://coderepos.org/share/wiki/JavaScript-XPath + * +/*--------------------------------------------------------------------------*/ + +if (!document.implementation + || !document.implementation.hasFeature + || !document.implementation.hasFeature("XPath", null)) (function() { + +var undefined = void(0); + + +var defaultConfig = { + targetFrame: undefined +}; + +var config; + +if (window.jsxpath) { + config = window.jsxpath; +} +else { + var scriptElms = document.getElementsByTagName('script'); + var scriptElm = scriptElms[scriptElms.length - 1]; + var scriptSrc = scriptElm.src; + config = {}; + var scriptSrcMatchResult = scriptSrc.match(/\?(.*)$/); + if (scriptSrcMatchResult) { + var configStrings = scriptSrcMatchResult[1].split('&'); + for (var i = 0, l = configStrings.length; i < l; i ++) { + var configString = configStrings[i]; + var configStringSplited = configString.split('='); + config[configStringSplited[0]] = configStringSplited[1] || true; + } + } +} + +for (var n in defaultConfig) { + if (!(n in config)) config[n] = defaultConfig[n] +} + + +var BinaryExpr; +var FilterExpr; +var FunctionCall; +var Literal; +var NameTest; +var NodeSet; +var NodeType; +var NodeUtil; +var Number; +var PathExpr; +var Step; +var UnaryExpr; +var UnionExpr; +var VariableReference; + +/* + * object: user agent identifier + */ +var uai = new function() { + + var ua = navigator.userAgent; + + if (RegExp == undefined) { + if (ua.indexOf("Opera") >= 0) { + this.opera = true; + } else if (ua.indexOf("Netscape") >= 0) { + this.netscape = true; + } else if (ua.indexOf("Mozilla/") == 0) { + this.mozilla = true; + } else { + this.unknown = slide + } + + if (ua.indexOf("Gecko/") >= 0) { + this.gecko = true; + } + + if (ua.indexOf("Win") >= 0) { + this.windows = true; + } else if (ua.indexOf("Mac") >= 0) { + this.mac = true; + } else if (ua.indexOf("Linux") >= 0) { + this.linux = true; + } else if (ua.indexOf("BSD") >= 0) { + this.bsd = true; + } else if (ua.indexOf("SunOS") >= 0) { + this.sunos = true; + } + } + else { + + /* for Trident/Tasman */ + /*@cc_on + @if (@_jscript) + function jscriptVersion() { + switch (@_jscript_version) { + case 3.0: return "4.0"; + case 5.0: return "5.0"; + case 5.1: return "5.01"; + case 5.5: return "5.5"; + case 5.6: + if ("XMLHttpRequest" in window) return "7.0"; + return "6.0"; + case 5.7: + return "7.0"; + default: return true; + } + } + if (@_win16 || @_win32 || @_win64) { + this.windows = true; + this.trident = jscriptVersion(); + } else if (@_mac || navigator.platform.indexOf("Mac") >= 0) { + // '@_mac' may be 'NaN' even if the platform is Mac, + // so we check 'navigator.platform', too. + this.mac = true; + this.tasman = jscriptVersion(); + } + if (match = ua.match("MSIE ?(\\d+\\.\\d+)b?;")) { + this.ie = match[1]; + this['ie' + match[1].charAt(0)] = true; + } + @else @*/ + + /* for AppleWebKit */ + if (match = ua.match("AppleWebKit/(\\d+(\\.\\d+)*)")) { + this.applewebkit = match[1]; + this['applewebkit' + match[1].charAt(0)] = true; + } + + /* for Gecko */ + else if (typeof(Components) == "object") { + if (match = ua.match("Gecko/(\\d{8})")) { + this.gecko = match[1]; + } else if (navigator.product == "Gecko" + && (match = navigator.productSub.match("^(\\d{8})$"))) { + this.gecko = match[1]; + } + } + + /*@end @*/ + + if (typeof(opera) == "object" && typeof(opera.version) == "function") { + this.opera = opera.version(); + this['opera' + this.opera[0] + this.opera[2]] = true; + + } else if (typeof(opera) == "object" + && (match = ua.match("Opera[/ ](\\d+\\.\\d+)"))) { + this.opera = match[1]; + } else if (this.ie) { + } else if (match = ua.match("Safari/(\\d+(\\.\\d+)*)")) { + this.safari = match[1]; + } else if (match = ua.match("Konqueror/(\\d+(\\.\\d+)*)")) { + this.konqueror = match[1]; + } else if (ua.indexOf("(compatible;") < 0 + && (match = ua.match("^Mozilla/(\\d+\\.\\d+)"))) { + this.mozilla = match[1]; + if (match = ua.match("\\([^(]*rv:(\\d+(\\.\\d+)*).*?\\)")) + this.mozillarv = match[1]; + if (match = ua.match("Firefox/(\\d+(\\.\\d+)*)")) { + this.firefox = match[1]; + } else if (match = ua.match("Netscape\\d?/(\\d+(\\.\\d+)*)")) { + this.netscape = match[1]; + } + } else { + this.unknown = true; + } + + if (ua.indexOf("Win 9x 4.90") >= 0) { + this.windows = "ME"; + } else if (match = ua.match("Win(dows)? ?(NT ?(\\d+\\.\\d+)?|\\d+|XP|ME|Vista)")) { + this.windows = match[2]; + if (match[3]) { + this.winnt = match[3]; + } else switch (match[2]) { + case "2000": this.winnt = "5.0"; break; + case "XP": this.winnt = "5.1"; break; + case "Vista": this.winnt = "6.0"; break; + } + } else if (ua.indexOf("Mac") >= 0) { + this.mac = true; + } else if (ua.indexOf("Linux") >= 0) { + this.linux = true; + } else if (match = ua.match("\\w*BSD")) { + this.bsd = match[0]; + } else if (ua.indexOf("SunOS") >= 0) { + this.sunos = true; + } + } +}; + + +/** + * pseudo class: Lexer + */ +var Lexer = function(source) { + var proto = Lexer.prototype; + var tokens = source.match(proto.regs.token); + for (var i = 0, l = tokens.length; i < l; i ++) { + if (proto.regs.strip.test(tokens[i])) { + tokens.splice(i, 1); + } + } + for (var n in proto) tokens[n] = proto[n]; + tokens.index = 0; + return tokens; +}; + +Lexer.prototype.regs = { + token: /\$?(?:(?![0-9-])[\w-]+:)?(?![0-9-])[\w-]+|\/\/|\.\.|::|\d+(?:\.\d*)?|\.\d+|"[^"]*"|'[^']*'|[!<>]=|(?![0-9-])[\w-]+:\*|\s+|./g, + strip: /^\s/ +}; + +Lexer.prototype.peek = function(i) { + return this[this.index + (i||0)]; +}; +Lexer.prototype.next = function() { + return this[this.index++]; +}; +Lexer.prototype.back = function() { + this.index--; +}; +Lexer.prototype.empty = function() { + return this.length <= this.index; +}; + + +/** + * class: Ctx + */ +var Ctx = function(node, position, last) { + this.node = node; + this.position = position || 1; + this.last = last || 1; +}; + + +/** + * abstract class: BaseExpr + */ +var BaseExpr = function() {}; + +BaseExpr.prototype.number = function(ctx) { + var exrs = this.evaluate(ctx); + if (exrs.isNodeSet) return exrs.number(); + return + exrs; +}; + +BaseExpr.prototype.string = function(ctx) { + var exrs = this.evaluate(ctx); + if (exrs.isNodeSet) return exrs.string(); + return '' + exrs; +}; + +BaseExpr.prototype.bool = function(ctx) { + var exrs = this.evaluate(ctx); + if (exrs.isNodeSet) return exrs.bool(); + return !! exrs; +}; + + +/** + * abstract class: BaseExprHasPredicates + */ +var BaseExprHasPredicates = function() {}; + +BaseExprHasPredicates.parsePredicates = function(lexer, expr) { + while (lexer.peek() == '[') { + lexer.next(); + if (lexer.empty()) { + throw Error('missing predicate expr'); + } + var predicate = BinaryExpr.parse(lexer); + expr.predicate(predicate); + if (lexer.empty()) { + throw Error('unclosed predicate expr'); + } + if (lexer.next() != ']') { + lexer.back(); + throw Error('bad token: ' + lexer.next()); + } + } +}; + +BaseExprHasPredicates.prototyps = new BaseExpr(); + +BaseExprHasPredicates.prototype.evaluatePredicates = function(nodeset, start) { + var predicates, predicate, nodes, node, nodeset, position, reverse; + + reverse = this.reverse; + predicates = this.predicates; + + nodeset.sort(); + + for (var i = start || 0, l0 = predicates.length; i < l0; i ++) { + predicate = predicates[i]; + + var deleteIndexes = []; + var nodes = nodeset.list(); + + for (var j = 0, l1 = nodes.length; j < l1; j ++) { + + position = reverse ? (l1 - j) : (j + 1); + exrs = predicate.evaluate(new Ctx(nodes[j], position, l1)); + + switch (typeof exrs) { + case 'number': + exrs = (position == exrs); + break; + case 'string': + exrs = !!exrs; + break; + case 'object': + exrs = exrs.bool(); + break; + } + + if (!exrs) { + deleteIndexes.push(j); + } + } + + for (var j = deleteIndexes.length - 1, l1 = 0; j >= l1; j --) { + nodeset.del(deleteIndexes[j]); + } + + } + + return nodeset; +}; + + +/** + * class: BinaryExpr + */ +if (!window.BinaryExpr && window.defaultConfig) + window.BinaryExpr = null; + +BinaryExpr = function(op, left, right, datatype) { + this.op = op; + this.left = left; + this.right = right; + + this.datatype = BinaryExpr.ops[op][2]; + + this.needContextPosition = left.needContextPosition || right.needContextPosition; + this.needContextNode = left.needContextNode || right.needContextNode; + + // Optimize [@id="foo"] and [@name="bar"] + if (this.op == '=') { + if (!right.needContextNode && !right.needContextPosition && + right.datatype != 'nodeset' && right.datatype != 'void' && left.quickAttr) { + this.quickAttr = true; + this.attrName = left.attrName; + this.attrValueExpr = right; + } + else if (!left.needContextNode && !left.needContextPosition && + left.datatype != 'nodeset' && left.datatype != 'void' && right.quickAttr) { + this.quickAttr = true; + this.attrName = right.attrName; + this.attrValueExpr = left; + } + } +}; + +BinaryExpr.compare = function(op, comp, left, right, ctx) { + var type, lnodes, rnodes, nodes, nodeset, primitive; + + left = left.evaluate(ctx); + right = right.evaluate(ctx); + + if (left.isNodeSet && right.isNodeSet) { + lnodes = left.list(); + rnodes = right.list(); + for (var i = 0, l0 = lnodes.length; i < l0; i ++) + for (var j = 0, l1 = rnodes.length; j < l1; j ++) + if (comp(NodeUtil.to('string', lnodes[i]), NodeUtil.to('string', rnodes[j]))) + return true; + return false; + } + + if (left.isNodeSet || right.isNodeSet) { + if (left.isNodeSet) + nodeset = left, primitive = right; + else + nodeset = right, primitive = left; + + nodes = nodeset.list(); + type = typeof primitive; + for (var i = 0, l = nodes.length; i < l; i ++) { + if (comp(NodeUtil.to(type, nodes[i]), primitive)) + return true; + } + return false; + } + + if (op == '=' || op == '!=') { + if (typeof left == 'boolean' || typeof right == 'boolean') { + return comp(!!left, !!right); + } + if (typeof left == 'number' || typeof right == 'number') { + return comp(+left, +right); + } + return comp(left, right); + } + + return comp(+left, +right); +}; + + +BinaryExpr.ops = { + 'div': [6, function(left, right, ctx) { + return left.number(ctx) / right.number(ctx); + }, 'number'], + 'mod': [6, function(left, right, ctx) { + return left.number(ctx) % right.number(ctx); + }, 'number'], + '*': [6, function(left, right, ctx) { + return left.number(ctx) * right.number(ctx); + }, 'number'], + '+': [5, function(left, right, ctx) { + return left.number(ctx) + right.number(ctx); + }, 'number'], + '-': [5, function(left, right, ctx) { + return left.number(ctx) - right.number(ctx); + }, 'number'], + '<': [4, function(left, right, ctx) { + return BinaryExpr.compare('<', + function(a, b) { return a < b }, left, right, ctx); + }, 'boolean'], + '>': [4, function(left, right, ctx) { + return BinaryExpr.compare('>', + function(a, b) { return a > b }, left, right, ctx); + }, 'boolean'], + '<=': [4, function(left, right, ctx) { + return BinaryExpr.compare('<=', + function(a, b) { return a <= b }, left, right, ctx); + }, 'boolean'], + '>=': [4, function(left, right, ctx) { + return BinaryExpr.compare('>=', + function(a, b) { return a >= b }, left, right, ctx); + }, 'boolean'], + '=': [3, function(left, right, ctx) { + return BinaryExpr.compare('=', + function(a, b) { return a == b }, left, right, ctx); + }, 'boolean'], + '!=': [3, function(left, right, ctx) { + return BinaryExpr.compare('!=', + function(a, b) { return a != b }, left, right, ctx); + }, 'boolean'], + 'and': [2, function(left, right, ctx) { + return left.bool(ctx) && right.bool(ctx); + }, 'boolean'], + 'or': [1, function(left, right, ctx) { + return left.bool(ctx) || right.bool(ctx); + }, 'boolean'] +}; + + +BinaryExpr.parse = function(lexer) { + var op, precedence, info, expr, stack = [], index = lexer.index; + + while (true) { + + if (lexer.empty()) { + throw Error('missing right expression'); + } + expr = UnaryExpr.parse(lexer); + + op = lexer.next(); + if (!op) { + break; + } + + info = this.ops[op]; + precedence = info && info[0]; + if (!precedence) { + lexer.back(); + break; + } + + while (stack.length && precedence <= this.ops[stack[stack.length-1]][0]) { + expr = new BinaryExpr(stack.pop(), stack.pop(), expr); + } + + stack.push(expr, op); + } + + while (stack.length) { + expr = new BinaryExpr(stack.pop(), stack.pop(), expr); + } + + return expr; +}; + +BinaryExpr.prototype = new BaseExpr(); + +BinaryExpr.prototype.evaluate = function(ctx) { + return BinaryExpr.ops[this.op][1](this.left, this.right, ctx); +}; + +BinaryExpr.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'binary: ' + this.op + '\n'; + indent += ' '; + t += this.left.show(indent); + t += this.right.show(indent); + return t; +}; + + +/** + * class: UnaryExpr + */ +if (!window.UnaryExpr && window.defaultConfig) + window.UnaryExpr = null; + +UnaryExpr = function(op, expr) { + this.op = op; + this.expr = expr; + + this.needContextPosition = expr.needContextPosition; + this.needContextNode = expr.needContextNode; +}; + +UnaryExpr.ops = { '-': 1 }; + +UnaryExpr.parse = function(lexer) { + var token; + if (this.ops[lexer.peek()]) + return new UnaryExpr(lexer.next(), UnaryExpr.parse(lexer)); + else + return UnionExpr.parse(lexer); +}; + +UnaryExpr.prototype = new BaseExpr(); + +UnaryExpr.prototype.datatype = 'number'; + +UnaryExpr.prototype.evaluate = function(ctx) { + return - this.expr.number(ctx); +}; + +UnaryExpr.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'unary: ' + this.op + '\n'; + indent += ' '; + t += this.expr.show(indent); + return t; +}; + + +/** + * class: UnionExpr + */ +if (!window.UnionExpr && window.defaultConfig) + window.UnionExpr = null; + +UnionExpr = function() { + this.paths = []; +}; + +UnionExpr.ops = { '|': 1 }; + + +UnionExpr.parse = function(lexer) { + var union, expr; + + expr = PathExpr.parse(lexer); + if (!this.ops[lexer.peek()]) + return expr; + + union = new UnionExpr(); + union.path(expr); + + while (true) { + if (!this.ops[lexer.next()]) break; + if (lexer.empty()) { + throw Error('missing next union location path'); + } + union.path(PathExpr.parse(lexer)); + } + + + + lexer.back(); + return union; +}; + +UnionExpr.prototype = new BaseExpr(); + +UnionExpr.prototype.datatype = 'nodeset'; + +UnionExpr.prototype.evaluate = function(ctx) { + var paths = this.paths; + var nodeset = new NodeSet(); + for (var i = 0, l = paths.length; i < l; i ++) { + var exrs = paths[i].evaluate(ctx); + if (!exrs.isNodeSet) throw Error('PathExpr must be nodeset'); + nodeset.merge(exrs); + } + return nodeset; +}; + +UnionExpr.prototype.path = function(path) { + this.paths.push(path); + + if (path.needContextPosition) { + this.needContextPosition = true; + } + if (path.needContextNode) { + this.needContextNode = true; + } +} +UnionExpr.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'union:' + '\n'; + indent += ' '; + for (var i = 0; i < this.paths.length; i ++) { + t += this.paths[i].show(indent); + } + return t; +}; + + +/** + * class: PathExpr + */ +if (!window.PathExpr && window.defaultConfig) + window.PathExpr = null; + +PathExpr = function(filter) { + this.filter = filter; + this.steps = []; + + this.datatype = filter.datatype; + + this.needContextPosition = filter.needContextPosition; + this.needContextNode = filter.needContextNode; +}; + +PathExpr.ops = { '//': 1, '/': 1 }; + +PathExpr.parse = function(lexer) { + var op, expr, path, token; + + if (this.ops[lexer.peek()]) { + op = lexer.next(); + token = lexer.peek(); + + if (op == '/' && (lexer.empty() || + (token != '.' && token != '..' && token != '@' && token != '*' && + !token.match(/(?![0-9])[\w]/)))) { + return FilterExpr.root(); + } + + path = new PathExpr(FilterExpr.root()); // RootExpr + + if (lexer.empty()) { + throw Error('missing next location step'); + } + expr = Step.parse(lexer); + path.step(op, expr); + } + else { + expr = FilterExpr.parse(lexer); + if (!expr) { + expr = Step.parse(lexer); + path = new PathExpr(FilterExpr.context()); + path.step('/', expr); + } + else if (!this.ops[lexer.peek()]) + return expr; + else + path = new PathExpr(expr); + } + + while (true) { + if (!this.ops[lexer.peek()]) break; + op = lexer.next(); + if (lexer.empty()) { + throw Error('missing next location step'); + } + path.step(op, Step.parse(lexer)); + } + + return path; +}; + +PathExpr.prototype = new BaseExpr(); + +PathExpr.prototype.evaluate = function(ctx) { + var nodeset = this.filter.evaluate(ctx); + if (!nodeset.isNodeSet) throw Exception('Filter nodeset must be nodeset type'); + + var steps = this.steps; + + for (var i = 0, l0 = steps.length; i < l0 && nodeset.length; i ++) { + var step = steps[i][1]; + var reverse = step.reverse; + var iter = nodeset.iterator(reverse); + var prevNodeset = nodeset; + nodeset = null; + var node, next; + if (!step.needContextPosition && step.axis == 'following') { + for (node = iter(); next = iter(); node = next) { + + // Safari 2 node.contains problem + if (uai.applewebkit4) { + var contains = false; + var ancestor = next; + do { + if (ancestor == node) { + contains = true; + break; + } + } while (ancestor = ancestor.parentNode); + if (!contains) break; + } + else { + try { if (!node.contains(next)) break } + catch(e) { if (!(next.compareDocumentPosition(node) & 8)) break } + } + } + nodeset = step.evaluate(new Ctx(node)); + } + else if (!step.needContextPosition && step.axis == 'preceding') { + node = iter(); + nodeset = step.evaluate(new Ctx(node)); + } + else { + node = iter(); + var j = 0; + nodeset = step.evaluate(new Ctx(node), false, prevNodeset, j); + while (node = iter()) { + j ++; + nodeset.merge(step.evaluate(new Ctx(node), false, prevNodeset, j)); + } + } + } + + return nodeset; +}; + +PathExpr.prototype.step = function(op, step) { + step.op = op; + this.steps.push([op, step]); + + this.quickAttr = false; + + if (this.steps.length == 1) { + if (op == '/' && step.axis == 'attribute') { + var test = step.test; + if (!test.notOnlyElement && test.name != '*') { + this.quickAttr = true; + this.attrName = test.name; + } + } + } +}; + +PathExpr.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'path:' + '\n'; + indent += ' '; + t += indent + 'filter:' + '\n'; + t += this.filter.show(indent + ' '); + if (this.steps.length) { + t += indent + 'steps:' + '\n'; + indent += ' '; + for (var i = 0; i < this.steps.length; i ++) { + var step = this.steps[i]; + t += indent + 'operator: ' + step[0] + '\n'; + t += step[1].show(indent); + } + } + return t; +}; + + +/** + * class: FilterExpr + */ +if (!window.FilterExpr && window.defaultConfig) + window.FilterExpr = null; + +FilterExpr = function(primary) { + this.primary = primary; + this.predicates = []; + + this.datatype = primary.datatype; + + this.needContextPosition = primary.needContextPosition; + + this.needContextNode = primary.needContextNode; +}; + +FilterExpr.parse = function(lexer) { + var expr, filter, token, ch; + + token = lexer.peek(); + ch = token.charAt(0); + + switch (ch) { + case '$': + expr = VariableReference.parse(lexer); + break; + + case '(': + lexer.next(); + expr = BinaryExpr.parse(lexer); + if (lexer.empty()) { + throw Error('unclosed "("'); + } + if (lexer.next() != ')') { + lexer.back(); + throw Error('bad token: ' + lexer.next()); + } + break; + + case '"': + case "'": + expr = Literal.parse(lexer); + break; + + default: + if (!isNaN(+token)) { + expr = Number.parse(lexer); + } + + else if (NodeType.types[token]) { + return null; + } + + else if (ch.match(/(?![0-9])[\w]/) && lexer.peek(1) == '(') { + expr = FunctionCall.parse(lexer); + } + else { + return null; + } + break; + } + + if (lexer.peek() != '[') return expr; + + filter = new FilterExpr(expr); + + BaseExprHasPredicates.parsePredicates(lexer, filter); + + return filter; +}; + +FilterExpr.root = function() { + return new FunctionCall('root-node'); +}; +FilterExpr.context = function() { + return new FunctionCall('context-node'); +}; + +FilterExpr.prototype = new BaseExprHasPredicates(); + +FilterExpr.prototype.evaluate = function(ctx) { + var nodeset = this.primary.evaluate(ctx); + if(!nodeset.isNodeSet) { + if (this.predicates.length) + throw Error( + 'Primary result must be nodeset type ' + + 'if filter have predicate expression'); + return nodeset; + } + + return this.evaluatePredicates(nodeset); +}; + +FilterExpr.prototype.predicate = function(predicate) { + this.predicates.push(predicate); +}; + +FilterExpr.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'filter: ' + '\n'; + indent += ' '; + t += this.primary.show(indent); + if (this.predicates.length) { + t += indent + 'predicates: ' + '\n'; + indent += ' '; + for (var i = 0; i < this.predicates.length; i ++) { + t += this.predicates[i].show(indent); + } + } + return t; +}; + + +if (!window.NodeUtil && window.defaultConfig) + window.NodeUtil = null; + +NodeUtil = { + to: function(valueType, node) { + var type = node.nodeType; +/*@cc_on + if (type == 1 && node.nodeName.toLowerCase() == 'title') { + t = node.text; + } + else +@*/ + if (type == 9 || type == 1) { + if (type == 9) { + node = node.documentElement; + } + else { + node = node.firstChild; + } + for (var t = '', stack = [], i = 0; node;) { + do { + if (node.nodeType != 1) { + t += node.nodeValue; + } +/*@cc_on + else if (node.nodeName.toLowerCase() == 'title') { + t += node.text; + } +@*/ + stack[i++] = node; // push + } while (node = node.firstChild); + while (i && !(node = stack[--i].nextSibling)) {} + } + } + else { + var t = node.nodeValue; + } + switch (valueType) { + case 'number': + return + t; + case 'boolean': + return !! t; + default: + return t; + } + }, + attrPropMap: { + name: 'name', + 'class': 'className', + dir: 'dir', + id: 'id', + name: 'name', + title: 'title' + }, + attrMatch: function(node, attrName, attrValue) { +/*@cc_on @if (@_jscript) + var propName = NodeUtil.attrPropMap[attrName]; + if (!attrName || + attrValue == null && ( + propName && node[propName] || + !propName && node.getAttribute && node.getAttribute(attrName) + ) || + attrValue != null && ( + propName && node[propName] == attrValue || + !propName && node.getAttribute && node.getAttribute(attrName) == attrValue + )) { +@else @*/ + if (!attrName || + attrValue == null && node.hasAttribute && node.hasAttribute(attrName) || + attrValue != null && node.getAttribute && node.getAttribute(attrName) == attrValue) { +/*@end @*/ + return true; + } + else { + return false; + } + }, + getDescendantNodes: function(test, node, nodeset, attrName, attrValue, prevNodeset, prevIndex) { + if (prevNodeset) { + prevNodeset.delDescendant(node, prevIndex); + } +/*@cc_on + if (!test.notOnlyElement || test.type == 8 || (attrName && test.type == 0)) { + + var all = node.all; + if (!all) { + return nodeset; + } + + var name = test.name; + if (test.type == 8) name = '!'; + else if (test.type == 0) name = '*'; + + if (name != '*') { + all = all.tags(name); + if (!all) { + return nodeset; + } + } + + if (attrName) { + var result = [] + var i = 0; + if (attrValue != null && (attrName == 'id' || attrName == 'name')) { + all = all[attrValue]; + if (!all) { + return nodeset; + } + if (!all.length) { + all = [all]; + } + } + + while (node = all[i++]) { + if (NodeUtil.attrMatch(node, attrName, attrValue)) result.push(node); + } + + all = result; + } + + var i = 0; + while (node = all[i++]) { + if (name != '*' || node.tagName != '!') { + nodeset.push(node); + } + } + + return nodeset; + } + + (function (parent) { + var g = arguments.callee; + var node = parent.firstChild; + if (node) { + for (; node; node = node.nextSibling) { + if (NodeUtil.attrMatch(node, attrName, attrValue)) { + if (test.match(node)) nodeset.push(node); + } + g(node); + } + } + })(node); + + return nodeset; +@*/ + if (attrValue && attrName == 'id' && node.getElementById) { + node = node.getElementById(attrValue); + if (node && test.match(node)) { + nodeset.push(node); + } + } + else if (attrValue && attrName == 'name' && node.getElementsByName) { + var nodes = node.getElementsByName(attrValue); + for (var i = 0, l = nodes.length; i < l; i ++) { + node = nodes[i]; + if (uai.opera ? (node.name == attrValue && test.match(node)) : test.match(node)) { + nodeset.push(node); + } + } + } + else if (attrValue && attrName == 'class' && node.getElementsByClassName) { + var nodes = node.getElementsByClassName(attrValue); + for (var i = 0, l = nodes.length; i < l; i ++) { + node = nodes[i]; + if (node.className == attrValue && test.match(node)) { + nodeset.push(node); + } + } + } + else if (test.notOnlyElement) { + (function (parent) { + var f = arguments.callee; + for (var node = parent.firstChild; node; node = node.nextSibling) { + if (NodeUtil.attrMatch(node, attrName, attrValue)) { + if (test.match(node.nodeType)) nodeset.push(node); + } + f(node); + } + })(node); + } + else { + var name = test.name; + if (node.getElementsByTagName) { + var nodes = node.getElementsByTagName(name); + if (nodes) { + var i = 0; + while (node = nodes[i++]) { + if (NodeUtil.attrMatch(node, attrName, attrValue)) nodeset.push(node); + } + } + } + } + return nodeset; + }, + + getChildNodes: function(test, node, nodeset, attrName, attrValue) { + +/*@cc_on + var children; + + if ((!test.notOnlyElement || test.type == 8 || (attrName && test.type == 0)) && (children = node.children)) { + var name, elm; + + name = test.name; + if (test.type == 8) name = '!'; + else if (test.type == 0) name = '*'; + + if (name != '*') { + children = children.tags(name); + if (!children) { + return nodeset; + } + } + + if (attrName) { + var result = [] + var i = 0; + if (attrName == 'id' || attrName == 'name') { + children = children[attrValue]; + + if (!children) { + return nodeset; + } + + if (!children.length) { + children = [children]; + } + } + + while (node = children[i++]) { + if (NodeUtil.attrMatch(node, attrName, attrValue)) result.push(node); + } + children = result; + } + + var i = 0; + while (node = children[i++]) { + if (name != '*' || node.tagName != '!') { + nodeset.push(node); + } + } + + return nodeset; + } + + for (var i = 0, node = node.firstChild; node; i++, node = node.nextSibling) { + if (NodeUtil.attrMatch(node, attrName, attrValue)) { + if (test.match(node)) nodeset.push(node); + } + } + + return nodeset; +@*/ + for (var node = node.firstChild; node; node = node.nextSibling) { + if (NodeUtil.attrMatch(node, attrName, attrValue)) { + if (test.match(node)) nodeset.push(node); + } + } + return nodeset; + } +}; + +/*@cc_on +var AttributeWrapper = function(node, parent, sourceIndex) { + this.node = node; + this.nodeType = 2; + this.nodeValue = node.nodeValue; + this.nodeName = node.nodeName; + this.parentNode = parent; + this.ownerElement = parent; + this.parentSourceIndex = sourceIndex; +}; + +@*/ + + +/** + * class: Step + */ +if (!window.Step && window.defaultConfig) + window.Step = null; + +Step = function(axis, test) { + // TODO check arguments and throw axis error + this.axis = axis; + this.reverse = Step.axises[axis][0]; + this.func = Step.axises[axis][1]; + this.test = test; + this.predicates = []; + this._quickAttr = Step.axises[axis][2] +}; + +Step.axises = { + + ancestor: [true, function(test, node, nodeset, _, __, prevNodeset, prevIndex) { + while (node = node.parentNode) { + if (prevNodeset && node.nodeType == 1) { + prevNodeset.reserveDelByNode(node, prevIndex, true); + } + if (test.match(node)) nodeset.unshift(node); + } + return nodeset; + }], + + 'ancestor-or-self': [true, function(test, node, nodeset, _, __, prevNodeset, prevIndex) { + do { + if (prevNodeset && node.nodeType == 1) { + prevNodeset.reserveDelByNode(node, prevIndex, true); + } + if (test.match(node)) nodeset.unshift(node); + } while (node = node.parentNode) + return nodeset; + }], + + attribute: [false, function(test, node, nodeset) { + var attrs = node.attributes; + if (attrs) { +/*@cc_on + var sourceIndex = node.sourceIndex; +@*/ + if ((test.notOnlyElement && test.type == 0) || test.name == '*') { + for (var i = 0, l = attrs.length; i < l; i ++) { + var attr = attrs[i]; +/*@cc_on @if (@_jscript) + if (attr.nodeValue) { + nodeset.push(new AttributeWrapper(attr, node, sourceIndex)); + } +@else @*/ + nodeset.push(attr); +/*@end @*/ + } + } + else { + var attr = attrs.getNamedItem(test.name) + +/*@cc_on @if (@_jscript) + if (attr && attr.nodeValue) { + attr = new AttributeWrapper(attr, node, sourceIndex);; +@else @*/ + if (attr) { +/*@end @*/ + nodeset.push(attr); + } + } + } + return nodeset; + }], + + child: [false, NodeUtil.getChildNodes, true], + + descendant: [false, NodeUtil.getDescendantNodes, true], + + 'descendant-or-self': [false, function(test, node, nodeset, attrName, attrValue, prevNodeset, prevIndex) { + if (NodeUtil.attrMatch(node, attrName, attrValue)) { + if (test.match(node)) nodeset.push(node); + } + return NodeUtil.getDescendantNodes(test, node, nodeset, attrName, attrValue, prevNodeset, prevIndex); + }, true], + + following: [false, function(test, node, nodeset, attrName, attrValue) { + do { + var child = node; + while (child = child.nextSibling) { + if (NodeUtil.attrMatch(child, attrName, attrValue)) { + if (test.match(child)) nodeset.push(child); + } + nodeset = NodeUtil.getDescendantNodes(test, child, nodeset, attrName, attrValue); + } + } while (node = node.parentNode); + return nodeset; + }, true], + + 'following-sibling': [false, function(test, node, nodeset, _, __, prevNodeset, prevIndex) { + while (node = node.nextSibling) { + + if (prevNodeset && node.nodeType == 1) { + prevNodeset.reserveDelByNode(node, prevIndex); + } + + if (test.match(node)) { + nodeset.push(node); + } + } + return nodeset; + }], + + namespace: [false, function(test, node, nodeset) { + // not implemented + return nodeset; + }], + + parent: [false, function(test, node, nodeset) { + if (node.nodeType == 9) { + return nodeset; + } + if (node.nodeType == 2) { + nodeset.push(node.ownerElement); + return nodeset; + } + var node = node.parentNode; + if (test.match(node)) nodeset.push(node); + return nodeset; + }], + + preceding: [true, function(test, node, nodeset, attrName, attrValue) { + var parents = []; + do { + parents.unshift(node); + } while (node = node.parentNode); + + for (var i = 1, l0 = parents.length; i < l0; i ++) { + var siblings = []; + node = parents[i]; + while (node = node.previousSibling) { + siblings.unshift(node); + } + + for (var j = 0, l1 = siblings.length; j < l1; j ++) { + node = siblings[j]; + if (NodeUtil.attrMatch(node, attrName, attrValue)) { + if (test.match(node)) nodeset.push(node); + } + nodeset = NodeUtil.getDescendantNodes(test, node, nodeset, attrName, attrValue); + } + } + return nodeset; + }, true], + + 'preceding-sibling': [true, function(test, node, nodeset, _, __, prevNodeset, prevIndex) { + while (node = node.previousSibling) { + + if (prevNodeset && node.nodeType == 1) { + prevNodeset.reserveDelByNode(node, prevIndex, true); + } + + if (test.match(node)) { + nodeset.unshift(node) + } + } + return nodeset; + }], + + self: [false, function(test, node, nodeset) { + if (test.match(node)) nodeset.push(node); + return nodeset; + }] +}; + +Step.parse = function(lexer) { + var axis, test, step, token; + + if (lexer.peek() == '.') { + step = this.self(); + lexer.next(); + } + else if (lexer.peek() == '..') { + step = this.parent(); + lexer.next(); + } + else { + if (lexer.peek() == '@') { + axis = 'attribute'; + lexer.next(); + if (lexer.empty()) { + throw Error('missing attribute name'); + } + } + else { + if (lexer.peek(1) == '::') { + + if (!lexer.peek().charAt(0).match(/(?![0-9])[\w]/)) { + throw Error('bad token: ' + lexer.next()); + } + + axis = lexer.next(); + lexer.next(); + + if (!this.axises[axis]) { + throw Error('invalid axis: ' + axis); + } + if (lexer.empty()) { + throw Error('missing node name'); + } + } + else { + axis = 'child'; + } + } + + token = lexer.peek(); + if (!token.charAt(0).match(/(?![0-9])[\w]/)) { + if (token == '*') { + test = NameTest.parse(lexer) + } + else { + throw Error('bad token: ' + lexer.next()); + } + } + else { + if (lexer.peek(1) == '(') { + if (!NodeType.types[token]) { + throw Error('invalid node type: ' + token); + } + test = NodeType.parse(lexer) + } + else { + test = NameTest.parse(lexer); + } + } + step = new Step(axis, test); + } + + BaseExprHasPredicates.parsePredicates(lexer, step); + + return step; +}; + +Step.self = function() { + return new Step('self', new NodeType('node')); +}; + +Step.parent = function() { + return new Step('parent', new NodeType('node')); +}; + +Step.prototype = new BaseExprHasPredicates(); + +Step.prototype.evaluate = function(ctx, special, prevNodeset, prevIndex) { + var node = ctx.node; + var reverse = false; + + if (!special && this.op == '//') { + + if (!this.needContextPosition && this.axis == 'child') { + if (this.quickAttr) { + var attrValue = this.attrValueExpr ? this.attrValueExpr.string(ctx) : null; + var nodeset = NodeUtil.getDescendantNodes(this.test, node, new NodeSet(), this.attrName, attrValue, prevNodeset, prevIndex); + nodeset = this.evaluatePredicates(nodeset, 1); + } + else { + var nodeset = NodeUtil.getDescendantNodes(this.test, node, new NodeSet(), null, null, prevNodeset, prevIndex); + nodeset = this.evaluatePredicates(nodeset); + } + } + else { + var step = new Step('descendant-or-self', new NodeType('node')); + var nodes = step.evaluate(ctx, false, prevNodeset, prevIndex).list(); + var nodeset = null; + step.op = '/'; + for (var i = 0, l = nodes.length; i < l; i ++) { + if (!nodeset) { + nodeset = this.evaluate(new Ctx(nodes[i]), true); + } + else { + nodeset.merge(this.evaluate(new Ctx(nodes[i]), true)); + } + } + nodeset = nodeset || new NodeSet(); + } + } + else { + + if (this.needContextPosition) { + prevNodeset = null; + prevIndex = null; + } + + if (this.quickAttr) { + var attrValue = this.attrValueExpr ? this.attrValueExpr.string(ctx) : null; + var nodeset = this.func(this.test, node, new NodeSet(), this.attrName, attrValue, prevNodeset, prevIndex); + nodeset = this.evaluatePredicates(nodeset, 1); + } + else { + var nodeset = this.func(this.test, node, new NodeSet(), null, null, prevNodeset, prevIndex); + nodeset = this.evaluatePredicates(nodeset); + } + if (prevNodeset) { + prevNodeset.doDel(); + } + } + return nodeset; +}; + +Step.prototype.predicate = function(predicate) { + this.predicates.push(predicate); + + if (predicate.needContextPosition || + predicate.datatype == 'number'|| + predicate.datatype == 'void') { + this.needContextPosition = true; + } + + if (this._quickAttr && this.predicates.length == 1 && predicate.quickAttr) { + var attrName = predicate.attrName; +/*@cc_on @if (@_jscript) + this.attrName = attrName.toLowerCase(); +@else @*/ + this.attrName = attrName; +/*@end @*/ + this.attrValueExpr = predicate.attrValueExpr; + this.quickAttr = true; + } +}; + +Step.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'step: ' + '\n'; + indent += ' '; + if (this.axis) t += indent + 'axis: ' + this.axis + '\n'; + t += this.test.show(indent); + if (this.predicates.length) { + t += indent + 'predicates: ' + '\n'; + indent += ' '; + for (var i = 0; i < this.predicates.length; i ++) { + t += this.predicates[i].show(indent); + } + } + return t; +}; + + + +/** + * NodeType + */ +if (!window.NodeType && window.defaultConfig) + window.NodeType = null; + +NodeType = function(name, literal) { + this.name = name; + this.literal = literal; + + switch (name) { + case 'comment': + this.type = 8; + break; + case 'text': + this.type = 3; + break; + case 'processing-instruction': + this.type = 7; + break; + case 'node': + this.type = 0; + break; + } +}; + +NodeType.types = { + 'comment':1, 'text':1, 'processing-instruction':1, 'node':1 +}; + +NodeType.parse = function(lexer) { + var type, literal, ch; + type = lexer.next(); + lexer.next(); + if (lexer.empty()) { + throw Error('bad nodetype'); + } + ch = lexer.peek().charAt(0); + if (ch == '"' || ch == "'") { + literal = Literal.parse(lexer); + } + if (lexer.empty()) { + throw Error('bad nodetype'); + } + if (lexer.next() != ')') { + lexer.back(); + throw Error('bad token ' + lexer.next()); + } + return new NodeType(type, literal); +}; + +NodeType.prototype = new BaseExpr(); + +NodeType.prototype.notOnlyElement = true; + +NodeType.prototype.match = function(node) { + return !this.type || this.type == node.nodeType; +}; + +NodeType.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'nodetype: ' + this.type + '\n'; + if (this.literal) { + indent += ' '; + t += this.literal.show(indent); + } + return t; +}; + + +/** + * NodeType + */ +if (!window.NameTest && window.defaultConfig) + window.NameTest = null; + +NameTest = function(name) { + this.name = name.toLowerCase(); +}; + +NameTest.parse = function(lexer) { + if (lexer.peek() != '*' && lexer.peek(1) == ':' && lexer.peek(2) == '*') { + return new NameTest(lexer.next() + lexer.next() + lexer.next()); + } + return new NameTest(lexer.next()); +}; + +NameTest.prototype = new BaseExpr(); + +NameTest.prototype.match = function(node) { + var type = node.nodeType; + + if (type == 1 || type == 2) { + if (this.name == '*' || this.name == node.nodeName.toLowerCase()) { + return true; + } + } + return false; +}; + +NameTest.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'nametest: ' + this.name + '\n'; + return t; +}; + + +/** + * class: VariableRefernce + */ +if (!window.VariableReference && window.defaultConfig) + window.VariableReference = null; + +VariableReference = function(name) { + this.name = name.substring(1); +}; + + +VariableReference.parse = function(lexer) { + var token = lexer.next(); + if (token.length < 2) { + throw Error('unnamed variable reference'); + } + return new VariableReference(token) +}; + +VariableReference.prototype = new BaseExpr(); + +VariableReference.prototype.datatype = 'void'; + +VariableReference.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'variable: ' + this.name + '\n'; + return t; +}; + + +/** + * class: Literal + */ +if (!window.Literal && window.defaultConfig) + window.Literal = null; + +Literal = function(text) { + this.text = text.substring(1, text.length - 1); +}; + +Literal.parse = function(lexer) { + var token = lexer.next(); + if (token.length < 2) { + throw Error('unclosed literal string'); + } + return new Literal(token) +}; + +Literal.prototype = new BaseExpr(); + +Literal.prototype.datatype = 'string'; + +Literal.prototype.evaluate = function(ctx) { + return this.text; +}; + +Literal.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'literal: ' + this.text + '\n'; + return t; +}; + + +/** + * class: Number + */ +if (!window.Number && window.defaultConfig) + window.Number = null; + +Number = function(digit) { + this.digit = +digit; +}; + + +Number.parse = function(lexer) { + return new Number(lexer.next()); +}; + +Number.prototype = new BaseExpr(); + +Number.prototype.datatype = 'number'; + +Number.prototype.evaluate = function(ctx) { + return this.digit; +}; + +Number.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'number: ' + this.digit + '\n'; + return t; +}; + + +/** + * class: FunctionCall + */ +if (!window.FunctionCall && window.defaultConfig) + window.FunctionCall = null; + +FunctionCall = function(name) { + var info = FunctionCall.funcs[name]; + this.name = name; + this.func = info[0]; + this.args = []; + + this.datatype = info[1]; + + if (info[2]) { + this.needContextPosition = true; + } + + this.needContextNodeInfo = info[3]; + this.needContextNode = this.needContextNodeInfo[0] +}; + +FunctionCall.funcs = { + + // Original Function + 'context-node': [function() { + if (arguments.length != 0) { + throw Error('Function context-node expects ()'); + } + var ns; + ns = new NodeSet(); + ns.push(this.node); + return ns; + }, 'nodeset', false, [true]], + + // Original Function + 'root-node': [function() { + if (arguments.length != 0) { + throw Error('Function root-node expects ()'); + } + var ns, ctxn; + ns = new NodeSet(); + ctxn = this.node; + if (ctxn.nodeType == 9) + ns.push(ctxn); + else + ns.push(ctxn.ownerDocument); + return ns; + }, 'nodeset', false, []], + + last: [function() { + if (arguments.length != 0) { + throw Error('Function last expects ()'); + } + return this.last; + }, 'number', true, []], + + position: [function() { + if (arguments.length != 0) { + throw Error('Function position expects ()'); + } + return this.position; + }, 'number', true, []], + + count: [function(ns) { + if (arguments.length != 1 || !(ns = ns.evaluate(this)).isNodeSet) { + throw Error('Function count expects (nodeset)'); + } + return ns.length; + }, 'number', false, []], + + id: [function(s) { + var ids, ns, i, id, elm, ctxn, doc; + if (arguments.length != 1) { + throw Error('Function id expects (object)'); + } + ctxn = this.node; + if (ctxn.nodeType == 9) + doc = ctxn; + else + doc = ctxn.ownerDocument; +/*@cc_on + all = doc.all; +@*/ + s = s.string(this); + ids = s.split(/\s+/); + ns = new NodeSet(); + for (i = 0, l = ids.length; i < l; i ++) { + id = ids[i]; + +/*@cc_on @if (@_jscript) + elm = all[id]; + if (elm) { + if (elm.length) { + var elms = elm; + for (var j = 0, l0 = elms.length; j < l0; j ++) { + var elem = elms[j]; + if (id == elem.id) { + ns.push(elem); + break; + } + } + } + else if (id == elm.id) { + ns.push(elm) + } + } +@else @*/ + elm = doc.getElementById(id); + if (uai.opera && elm.id != id) { + var elms = doc.getElementsByName(id); + for (var j = 0, l0 = elms.length; j < l0; j ++) { + elm = elms[j]; + if (elm.id == id) { + ns.push(elm); + } + } + } + else { + if (elm) ns.push(elm) + } +/*@end @*/ + + } + ns.isSorted = false; + return ns; + }, 'nodeset', false, []], + + 'local-name': [function(ns) { + var nd; + switch (arguments.length) { + case 0: + nd = this.node; + break; + case 1: + if ((ns = ns.evaluate(this)).isNodeSet) { + nd = ns.first(); + break; + } + default: + throw Error('Function local-name expects (nodeset?)'); + break; + } + return '' + nd.nodeName.toLowerCase(); + }, 'string', false, [true, false]], + + name: [function(ns) { + // not implemented + return FunctionCall.funcs['local-name'][0].apply(this, arguments); + }, 'string', false, [true, false]], + + 'namespace-uri': [function(ns) { + // not implemented + return ''; + }, 'string', false, [true, false]], + + string: [function(s) { + switch (arguments.length) { + case 0: + s = NodeUtil.to('string', this.node); + break; + case 1: + s = s.string(this); + break; + default: + throw Error('Function string expects (object?)'); + break; + } + return s; + }, 'string', false, [true, false]], + + concat: [function(s1, s2) { + if (arguments.length < 2) { + throw Error('Function concat expects (string, string[, ...])'); + } + for (var t = '', i = 0, l = arguments.length; i < l; i ++) { + t += arguments[i].string(this); + } + return t; + }, 'string', false, []], + + 'starts-with': [function(s1, s2) { + if (arguments.length != 2) { + throw Error('Function starts-with expects (string, string)'); + } + s1 = s1.string(this); + s2 = s2.string(this); + return s1.indexOf(s2) == 0; + }, 'boolean', false, []], + + contains: [function(s1, s2) { + if (arguments.length != 2) { + throw Error('Function contains expects (string, string)'); + } + s1 = s1.string(this); + s2 = s2.string(this); + return s1.indexOf(s2) != -1; + }, 'boolean', false, []], + + substring: [function(s, n1, n2) { + var a1, a2; + s = s.string(this); + n1 = n1.number(this); + switch (arguments.length) { + case 2: + n2 = s.length - n1 + 1; + break; + case 3: + n2 = n2.number(this); + break; + default: + throw Error('Function substring expects (string, string)'); + break; + } + n1 = Math.round(n1); + n2 = Math.round(n2); + a1 = n1 - 1; + a2 = n1 + n2 - 1; + if (a2 == Infinity) { + return s.substring(a1 < 0 ? 0 : a1); + } + else { + return s.substring(a1 < 0 ? 0 : a1, a2) + } + }, 'string', false, []], + + 'substring-before': [function(s1, s2) { + var n; + if (arguments.length != 2) { + throw Error('Function substring-before expects (string, string)'); + } + s1 = s1.string(this); + s2 = s2.string(this); + n = s1.indexOf(s2); + if (n == -1) return ''; + return s1.substring(0, n); + }, 'string', false, []], + + 'substring-after': [function(s1, s2) { + if (arguments.length != 2) { + throw Error('Function substring-after expects (string, string)'); + } + s1 = s1.string(this); + s2 = s2.string(this); + var n = s1.indexOf(s2); + if (n == -1) return ''; + return s1.substring(n + s2.length); + }, 'string', false, []], + + 'string-length': [function(s) { + switch (arguments.length) { + case 0: + s = NodeUtil.to('string', this.node); + break; + case 1: + s = s.string(this); + break; + default: + throw Error('Function string-length expects (string?)'); + break; + } + return s.length; + }, 'number', false, [true, false]], + + 'normalize-space': [function(s) { + switch (arguments.length) { + case 0: + s = NodeUtil.to('string', this.node); + break; + case 1: + s = s.string(this); + break; + default: + throw Error('Function normalize-space expects (string?)'); + break; + } + return s.replace(/\s+/g, ' ').replace(/^ /, '').replace(/ $/, ''); + }, 'string', false, [true, false]], + + translate: [function(s1, s2, s3) { + if (arguments.length != 3) { + throw Error('Function translate expects (string, string, string)'); + } + s1 = s1.string(this); + s2 = s2.string(this); + s3 = s3.string(this); + + var map = []; + for (var i = 0, l = s2.length; i < l; i ++) { + var ch = s2.charAt(i); + if (!map[ch]) map[ch] = s3.charAt(i) || ''; + } + for (var t = '', i = 0, l = s1.length; i < l; i ++) { + var ch = s1.charAt(i); + var replace = map[ch] + t += (replace != undefined) ? replace : ch; + } + return t; + }, 'string', false, []], + + 'boolean': [function(b) { + if (arguments.length != 1) { + throw Error('Function boolean expects (object)'); + } + return b.bool(this) + }, 'boolean', false, []], + + not: [function(b) { + if (arguments.length != 1) { + throw Error('Function not expects (object)'); + } + return !b.bool(this) + }, 'boolean', false, []], + + 'true': [function() { + if (arguments.length != 0) { + throw Error('Function true expects ()'); + } + return true; + }, 'boolean', false, []], + + 'false': [function() { + if (arguments.length != 0) { + throw Error('Function false expects ()'); + } + return false; + }, 'boolean', false, []], + + lang: [function(s) { + // not implemented + return false; + }, 'boolean', false, []], + + number: [function(n) { + switch (arguments.length) { + case 0: + n = NodeUtil.to('number', this.node); + break; + case 1: + n = n.number(this); + break; + default: + throw Error('Function number expects (object?)'); + break; + } + return n; + }, 'number', false, [true, false]], + + sum: [function(ns) { + var nodes, n, i, l; + if (arguments.length != 1 || !(ns = ns.evaluate(this)).isNodeSet) { + throw Error('Function sum expects (nodeset)'); + } + nodes = ns.list(); + n = 0; + for (i = 0, l = nodes.length; i < l; i ++) { + n += NodeUtil.to('number', nodes[i]); + } + return n; + }, 'number', false, []], + + floor: [function(n) { + if (arguments.length != 1) { + throw Error('Function floor expects (number)'); + } + n = n.number(this); + return Math.floor(n); + }, 'number', false, []], + + ceiling: [function(n) { + if (arguments.length != 1) { + throw Error('Function ceiling expects (number)'); + } + n = n.number(this); + return Math.ceil(n); + }, 'number', false, []], + + round: [function(n) { + if (arguments.length != 1) { + throw Error('Function round expects (number)'); + } + n = n.number(this); + return Math.round(n); + }, 'number', false, []] +}; + +FunctionCall.parse = function(lexer) { + var expr, func = new FunctionCall(lexer.next()); + lexer.next(); + while (lexer.peek() != ')') { + if (lexer.empty()) { + throw Error('missing function argument list'); + } + expr = BinaryExpr.parse(lexer); + func.arg(expr); + if (lexer.peek() != ',') break; + lexer.next(); + } + if (lexer.empty()) { + throw Error('unclosed function argument list'); + } + if (lexer.next() != ')') { + lexer.back(); + throw Error('bad token: ' + lexer.next()); + } + return func +}; + +FunctionCall.prototype = new BaseExpr(); + +FunctionCall.prototype.evaluate = function (ctx) { + return this.func.apply(ctx, this.args); +}; + +FunctionCall.prototype.arg = function(arg) { + this.args.push(arg); + + if (arg.needContextPosition) { + this.needContextPosition = true; + } + + var args = this.args; + if (arg.needContextNode) { + args.needContexNode = true; + } + this.needContextNode = args.needContextNode || + this.needContextNodeInfo[args.length]; +}; + +FunctionCall.prototype.show = function(indent) { + indent = indent || ''; + var t = ''; + t += indent + 'function: ' + this.name + '\n'; + indent += ' '; + + if (this.args.length) { + t += indent + 'arguments: ' + '\n'; + indent += ' '; + for (var i = 0; i < this.args.length; i ++) { + t += this.args[i].show(indent); + } + } + + return t; +}; + + +/*@cc_on @if (@_jscript) +var NodeWrapper = function(node, sourceIndex, subIndex, attributeName) { + this.node = node; + this.nodeType = node.nodeType; + this.sourceIndex = sourceIndex; + this.subIndex = subIndex; + this.attributeName = attributeName || ''; + this.order = String.fromCharCode(sourceIndex) + String.fromCharCode(subIndex) + attributeName; +}; + +NodeWrapper.prototype.toString = function() { + return this.order; +}; +@else @*/ +var NodeID = { + uuid: 1, + get: function(node) { + return node.__jsxpath_id__ || (node.__jsxpath_id__ = this.uuid++); + } +}; +/*@end @*/ + +if (!window.NodeSet && window.defaultConfig) + window.NodeSet = null; + +NodeSet = function() { + this.length = 0; + this.nodes = []; + this.seen = {}; + this.idIndexMap = null; + this.reserveDels = []; +}; + +NodeSet.prototype.isNodeSet = true; +NodeSet.prototype.isSorted = true; + +/*@_cc_on +NodeSet.prototype.shortcut = true; +@*/ + +NodeSet.prototype.merge = function(nodeset) { + this.isSorted = false; + if (nodeset.only) { + return this.push(nodeset.only); + } + + if (this.only){ + var only = this.only; + delete this.only; + this.push(only); + this.length --; + } + + var nodes = nodeset.nodes; + for (var i = 0, l = nodes.length; i < l; i ++) { + this._add(nodes[i]); + } +}; + +NodeSet.prototype.sort = function() { + if (this.only) return; + if (this.sortOff) return; + + if (!this.isSorted) { + this.isSorted = true; + this.idIndexMap = null; + +/*@cc_on + if (this.shortcut) { + this.nodes.sort(); + } + else { + this.nodes.sort(function(a, b) { + var result; + result = a.sourceIndex - b.sourceIndex; + if (result == 0) + return a.subIndex - a.subIndex; + else + return result; + }); + } + return; +@*/ + var nodes = this.nodes; + nodes.sort(function(a, b) { + if (a == b) return 0; + + if (a.compareDocumentPosition) { + var result = a.compareDocumentPosition(b); + if (result & 2) return 1; + if (result & 4) return -1; + return 0; + } + else { + var node1 = a, node2 = b, ancestor1 = a, ancestor2 = b, deep1 = 0, deep2 = 0; + + while(ancestor1 = ancestor1.parentNode) deep1 ++; + while(ancestor2 = ancestor2.parentNode) deep2 ++; + + // same deep + if (deep1 > deep2) { + while (deep1-- != deep2) node1 = node1.parentNode; + if (node1 == node2) return 1; + } + else if (deep2 > deep1) { + while (deep2-- != deep1) node2 = node2.parentNode; + if (node1 == node2) return -1; + } + + while ((ancestor1 = node1.parentNode) != (ancestor2 = node2.parentNode)) { + node1 = ancestor1; + node2 = ancestor2; + } + + // node1 is node2's sibling + while (node1 = node1.nextSibling) if (node1 == node2) return -1; + + return 1; + } + }); + } +}; + + +/*@cc_on @if (@_jscript) +NodeSet.prototype.sourceOffset = 1; +NodeSet.prototype.subOffset = 2; +NodeSet.prototype.createWrapper = function(node) { + var parent, child, attributes, attributesLength, sourceIndex, subIndex, attributeName; + + sourceIndex = node.sourceIndex; + + if (typeof sourceIndex != 'number') { + type = node.nodeType; + switch (type) { + case 2: + parent = node.parentNode; + sourceIndex = node.parentSourceIndex; + subIndex = -1; + attributeName = node.nodeName; + break; + case 9: + subIndex = -2; + sourceIndex = -1; + break; + default: + child = node; + subIndex = 0; + do { + subIndex ++; + sourceIndex = child.sourceIndex; + if (sourceIndex) { + parent = child; + child = child.lastChild; + if (!child) { + child = parent; + break; + } + subIndex ++; + } + } while (child = child.previousSibling); + if (!sourceIndex) { + sourceIndex = node.parentNode.sourceIndex; + } + break; + } + } + else { + subIndex = -2; + } + + sourceIndex += this.sourceOffset; + subIndex += this.subOffset; + + return new NodeWrapper(node, sourceIndex, subIndex, attributeName); +}; + +NodeSet.prototype.reserveDelBySourceIndexAndSubIndex = function(sourceIndex, subIndex, offset, reverse) { + var map = this.createIdIndexMap(); + var index; + if ((map = map[sourceIndex]) && (index = map[subIndex])) { + if (reverse && (this.length - offset - 1) > index || !reverse && offset < index) { + var obj = { + value: index, + order: String.fromCharCode(index), + toString: function() { return this.order }, + valueOf: function() { return this.value } + }; + this.reserveDels.push(obj); + } + } +}; +@else @*/ +NodeSet.prototype.reserveDelByNodeID = function(id, offset, reverse) { + var map = this.createIdIndexMap(); + var index; + if (index = map[id]) { + if (reverse && (this.length - offset - 1) > index || !reverse && offset < index) { + var obj = { + value: index, + order: String.fromCharCode(index), + toString: function() { return this.order }, + valueOf: function() { return this.value } + }; + this.reserveDels.push(obj); + } + } +}; +/*@end @*/ + +NodeSet.prototype.reserveDelByNode = function(node, offset, reverse) { +/*@cc_on @if (@_jscript) + node = this.createWrapper(node); + this.reserveDelBySourceIndexAndSubIndex(node.sourceIndex, node.subIndex, offset, reverse); +@else @*/ + this.reserveDelByNodeID(NodeID.get(node), offset, reverse); +/*@end @*/ +}; + +NodeSet.prototype.doDel = function() { + if (!this.reserveDels.length) return; + + if (this.length < 0x10000) { + var dels = this.reserveDels.sort(function(a, b) { return b - a }); + } + else { + var dels = this.reserveDels.sort(function(a, b) { return b - a }); + } + for (var i = 0, l = dels.length; i < l; i ++) { + this.del(dels[i]); + } + this.reserveDels = []; + this.idIndexMap = null; +}; + +NodeSet.prototype.createIdIndexMap = function() { + if (this.idIndexMap) { + return this.idIndexMap; + } + else { + var map = this.idIndexMap = {}; + var nodes = this.nodes; + for (var i = 0, l = nodes.length; i < l; i ++) { + var node = nodes[i]; +/*@cc_on @if (@_jscript) + var sourceIndex = node.sourceIndex; + var subIndex = node.subIndex; + if (!map[sourceIndex]) map[sourceIndex] = {}; + map[sourceIndex][subIndex] = i; +@else @*/ + var id = NodeID.get(node); + map[id] = i; +/*@end @*/ + } + return map; + } +}; + +NodeSet.prototype.del = function(index) { + this.length --; + if (this.only) { + delete this.only; + } + else { + var node = this.nodes.splice(index, 1)[0]; + + if (this._first == node) { + delete this._first; + delete this._firstSourceIndex; + delete this._firstSubIndex; + } + +/*@cc_on @if (@_jscript) + delete this.seen[node.sourceIndex][node.subIndex]; +@else @*/ + delete this.seen[NodeID.get(node)]; +/*@end @*/ + } +}; + + +NodeSet.prototype.delDescendant = function(elm, offset) { + if (this.only) return; + var nodeType = elm.nodeType; + if (nodeType != 1 && nodeType != 9) return; + if (uai.applewebkit4) return; + + // element || document + if (!elm.contains) { + if (nodeType == 1) { + var _elm = elm; + elm = { + contains: function(node) { + return node.compareDocumentPosition(_elm) & 8; + } + }; + } + else { + // document + elm = { + contains: function() { + return true; + } + }; + } + } + + var nodes = this.nodes; + for (var i = offset + 1; i < nodes.length; i ++) { + +/*@cc_on @if (@_jscript) + if (nodes[i].node.nodeType == 1 && elm.contains(nodes[i].node)) { +@else @*/ + if (elm.contains(nodes[i])) { +/*@end @*/ + this.del(i); + i --; + } + } +}; + +NodeSet.prototype._add = function(node, reverse) { + +/*@cc_on @if (@_jscript) + + var first, firstSourceIndex, firstSubIndex, sourceIndex, subIndex, attributeName; + + sourceIndex = node.sourceIndex; + subIndex = node.subIndex; + attributeName = node.attributeName; + seen = this.seen; + + seen = seen[sourceIndex] || (seen[sourceIndex] = {}); + + if (node.nodeType == 2) { + seen = seen[subIndex] || (seen[subIndex] = {}); + if (seen[attributeName]) { + return true; + } + seen[attributeName] = true; + } + else { + if (seen[subIndex]) { + return true; + } + seen[subIndex] = true; + } + + if (sourceIndex >= 0x10000 || subIndex >= 0x10000) { + this.shortcut = false; + } + + // if this._first is undefined and this.nodes is not empty + // then first node shortcut is disabled. + if (this._first || this.nodes.length == 0) { + first = this._first; + firstSourceIndex = this._firstSourceIndex; + firstSubIndex = this._firstSubIndex; + if (!first || firstSourceIndex > sourceIndex || (firstSourceIndex == sourceIndex && firstSubIndex > subIndex)) { + this._first = node; + this._firstSourceIndex = sourceIndex; + this._firstSubIndex = subIndex + } + } + +@else @*/ + + var seen = this.seen; + var id = NodeID.get(node); + if (seen[id]) return true; + seen[id] = true; + +/*@end @*/ + + this.length++; + if (reverse) + this.nodes.unshift(node); + else + this.nodes.push(node); +}; + + +NodeSet.prototype.unshift = function(node) { + if (!this.length) { + this.length ++; + this.only = node; + return + } + if (this.only){ + var only = this.only; + delete this.only; + this.unshift(only); + this.length --; + } +/*@cc_on + node = this.createWrapper(node); +@*/ + return this._add(node, true); +}; + + +NodeSet.prototype.push = function(node) { + if (!this.length) { + this.length ++; + this.only = node; + return; + } + if (this.only) { + var only = this.only; + delete this.only; + this.push(only); + this.length --; + } +/*@cc_on + node = this.createWrapper(node); +@*/ + return this._add(node); +}; + +NodeSet.prototype.first = function() { + if (this.only) return this.only; +/*@cc_on + if (this._first) return this._first.node; + if (this.nodes.length > 1) this.sort(); + var node = this.nodes[0]; + return node ? node.node : undefined; +@*/ + if (this.nodes.length > 1) this.sort(); + return this.nodes[0]; +}; + +NodeSet.prototype.list = function() { + if (this.only) return [this.only]; + this.sort(); +/*@cc_on + var i, l, nodes, results; + nodes = this.nodes; + results = []; + for (i = 0, l = nodes.length; i < l; i ++) { + results.push(nodes[i].node); + } + return results; +@*/ + return this.nodes; +}; + +NodeSet.prototype.string = function() { + var node = this.only || this.first(); + return node ? NodeUtil.to('string', node) : ''; +}; + +NodeSet.prototype.bool = function() { + return !! (this.length || this.only); +}; + +NodeSet.prototype.number = function() { + return + this.string(); +}; + +NodeSet.prototype.iterator = function(reverse) { + this.sort(); + var nodeset = this; + + if (!reverse) { + var count = 0; + return function() { + if (nodeset.only && count++ == 0) return nodeset.only; +/*@cc_on @if(@_jscript) + var wrapper = nodeset.nodes[count++]; + if (wrapper) return wrapper.node; + return undefined; +@else @*/ + return nodeset.nodes[count++]; +/*@end @*/ + }; + } + else { + var count = 0; + return function() { + var index = nodeset.length - (count++) - 1; + if (nodeset.only && index == 0) return nodeset.only; +/*@cc_on @if(@_jscript) + var wrapper = nodeset.nodes[index]; + if (wrapper) return wrapper.node; + return undefined; +@else @*/ + return nodeset.nodes[index]; +/*@end @*/ + }; + } +}; + + +var install = function(win) { + + win = win || this; + + win.XPathExpression = function(expr) { + if (!expr.length) { + throw Error('no expression'); + } + var lexer = this.lexer = Lexer(expr); + if (lexer.empty()) { + throw Error('no expression'); + } + this.expr = BinaryExpr.parse(lexer); + if (!lexer.empty()) { + throw Error('bad token: ' + lexer.next()); + } + }; + + win.XPathExpression.prototype.evaluate = function(node, type) { + return new XPathResult(this.expr.evaluate(new Ctx(node)), type); + }; + + win.XPathResult = function (value, type) { + if (type == 0) { + switch (typeof value) { + case 'object': type ++; // 4 + case 'boolean': type ++; // 3 + case 'string': type ++; // 2 + case 'number': type ++; // 1 + } + } + + this.resultType = type; + + switch (type) { + case 1: + this.numberValue = value.isNodeSet ? value.number() : +value; + return; + case 2: + this.stringValue = value.isNodeSet ? value.string() : '' + value; + return; + case 3: + this.booleanValue = value.isNodeSet ? value.bool() : !! value; + return; + case 4: case 5: case 6: case 7: + this.nodes = value.list(); + this.snapshotLength = value.length; + this.index = 0; + this.invalidIteratorState = false; + break; + case 8: case 9: + this.singleNodeValue = value.first(); + return; + } + }; + + win.XPathResult.prototype.iterateNext = function() { return this.nodes[this.index++] }; + win.XPathResult.prototype.snapshotItem = function(i) { return this.nodes[i] }; + + win.XPathResult.ANY_TYPE = 0; + win.XPathResult.NUMBER_TYPE = 1; + win.XPathResult.STRING_TYPE = 2; + win.XPathResult.BOOLEAN_TYPE = 3; + win.XPathResult.UNORDERED_NODE_ITERATOR_TYPE = 4; + win.XPathResult.ORDERED_NODE_ITERATOR_TYPE = 5; + win.XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE = 6; + win.XPathResult.ORDERED_NODE_SNAPSHOT_TYPE = 7; + win.XPathResult.ANY_UNORDERED_NODE_TYPE = 8; + win.XPathResult.FIRST_ORDERED_NODE_TYPE = 9; + + + win.document.createExpression = function(expr) { + return new XPathExpression(expr, null); + }; + + win.document.evaluate = function(expr, context, _, type) { + return document.createExpression(expr, null).evaluate(context, type); + }; +}; + +var win; + +if (config.targetFrame) { + var frame = document.getElementById(config.targetFrame); + if (frame) win = frame.contentWindow; +} + +install(win || window); + +})(); + +// Thanks for reading this source code. We love JavaScript. + diff --git a/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-2022-jp/one.txt b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-2022-jp/one.txt new file mode 100644 index 0000000..c2923de --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-2022-jp/one.txt @@ -0,0 +1,11 @@ +ISO-2022-JPは、インターネット上(特に電子メール)などで使われる日本の文字用の文字符号化方式。ISO/IEC 2022のエスケープシーケンスを利用して文字集合を切り替える7ビットのコードであることを特徴とする (アナウンス機能のエスケープシーケンスは省略される)。俗に「JISコード」と呼ばれることもある。 + +概要 +日本語表記への利用が想定されている文字コードであり、日本語の利用されるネットワークにおいて、日本の規格を応用したものである。また文字集合としては、日本語で用いられる漢字、ひらがな、カタカナはもちろん、ラテン文字、ギリシア文字、キリル文字なども含んでおり、学術や産業の分野での利用も考慮たものとなっている。規格名に、ISOの日本語の言語コードであるjaではなく、国・地域名コードのJPが示されているゆえんである。 +文字集合としてJIS X 0201のC0集合(制御文字)、JIS X 0201のラテン文字集合、ISO 646の国際基準版図形文字、JIS X 0208の1978年版(JIS C 6226-1978)と1983年および1990年版が利用できる。JIS X 0201の片仮名文字集合は利用できない。1986年以降、日本の電子メールで用いられてきたJUNETコードを、村井純・Mark Crispin・Erik van der Poelが1993年にRFC化したもの(RFC 1468)。後にJIS X 0208:1997の附属書2としてJISに規定された。MIMEにおける文字符号化方式の識別用の名前として IANA に登録されている。 +なお、符号化の仕様についてはISO/IEC 2022#ISO-2022-JPも参照。 + +ISO-2022-JPと非標準的拡張使用 +「JISコード」(または「ISO-2022-JP」)というコード名の規定下では、その仕様通りの使用が求められる。しかし、Windows OS上では、実際にはCP932コード (MicrosoftによるShift JISを拡張した亜種。ISO-2022-JP規定外文字が追加されている。)による独自拡張(の文字)を断りなく使うアプリケーションが多い。この例としてInternet ExplorerやOutlook Expressがある。また、EmEditor、秀丸エディタやThunderbirdのようなMicrosoft社以外のWindowsアプリケーションでも同様の場合がある。この場合、ISO-2022-JPの範囲外の文字を使ってしまうと、異なる製品間では未定義不明文字として認識されるか、もしくは文字化けを起こす原因となる。そのため、Windows用の電子メールクライアントであっても独自拡張の文字を使用すると警告を出したり、あえて使えないように制限しているものも存在する。さらにはISO-2022-JPの範囲内であってもCP932は非標準文字(FULLWIDTH TILDE等)を持つので文字化けの原因になり得る。 +また、符号化方式名をISO-2022-JPとしているのに、文字集合としてはJIS X 0212 (いわゆる補助漢字) やJIS X 0201の片仮名文字集合 (いわゆる半角カナ) をも符号化している例があるが、ISO-2022-JPではこれらの文字を許容していない。これらの符号化は独自拡張の実装であり、中にはISO/IEC 2022の仕様に準拠すらしていないものもある[2]。従って受信側の電子メールクライアントがこれらの独自拡張に対応していない場合、その文字あるいはその文字を含む行、時にはテキスト全体が文字化けすることがある。 + diff --git a/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-8859-1/one.txt b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-8859-1/one.txt new file mode 100644 index 0000000..3101178 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/iso-8859-1/one.txt @@ -0,0 +1,19 @@ +Op mat eraus hinnen beschte, rou zënne schaddreg ké. Ké sin Eisen Kaffi prächteg, den haut esou Fielse wa, Well zielen d'Welt am dir. Aus grousse rëschten d'Stroos do, as dat Kléder gewëss d'Kàchen. Schied gehéiert d'Vioule net hu, rou ke zënter Säiten d'Hierz. Ze eise Fletschen mat, gei as gréng d'Lëtzebuerger. Wäit räich no mat. + +Säiten d'Liewen aus en. Un gëtt bléit lossen wee, da wéi alle weisen Kolrettchen. Et deser d'Pan d'Kirmes vun, en wuel Benn rëschten méi. En get drem ménger beschte, da wär Stad welle. Nun Dach d'Pied do, mä gét ruffen gehéiert. Ze onser ugedon fir, d'Liewen Plett'len ech no, si Räis wielen bereet wat. Iwer spilt fir jo. + +An hin däischter Margréitchen, eng ke Frot brommt, vu den Räis néierens. Da hir Hunn Frot nozegon, rout Fläiß Himmel zum si, net gutt Kaffi Gesträich fu. Vill lait Gaart sou wa, Land Mamm Schuebersonndeg rei do. Gei geet Minutt en, gei d'Leit beschte Kolrettchen et, Mamm fergiess un hun. + +Et gutt Heck kommen oft, Lann rëscht rei um, Hunn rëscht schéinste ke der. En lait zielen schnéiwäiss hir, fu rou botze éiweg Minutt, rem fest gudden schaddreg en. Noper bereet Margréitchen mat op, dem denkt d'Leit d'Vioule no, oft ké Himmel Hämmel. En denkt blénken Fréijor net, Gart Schiet d'Natur no wou. No hin Ierd Frot d'Kirmes. Hire aremt un rou, ké den éiweg wielen Milliounen. + +Mir si Hunn Blénkeg. Ké get ston derfir d'Kàchen. Haut d'Pan fu ons, dé frou löschteg d'Meereische rei. Sou op wuel Léift. Stret schlon grousse gin hu. Mä denkt d'Leit hinnen net, ké gét haut fort rëscht. + +Koum d'Pan hannendrun ass ké, ké den brét Kaffi geplot. Schéi Hären d'Pied fu gét, do d'Mier néierens bei. Rëm päift Hämmel am, wee Engel beschéngt mä. Brommt klinzecht der ke, wa rout jeitzt dén. Get Zalot d'Vioule däischter da, jo fir Bänk päift duerch, bei d'Beem schéinen Plett'len jo. Den haut Faarwen ze, eng en Biereg Kirmesdag, um sin alles Faarwen d'Vioule. + +Eng Hunn Schied et, wat wa Frot fest gebotzt. Bei jo bleiwe ruffen Klarinett. Un Feld klinzecht gét, rifft Margréitchen rem ke. Mir dé Noper duurch gewëss, ston sech kille sin en. Gei Stret d'Wise um, Haus Gart wee as. Monn ménger an blo, wat da Gart gefällt Hämmelsbrot. + +Brommt geplot och ze, dat wa Räis Well Kaffi. Do get spilt prächteg, as wär kille bleiwe gewalteg. Onser frësch Margréitchen rem ke, blo en huet ugedon. Onser Hemecht wär de, hu eraus d'Sonn dat, eise deser hannendrun da och. + +As durch Himmel hun, no fest iw'rem schéinste mir, Hunn séngt Hierz ke zum. Séngt iw'rem d'Natur zum an. Ke wär gutt Grénge. Kënnt gudden prächteg mä rei. Dé dir Blénkeg Klarinett Kolrettchen, da fort muerges d'Kanner wou, main Feld ruffen vu wéi. Da gin esou Zalot gewalteg, gét vill Hemecht blénken dé. + +Haut gréng nun et, nei vu Bass gréng d'Gaassen. Fest d'Beem uechter si gin. Oft vu sinn wellen kréien. Et ass lait Zalot schéinen. \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/one.txt b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/one.txt new file mode 100644 index 0000000..26c94d5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/one.txt @@ -0,0 +1,22 @@ +Код одно гринспана руководишь на. Его вы знания движение. Ты две начать +одиночку, сказать основатель удовольствием но миф. Бы какие система тем. +Полностью использует три мы, человек клоунов те нас, бы давать творческую +эзотерическая шеф. + +Мог не помнить никакого сэкономленного, две либо какие пишите бы. Должен +компанию кто те, этот заключалась проектировщик не ты. Глупые периоды ты +для. Вам который хороший он. Те любых кремния концентрируются мог, +собирать принадлежите без вы. + +Джоэла меньше хорошего вы миф, за тем году разработки. Даже управляющим +руководители был не. Три коде выпускать заботиться ну. То его система +удовольствием безостановочно, или ты главной процессорах. Мы без джоэл +знания получат, статьи остальные мы ещё. + +Них русском касается поскольку по, образование должником +систематизированный ну мои. Прийти кандидата университет но нас, для бы +должны никакого, биг многие причин интервьюирования за. + +Тем до плиту почему. Вот учёт такие одного бы, об биг разным внешних +промежуток. Вас до какому возможностей безответственный, были погодите бы +его, по них глупые долгий количества. diff --git a/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/three.txt b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/three.txt new file mode 100644 index 0000000..c81ccd5 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/three.txt @@ -0,0 +1,45 @@ +Αν ήδη διάβασε γλιτώσει μεταγλωτίσει, αυτήν θυμάμαι μου μα. Την κατάσταση χρησιμοποίησέ να! Τα διαφορά φαινόμενο διολισθήσεις πες, υψηλότερη προκαλείς περισσότερες όχι κι. Με ελέγχου γίνεται σας, μικρής δημιουργούν τη του. Τις τα γράψει εικόνες απαράδεκτη? + +Να ότι πρώτοι απαραίτητο. Άμεση πετάνε κακόκεφος τον ώς, να χώρου πιθανότητες του. Το μέχρι ορίστε λιγότερους σας. Πω ναί φυσικά εικόνες. + +Μου οι κώδικα αποκλειστικούς, λες το μάλλον συνεχώς. Νέου σημεία απίστευτα σας μα. Χρόνου μεταγλωτιστής σε νέα, τη τις πιάνει μπορούσες προγραμματιστές. Των κάνε βγαίνει εντυπωσιακό τα? Κρατάει τεσσαρών δυστυχώς της κι, ήδη υψηλότερη εξακολουθεί τα? + +Ώρα πετάνε μπορούσε λιγότερους αν, τα απαράδεκτη συγχωνευτεί ροή. Τη έγραψες συνηθίζουν σαν. Όλα με υλικό στήλες χειρότερα. Ανώδυνη δουλέψει επί ως, αν διαδίκτυο εσωτερικών παράγοντες από. Κεντρικό επιτυχία πες το. + +Πω ναι λέει τελειώσει, έξι ως έργων τελειώσει. Με αρχεία βουτήξουν ανταγωνιστής ώρα, πολύ γραφικά σελίδων τα στη. Όρο οέλεγχος δημιουργούν δε, ας θέλεις ελέγχου συντακτικό όρο! Της θυμάμαι επιδιόρθωση τα. Για μπορούσε περισσότερο αν, μέγιστη σημαίνει αποφάσισε τα του, άτομο αποτελέσει τι στα. + +Τι στην αφήσεις διοίκηση στη. Τα εσφαλμένη δημιουργια επιχείριση έξι! Βήμα μαγικά εκτελέσει ανά τη. Όλη αφήσεις συνεχώς εμπορικά αν, το λες κόλπα επιτυχία. Ότι οι ζώνη κειμένων. Όρο κι ρωτάει γραμμής πελάτες, τελειώσει διολισθήσεις καθυστερούσε αν εγώ? Τι πετούν διοίκηση προβλήματα ήδη. + +Τη γλιτώσει αποθηκευτικού μια. Πω έξι δημιουργια πιθανότητες, ως πέντε ελέγχους εκτελείται λες. Πως ερωτήσεις διοικητικό συγκεντρωμένοι οι, ας συνεχώς διοικητικό αποστηθίσει σαν. Δε πρώτες συνεχώς διολισθήσεις έχω, από τι κανένας βουτήξουν, γειτονιάς προσεκτικά ανταγωνιστής κι σαν. + +Δημιουργια συνηθίζουν κλπ τι? Όχι ποσοστό διακοπής κι. Κλπ φακέλους δεδομένη εξοργιστικά θα? Υποψήφιο καθορίζουν με όλη, στα πήρε προσοχή εταιρείες πω, ώς τον συνάδελφος διοικητικό δημιουργήσεις! Δούλευε επιτίθενται σας θα, με ένας παραγωγικής ένα, να ναι σημεία μέγιστη απαράδεκτη? + +Σας τεσσαρών συνεντεύξης τη, αρπάζεις σίγουρος μη για', επί τοπικές εντολές ακούσει θα? Ως δυστυχής μεταγλωτιστής όλη, να την είχαν σφάλμα απαραίτητο! Μην ώς άτομο διορθώσει χρησιμοποιούνταν. Δεν τα κόλπα πετάξαμε, μη που άγχος υόρκη άμεση, αφού δυστυχώς διακόψουμε όρο αν! Όλη μαγικά πετάνε επιδιορθώσεις δε, ροή φυσικά αποτελέσει πω. + +Άπειρα παραπάνω φαινόμενο πω ώρα, σαν πόρτες κρατήσουν συνηθίζουν ως. Κι ώρα τρέξει είχαμε εφαρμογή. Απλό σχεδιαστής μεταγλωτιστής ας επί, τις τα όταν έγραψες γραμμής? Όλα κάνεις συνάδελφος εργαζόμενοι θα, χαρτιού χαμηλός τα ροή. Ως ναι όροφο έρθει, μην πελάτες αποφάσισε μεταφραστής με, να βιαστικά εκδόσεις αναζήτησης λες. Των φταίει εκθέσεις προσπαθήσεις οι, σπίτι αποστηθίσει ας λες? + +Ώς που υπηρεσία απαραίτητο δημιουργείς. Μη άρα χαρά καθώς νύχτας, πω ματ μπουν είχαν. Άμεση δημιουργείς ώς ροή, γράψει γραμμής σίγουρος στα τι! Αν αφού πρώτοι εργαζόμενων ναί. + +Άμεση διορθώσεις με δύο? Έχουν παράδειγμα των θα, μου έρθει θυμάμαι περισσότερο το. Ότι θα αφού χρειάζονται περισσότερες. Σαν συνεχώς περίπου οι. + +Ώς πρώτης πετάξαμε λες, όρο κι πρώτες ζητήσεις δυστυχής. Ανά χρόνου διακοπή επιχειρηματίες ας, ώς μόλις άτομο χειρότερα όρο, κρατάει σχεδιαστής προσπαθήσεις νέο το. Πουλάς προσθέσει όλη πω, τύπου χαρακτηριστικό εγώ σε, πω πιο δούλευε αναζήτησης? Αναφορά δίνοντας σαν μη, μάθε δεδομένη εσωτερικών με ναι, αναφέρονται περιβάλλοντος ώρα αν. Και λέει απόλαυσε τα, που το όροφο προσπαθούν? + +Πάντα χρόνου χρήματα ναι το, σαν σωστά θυμάμαι σκεφτείς τα. Μα αποτελέσει ανεπιθύμητη την, πιο το τέτοιο ατόμου, τη των τρόπο εργαλείων επιδιόρθωσης. Περιβάλλον παραγωγικής σου κι, κλπ οι τύπου κακόκεφους αποστηθίσει, δε των πλέον τρόποι. Πιθανότητες χαρακτηριστικών σας κι, γραφικά δημιουργήσεις μια οι, πω πολλοί εξαρτάται προσεκτικά εδώ. Σταματάς παράγοντες για' ώς, στις ρωτάει το ναι! Καρέκλα ζητήσεις συνδυασμούς τη ήδη! + +Για μαγικά συνεχώς ακούσει το. Σταματάς προϊόντα βουτήξουν ώς ροή. Είχαν πρώτες οι ναι, μα λες αποστηθίσει ανακαλύπτεις. Όροφο άλγεβρα παραπάνω εδώ τη, πρόσληψη λαμβάνουν καταλάθος ήδη ας? Ως και εισαγωγή κρατήσουν, ένας κακόκεφους κι μας, όχι κώδικάς παίξουν πω. Πω νέα κρατάει εκφράσουν, τότε τελικών τη όχι, ας της τρέξει αλλάζοντας αποκλειστικούς. + +Ένας βιβλίο σε άρα, ναι ως γράψει ταξινομεί διορθώσεις! Εδώ να γεγονός συγγραφείς, ώς ήδη διακόψουμε επιχειρηματίες? Ότι πακέτων εσφαλμένη κι, θα όρο κόλπα παραγωγικής? Αν έχω κεντρικό υψηλότερη, κι δεν ίδιο πετάνε παρατηρούμενη! Που λοιπόν σημαντικό μα, προκαλείς χειροκροτήματα ως όλα, μα επί κόλπα άγχος γραμμές! Δε σου κάνεις βουτήξουν, μη έργων επενδυτής χρησιμοποίησέ στα, ως του πρώτες διάσημα σημαντικό. + +Βιβλίο τεράστιο προκύπτουν σαν το, σαν τρόπο επιδιόρθωση ας. Είχαν προσοχή προσπάθεια κι ματ, εδώ ως έτσι σελίδων συζήτηση. Και στην βγαίνει εσφαλμένη με, δυστυχής παράδειγμα δε μας, από σε υόρκη επιδιόρθωσης. Νέα πω νέου πιθανό, στήλες συγγραφείς μπαίνοντας μα για', το ρωτήσει κακόκεφους της? Μου σε αρέσει συγγραφής συγχωνευτεί, μη μου υόρκη ξέχασε διακοπής! Ώς επί αποφάσισε αποκλειστικούς χρησιμοποιώντας, χρήματα σελίδων ταξινομεί ναι με. + +Μη ανά γραμμή απόλαυσε, πω ναι μάτσο διασφαλίζεται. Τη έξι μόλις εργάστηκε δημιουργούν, έκδοση αναφορά δυσκολότερο οι νέο. Σας ως μπορούσε παράδειγμα, αν ότι δούλευε μπορούσε αποκλειστικούς, πιο λέει βουτήξουν διορθώσει ως. Έχω τελευταία κακόκεφους ας, όσο εργαζόμενων δημιουργήσεις τα. + +Του αν δουλέψει μπορούσε, πετούν χαμηλός εδώ ας? Κύκλο τύπους με που, δεν σε έχουν συνεχώς χειρότερα, τις τι απαράδεκτη συνηθίζουν? Θα μην τους αυτήν, τη ένα πήρε πακέτων, κι προκύπτουν περιβάλλον πως. Μα για δουλέψει απόλαυσε εφαμοργής, ώς εδώ σημαίνει μπορούσες, άμεση ακούσει προσοχή τη εδώ? + +Στα δώσε αθόρυβες λιγότερους οι, δε αναγκάζονται αποκλειστικούς όλα! Ας μπουν διοικητικό μια, πάντα ελέγχου διορθώσεις ώς τον. Ότι πήρε κανόνα μα. Που άτομα κάνεις δημιουργίες τα, οι μας αφού κόλπα προγραμματιστής, αφού ωραίο προκύπτουν στα ως. Θέμα χρησιμοποιήσει αν όλα, του τα άλγεβρα σελίδων. Τα ότι ανώδυνη δυστυχώς συνδυασμούς, μας οι πάντα γνωρίζουμε ανταγωνιστής, όχι τα δοκιμάσεις σχεδιαστής! Στην συνεντεύξης επιδιόρθωση πιο τα, μα από πουλάς περιβάλλον παραγωγικής. + +Έχουν μεταγλωτίσει σε σας, σε πάντα πρώτης μειώσει των, γράψει ρουτίνα δυσκολότερο ήδη μα? Ταξινομεί διορθώσεις να μας. Θα της προσπαθούν περιεχόμενα, δε έχω τοπικές στέλνοντάς. Ανά δε αλφα άμεση, κάποιο ρωτάει γνωρίζουμε πω στη, φράση μαγικά συνέχεια δε δύο! Αν είχαμε μειώσει ροή, μας μετράει καθυστερούσε επιδιορθώσεις μη. Χάος υόρκη κεντρικό έχω σε, ανά περίπου αναγκάζονται πω. + +Όσο επιστρέφουν χρονοδιαγράμματα μη. Πως ωραίο κακόκεφος διαχειριστής ως, τις να διακοπής αναζήτησης. Κάποιο ποσοστό ταξινομεί επί τη? Μάθε άμεση αλλάζοντας δύο με, μου νέου πάντα να. + +Πω του δυστυχώς πιθανότητες. Κι ρωτάει υψηλότερη δημιουργια ότι, πω εισαγωγή τελευταία απομόνωση ναι. Των ζητήσεις γνωρίζουμε ώς? Για' μη παραδοτέου αναφέρονται! Ύψος παραγωγικά ροή ως, φυσικά διάβασε εικόνες όσο σε? Δεν υόρκη διορθώσεις επεξεργασία θα, ως μέση σύστημα χρησιμοποιήσει τις. \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/two.txt b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/two.txt new file mode 100644 index 0000000..2443fc4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/_samples/charsets/utf-8/two.txt @@ -0,0 +1,3 @@ +रखति आवश्यकत प्रेरना मुख्यतह हिंदी किएलोग असक्षम कार्यलय करते विवरण किके मानसिक दिनांक पुर्व संसाध एवम् कुशलता अमितकुमार प्रोत्साहित जनित देखने उदेशीत विकसित बलवान ब्रौशर किएलोग विश्लेषण लोगो कैसे जागरुक प्रव्रुति प्रोत्साहित सदस्य आवश्यकत प्रसारन उपलब्धता अथवा हिंदी जनित दर्शाता यन्त्रालय बलवान अतित सहयोग शुरुआत सभीकुछ माहितीवानीज्य लिये खरिदे है।अभी एकत्रित सम्पर्क रिती मुश्किल प्राथमिक भेदनक्षमता विश्व उन्हे गटको द्वारा तकरीबन + +विश्व द्वारा व्याख्या सके। आजपर वातावरण व्याख्यान पहोच। हमारी कीसे प्राथमिक विचारशिलता पुर्व करती कम्प्युटर भेदनक्षमता लिये बलवान और्४५० यायेका वार्तालाप सुचना भारत शुरुआत लाभान्वित पढाए संस्था वर्णित मार्गदर्शन चुनने \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/tests/_samples/files/data.txt b/vendor/swiftmailer/swiftmailer/tests/_samples/files/data.txt new file mode 100644 index 0000000..3f35021 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/_samples/files/data.txt @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/tests/_samples/files/textfile.zip b/vendor/swiftmailer/swiftmailer/tests/_samples/files/textfile.zip new file mode 100644 index 0000000000000000000000000000000000000000..5a580ecbf81ff98445bc5c6d0fce7a9a301f0e39 GIT binary patch literal 202 zcmWIWW@h1HU}9ikII%0tqR&rhgC39#!aNM33?-=*C25&Csd^<9C7~gl49w;G_PK*_ zXax(ySH`c5AsLy)3P4nlSX82rpQezg5L}*_R-)jW2-H=iP-db~oSUDWs!)skipUnless( + SWIFT_TMP_DIR, 'Cannot run test without a writable directory to use (' . + 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' + ); + } + + public function setUp() + { + $this->_tmpDir = SWIFT_TMP_DIR; + $this->_testFile = $this->_tmpDir . '/swift-test-file' . __CLASS__; + file_put_contents($this->_testFile, 'abcdefghijklm'); + } + + public function tearDown() + { + unlink($this->_testFile); + } + + public function testFileDataCanBeRead() + { + $file = $this->_createFileStream($this->_testFile); + $str = ''; + while (false !== $bytes = $file->read(8192)) { + $str .= $bytes; + } + $this->assertEqual('abcdefghijklm', $str); + } + + public function testFileDataCanBeReadSequentially() + { + $file = $this->_createFileStream($this->_testFile); + $this->assertEqual('abcde', $file->read(5)); + $this->assertEqual('fghijklm', $file->read(8)); + $this->assertFalse($file->read(1)); + } + + public function testFilenameIsReturned() + { + $file = $this->_createFileStream($this->_testFile); + $this->assertEqual($this->_testFile, $file->getPath()); + } + + public function testFileCanBeWrittenTo() + { + $file = $this->_createFileStream( + $this->_testFile, true + ); + $file->write('foobar'); + $this->assertEqual('foobar', $file->read(8192)); + } + + public function testReadingFromThenWritingToFile() + { + $file = $this->_createFileStream( + $this->_testFile, true + ); + $file->write('foobar'); + $this->assertEqual('foobar', $file->read(8192)); + $file->write('zipbutton'); + $this->assertEqual('zipbutton', $file->read(8192)); + } + + public function testWritingToFileWithCanonicalization() + { + $file = $this->_createFileStream( + $this->_testFile, true + ); + $file->addFilter($this->_createFilter(array("\r\n", "\r"), "\n"), 'allToLF'); + $file->write("foo\r\nbar\r"); + $file->write("\nzip\r\ntest\r"); + $file->flushBuffers(); + $this->assertEqual("foo\nbar\nzip\ntest\n", file_get_contents($this->_testFile)); + } + + public function testBindingOtherStreamsMirrorsWriteOperations() + { + $file = $this->_createFileStream( + $this->_testFile, true + ); + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->write('x') + -> one($is2)->write('x') + -> one($is1)->write('y') + -> one($is2)->write('y') + ); + + $file->bind($is1); + $file->bind($is2); + + $file->write('x'); + $file->write('y'); + } + + public function testBindingOtherStreamsMirrorsFlushOperations() + { + $file = $this->_createFileStream( + $this->_testFile, true + ); + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->flushBuffers() + -> one($is2)->flushBuffers() + ); + + $file->bind($is1); + $file->bind($is2); + + $file->flushBuffers(); + } + + public function testUnbindingStreamPreventsFurtherWrites() + { + $file = $this->_createFileStream( + $this->_testFile, true + ); + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->write('x') + -> one($is2)->write('x') + -> one($is1)->write('y') + ); + + $file->bind($is1); + $file->bind($is2); + + $file->write('x'); + + $file->unbind($is2); + + $file->write('y'); + } + + // -- Creation methods + + private function _createFilter($search, $replace) + { + return new Swift_StreamFilters_StringReplacementFilter($search, $replace); + } + + private function _createMockInputStream() + { + return $this->_mock('Swift_InputByteStream'); + } + + private function _createFileStream($file, $writable = false) + { + return new Swift_ByteStream_FileByteStream($file, $writable); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php new file mode 100644 index 0000000..c638337 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/CharacterReaderFactory/SimpleCharacterReaderFactoryAcceptanceTest.php @@ -0,0 +1,183 @@ +_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + } + + public function testCreatingUtf8Reader() + { + foreach (array('utf8', 'utf-8', 'UTF-8', 'UTF8') as $utf8) { + $reader = $this->_factory->getReaderFor($utf8); + $this->assertIsA($reader, $this->_prefix . 'Utf8Reader'); + } + } + + public function testCreatingIso8859XReaders() + { + $charsets = array(); + foreach (range(1, 16) as $number) { + foreach (array('iso', 'iec') as $body) { + $charsets[] = $body . '-8859-' . $number; + $charsets[] = $body . '8859-' . $number; + $charsets[] = strtoupper($body) . '-8859-' . $number; + $charsets[] = strtoupper($body) . '8859-' . $number; + } + } + + foreach ($charsets as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingWindows125XReaders() + { + $charsets = array(); + foreach (range(0, 8) as $number) { + $charsets[] = 'windows-125' . $number; + $charsets[] = 'windows125' . $number; + $charsets[] = 'WINDOWS-125' . $number; + $charsets[] = 'WINDOWS125' . $number; + } + + foreach ($charsets as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingCodePageReaders() + { + $charsets = array(); + foreach (range(0, 8) as $number) { + $charsets[] = 'cp-125' . $number; + $charsets[] = 'cp125' . $number; + $charsets[] = 'CP-125' . $number; + $charsets[] = 'CP125' . $number; + } + + foreach (array(437, 737, 850, 855, 857, 858, 860, + 861, 863, 865, 866, 869) as $number) + { + $charsets[] = 'cp-' . $number; + $charsets[] = 'cp' . $number; + $charsets[] = 'CP-' . $number; + $charsets[] = 'CP' . $number; + } + + foreach ($charsets as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingAnsiReader() + { + foreach (array('ansi', 'ANSI') as $ansi) { + $reader = $this->_factory->getReaderFor($ansi); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingMacintoshReader() + { + foreach (array('macintosh', 'MACINTOSH') as $mac) { + $reader = $this->_factory->getReaderFor($mac); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingKOIReaders() + { + $charsets = array(); + foreach (array('7', '8-r', '8-u', '8u', '8r') as $end) { + $charsets[] = 'koi-' . $end; + $charsets[] = 'koi' . $end; + $charsets[] = 'KOI-' . $end; + $charsets[] = 'KOI' . $end; + } + + foreach ($charsets as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingIsciiReaders() + { + foreach (array('iscii', 'ISCII', 'viscii', 'VISCII') as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingMIKReader() + { + foreach (array('mik', 'MIK') as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingCorkReader() + { + foreach (array('cork', 'CORK', 't1', 'T1') as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(1, $reader->getInitialByteSize()); + } + } + + public function testCreatingUcs2Reader() + { + foreach (array('ucs-2', 'UCS-2', 'ucs2', 'UCS2') as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(2, $reader->getInitialByteSize()); + } + } + + public function testCreatingUtf16Reader() + { + foreach (array('utf-16', 'UTF-16', 'utf16', 'UTF16') as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(2, $reader->getInitialByteSize()); + } + } + + public function testCreatingUcs4Reader() + { + foreach (array('ucs-4', 'UCS-4', 'ucs4', 'UCS4') as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(4, $reader->getInitialByteSize()); + } + } + + public function testCreatingUtf32Reader() + { + foreach (array('utf-32', 'UTF-32', 'utf32', 'UTF32') as $charset) { + $reader = $this->_factory->getReaderFor($charset); + $this->assertIsA($reader, $this->_prefix . 'GenericFixedWidthReader'); + $this->assertEqual(4, $reader->getInitialByteSize()); + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php new file mode 100644 index 0000000..8efa4fd --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/DependencyContainerAcceptanceTest.php @@ -0,0 +1,22 @@ +listItems() as $itemName) { + try { + $di->lookup($itemName); + } catch (Swift_DependencyException $e) { + $this->fail($e->getMessage()); + } + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php new file mode 100644 index 0000000..44a8e48 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EmbeddedFileAcceptanceTest.php @@ -0,0 +1,13 @@ +_samplesDir = realpath(dirname(__FILE__) . '/../../../_samples/charsets'); + $this->_encoder = new Swift_Encoder_Base64Encoder(); + } + + public function testEncodingAndDecodingSamples() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + $encodedText = $this->_encoder->encodeString($text); + + $this->assertEqual( + base64_decode($encodedText), $text, + '%s: Encoded string should decode back to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php new file mode 100644 index 0000000..4406e1d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/QpEncoderAcceptanceTest.php @@ -0,0 +1,58 @@ +_samplesDir = realpath(dirname(__FILE__) . '/../../../_samples/charsets'); + $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + } + + public function testEncodingAndDecodingSamples() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $encoding = $encodingDir; + $charStream = new Swift_CharacterStream_ArrayCharacterStream( + $this->_factory, $encoding); + $encoder = new Swift_Encoder_QpEncoder($charStream); + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + $encodedText = $encoder->encodeString($text); + + $this->assertEqual( + quoted_printable_decode($encodedText), $text, + '%s: Encoded string should decode back to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php new file mode 100644 index 0000000..8c472b1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Encoder/Rfc2231EncoderAcceptanceTest.php @@ -0,0 +1,56 @@ +_samplesDir = realpath(dirname(__FILE__) . '/../../../_samples/charsets'); + $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + } + + public function testEncodingAndDecodingSamples() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $encoding = $encodingDir; + $charStream = new Swift_CharacterStream_ArrayCharacterStream( + $this->_factory, $encoding); + $encoder = new Swift_Encoder_Rfc2231Encoder($charStream); + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + $encodedText = $encoder->encodeString($text); + + $this->assertEqual( + urldecode(implode('', explode("\r\n", $encodedText))), $text, + '%s: Encoded string should decode back to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php new file mode 100644 index 0000000..9fa461a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/EncodingAcceptanceTest.php @@ -0,0 +1,31 @@ +assertEqual('7bit', $encoder->getName()); + } + + public function testGet8BitEncodingReturns8BitEncoder() + { + $encoder = Swift_Encoding::get8BitEncoding(); + $this->assertEqual('8bit', $encoder->getName()); + } + + public function testGetQpEncodingReturnsQpEncoder() + { + $encoder = Swift_Encoding::getQpEncoding(); + $this->assertEqual('quoted-printable', $encoder->getName()); + } + + public function testGetBase64EncodingReturnsBase64Encoder() + { + $encoder = Swift_Encoding::getBase64Encoding(); + $this->assertEqual('base64', $encoder->getName()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php new file mode 100644 index 0000000..da051f4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/ArrayKeyCacheAcceptanceTest.php @@ -0,0 +1,179 @@ +_cache = new Swift_KeyCache_ArrayKeyCache( + new Swift_KeyCache_SimpleKeyCacheInputStream() + ); + } + + public function testStringDataCanBeSetAndFetched() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('test', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testStringDataCanBeOverwritten() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('whatever', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testStringDataCanBeAppended() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND + ); + $this->assertEqual('testing', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testHasKeyReturnValue() + { + $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); + } + + public function testNsKeyIsWellPartitioned() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('test', $this->_cache->getString($this->_key1, 'foo')); + $this->assertEqual('ing', $this->_cache->getString($this->_key2, 'foo')); + } + + public function testItemKeyIsWellPartitioned() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('test', $this->_cache->getString($this->_key1, 'foo')); + $this->assertEqual('ing', $this->_cache->getString($this->_key1, 'bar')); + } + + public function testByteStreamCanBeImported() + { + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write('abcdef'); + + $this->_cache->importFromByteStream( + $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('abcdef', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testByteStreamCanBeAppended() + { + $os1 = new Swift_ByteStream_ArrayByteStream(); + $os1->write('abcdef'); + + $os2 = new Swift_ByteStream_ArrayByteStream(); + $os2->write('xyzuvw'); + + $this->_cache->importFromByteStream( + $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND + ); + $this->_cache->importFromByteStream( + $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND + ); + + $this->assertEqual('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testByteStreamAndStringCanBeAppended() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND + ); + + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write('abcdef'); + + $this->_cache->importFromByteStream( + $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND + ); + $this->assertEqual('testabcdef', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testDataCanBeExportedToByteStream() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + + $is = new Swift_ByteStream_ArrayByteStream(); + + $this->_cache->exportToByteStream($this->_key1, 'foo', $is); + + $string = ''; + while (false !== $bytes = $is->read(8192)) { + $string .= $bytes; + } + + $this->assertEqual('test', $string); + } + + public function testKeyCanBeCleared() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); + $this->_cache->clearKey($this->_key1, 'foo'); + $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); + } + + public function testNsKeyCanBeCleared() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE + ); + $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); + $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar')); + $this->_cache->clearAll($this->_key1); + $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); + $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar')); + } + + public function testKeyCacheInputStream() + { + $is = $this->_cache->getInputByteStream($this->_key1, 'foo'); + $is->write('abc'); + $is->write('xyz'); + $this->assertEqual('abcxyz', $this->_cache->getString($this->_key1, 'foo')); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php new file mode 100644 index 0000000..a3a37c1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/KeyCache/DiskKeyCacheAcceptanceTest.php @@ -0,0 +1,189 @@ +skipUnless( + SWIFT_TMP_DIR, 'Cannot run test without a writable directory to use (' . + 'define SWIFT_TMP_DIR in tests/config.php if you wish to run this test)' + ); + } + + public function setUp() + { + $this->_key1 = uniqid(microtime(true), true); + $this->_key2 = uniqid(microtime(true), true); + $this->_cache = new Swift_KeyCache_DiskKeyCache( + new Swift_KeyCache_SimpleKeyCacheInputStream(), + SWIFT_TMP_DIR + ); + } + + public function testStringDataCanBeSetAndFetched() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('test', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testStringDataCanBeOverwritten() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('whatever', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testStringDataCanBeAppended() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND + ); + $this->assertEqual('testing', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testHasKeyReturnValue() + { + $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); + } + + public function testNsKeyIsWellPartitioned() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('test', $this->_cache->getString($this->_key1, 'foo')); + $this->assertEqual('ing', $this->_cache->getString($this->_key2, 'foo')); + } + + public function testItemKeyIsWellPartitioned() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('test', $this->_cache->getString($this->_key1, 'foo')); + $this->assertEqual('ing', $this->_cache->getString($this->_key1, 'bar')); + } + + public function testByteStreamCanBeImported() + { + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write('abcdef'); + + $this->_cache->importFromByteStream( + $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('abcdef', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testByteStreamCanBeAppended() + { + $os1 = new Swift_ByteStream_ArrayByteStream(); + $os1->write('abcdef'); + + $os2 = new Swift_ByteStream_ArrayByteStream(); + $os2->write('xyzuvw'); + + $this->_cache->importFromByteStream( + $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND + ); + $this->_cache->importFromByteStream( + $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND + ); + + $this->assertEqual('abcdefxyzuvw', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testByteStreamAndStringCanBeAppended() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND + ); + + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write('abcdef'); + + $this->_cache->importFromByteStream( + $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND + ); + $this->assertEqual('testabcdef', $this->_cache->getString($this->_key1, 'foo')); + } + + public function testDataCanBeExportedToByteStream() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + + $is = new Swift_ByteStream_ArrayByteStream(); + + $this->_cache->exportToByteStream($this->_key1, 'foo', $is); + + $string = ''; + while (false !== $bytes = $is->read(8192)) { + $string .= $bytes; + } + + $this->assertEqual('test', $string); + } + + public function testKeyCanBeCleared() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); + $this->_cache->clearKey($this->_key1, 'foo'); + $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); + } + + public function testNsKeyCanBeCleared() + { + $this->_cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->_cache->setString( + $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE + ); + $this->assertTrue($this->_cache->hasKey($this->_key1, 'foo')); + $this->assertTrue($this->_cache->hasKey($this->_key1, 'bar')); + $this->_cache->clearAll($this->_key1); + $this->assertFalse($this->_cache->hasKey($this->_key1, 'foo')); + $this->assertFalse($this->_cache->hasKey($this->_key1, 'bar')); + } + + public function testKeyCacheInputStream() + { + $is = $this->_cache->getInputByteStream($this->_key1, 'foo'); + $is->write('abc'); + $is->write('xyz'); + $this->assertEqual('abcxyz', $this->_cache->getString($this->_key1, 'foo')); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php new file mode 100644 index 0000000..25f451c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MessageAcceptanceTest.php @@ -0,0 +1,57 @@ +_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + + $id = $message->getId(); + $date = $message->getDate(); + $boundary = $message->getBoundary(); + + $message->addPart('foo', 'text/plain', 'iso-8859-1'); + $message->addPart('test foo', 'text/html', 'iso-8859-1'); + + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/plain; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'test foo' . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n", + $message->toString() + ); + } + + // -- Private helpers + + protected function _createMessage() + { + Swift_DependencyContainer::getInstance() + ->register('properties.charset')->asValue(null); + return Swift_Message::newInstance(); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php new file mode 100644 index 0000000..d4e0500 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/AttachmentAcceptanceTest.php @@ -0,0 +1,136 @@ +_cache = new Swift_KeyCache_ArrayKeyCache( + new Swift_KeyCache_SimpleKeyCacheInputStream() + ); + $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); + + $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder( + new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8') + ); + $paramEncoder = new Swift_Encoder_Rfc2231Encoder( + new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8') + ); + $this->_grammar = new Swift_Mime_Grammar(); + $this->_headers = new Swift_Mime_SimpleHeaderSet( + new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar) + ); + } + + public function testDispositionIsSetInHeader() + { + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setDisposition('inline'); + $this->assertEqual( + 'Content-Type: application/pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline' . "\r\n", + $attachment->toString() + ); + } + + public function testDispositionIsAttachmentByDefault() + { + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $this->assertEqual( + 'Content-Type: application/pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment' . "\r\n", + $attachment->toString() + ); + } + + public function testFilenameIsSetInHeader() + { + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setFilename('foo.pdf'); + $this->assertEqual( + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=foo.pdf' . "\r\n", + $attachment->toString() + ); + } + + public function testSizeIsSetInHeader() + { + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setSize(12340); + $this->assertEqual( + 'Content-Type: application/pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; size=12340' . "\r\n", + $attachment->toString() + ); + } + + public function testMultipleParametersInHeader() + { + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setFilename('foo.pdf'); + $attachment->setSize(12340); + $this->assertEqual( + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=foo.pdf; size=12340' . "\r\n", + $attachment->toString() + ); + } + + public function testEndToEnd() + { + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setFilename('foo.pdf'); + $attachment->setSize(12340); + $attachment->setBody('abcd'); + $this->assertEqual( + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=foo.pdf; size=12340' . "\r\n" . + "\r\n" . + base64_encode('abcd'), + $attachment->toString() + ); + } + + // -- Private helpers + + protected function _createAttachment() + { + $entity = new Swift_Mime_Attachment( + $this->_headers, + $this->_contentEncoder, + $this->_cache, + $this->_grammar + ); + return $entity; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php new file mode 100644 index 0000000..03ad0f7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/Base64ContentEncoderAcceptanceTest.php @@ -0,0 +1,62 @@ +_samplesDir = realpath(dirname(__FILE__) . '/../../../../_samples/charsets'); + $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); + } + + public function testEncodingAndDecodingSamples() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write($text); + + $is = new Swift_ByteStream_ArrayByteStream(); + + $this->_encoder->encodeByteStream($os, $is); + + $encoded = ''; + while (false !== $bytes = $is->read(8192)) { + $encoded .= $bytes; + } + + $this->assertEqual( + base64_decode($encoded), $text, + '%s: Encoded string should decode back to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php new file mode 100644 index 0000000..9ec4300 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/NativeQpContentEncoderAcceptanceTest.php @@ -0,0 +1,94 @@ +_samplesDir = realpath(dirname(__FILE__) . '/../../../../_samples/charsets'); + $this->_encoder = new Swift_Mime_ContentEncoder_NativeQpContentEncoder(); + } + + public function testEncodingAndDecodingSamples() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write($text); + + $is = new Swift_ByteStream_ArrayByteStream(); + $this->_encoder->encodeByteStream($os, $is); + + $encoded = ''; + while (false !== $bytes = $is->read(8192)) { + $encoded .= $bytes; + } + + $this->assertEqual( + quoted_printable_decode($encoded), $text, + '%s: Encoded string should decode back to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + + } + + public function testEncodingAndDecodingSamplesFromDiConfiguredInstance() + { + $encoder = $this->_createEncoderFromContainer(); + $this->assertSame('=C3=A4=C3=B6=C3=BC=C3=9F', $encoder->encodeString('äöüß')); + } + + public function testCharsetChangeNotImplemented() + { + $this->_encoder->charsetChanged('utf-8'); + $this->expectException(new RuntimeException('Charset "charset" not supported. NativeQpContentEncoder only supports "utf-8"')); + $this->_encoder->charsetChanged('charset'); + } + + public function testGetName() + { + $this->assertSame('quoted-printable', $this->_encoder->getName()); + } + + // -- Private Methods + + private function _createEncoderFromContainer() + { + return Swift_DependencyContainer::getInstance() + ->lookup('mime.nativeqpcontentencoder') + ; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php new file mode 100644 index 0000000..103bbf4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/PlainContentEncoderAcceptanceTest.php @@ -0,0 +1,96 @@ +_samplesDir = realpath(dirname(__FILE__) . '/../../../../_samples/charsets'); + $this->_encoder = new Swift_Mime_ContentEncoder_PlainContentEncoder('8bit'); + } + + public function testEncodingAndDecodingSamplesString() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + $encodedText = $this->_encoder->encodeString($text); + + $this->assertEqual( + $encodedText, $text, + '%s: Encoded string should be identical to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + } + + public function testEncodingAndDecodingSamplesByteStream() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write($text); + + $is = new Swift_ByteStream_ArrayByteStream(); + + $this->_encoder->encodeByteStream($os, $is); + + $encoded = ''; + while (false !== $bytes = $is->read(8192)) { + $encoded .= $bytes; + } + + $this->assertEqual( + $encoded, $text, + '%s: Encoded string should be identical to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php new file mode 100644 index 0000000..1373fd3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/ContentEncoder/QpContentEncoderAcceptanceTest.php @@ -0,0 +1,170 @@ +_samplesDir = realpath(dirname(__FILE__) . '/../../../../_samples/charsets'); + $this->_factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + } + + public function testEncodingAndDecodingSamples() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $encoding = $encodingDir; + $charStream = new Swift_CharacterStream_NgCharacterStream( + $this->_factory, $encoding); + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write($text); + + $is = new Swift_ByteStream_ArrayByteStream(); + $encoder->encodeByteStream($os, $is); + + $encoded = ''; + while (false !== $bytes = $is->read(8192)) { + $encoded .= $bytes; + } + + $this->assertEqual( + quoted_printable_decode($encoded), $text, + '%s: Encoded string should decode back to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + } + + public function testEncodingAndDecodingSamplesFromDiConfiguredInstance() + { + $sampleFp = opendir($this->_samplesDir); + while (false !== $encodingDir = readdir($sampleFp)) { + if (substr($encodingDir, 0, 1) == '.') { + continue; + } + + $encoding = $encodingDir; + $encoder = $this->_createEncoderFromContainer(); + + $sampleDir = $this->_samplesDir . '/' . $encodingDir; + + if (is_dir($sampleDir)) { + + $fileFp = opendir($sampleDir); + while (false !== $sampleFile = readdir($fileFp)) { + if (substr($sampleFile, 0, 1) == '.') { + continue; + } + + $text = file_get_contents($sampleDir . '/' . $sampleFile); + + $os = new Swift_ByteStream_ArrayByteStream(); + $os->write($text); + + $is = new Swift_ByteStream_ArrayByteStream(); + $encoder->encodeByteStream($os, $is); + + $encoded = ''; + while (false !== $bytes = $is->read(8192)) { + $encoded .= $bytes; + } + + $this->assertEqual( + str_replace("\r\n", "\n", quoted_printable_decode($encoded)), str_replace("\r\n", "\n", $text), + '%s: Encoded string should decode back to original string for sample ' . + $sampleDir . '/' . $sampleFile + ); + } + closedir($fileFp); + } + + } + closedir($sampleFp); + } + + public function testEncodingLFTextWithDiConfiguredInstance() + { + $encoder = $this->_createEncoderFromContainer(); + $this->assertEqual("a\r\nb\r\nc", $encoder->encodeString("a\nb\nc")); + } + + public function testEncodingCRTextWithDiConfiguredInstance() + { + $encoder = $this->_createEncoderFromContainer(); + $this->assertEqual("a\r\nb\r\nc", $encoder->encodeString("a\rb\rc")); + } + + public function testEncodingLFCRTextWithDiConfiguredInstance() + { + $encoder = $this->_createEncoderFromContainer(); + $this->assertEqual("a\r\n\r\nb\r\n\r\nc", $encoder->encodeString("a\n\rb\n\rc")); + } + + public function testEncodingCRLFTextWithDiConfiguredInstance() + { + $encoder = $this->_createEncoderFromContainer(); + $this->assertEqual("a\r\nb\r\nc", $encoder->encodeString("a\r\nb\r\nc")); + } + + public function testEncodingDotStuffingWithDiConfiguredInstance() + { + // Enable DotEscaping + Swift_Preferences::getInstance()->setQPDotEscape(true); + $encoder = $this->_createEncoderFromContainer(); + $this->assertEqual("a=2E\r\n=2E\r\n=2Eb\r\nc", $encoder->encodeString("a.\r\n.\r\n.b\r\nc")); + // Return to default + Swift_Preferences::getInstance()->setQPDotEscape(false); + $encoder = $this->_createEncoderFromContainer(); + $this->assertEqual("a.\r\n.\r\n.b\r\nc", $encoder->encodeString("a.\r\n.\r\n.b\r\nc")); + } + + public function testDotStuffingEncodingAndDecodingSamplesFromDiConfiguredInstance() + { + // Enable DotEscaping + Swift_Preferences::getInstance()->setQPDotEscape(true); + $this->testEncodingAndDecodingSamplesFromDiConfiguredInstance(); + // Disable DotStuffing to continue + Swift_Preferences::getInstance()->setQPDotEscape(false); + } + + // -- Private Methods + + private function _createEncoderFromContainer() + { + return Swift_DependencyContainer::getInstance() + ->lookup('mime.qpcontentencoder') + ; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php new file mode 100644 index 0000000..7aaf48f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/EmbeddedFileAcceptanceTest.php @@ -0,0 +1,149 @@ +_cache = new Swift_KeyCache_ArrayKeyCache( + new Swift_KeyCache_SimpleKeyCacheInputStream() + ); + $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + $this->_contentEncoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); + + $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder( + new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8') + ); + $paramEncoder = new Swift_Encoder_Rfc2231Encoder( + new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8') + ); + $this->_grammar = new Swift_Mime_Grammar(); + $this->_headers = new Swift_Mime_SimpleHeaderSet( + new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar) + ); + } + + public function testContentIdIsSetInHeader() + { + $file = $this->_createEmbeddedFile(); + $file->setContentType('application/pdf'); + $file->setId('foo@bar'); + $this->assertEqual( + 'Content-Type: application/pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline' . "\r\n" . + 'Content-ID: ' . "\r\n", + $file->toString() + ); + } + + public function testDispositionIsSetInHeader() + { + $file = $this->_createEmbeddedFile(); + $id = $file->getId(); + $file->setContentType('application/pdf'); + $file->setDisposition('attachment'); + $this->assertEqual( + 'Content-Type: application/pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment' . "\r\n" . + 'Content-ID: <'. $id . '>' . "\r\n", + $file->toString() + ); + } + + public function testFilenameIsSetInHeader() + { + $file = $this->_createEmbeddedFile(); + $id = $file->getId(); + $file->setContentType('application/pdf'); + $file->setFilename('foo.pdf'); + $this->assertEqual( + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=foo.pdf' . "\r\n" . + 'Content-ID: <'. $id . '>' . "\r\n", + $file->toString() + ); + } + + public function testSizeIsSetInHeader() + { + $file = $this->_createEmbeddedFile(); + $id = $file->getId(); + $file->setContentType('application/pdf'); + $file->setSize(12340); + $this->assertEqual( + 'Content-Type: application/pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; size=12340' . "\r\n" . + 'Content-ID: <'. $id . '>' . "\r\n", + $file->toString() + ); + } + + public function testMultipleParametersInHeader() + { + $file = $this->_createEmbeddedFile(); + $id = $file->getId(); + $file->setContentType('application/pdf'); + $file->setFilename('foo.pdf'); + $file->setSize(12340); + $this->assertEqual( + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=foo.pdf; size=12340' . "\r\n" . + 'Content-ID: <'. $id . '>' . "\r\n", + $file->toString() + ); + } + + public function testEndToEnd() + { + $file = $this->_createEmbeddedFile(); + $id = $file->getId(); + $file->setContentType('application/pdf'); + $file->setFilename('foo.pdf'); + $file->setSize(12340); + $file->setBody('abcd'); + $this->assertEqual( + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=foo.pdf; size=12340' . "\r\n" . + 'Content-ID: <'. $id . '>' . "\r\n" . + "\r\n" . + base64_encode('abcd'), + $file->toString() + ); + } + + // -- Private helpers + + protected function _createEmbeddedFile() + { + $entity = new Swift_Mime_EmbeddedFile( + $this->_headers, + $this->_contentEncoder, + $this->_cache, + $this->_grammar + ); + return $entity; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php new file mode 100644 index 0000000..4f3411c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/HeaderEncoder/Base64HeaderEncoderAcceptanceTest.php @@ -0,0 +1,37 @@ +_encoder = new Swift_Mime_HeaderEncoder_Base64HeaderEncoder(); + } + + public function testEncodingJIS() + { + if (function_exists('mb_convert_encoding')) { + // base64_encode and split cannot handle long JIS text to fold + $subject = "長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い長い件名"; + + $encodedWrapperLength = strlen('=?iso-2022-jp?' . $this->_encoder->getName() . '??='); + + $old = mb_internal_encoding(); + mb_internal_encoding('utf-8'); + $newstring = mb_encode_mimeheader($subject, 'iso-2022-jp', 'B', "\r\n"); + mb_internal_encoding($old); + + $encoded = $this->_encoder->encodeString($subject, 0, 75 - $encodedWrapperLength, 'iso-2022-jp'); + $this->assertEqual( + $encoded, $newstring, + 'Encoded string should decode back to original string for sample ' + ); + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php new file mode 100644 index 0000000..fa679d2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/MimePartAcceptanceTest.php @@ -0,0 +1,142 @@ +_cache = new Swift_KeyCache_ArrayKeyCache( + new Swift_KeyCache_SimpleKeyCacheInputStream() + ); + $factory = new Swift_CharacterReaderFactory_SimpleCharacterReaderFactory(); + $this->_contentEncoder = new Swift_Mime_ContentEncoder_QpContentEncoder( + new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'), + new Swift_StreamFilters_ByteArrayReplacementFilter( + array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), + array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) + ) + ); + + $headerEncoder = new Swift_Mime_HeaderEncoder_QpHeaderEncoder( + new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8') + ); + $paramEncoder = new Swift_Encoder_Rfc2231Encoder( + new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8') + ); + $this->_grammar = new Swift_Mime_Grammar(); + $this->_headers = new Swift_Mime_SimpleHeaderSet( + new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $this->_grammar) + ); + } + + public function testCharsetIsSetInHeader() + { + $part = $this->_createMimePart(); + $part->setContentType('text/plain'); + $part->setCharset('utf-8'); + $part->setBody('foobar'); + $this->assertEqual( + 'Content-Type: text/plain; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foobar', + $part->toString() + ); + } + + public function testFormatIsSetInHeaders() + { + $part = $this->_createMimePart(); + $part->setContentType('text/plain'); + $part->setFormat('flowed'); + $part->setBody('> foobar'); + $this->assertEqual( + 'Content-Type: text/plain; format=flowed' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + '> foobar', + $part->toString() + ); + } + + public function testDelSpIsSetInHeaders() + { + $part = $this->_createMimePart(); + $part->setContentType('text/plain'); + $part->setDelSp(true); + $part->setBody('foobar'); + $this->assertEqual( + 'Content-Type: text/plain; delsp=yes' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foobar', + $part->toString() + ); + } + + public function testAll3ParamsInHeaders() + { + $part = $this->_createMimePart(); + $part->setContentType('text/plain'); + $part->setCharset('utf-8'); + $part->setFormat('fixed'); + $part->setDelSp(true); + $part->setBody('foobar'); + $this->assertEqual( + 'Content-Type: text/plain; charset=utf-8; format=fixed; delsp=yes' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foobar', + $part->toString() + ); + } + + public function testBodyIsCanonicalized() + { + $part = $this->_createMimePart(); + $part->setContentType('text/plain'); + $part->setCharset('utf-8'); + $part->setBody("foobar\r\rtest\ning\r"); + $this->assertEqual( + 'Content-Type: text/plain; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + "foobar\r\n" . + "\r\n" . + "test\r\n" . + "ing\r\n", + $part->toString() + ); + } + + // -- Private helpers + + protected function _createMimePart() + { + $entity = new Swift_Mime_MimePart( + $this->_headers, + $this->_contentEncoder, + $this->_cache, + $this->_grammar + ); + return $entity; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php new file mode 100644 index 0000000..87e4db8 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Mime/SimpleMessageAcceptanceTest.php @@ -0,0 +1,1254 @@ +setCharset(null); //TODO: Test with the charset defined + } + + public function testBasicHeaders() + { + /* -- RFC 2822, 3.6. + */ + + $message = $this->_createMessage(); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString(), + '%s: Only required headers, and non-empty headers should be displayed' + ); + } + + public function testSubjectIsDisplayedIfSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testDateCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $id = $message->getId(); + $message->setDate(1234); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', 1234) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testMessageIdCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setId('foo@bar'); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: ' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testContentTypeCanBeChanged() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setContentType('text/html'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/html' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testCharsetCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setContentType('text/html'); + $message->setCharset('iso-8859-1'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/html; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testFormatCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFormat('flowed'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain; format=flowed' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testEncoderCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setContentType('text/html'); + $message->setEncoder( + new Swift_Mime_ContentEncoder_PlainContentEncoder('7bit') + ); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/html' . "\r\n" . + 'Content-Transfer-Encoding: 7bit' . "\r\n", + $message->toString() + ); + } + + public function testFromAddressCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom('chris.corbyn@swiftmailer.org'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: chris.corbyn@swiftmailer.org' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testFromAddressCanBeSetWithName() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testMultipleFromAddressesCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' + )); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn , mark@swiftmailer.org' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testReturnPathAddressCanBeSet() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testEmptyReturnPathHeaderCanBeUsed() + { + $message = $this->_createMessage(); + $message->setReturnPath(''); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Return-Path: <>' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testSenderCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setSender('chris.corbyn@swiftmailer.org'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Sender: chris.corbyn@swiftmailer.org' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testSenderCanBeSetWithName() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setSender(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Sender: Chris ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testReplyToCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $message->setReplyTo(array('chris@w3style.co.uk'=>'Myself')); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris ' . "\r\n" . + 'Reply-To: Myself ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testMultipleReplyAddressCanBeUsed() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $message->setReplyTo(array( + 'chris@w3style.co.uk' => 'Myself', + 'my.other@address.com' => 'Me' + )); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris ' . "\r\n" . + 'Reply-To: Myself , Me ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testToAddressCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $message->setReplyTo(array( + 'chris@w3style.co.uk' => 'Myself', + 'my.other@address.com' => 'Me' + )); + $message->setTo('mark@swiftmailer.org'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris ' . "\r\n" . + 'Reply-To: Myself , Me ' . "\r\n" . + 'To: mark@swiftmailer.org' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testMultipleToAddressesCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $message->setReplyTo(array( + 'chris@w3style.co.uk' => 'Myself', + 'my.other@address.com' => 'Me' + )); + $message->setTo(array( + 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn' + )); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris ' . "\r\n" . + 'Reply-To: Myself , Me ' . "\r\n" . + 'To: mark@swiftmailer.org, Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testCcAddressCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $message->setReplyTo(array( + 'chris@w3style.co.uk' => 'Myself', + 'my.other@address.com' => 'Me' + )); + $message->setTo(array( + 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn' + )); + $message->setCc('john@some-site.com'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris ' . "\r\n" . + 'Reply-To: Myself , Me ' . "\r\n" . + 'To: mark@swiftmailer.org, Chris Corbyn ' . "\r\n" . + 'Cc: john@some-site.com' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testMultipleCcAddressesCanBeSet() + { + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $message->setReplyTo(array( + 'chris@w3style.co.uk' => 'Myself', + 'my.other@address.com' => 'Me' + )); + $message->setTo(array( + 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn' + )); + $message->setCc(array( + 'john@some-site.com' => 'John West', + 'fred@another-site.co.uk' => 'Big Fred' + )); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris ' . "\r\n" . + 'Reply-To: Myself , Me ' . "\r\n" . + 'To: mark@swiftmailer.org, Chris Corbyn ' . "\r\n" . + 'Cc: John West , Big Fred ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testBccAddressCanBeSet() + { + //Obviously Transports need to setBcc(array()) and send to each Bcc recipient + // separately in accordance with RFC 2822/2821 + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $message->setReplyTo(array( + 'chris@w3style.co.uk' => 'Myself', + 'my.other@address.com' => 'Me' + )); + $message->setTo(array( + 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn' + )); + $message->setCc(array( + 'john@some-site.com' => 'John West', + 'fred@another-site.co.uk' => 'Big Fred' + )); + $message->setBcc('x@alphabet.tld'); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris ' . "\r\n" . + 'Reply-To: Myself , Me ' . "\r\n" . + 'To: mark@swiftmailer.org, Chris Corbyn ' . "\r\n" . + 'Cc: John West , Big Fred ' . "\r\n" . + 'Bcc: x@alphabet.tld' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testMultipleBccAddressesCanBeSet() + { + //Obviously Transports need to setBcc(array()) and send to each Bcc recipient + // separately in accordance with RFC 2822/2821 + $message = $this->_createMessage(); + $message->setSubject('just a test subject'); + $message->setFrom(array('chris.corbyn@swiftmailer.org'=>'Chris')); + $message->setReplyTo(array( + 'chris@w3style.co.uk' => 'Myself', + 'my.other@address.com' => 'Me' + )); + $message->setTo(array( + 'mark@swiftmailer.org', 'chris@swiftmailer.org' => 'Chris Corbyn' + )); + $message->setCc(array( + 'john@some-site.com' => 'John West', + 'fred@another-site.co.uk' => 'Big Fred' + )); + $message->setBcc(array('x@alphabet.tld', 'a@alphabet.tld' => 'A')); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris ' . "\r\n" . + 'Reply-To: Myself , Me ' . "\r\n" . + 'To: mark@swiftmailer.org, Chris Corbyn ' . "\r\n" . + 'Cc: John West , Big Fred ' . "\r\n" . + 'Bcc: x@alphabet.tld, A ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString() + ); + } + + public function testStringBodyIsAppended() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $message->setBody( + 'just a test body' . "\r\n" . + 'with a new line' + ); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'just a test body' . "\r\n" . + 'with a new line', + $message->toString() + ); + } + + public function testStringBodyIsEncoded() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $message->setBody( + 'Just s' . pack('C*', 0xC2, 0x01, 0x01) . 'me multi-' . "\r\n" . + 'line message!' + ); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'Just s=C2=01=01me multi-' . "\r\n" . + 'line message!', + $message->toString() + ); + } + + public function testChildrenCanBeAttached() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + + $id = $message->getId(); + $date = $message->getDate(); + $boundary = $message->getBoundary(); + + $part1 = $this->_createMimePart(); + $part1->setContentType('text/plain'); + $part1->setCharset('iso-8859-1'); + $part1->setBody('foo'); + + $message->attach($part1); + + $part2 = $this->_createMimePart(); + $part2->setContentType('text/html'); + $part2->setCharset('iso-8859-1'); + $part2->setBody('test foo'); + + $message->attach($part2); + + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/plain; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'test foo' . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n", + $message->toString() + ); + } + + public function testAttachmentsBeingAttached() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + + $part = $this->_createMimePart(); + $part->setContentType('text/plain'); + $part->setCharset('iso-8859-1'); + $part->setBody('foo'); + + $message->attach($part); + + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setFilename('foo.pdf'); + $attachment->setBody(''); + + $message->attach($attachment); + + $this->assertPattern( + '~^' . + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/mixed;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="(.*?)"' . "\r\n" . + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: text/plain; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + "\r\n\r\n" . + '--\\1--' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=foo.pdf' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D', + $message->toString() + ); + } + + public function testAttachmentsAndEmbeddedFilesBeingAttached() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + + $part = $this->_createMimePart(); + $part->setContentType('text/plain'); + $part->setCharset('iso-8859-1'); + $part->setBody('foo'); + + $message->attach($part); + + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setFilename('foo.pdf'); + $attachment->setBody(''); + + $message->attach($attachment); + + $file = $this->_createEmbeddedFile(); + $file->setContentType('image/jpeg'); + $file->setFilename('myimage.jpg'); + $file->setBody(''); + + $message->attach($file); + + $cid = $file->getId(); + + $this->assertPattern( + '~^' . + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/mixed;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="(.*?)"' . "\r\n" . + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: text/plain; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: multipart/related;' . "\r\n" . + ' boundary="(.*?)"' . "\r\n" . + "\r\n\r\n" . + '--\\2' . "\r\n" . + 'Content-Type: image/jpeg; name=myimage.jpg' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=myimage.jpg' . "\r\n" . + 'Content-ID: <' . $cid . '>' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--\\2--' . "\r\n" . + "\r\n\r\n" . + '--\\1--' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=foo.pdf' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D', + $message->toString() + ); + } + + public function testComplexEmbeddingOfContent() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setFilename('foo.pdf'); + $attachment->setBody(''); + + $message->attach($attachment); + + $file = $this->_createEmbeddedFile(); + $file->setContentType('image/jpeg'); + $file->setFilename('myimage.jpg'); + $file->setBody(''); + + $part = $this->_createMimePart(); + $part->setContentType('text/html'); + $part->setCharset('iso-8859-1'); + $part->setBody('foo '); + + $message->attach($part); + + $cid = $file->getId(); + + $this->assertPattern( + '~^' . + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/mixed;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: multipart/related;' . "\r\n" . + ' boundary="(.*?)"' . "\r\n" . + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: text/html; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo ' . //=3D is just = in QP + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: image/jpeg; name=myimage.jpg' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=myimage.jpg' . "\r\n" . + 'Content-ID: <' . $cid . '>' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--\\1--' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=foo.pdf' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D', + $message->toString() + ); + } + + public function testAttachingAndDetachingContent() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + + $part = $this->_createMimePart(); + $part->setContentType('text/plain'); + $part->setCharset('iso-8859-1'); + $part->setBody('foo'); + + $message->attach($part); + + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setFilename('foo.pdf'); + $attachment->setBody(''); + + $message->attach($attachment); + + $file = $this->_createEmbeddedFile(); + $file->setContentType('image/jpeg'); + $file->setFilename('myimage.jpg'); + $file->setBody(''); + + $message->attach($file); + + $cid = $file->getId(); + + $message->detach($attachment); + + $this->assertPattern( + '~^' . + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/plain; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: multipart/related;' . "\r\n" . + ' boundary="(.*?)"' . "\r\n" . + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: image/jpeg; name=myimage.jpg' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=myimage.jpg' . "\r\n" . + 'Content-ID: <' . $cid . '>' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--\\1--' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D', + $message->toString(), + '%s: Attachment should have been detached' + ); + } + + public function testBoundaryDoesNotAppearAfterAllPartsAreDetached() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + + $id = $message->getId(); + $date = $message->getDate(); + $boundary = $message->getBoundary(); + + $part1 = $this->_createMimePart(); + $part1->setContentType('text/plain'); + $part1->setCharset('iso-8859-1'); + $part1->setBody('foo'); + + $message->attach($part1); + + $part2 = $this->_createMimePart(); + $part2->setContentType('text/html'); + $part2->setCharset('iso-8859-1'); + $part2->setBody('test foo'); + + $message->attach($part2); + + $message->detach($part1); + $message->detach($part2); + + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n", + $message->toString(), + '%s: Message should be restored to orignal state after parts are detached' + ); + } + + public function testCharsetFormatOrDelSpAreNotShownWhenBoundaryIsSet() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $message->setCharset('utf-8'); + $message->setFormat('flowed'); + $message->setDelSp(true); + + $id = $message->getId(); + $date = $message->getDate(); + $boundary = $message->getBoundary(); + + $part1 = $this->_createMimePart(); + $part1->setContentType('text/plain'); + $part1->setCharset('iso-8859-1'); + $part1->setBody('foo'); + + $message->attach($part1); + + $part2 = $this->_createMimePart(); + $part2->setContentType('text/html'); + $part2->setCharset('iso-8859-1'); + $part2->setBody('test foo'); + + $message->attach($part2); + + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/plain; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'test foo' . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n", + $message->toString() + ); + } + + public function testBodyCanBeSetWithAttachments() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $message->setContentType('text/html'); + $message->setCharset('iso-8859-1'); + $message->setBody('foo'); + + $id = $message->getId(); + $date = date('r', $message->getDate()); + $boundary = $message->getBoundary(); + + $attachment = $this->_createAttachment(); + $attachment->setContentType('application/pdf'); + $attachment->setFilename('foo.pdf'); + $attachment->setBody(''); + + $message->attach($attachment); + + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/mixed;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html; charset=iso-8859-1' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: application/pdf; name=foo.pdf' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=foo.pdf' . "\r\n" . + "\r\n" . + base64_encode('') . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n", + $message->toString() + ); + } + + public function testHtmlPartAlwaysAppearsLast() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + + $id = $message->getId(); + $date = date('r', $message->getDate()); + $boundary = $message->getBoundary(); + + $part1 = $this->_createMimePart(); + $part1->setContentType('text/html'); + $part1->setBody('foo'); + + $part2 = $this->_createMimePart(); + $part2->setContentType('text/plain'); + $part2->setBody('bar'); + + $message->attach($part1); + $message->attach($part2); + + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'bar' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n", + $message->toString() + ); + } + + public function testBodyBecomesPartIfOtherPartsAttached() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $message->setContentType('text/html'); + $message->setBody('foo'); + + $id = $message->getId(); + $date = date('r', $message->getDate()); + $boundary = $message->getBoundary(); + + $part2 = $this->_createMimePart(); + $part2->setContentType('text/plain'); + $part2->setBody('bar'); + + $message->attach($part2); + + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'bar' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'foo' . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n", + $message->toString() + ); + } + + public function testBodyIsCanonicalized() + { + $message = $this->_createMessage(); + $message->setReturnPath('chris@w3style.co.uk'); + $message->setSubject('just a test subject'); + $message->setFrom(array( + 'chris.corbyn@swiftmailer.org' => 'Chris Corbyn')); + $message->setBody( + 'just a test body' . "\n" . + 'with a new line' + ); + $id = $message->getId(); + $date = $message->getDate(); + $this->assertEqual( + 'Return-Path: ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . date('r', $date) . "\r\n" . + 'Subject: just a test subject' . "\r\n" . + 'From: Chris Corbyn ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: text/plain' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'just a test body' . "\r\n" . + 'with a new line', + $message->toString() + ); + } + + // -- Private helpers + + protected function _createMessage() + { + return new Swift_Message(); + } + + protected function _createMimePart() + { + return new Swift_MimePart(); + } + + protected function _createAttachment() + { + return new Swift_Attachment(); + } + + protected function _createEmbeddedFile() + { + return new Swift_EmbeddedFile(); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php new file mode 100644 index 0000000..3e10791 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/MimePartAcceptanceTest.php @@ -0,0 +1,14 @@ +register('properties.charset')->asValue(null); + return Swift_MimePart::newInstance(); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php new file mode 100644 index 0000000..7b6c726 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/AbstractStreamBufferAcceptanceTest.php @@ -0,0 +1,122 @@ +_buffer = new Swift_Transport_StreamBuffer( + $this->_stub('Swift_ReplacementFilterFactory') + ); + } + + public function testReadLine() + { + $this->_initializeBuffer(); + + $line = $this->_buffer->readLine(0); + $this->assertPattern('/^[0-9]{3}.*?\r\n$/D', $line); + $seq = $this->_buffer->write("QUIT\r\n"); + $this->assertTrue($seq); + $line = $this->_buffer->readLine($seq); + $this->assertPattern('/^[0-9]{3}.*?\r\n$/D', $line); + $this->_buffer->terminate(); + } + + public function testWrite() + { + $this->_initializeBuffer(); + + $line = $this->_buffer->readLine(0); + $this->assertPattern('/^[0-9]{3}.*?\r\n$/D', $line); + + $seq = $this->_buffer->write("HELO foo\r\n"); + $this->assertTrue($seq); + $line = $this->_buffer->readLine($seq); + $this->assertPattern('/^[0-9]{3}.*?\r\n$/D', $line); + + $seq = $this->_buffer->write("QUIT\r\n"); + $this->assertTrue($seq); + $line = $this->_buffer->readLine($seq); + $this->assertPattern('/^[0-9]{3}.*?\r\n$/D', $line); + $this->_buffer->terminate(); + } + + public function testBindingOtherStreamsMirrorsWriteOperations() + { + $this->_initializeBuffer(); + + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->write('x') + -> one($is2)->write('x') + -> one($is1)->write('y') + -> one($is2)->write('y') + ); + + $this->_buffer->bind($is1); + $this->_buffer->bind($is2); + + $this->_buffer->write('x'); + $this->_buffer->write('y'); + } + + public function testBindingOtherStreamsMirrorsFlushOperations() + { + $this->_initializeBuffer(); + + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->flushBuffers() + -> one($is2)->flushBuffers() + ); + + $this->_buffer->bind($is1); + $this->_buffer->bind($is2); + + $this->_buffer->flushBuffers(); + } + + public function testUnbindingStreamPreventsFurtherWrites() + { + $this->_initializeBuffer(); + + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->write('x') + -> one($is2)->write('x') + -> one($is1)->write('y') + ); + + $this->_buffer->bind($is1); + $this->_buffer->bind($is2); + + $this->_buffer->write('x'); + + $this->_buffer->unbind($is2); + + $this->_buffer->write('y'); + } + + // -- Creation Methods + + private function _createMockInputStream() + { + return $this->_mock('Swift_InputByteStream'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php new file mode 100644 index 0000000..364e353 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/BasicSocketAcceptanceTest.php @@ -0,0 +1,31 @@ +skipUnless(SWIFT_SMTP_HOST, + 'Cannot run test without an SMTP host to connect to (define ' . + 'SWIFT_SMTP_HOST in tests/acceptance.conf.php if you wish to run this test)' + ); + } + + protected function _initializeBuffer() + { + $parts = explode(':', SWIFT_SMTP_HOST); + $host = $parts[0]; + $port = isset($parts[1]) ? $parts[1] : 25; + + $this->_buffer->initialize(array( + 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, + 'host' => $host, + 'port' => $port, + 'protocol' => 'tcp', + 'blocking' => 1, + 'timeout' => 15 + )); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php new file mode 100644 index 0000000..a108ba2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/ProcessAcceptanceTest.php @@ -0,0 +1,23 @@ +skipIf(!SWIFT_SENDMAIL_PATH, + 'Cannot run test without a path to sendmail (define ' . + 'SWIFT_SENDMAIL_PATH in tests/acceptance.conf.php if you wish to run this test)' + ); + } + + protected function _initializeBuffer() + { + $this->_buffer->initialize(array( + 'type' => Swift_Transport_IoBuffer::TYPE_PROCESS, + 'command' => SWIFT_SENDMAIL_PATH . ' -bs' + )); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php new file mode 100644 index 0000000..93fb74a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SocketTimeoutTest.php @@ -0,0 +1,72 @@ +_buffer = new Swift_Transport_StreamBuffer( + $this->_stub('Swift_ReplacementFilterFactory') + ); + } + + public function skip() + { + $serverStarted=false; + for ($i=0; $i<5; ++$i) { + $this->_randomHighPort=rand(50000,65000); + $this->_server = stream_socket_server('tcp://127.0.0.1:' . $this->_randomHighPort); + if ($this->_server) { + $serverStarted=true; + } + } + $this->skipUnless(SWIFT_SMTP_HOST, + 'Cannot run test without an SMTP host to connect to (define ' . + 'SWIFT_SMTP_HOST in tests/acceptance.conf.php if you wish to run this test)' + ); + } + + protected function _initializeBuffer() + { + $host = '127.0.0.1'; + $port = $this->_randomHighPort; + + $this->_buffer->initialize(array( + 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, + 'host' => $host, + 'port' => $port, + 'protocol' => 'tcp', + 'blocking' => 1, + 'timeout' => 1 + )); + } + + public function testTimeoutException() + { + $this->_initializeBuffer(); + $e=null; + try { + $line = $this->_buffer->readLine(0); + } catch (Exception $e) { + } + $this->assertIsA($e, 'Swift_IoException', 'IO Exception Not Thrown On Connection Timeout'); + $this->assertPattern('/Connection to .* Timed Out/', $e->getMessage()); + } + + public function tearDown() + { + if ($this->_server) { + stream_socket_shutdown($this->_server, STREAM_SHUT_RDWR); + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php new file mode 100644 index 0000000..4dea91c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/SslSocketAcceptanceTest.php @@ -0,0 +1,35 @@ +skipIf(!in_array('ssl', $streams), + 'SSL is not configured for your system. It is not possible to run this test' + ); + $this->skipIf(!SWIFT_SSL_HOST, + 'Cannot run test without an SSL enabled SMTP host to connect to (define ' . + 'SWIFT_SSL_HOST in tests/acceptance.conf.php if you wish to run this test)' + ); + } + + protected function _initializeBuffer() + { + $parts = explode(':', SWIFT_SSL_HOST); + $host = $parts[0]; + $port = isset($parts[1]) ? $parts[1] : 25; + + $this->_buffer->initialize(array( + 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, + 'host' => $host, + 'port' => $port, + 'protocol' => 'ssl', + 'blocking' => 1, + 'timeout' => 15 + )); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php new file mode 100644 index 0000000..b1e38d7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/acceptance/Swift/Transport/StreamBuffer/TlsSocketAcceptanceTest.php @@ -0,0 +1,35 @@ +skipIf(!in_array('tls', $streams), + 'TLS is not configured for your system. It is not possible to run this test' + ); + $this->skipIf(!SWIFT_TLS_HOST, + 'Cannot run test without a TLS enabled SMTP host to connect to (define ' . + 'SWIFT_TLS_HOST in tests/acceptance.conf.php if you wish to run this test)' + ); + } + + protected function _initializeBuffer() + { + $parts = explode(':', SWIFT_TLS_HOST); + $host = $parts[0]; + $port = isset($parts[1]) ? $parts[1] : 25; + + $this->_buffer->initialize(array( + 'type' => Swift_Transport_IoBuffer::TYPE_SOCKET, + 'host' => $host, + 'port' => $port, + 'protocol' => 'tls', + 'blocking' => 1, + 'timeout' => 15 + )); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php new file mode 100644 index 0000000..1afb64c --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug111Test.php @@ -0,0 +1,44 @@ + array( + 'email1@example.com', + 'email2@example.com', + 'email3@example.com', + 'email4@example.com', + 'email5@example.com', + ), + 'sub' => array( + '-name-' => array( + 'email1', + '"email2"', + 'email3\\', + 'email4', + 'email5', + ), + '-url-' => array( + 'http://google.com', + 'http://yahoo.com', + 'http://hotmail.com', + 'http://aol.com', + 'http://facebook.com', + ), + ) + ); + $json = json_encode($complicated_header); + + $message = new Swift_Message(); + $headers = $message->getHeaders(); + $headers->addTextHeader('X-SMTPAPI', $json); + $header = $headers->get('X-SMTPAPI'); + + $this->assertEqual('Swift_Mime_Headers_UnstructuredHeader', get_class($header)); + $this->assertEqual($json, $header->getFieldBody()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php new file mode 100644 index 0000000..0800a00 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug118Test.php @@ -0,0 +1,22 @@ +_message = new Swift_Message(); + } + + public function testCallingGenerateIdChangesTheMessageId() + { + $currentId = $this->_message->getId(); + $this->_message->generateId(); + $newId = $this->_message->getId(); + + $this->assertNotEqual($currentId, $newId); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php new file mode 100644 index 0000000..8833eb2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug206Test.php @@ -0,0 +1,40 @@ +_factory = new Swift_Mime_SimpleHeaderFactory($headerEncoder, $paramEncoder, $grammar); + } + + public function testMailboxHeaderEncoding() + { + $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Name, Name', ' "Family Name, Name" '); + $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé, Name', ' Family =?utf-8?Q?Nam=C3=A9=2C?= Name'); + $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé , Name', ' Family =?utf-8?Q?Nam=C3=A9_=2C?= Name'); + $this->_testHeaderIsFullyEncoded('email@example.org', 'Family Namé ;Name', ' Family =?utf-8?Q?Nam=C3=A9_=3BName?= '); + } + + private function _testHeaderIsFullyEncoded($email, $name, $expected) + { + $mailboxHeader = $this->_factory->createMailboxHeader('To', array( + $email => $name + )); + + $headerBody = substr($mailboxHeader->toString(), 3, strlen($expected)); + + $this->assertEqual($expected, $headerBody); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php new file mode 100644 index 0000000..c87bd78 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug34Test.php @@ -0,0 +1,77 @@ +setCharset('utf-8'); + } + + public function testEmbeddedFilesWithMultipartDataCreateMultipartRelatedContentAsAnAlternative() + { + $message = Swift_Message::newInstance(); + $message->setCharset('utf-8'); + $message->setSubject('test subject'); + $message->addPart('plain part', 'text/plain'); + + $image = Swift_Image::newInstance('', 'image.gif', 'image/gif'); + $cid = $message->embed($image); + + $message->setBody('', 'text/html'); + + $message->setTo(array('user@domain.tld' => 'User')); + + $message->setFrom(array('other@domain.tld' => 'Other')); + $message->setSender(array('other@domain.tld' => 'Other')); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + $cidVal = $image->getId(); + + $this->assertPattern( + '~^' . + 'Sender: Other ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: test subject' . "\r\n" . + 'From: Other ' . "\r\n" . + 'To: User ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/plain; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'plain part' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: multipart/related;' . "\r\n" . + ' boundary="(.*?)"' . "\r\n" . + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: text/html; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + '' . + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: image/gif; name=image.gif' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=image.gif' . "\r\n" . + 'Content-ID: <' . $cidVal . '>' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--\\1--' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D', + $message->toString() + ); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php new file mode 100644 index 0000000..5138790 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug35Test.php @@ -0,0 +1,75 @@ +setCharset('utf-8'); + } + + public function testHTMLPartAppearsLastEvenWhenAttachmentsAdded() + { + $message = Swift_Message::newInstance(); + $message->setCharset('utf-8'); + $message->setSubject('test subject'); + $message->addPart('plain part', 'text/plain'); + + $attachment = Swift_Attachment::newInstance('', 'image.gif', 'image/gif'); + $message->attach($attachment); + + $message->setBody('HTML part', 'text/html'); + + $message->setTo(array('user@domain.tld' => 'User')); + + $message->setFrom(array('other@domain.tld' => 'Other')); + $message->setSender(array('other@domain.tld' => 'Other')); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + + $this->assertPattern( + '~^' . + 'Sender: Other ' . "\r\n" . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: test subject' . "\r\n" . + 'From: Other ' . "\r\n" . + 'To: User ' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/mixed;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: multipart/alternative;' . "\r\n" . + ' boundary="(.*?)"' . "\r\n" . + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: text/plain; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'plain part' . + "\r\n\r\n" . + '--\\1' . "\r\n" . + 'Content-Type: text/html; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'HTML part' . + "\r\n\r\n" . + '--\\1--' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: image/gif; name=image.gif' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=image.gif' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D', + $message->toString() + ); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php new file mode 100644 index 0000000..d28b8eb --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug38Test.php @@ -0,0 +1,196 @@ +_attFileName = 'data.txt'; + $this->_attFileType = 'text/plain'; + $this->_attFile = dirname(__FILE__) . '/../../_samples/files/data.txt'; + Swift_Preferences::getInstance()->setCharset('utf-8'); + } + + public function testWritingMessageToByteStreamProducesCorrectStructure() + { + $message = new Swift_Message(); + $message->setSubject('test subject'); + $message->setTo('user@domain.tld'); + $message->setCc('other@domain.tld'); + $message->setFrom('user@domain.tld'); + + $image = new Swift_Image('', 'image.gif', 'image/gif'); + + $cid = $message->embed($image); + $message->setBody('HTML part', 'text/html'); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + $imgId = $image->getId(); + + $stream = new Swift_ByteStream_ArrayByteStream(); + + $message->toByteStream($stream); + + $this->assertPatternInStream( + '~^' . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: test subject' . "\r\n" . + 'From: user@domain.tld' . "\r\n" . + 'To: user@domain.tld' . "\r\n" . + 'Cc: other@domain.tld' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/related;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'HTML part' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: image/gif; name=image.gif' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=image.gif' . "\r\n" . + 'Content-ID: <' . preg_quote($imgId, '~') . '>' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D', + $stream + ); + } + + public function testWritingMessageToByteStreamTwiceProducesCorrectStructure() + { + $message = new Swift_Message(); + $message->setSubject('test subject'); + $message->setTo('user@domain.tld'); + $message->setCc('other@domain.tld'); + $message->setFrom('user@domain.tld'); + + $image = new Swift_Image('', 'image.gif', 'image/gif'); + + $cid = $message->embed($image); + $message->setBody('HTML part', 'text/html'); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + $imgId = $image->getId(); + + $pattern = '~^' . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: test subject' . "\r\n" . + 'From: user@domain.tld' . "\r\n" . + 'To: user@domain.tld' . "\r\n" . + 'Cc: other@domain.tld' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/related;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'HTML part' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: image/gif; name=image.gif' . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: inline; filename=image.gif' . "\r\n" . + 'Content-ID: <' . preg_quote($imgId, '~') . '>' . "\r\n" . + "\r\n" . + preg_quote(base64_encode(''), '~') . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D' + ; + + $streamA = new Swift_ByteStream_ArrayByteStream(); + $streamB = new Swift_ByteStream_ArrayByteStream(); + + $message->toByteStream($streamA); + $message->toByteStream($streamB); + + $this->assertPatternInStream($pattern, $streamA); + $this->assertPatternInStream($pattern, $streamB); + } + + public function testWritingMessageToByteStreamTwiceUsingAFileAttachment() + { + $message = new Swift_Message(); + $message->setSubject('test subject'); + $message->setTo('user@domain.tld'); + $message->setCc('other@domain.tld'); + $message->setFrom('user@domain.tld'); + + $attachment = Swift_Attachment::fromPath($this->_attFile); + + $message->attach($attachment); + + $message->setBody('HTML part', 'text/html'); + + $id = $message->getId(); + $date = preg_quote(date('r', $message->getDate()), '~'); + $boundary = $message->getBoundary(); + + $streamA = new Swift_ByteStream_ArrayByteStream(); + $streamB = new Swift_ByteStream_ArrayByteStream(); + + $pattern = '~^' . + 'Message-ID: <' . $id . '>' . "\r\n" . + 'Date: ' . $date . "\r\n" . + 'Subject: test subject' . "\r\n" . + 'From: user@domain.tld' . "\r\n" . + 'To: user@domain.tld' . "\r\n" . + 'Cc: other@domain.tld' . "\r\n" . + 'MIME-Version: 1.0' . "\r\n" . + 'Content-Type: multipart/mixed;' . "\r\n" . + ' boundary="' . $boundary . '"' . "\r\n" . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: text/html; charset=utf-8' . "\r\n" . + 'Content-Transfer-Encoding: quoted-printable' . "\r\n" . + "\r\n" . + 'HTML part' . + "\r\n\r\n" . + '--' . $boundary . "\r\n" . + 'Content-Type: ' . $this->_attFileType . '; name=' . $this->_attFileName . "\r\n" . + 'Content-Transfer-Encoding: base64' . "\r\n" . + 'Content-Disposition: attachment; filename=' . $this->_attFileName . "\r\n" . + "\r\n" . + preg_quote(base64_encode(file_get_contents($this->_attFile)), '~') . + "\r\n\r\n" . + '--' . $boundary . '--' . "\r\n" . + '$~D' + ; + + $message->toByteStream($streamA); + $message->toByteStream($streamB); + + $this->assertPatternInStream($pattern, $streamA); + $this->assertPatternInStream($pattern, $streamB); + } + + // -- Helpers + + public function assertPatternInStream($pattern, $stream, $message = '%s') + { + $string = ''; + while (false !== $bytes = $stream->read(8192)) { + $string .= $bytes; + } + $this->assertPattern($pattern, $string, $message); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php new file mode 100644 index 0000000..51d69b9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug51Test.php @@ -0,0 +1,125 @@ +skipUnless( + is_writable(SWIFT_TMP_DIR), + '%s: This test requires tests/acceptance.conf.php to specify a ' . + 'writable SWIFT_TMP_DIR' + ); + } + + public function setUp() + { + $this->_attachmentFile = SWIFT_TMP_DIR . '/attach.rand.bin'; + file_put_contents($this->_attachmentFile, ''); + + $this->_outputFile = SWIFT_TMP_DIR . '/attach.out.bin'; + file_put_contents($this->_outputFile, ''); + } + + public function tearDown() + { + unlink($this->_attachmentFile); + unlink($this->_outputFile); + } + + public function testAttachmentsDoNotGetTruncatedUsingToByteStream() + { + //Run 100 times with 10KB attachments + for ($i = 0; $i < 10; ++$i) { + $message = $this->_createMessageWithRandomAttachment( + 10000, $this->_attachmentFile + ); + + file_put_contents($this->_outputFile, ''); + $message->toByteStream( + new Swift_ByteStream_FileByteStream($this->_outputFile, true) + ); + + $emailSource = file_get_contents($this->_outputFile); + + $this->assertAttachmentFromSourceMatches( + file_get_contents($this->_attachmentFile), + $emailSource + ); + } + } + + public function testAttachmentsDoNotGetTruncatedUsingToString() + { + //Run 100 times with 10KB attachments + for ($i = 0; $i < 10; ++$i) { + $message = $this->_createMessageWithRandomAttachment( + 10000, $this->_attachmentFile + ); + + $emailSource = $message->toString(); + + $this->assertAttachmentFromSourceMatches( + file_get_contents($this->_attachmentFile), + $emailSource + ); + } + } + + // -- Custom Assertions + + public function assertAttachmentFromSourceMatches($attachmentData, $source) + { + $encHeader = 'Content-Transfer-Encoding: base64'; + $base64declaration = strpos($source, $encHeader); + + $attachmentDataStart = strpos($source, "\r\n\r\n", $base64declaration); + $attachmentDataEnd = strpos($source, "\r\n--", $attachmentDataStart); + + if (false === $attachmentDataEnd) { + $attachmentBase64 = trim(substr($source, $attachmentDataStart)); + } else { + $attachmentBase64 = trim(substr( + $source, $attachmentDataStart, + $attachmentDataEnd - $attachmentDataStart + )); + } + + $this->assertIdenticalBinary($attachmentData, base64_decode($attachmentBase64)); + } + + // -- Creation Methods + + private function _fillFileWithRandomBytes($byteCount, $file) + { + // I was going to use dd with if=/dev/random but this way seems more + // cross platform even if a hella expensive!! + + file_put_contents($file, ''); + $fp = fopen($file, 'wb'); + for ($i = 0; $i < $byteCount; ++$i) { + $byteVal = rand(0, 255); + fwrite($fp, pack('i', $byteVal)); + } + fclose($fp); + } + + private function _createMessageWithRandomAttachment($size, $attachmentPath) + { + $this->_fillFileWithRandomBytes($size, $attachmentPath); + + $message = Swift_Message::newInstance() + ->setSubject('test') + ->setBody('test') + ->setFrom('a@b.c') + ->setTo('d@e.f') + ->attach(Swift_Attachment::fromPath($attachmentPath)) + ; + + return $message; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php new file mode 100644 index 0000000..d00ebaf --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug71Test.php @@ -0,0 +1,22 @@ +_message = new Swift_Message('test'); + } + + public function testCallingToStringAfterSettingNewBodyReflectsChanges() + { + $this->_message->setBody('BODY1'); + $this->assertPattern('/BODY1/', $this->_message->toString()); + + $this->_message->setBody('BODY2'); + $this->assertPattern('/BODY2/', $this->_message->toString()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php new file mode 100644 index 0000000..ce8714b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/bug/Swift/Bug76Test.php @@ -0,0 +1,86 @@ +skipUnless( + is_writable(SWIFT_TMP_DIR), + '%s: This test requires tests/acceptance.conf.php to specify a ' . + 'writable SWIFT_TMP_DIR' + ); + } + + public function setUp() + { + $this->_inputFile = SWIFT_TMP_DIR . '/in.bin'; + file_put_contents($this->_inputFile, ''); + + $this->_outputFile = SWIFT_TMP_DIR . '/out.bin'; + file_put_contents($this->_outputFile, ''); + + $this->_encoder = $this->_createEncoder(); + } + + public function tearDown() + { + unlink($this->_inputFile); + unlink($this->_outputFile); + } + + public function testBase64EncodedLineLengthNeverExceeds76CharactersEvenIfArgsDo() + { + $this->_fillFileWithRandomBytes(1000, $this->_inputFile); + + $os = $this->_createStream($this->_inputFile); + $is = $this->_createStream($this->_outputFile); + + $this->_encoder->encodeByteStream($os, $is, 0, 80); //Exceeds 76 + + $this->assertMaxLineLength(76, $this->_outputFile, + '%s: Line length should not exceed 76 characters' + ); + } + + // -- Custom Assertions + + public function assertMaxLineLength($length, $filePath, $message = '%s') + { + $lines = file($filePath); + foreach ($lines as $line) { + $this->assertTrue((strlen(trim($line)) <= 76), $message); + } + } + + // -- Creation Methods + + private function _fillFileWithRandomBytes($byteCount, $file) + { + // I was going to use dd with if=/dev/random but this way seems more + // cross platform even if a hella expensive!! + + file_put_contents($file, ''); + $fp = fopen($file, 'wb'); + for ($i = 0; $i < $byteCount; ++$i) { + $byteVal = rand(0, 255); + fwrite($fp, pack('i', $byteVal)); + } + fclose($fp); + } + + private function _createEncoder() + { + return new Swift_Mime_ContentEncoder_Base64ContentEncoder(); + } + + private function _createStream($file) + { + return new Swift_ByteStream_FileByteStream($file, true); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/IdenticalBinaryExpectation.php b/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/IdenticalBinaryExpectation.php new file mode 100644 index 0000000..4d5a97b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/IdenticalBinaryExpectation.php @@ -0,0 +1,78 @@ +_left = $left; + } + + /** + * Get the given string of bytes as a stirng of Hexadecimal sequences. + * @param string $binary + * @return string + */ + public function asHexString($binary) + { + $hex = ''; + + $bytes = unpack('H*', $binary); + + foreach ($bytes as &$byte) { + $byte = strtoupper($byte); + } + + return implode('', $bytes); + } + + /** + * Test that the passed subject ($right) is identical to $left. + * @param string $right, subject + * @return boolean + */ + public function test($right) + { + $aHex = $this->asHexString($this->_left); + $bHex = $this->asHexString($right); + + return $aHex === $bHex; + } + + /** + * Get the message depending upon whether this expectation is satisfied. + * @param $right subject to compare against + * @return string + */ + public function testMessage($right) + { + if ($this->test($right)) { + return 'Identical binary expectation [' . $this->asHexString($right) . ']'; + } else { + $this->_dumper=new SimpleDumper(); + return 'Identical binary expectation fails ' . + $this->_dumper->describeDifference( + $this->asHexString($this->_left), + $this->asHexString($right) + ); + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/SwiftSmokeTestCase.php b/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/SwiftSmokeTestCase.php new file mode 100644 index 0000000..79e776d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/SwiftSmokeTestCase.php @@ -0,0 +1,53 @@ +skipUnless(SWIFT_SMOKE_TRANSPORT_TYPE, + '%s: Smoke tests are skipped if tests/smoke.conf.php is not editted' + ); + } + + protected function _getMailer() + { + switch (SWIFT_SMOKE_TRANSPORT_TYPE) + { + case 'smtp': + $transport = Swift_DependencyContainer::getInstance()->lookup('transport.smtp') + ->setHost(SWIFT_SMOKE_SMTP_HOST) + ->setPort(SWIFT_SMOKE_SMTP_PORT) + ->setUsername(SWIFT_SMOKE_SMTP_USER) + ->setPassword(SWIFT_SMOKE_SMTP_PASS) + ->setEncryption(SWIFT_SMOKE_SMTP_ENCRYPTION) + ; + break; + case 'sendmail': + $transport = Swift_DependencyContainer::getInstance()->lookup('transport.sendmail') + ->setCommand(SWIFT_SMOKE_SENDMAIL_COMMAND) + ; + break; + case 'mail': + case 'nativemail': + $transport = Swift_DependencyContainer::getInstance()->lookup('transport.mail'); + break; + default: + throw new Exception('Undefined transport [' . SWIFT_SMOKE_TRANSPORT_TYPE . ']'); + } + return new Swift_Mailer($transport); + } + + protected function _visualCheck($url) + { + $this->dump('{image @ ' . $url . '}'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/SwiftUnitTestCase.php b/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/SwiftUnitTestCase.php new file mode 100644 index 0000000..a382b8d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/helpers/Swift/Tests/SwiftUnitTestCase.php @@ -0,0 +1,97 @@ +_mockery()->assertIsSatisfied(); + } catch (Yay_NotSatisfiedException $e) { + $this->fail($e->getMessage()); + } + $this->_mockery = null; + return parent::after($method); + } + + /** + * Assert two binary strings are an exact match. + * @param string $a + * @param string $b + * @param string $s formatted message + */ + public function assertIdenticalBinary($a, $b, $s = '%s') + { + return $this->assert(new Swift_Tests_IdenticalBinaryExpectation($a), $b, $s); + } + + // -- Protected methods + + /** + * Returns a singleton-per-test method for Yay_Mockery. + * @return Yay_Mockery + */ + protected function _mockery() + { + if (!isset($this->_mockery)) { + $this->_mockery = new Yay_Mockery(); + } + return $this->_mockery; + } + + /** + * Create a mock object. + * @param string $class + * @return Yay_Mock + */ + protected function _mock($class) + { + return $this->_mockery()->mock($class); + } + + /** + * Add mock expectations. + * @param Yay_Expectations $expectations + */ + protected function _checking($expectations) + { + return $this->_mockery()->checking($expectations); + } + + /** + * Create a mock object which does nothing. + * @param string $class + * @return Yay_Mock + */ + protected function _stub($class) + { + $stub = $this->_mockery()->mock($class); + $this->_mockery()->checking(Yay_Expectations::create() + -> ignoring($stub) + ); + return $stub; + } + + protected function _states($machineName) + { + return $this->_mockery()->states($machineName); + } + + protected function _sequence($sequenceName) + { + return $this->_mockery()->sequence($sequenceName); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default b/vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default new file mode 100644 index 0000000..2a75b7d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/smoke.conf.php.default @@ -0,0 +1,63 @@ +_attFile = dirname(__FILE__) . '/../../../_samples/files/textfile.zip'; + } + + public function testAttachmentSending() + { + $mailer = $this->_getMailer(); + $message = Swift_Message::newInstance() + ->setSubject('[Swift Mailer] AttachmentSmokeTest') + ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer')) + ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS) + ->setBody('This message should contain an attached ZIP file (named "textfile.zip").' . PHP_EOL . + 'When unzipped, the archive should produce a text file which reads:' . PHP_EOL . + '"This is part of a Swift Mailer v4 smoke test."' + ) + ->attach(Swift_Attachment::fromPath($this->_attFile)) + ; + $this->assertEqual(1, $mailer->send($message), + '%s: The smoke test should send a single message' + ); + $this->_visualCheck('http://swiftmailer.org/smoke/4.0.0/attachment.jpg'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php new file mode 100644 index 0000000..1436a22 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/BasicSmokeTest.php @@ -0,0 +1,24 @@ +_getMailer(); + $message = Swift_Message::newInstance() + ->setSubject('[Swift Mailer] BasicSmokeTest') + ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer')) + ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS) + ->setBody('One, two, three, four, five...' . PHP_EOL . + 'six, seven, eight...' + ) + ; + $this->assertEqual(1, $mailer->send($message), + '%s: The smoke test should send a single message' + ); + $this->_visualCheck('http://swiftmailer.org/smoke/4.0.0/basic.jpg'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php new file mode 100644 index 0000000..e6fa4a8 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/HtmlWithAttachmentSmokeTest.php @@ -0,0 +1,30 @@ +_attFile = dirname(__FILE__) . '/../../../_samples/files/textfile.zip'; + } + + public function testAttachmentSending() + { + $mailer = $this->_getMailer(); + $message = Swift_Message::newInstance('[Swift Mailer] HtmlWithAttachmentSmokeTest') + ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Swift Mailer')) + ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS) + ->attach(Swift_Attachment::fromPath($this->_attFile)) + ->setBody('

    This HTML-formatted message should contain an attached ZIP file (named "textfile.zip").' . PHP_EOL . + 'When unzipped, the archive should produce a text file which reads:

    ' . PHP_EOL . + '

    This is part of a Swift Mailer v4 smoke test.

    ', 'text/html' + ) + ; + $this->assertEqual(1, $mailer->send($message), + '%s: The smoke test should send a single message' + ); + $this->_visualCheck('http://swiftmailer.org/smoke/4.0.0/attachment.jpg'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php new file mode 100644 index 0000000..e3131c8 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/smoke/Swift/Smoke/InternationalSmokeTest.php @@ -0,0 +1,37 @@ +_attFile = dirname(__FILE__) . '/../../../_samples/files/textfile.zip'; + } + + public function testAttachmentSending() + { + $mailer = $this->_getMailer(); + $message = Swift_Message::newInstance() + ->setCharset('utf-8') + ->setSubject('[Swift Mailer] InternationalSmokeTest (διεθνής)') + ->setFrom(array(SWIFT_SMOKE_EMAIL_ADDRESS => 'Χριστοφορου (Swift Mailer)')) + ->setTo(SWIFT_SMOKE_EMAIL_ADDRESS) + ->setBody('This message should contain an attached ZIP file (named "κείμενο, εδάφιο, θέμα.zip").' . PHP_EOL . + 'When unzipped, the archive should produce a text file which reads:' . PHP_EOL . + '"This is part of a Swift Mailer v4 smoke test."' . PHP_EOL . + PHP_EOL . + 'Following is some arbitrary Greek text:' . PHP_EOL . + 'Δεν βρέθηκαν λέξεις.' + ) + ->attach(Swift_Attachment::fromPath($this->_attFile) + ->setContentType('application/zip') + ->setFilename('κείμενο, εδάφιο, θέμα.zip') + ) + ; + $this->assertEqual(1, $mailer->send($message), + '%s: The smoke test should send a single message' + ); + $this->_visualCheck('http://swiftmailer.org/smoke/4.0.0/international.jpg'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php new file mode 100644 index 0000000..80ca0c3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/ByteStream/ArrayByteStreamTest.php @@ -0,0 +1,204 @@ +_createArrayStream($input); + $output = array(); + while (false !== $bytes = $bs->read(1)) { + $output[] = $bytes; + } + $this->assertEqual($input, $output, + '%s: Bytes read from stream should be the same as bytes in constructor' + ); + } + + public function testReadingMultipleBytesFromBaseInput() + { + $input = array('a', 'b', 'c', 'd'); + $bs = $this->_createArrayStream($input); + $output = array(); + while (false !== $bytes = $bs->read(2)) { + $output[] = $bytes; + } + $this->assertEqual(array('ab', 'cd'), $output, + '%s: Bytes read from stream should be in pairs' + ); + } + + public function testReadingOddOffsetOnLastByte() + { + $input = array('a', 'b', 'c', 'd', 'e'); + $bs = $this->_createArrayStream($input); + $output = array(); + while (false !== $bytes = $bs->read(2)) { + $output[] = $bytes; + } + $this->assertEqual(array('ab', 'cd', 'e'), $output, + '%s: Bytes read from stream should be in pairs except final read' + ); + } + + public function testSettingPointerPartway() + { + $input = array('a', 'b', 'c'); + $bs = $this->_createArrayStream($input); + $bs->setReadPointer(1); + $this->assertEqual('b', $bs->read(1), + '%s: Byte should be second byte since pointer as at offset 1' + ); + } + + public function testResettingPointerAfterExhaustion() + { + $input = array('a', 'b', 'c'); + $bs = $this->_createArrayStream($input); + + while (false !== $bs->read(1)); + + $bs->setReadPointer(0); + $this->assertEqual('a', $bs->read(1), + '%s: Byte should be first byte since pointer as at offset 0' + ); + } + + public function testPointerNeverSetsBelowZero() + { + $input = array('a', 'b', 'c'); + $bs = $this->_createArrayStream($input); + + $bs->setReadPointer(-1); + $this->assertEqual('a', $bs->read(1), + '%s: Byte should be first byte since pointer should be at offset 0' + ); + } + + public function testPointerNeverSetsAboveStackSize() + { + $input = array('a', 'b', 'c'); + $bs = $this->_createArrayStream($input); + + $bs->setReadPointer(3); + $this->assertIdentical(false, $bs->read(1), + '%s: Stream should be at end and thus return false' + ); + } + + public function testBytesCanBeWrittenToStream() + { + $input = array('a', 'b', 'c'); + $bs = $this->_createArrayStream($input); + + $bs->write('de'); + + $output = array(); + while (false !== $bytes = $bs->read(1)) { + $output[] = $bytes; + } + $this->assertEqual(array('a', 'b', 'c', 'd', 'e'), $output, + '%s: Bytes read from stream should be from initial stack + written' + ); + } + + public function testContentsCanBeFlushed() + { + $input = array('a', 'b', 'c'); + $bs = $this->_createArrayStream($input); + + $bs->flushBuffers(); + + $this->assertIdentical(false, $bs->read(1), + '%s: Contents have been flushed so read() should return false' + ); + } + + public function testConstructorCanTakeStringArgument() + { + $bs = $this->_createArrayStream('abc'); + $output = array(); + while (false !== $bytes = $bs->read(1)) { + $output[] = $bytes; + } + $this->assertEqual(array('a', 'b', 'c'), $output, + '%s: Bytes read from stream should be the same as bytes in constructor' + ); + } + + public function testBindingOtherStreamsMirrorsWriteOperations() + { + $bs = $this->_createArrayStream(''); + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->write('x') + -> one($is2)->write('x') + -> one($is1)->write('y') + -> one($is2)->write('y') + ); + + $bs->bind($is1); + $bs->bind($is2); + + $bs->write('x'); + $bs->write('y'); + } + + public function testBindingOtherStreamsMirrorsFlushOperations() + { + $bs = $this->_createArrayStream(''); + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->flushBuffers() + -> one($is2)->flushBuffers() + ); + + $bs->bind($is1); + $bs->bind($is2); + + $bs->flushBuffers(); + } + + public function testUnbindingStreamPreventsFurtherWrites() + { + $bs = $this->_createArrayStream(''); + $is1 = $this->_createMockInputStream(); + $is2 = $this->_createMockInputStream(); + + $this->_checking(Expectations::create() + -> one($is1)->write('x') + -> one($is2)->write('x') + -> one($is1)->write('y') + ); + + $bs->bind($is1); + $bs->bind($is2); + + $bs->write('x'); + + $bs->unbind($is2); + + $bs->write('y'); + } + + // -- Creation Methods + + private function _createArrayStream($input) + { + return new Swift_ByteStream_ArrayByteStream($input); + } + + private function _createMockInputStream() + { + return $this->_mock('Swift_InputByteStream'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php new file mode 100644 index 0000000..130c47f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/GenericFixedWidthReaderTest.php @@ -0,0 +1,46 @@ +assertIdentical(1, $reader->getInitialByteSize()); + + $reader = new Swift_CharacterReader_GenericFixedWidthReader(4); + $this->assertIdentical(4, $reader->getInitialByteSize()); + } + + public function testValidationValueIsBasedOnOctetCount() + { + $reader = new Swift_CharacterReader_GenericFixedWidthReader(4); + + $this->assertIdentical( + 1, $reader->validateByteSequence(array(0x01, 0x02, 0x03), 3) + ); //3 octets + + $this->assertIdentical( + 2, $reader->validateByteSequence(array(0x01, 0x0A), 2) + ); //2 octets + + $this->assertIdentical( + 3, $reader->validateByteSequence(array(0xFE), 1) + ); //1 octet + + $this->assertIdentical( + 0, $reader->validateByteSequence(array(0xFE, 0x03, 0x67, 0x9A), 4) + ); //All 4 octets + } + + public function testValidationFailsIfTooManyOctets() + { + $reader = new Swift_CharacterReader_GenericFixedWidthReader(6); + + $this->assertIdentical(-1, $reader->validateByteSequence( + array(0xFE, 0x03, 0x67, 0x9A, 0x10, 0x09, 0x85), 7 + )); //7 octets + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php new file mode 100644 index 0000000..7611262 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/UsAsciiReaderTest.php @@ -0,0 +1,55 @@ +read($size); ) { + $c .= $bytes; + $size = $v->validateCharacter($c); + if (-1 == $size) { + throw new Exception( ... invalid char .. ); + } elseif (0 == $size) { + return $c; //next character in $os + } + } + + */ + + private $_reader; + + public function setUp() + { + $this->_reader = new Swift_CharacterReader_UsAsciiReader(); + } + + public function testAllValidAsciiCharactersReturnZero() + { + for ($ordinal = 0x00; $ordinal <= 0x7F; ++$ordinal) { + $this->assertIdentical( + 0, $this->_reader->validateByteSequence(array($ordinal), 1) + ); + } + } + + public function testMultipleBytesAreInvalid() + { + for ($ordinal = 0x00; $ordinal <= 0x7F; $ordinal += 2) { + $this->assertIdentical( + -1, $this->_reader->validateByteSequence(array($ordinal, $ordinal + 1), 2) + ); + } + } + + public function testBytesAboveAsciiRangeAreInvalid() + { + for ($ordinal = 0x80; $ordinal <= 0xFF; ++$ordinal) { + $this->assertIdentical( + -1, $this->_reader->validateByteSequence(array($ordinal), 1) + ); + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php new file mode 100644 index 0000000..02e21b1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterReader/Utf8ReaderTest.php @@ -0,0 +1,68 @@ +_reader = new Swift_CharacterReader_Utf8Reader(); + } + + public function testLeading7BitOctetCausesReturnZero() + { + for ($ordinal = 0x00; $ordinal <= 0x7F; ++$ordinal) { + $this->assertIdentical( + 0, $this->_reader->validateByteSequence(array($ordinal), 1) + ); + } + } + + public function testLeadingByteOf2OctetCharCausesReturn1() + { + for ($octet = 0xC0; $octet <= 0xDF; ++$octet) { + $this->assertIdentical( + 1, $this->_reader->validateByteSequence(array($octet), 1) + ); + } + } + + public function testLeadingByteOf3OctetCharCausesReturn2() + { + for ($octet = 0xE0; $octet <= 0xEF; ++$octet) { + $this->assertIdentical( + 2, $this->_reader->validateByteSequence(array($octet), 1) + ); + } + } + + public function testLeadingByteOf4OctetCharCausesReturn3() + { + for ($octet = 0xF0; $octet <= 0xF7; ++$octet) { + $this->assertIdentical( + 3, $this->_reader->validateByteSequence(array($octet), 1) + ); + } + } + + public function testLeadingByteOf5OctetCharCausesReturn4() + { + for ($octet = 0xF8; $octet <= 0xFB; ++$octet) { + $this->assertIdentical( + 4, $this->_reader->validateByteSequence(array($octet),1) + ); + } + } + + public function testLeadingByteOf6OctetCharCausesReturn5() + { + for ($octet = 0xFC; $octet <= 0xFD; ++$octet) { + $this->assertIdentical( + 5, $this->_reader->validateByteSequence(array($octet),1) + ); + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php new file mode 100644 index 0000000..3944622 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/CharacterStream/ArrayCharacterStreamTest.php @@ -0,0 +1,374 @@ +_getReader(); + $factory = $this->_getFactory($reader); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-sequence'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importString(pack('C*', + 0xD0, 0x94, + 0xD0, 0xB6, + 0xD0, 0xBE, + 0xD1, 0x8D, + 0xD0, 0xBB, + 0xD0, 0xB0 + ) + ); + } + + public function testCharactersWrittenUseValidator() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-sequence'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE)); + + $stream->write(pack('C*', + 0xD0, 0xBB, + 0xD1, 0x8E, + 0xD0, 0xB1, + 0xD1, 0x8B, + 0xD1, 0x85 + ) + ); + } + + public function testReadCharactersAreInTact() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-sequence'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + //String + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + //Stream + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE)); + + $stream->write(pack('C*', + 0xD0, 0xBB, + 0xD1, 0x8E, + 0xD0, 0xB1, + 0xD1, 0x8B, + 0xD1, 0x85 + ) + ); + + $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94), $stream->read(1)); + $this->assertIdenticalBinary( + pack('C*', 0xD0, 0xB6, 0xD0, 0xBE), $stream->read(2) + ); + $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBB), $stream->read(1)); + $this->assertIdenticalBinary( + pack('C*', 0xD1, 0x8E, 0xD0, 0xB1, 0xD1, 0x8B), $stream->read(3) + ); + $this->assertIdenticalBinary(pack('C*', 0xD1, 0x85), $stream->read(1)); + + $this->assertIdentical(false, $stream->read(1)); + } + + public function testCharactersCanBeReadAsByteArrays() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-sequence'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + //String + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + //Stream + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD1), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE)); + + $stream->write(pack('C*', + 0xD0, 0xBB, + 0xD1, 0x8E, + 0xD0, 0xB1, + 0xD1, 0x8B, + 0xD1, 0x85 + ) + ); + + $this->assertEqual(array(0xD0, 0x94), $stream->readBytes(1)); + $this->assertEqual(array(0xD0, 0xB6, 0xD0, 0xBE), $stream->readBytes(2)); + $this->assertEqual(array(0xD0, 0xBB), $stream->readBytes(1)); + $this->assertEqual( + array(0xD1, 0x8E, 0xD0, 0xB1, 0xD1, 0x8B), $stream->readBytes(3) + ); + $this->assertEqual(array(0xD1, 0x85), $stream->readBytes(1)); + + $this->assertIdentical(false, $stream->readBytes(1)); + } + + public function testRequestingLargeCharCountPastEndOfStream() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-sequence'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE)); + + $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE), + $stream->read(100) + ); + + $this->assertIdentical(false, $stream->read(1)); + } + + public function testRequestingByteArrayCountPastEndOfStream() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-sequence'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE)); + + $this->assertEqual(array(0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE), + $stream->readBytes(100) + ); + + $this->assertIdentical(false, $stream->readBytes(1)); + } + + public function testPointerOffsetCanBeSet() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-sequence'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE)); + + $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94), $stream->read(1)); + + $stream->setPointer(0); + + $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94), $stream->read(1)); + + $stream->setPointer(2); + + $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBE), $stream->read(1)); + } + + public function testContentsCanBeFlushed() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-sequence'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importString(pack('C*', 0xD0, 0x94, 0xD0, 0xB6, 0xD0, 0xBE)); + + $stream->flushContents(); + + $this->assertIdentical(false, $stream->read(1)); + } + + public function testByteStreamCanBeImportingUsesValidator() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + $os = $this->_getByteStream(); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-stream'); + $this->_checking(Expectations::create() + -> between(0,1)->of($os)->setReadPointer(0) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xD0)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0x94)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xD0)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xB6)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xD0)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xBE)) + -> ignoring($os)->read(any()) -> returns(false) + ); + + $seq = $this->_mockery()->sequence('read-chars'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importByteStream($os); + } + + public function testImportingStreamProducesCorrectCharArray() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + $os = $this->_getByteStream(); + + $stream = new Swift_CharacterStream_ArrayCharacterStream($factory, 'utf-8'); + + $seq = $this->_mockery()->sequence('read-stream'); + $this->_checking(Expectations::create() + -> between(0,1)->of($os)->setReadPointer(0) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xD0)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0x94)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xD0)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xB6)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xD0)) + -> one($os)->read(any()) -> inSequence($seq) -> returns(pack('C*', 0xBE)) + -> ignoring($os)->read(any()) -> returns(false) + ); + + $seq = $this->_mockery()->sequence('read-chars'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + -> one($reader)->validateByteSequence(array(0xD0), 1) -> inSequence($seq) -> returns(1) + ); + + $stream->importByteStream($os); + + $this->assertIdenticalBinary(pack('C*', 0xD0, 0x94), $stream->read(1)); + $this->assertIdenticalBinary(pack('C*', 0xD0, 0xB6), $stream->read(1)); + $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBE), $stream->read(1)); + + $this->assertIdentical(false, $stream->read(1)); + } + + public function testAlgorithmWithFixedWidthCharsets() + { + $reader = $this->_getReader(); + $factory = $this->_getFactory($reader); + + $seq = $this->_mockery()->sequence('read-chars'); + $this->_checking(Expectations::create() + -> ignoring($reader)->getInitialByteSize() -> returns(2) + -> one($reader)->validateByteSequence(array(0xD1, 0x8D), 2) -> inSequence($seq) + -> one($reader)->validateByteSequence(array(0xD0, 0xBB), 2) -> inSequence($seq) + -> one($reader)->validateByteSequence(array(0xD0, 0xB0), 2) -> inSequence($seq) + ); + + $stream = new Swift_CharacterStream_ArrayCharacterStream( + $factory, 'utf-8' + ); + $stream->importString(pack('C*', 0xD1, 0x8D, 0xD0, 0xBB, 0xD0, 0xB0)); + + $this->assertIdenticalBinary(pack('C*', 0xD1, 0x8D), $stream->read(1)); + $this->assertIdenticalBinary(pack('C*', 0xD0, 0xBB), $stream->read(1)); + $this->assertIdenticalBinary(pack('C*', 0xD0, 0xB0), $stream->read(1)); + + $this->assertIdentical(false, $stream->read(1)); + } + + // -- Creation methods + + private function _getReader() + { + return $this->_mock('Swift_CharacterReader'); + } + + private function _getFactory($reader) + { + $factory = $this->_mock('Swift_CharacterReaderFactory'); + $this->_checking(Expectations::create() + -> allowing($factory)->getReaderFor('utf-8') -> returns($reader) + ); + return $factory; + } + + private function _getByteStream() + { + return $this->_mock('Swift_OutputByteStream'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php new file mode 100644 index 0000000..9aac193 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/DependencyContainerTest.php @@ -0,0 +1,175 @@ +arg1 = $arg1; + $this->arg2 = $arg2; + } +} + +class Swift_DependencyContainerTest extends Swift_Tests_SwiftUnitTestCase +{ + private $_container; + + public function setUp() + { + $this->_container = new Swift_DependencyContainer(); + } + + public function testRegisterAndLookupValue() + { + $this->_container->register('foo')->asValue('bar'); + $this->assertIdentical('bar', $this->_container->lookup('foo')); + } + + public function testHasReturnsTrueForRegisteredValue() + { + $this->_container->register('foo')->asValue('bar'); + $this->assertTrue($this->_container->has('foo')); + } + + public function testHasReturnsFalseForUnregisteredValue() + { + $this->assertFalse($this->_container->has('foo')); + } + + public function testRegisterAndLookupNewInstance() + { + $this->_container->register('one')->asNewInstanceOf('One'); + $this->assertIsA($this->_container->lookup('one'), 'One'); + } + + public function testHasReturnsTrueForRegisteredInstance() + { + $this->_container->register('one')->asNewInstanceOf('One'); + $this->assertTrue($this->_container->has('one')); + } + + public function testNewInstanceIsAlwaysNew() + { + $this->_container->register('one')->asNewInstanceOf('One'); + $a = $this->_container->lookup('one'); + $b = $this->_container->lookup('one'); + $this->assertClone($a, $b); + } + + public function testRegisterAndLookupSharedInstance() + { + $this->_container->register('one')->asSharedInstanceOf('One'); + $this->assertIsA($this->_container->lookup('one'), 'One'); + } + + public function testHasReturnsTrueForSharedInstance() + { + $this->_container->register('one')->asSharedInstanceOf('One'); + $this->assertTrue($this->_container->has('one')); + } + + public function testMultipleSharedInstancesAreSameInstance() + { + $this->_container->register('one')->asSharedInstanceOf('One'); + $a = $this->_container->lookup('one'); + $b = $this->_container->lookup('one'); + $this->assertSame($a, $b); + } + + public function testNewInstanceWithDependencies() + { + $this->_container->register('foo')->asValue('FOO'); + $this->_container->register('one')->asNewInstanceOf('One') + ->withDependencies(array('foo')); + $obj = $this->_container->lookup('one'); + $this->assertIdentical('FOO', $obj->arg1); + } + + public function testNewInstanceWithMultipleDependencies() + { + $this->_container->register('foo')->asValue('FOO'); + $this->_container->register('bar')->asValue(42); + $this->_container->register('one')->asNewInstanceOf('One') + ->withDependencies(array('foo', 'bar')); + $obj = $this->_container->lookup('one'); + $this->assertIdentical('FOO', $obj->arg1); + $this->assertIdentical(42, $obj->arg2); + } + + public function testNewInstanceWithInjectedObjects() + { + $this->_container->register('foo')->asValue('FOO'); + $this->_container->register('one')->asNewInstanceOf('One'); + $this->_container->register('two')->asNewInstanceOf('One') + ->withDependencies(array('one', 'foo')); + $obj = $this->_container->lookup('two'); + $this->assertClone($this->_container->lookup('one'), $obj->arg1); + $this->assertIdentical('FOO', $obj->arg2); + } + + public function testNewInstanceWithAddConstructorValue() + { + $this->_container->register('one')->asNewInstanceOf('One') + ->addConstructorValue('x') + ->addConstructorValue(99); + $obj = $this->_container->lookup('one'); + $this->assertIdentical('x', $obj->arg1); + $this->assertIdentical(99, $obj->arg2); + } + + public function testNewInstanceWithAddConstructorLookup() + { + $this->_container->register('foo')->asValue('FOO'); + $this->_container->register('bar')->asValue(42); + $this->_container->register('one')->asNewInstanceOf('One') + ->addConstructorLookup('foo') + ->addConstructorLookup('bar'); + + $obj = $this->_container->lookup('one'); + $this->assertIdentical('FOO', $obj->arg1); + $this->assertIdentical(42, $obj->arg2); + } + + public function testResolvedDependenciesCanBeLookedUp() + { + $this->_container->register('foo')->asValue('FOO'); + $this->_container->register('one')->asNewInstanceOf('One'); + $this->_container->register('two')->asNewInstanceOf('One') + ->withDependencies(array('one', 'foo')); + $deps = $this->_container->createDependenciesFor('two'); + $this->assertEqual( + array($this->_container->lookup('one'), 'FOO'), $deps + ); + } + + public function testArrayOfDependenciesCanBeSpecified() + { + $this->_container->register('foo')->asValue('FOO'); + $this->_container->register('one')->asNewInstanceOf('One'); + $this->_container->register('two')->asNewInstanceOf('One') + ->withDependencies(array(array('one', 'foo'), 'foo')); + + $obj = $this->_container->lookup('two'); + $this->assertEqual(array($this->_container->lookup('one'), 'FOO'), $obj->arg1); + $this->assertIdentical('FOO', $obj->arg2); + } + + public function testAliasCanBeSet() + { + $this->_container->register('foo')->asValue('FOO'); + $this->_container->register('bar')->asAliasOf('foo'); + + $this->assertIdentical('FOO', $this->_container->lookup('bar')); + } + + public function testAliasOfAliasCanBeSet() + { + $this->_container->register('foo')->asValue('FOO'); + $this->_container->register('bar')->asAliasOf('foo'); + $this->_container->register('zip')->asAliasOf('bar'); + $this->_container->register('button')->asAliasOf('zip'); + + $this->assertIdentical('FOO', $this->_container->lookup('button')); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php new file mode 100644 index 0000000..1a271ac --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Base64EncoderTest.php @@ -0,0 +1,175 @@ +_encoder = new Swift_Encoder_Base64Encoder(); + } + + /* + There's really no point in testing the entire base64 encoding to the + level QP encoding has been tested. base64_encode() has been in PHP for + years. + */ + + public function testInputOutputRatioIs3to4Bytes() + { + /* + RFC 2045, 6.8 + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + */ + + $this->assertEqual( + 'MTIz', $this->_encoder->encodeString('123'), + '%s: 3 bytes of input should yield 4 bytes of output' + ); + $this->assertEqual( + 'MTIzNDU2', $this->_encoder->encodeString('123456'), + '%s: 6 bytes in input should yield 8 bytes of output' + ); + $this->assertEqual( + 'MTIzNDU2Nzg5', $this->_encoder->encodeString('123456789'), + '%s: 9 bytes in input should yield 12 bytes of output' + ); + } + + public function testPadLength() + { + /* + RFC 2045, 6.8 + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a body. When fewer than 24 input bits + are available in an input group, zero bits are added (on the right) + to form an integral number of 6-bit groups. Padding at the end of + the data is performed using the "=" character. Since all base64 + input is an integral number of octets, only the following cases can + arise: (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded output will be + an integral multiple of 4 characters with no "=" padding, (2) the + final quantum of encoding input is exactly 8 bits; here, the final + unit of encoded output will be two characters followed by two "=" + padding characters, or (3) the final quantum of encoding input is + exactly 16 bits; here, the final unit of encoded output will be three + characters followed by one "=" padding character. + */ + + for ($i = 0; $i < 30; ++$i) { + $input = pack('C', rand(0, 255)); + $this->assertPattern( + '~^[a-zA-Z0-9/\+]{2}==$~', $this->_encoder->encodeString($input), + '%s: A single byte should have 2 bytes of padding' + ); + } + + for ($i = 0; $i < 30; ++$i) { + $input = pack('C*', rand(0, 255), rand(0, 255)); + $this->assertPattern( + '~^[a-zA-Z0-9/\+]{3}=$~', $this->_encoder->encodeString($input), + '%s: Two bytes should have 1 byte of padding' + ); + } + + for ($i = 0; $i < 30; ++$i) { + $input = pack('C*', rand(0, 255), rand(0, 255), rand(0, 255)); + $this->assertPattern( + '~^[a-zA-Z0-9/\+]{4}$~', $this->_encoder->encodeString($input), + '%s: Three bytes should have no padding' + ); + } + } + + public function testMaximumLineLengthIs76Characters() + { + /* + The encoded output stream must be represented in lines of no more + than 76 characters each. All line breaks or other characters not + found in Table 1 must be ignored by decoding software. + */ + + $input = + 'abcdefghijklmnopqrstuvwxyz' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . + '1234567890' . + 'abcdefghijklmnopqrstuvwxyz' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . + '1234567890' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + $output = + 'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQk' . //38 + 'NERUZHSElKS0xNTk9QUVJTVFVWV1hZWjEyMzQ1' . "\r\n" . //76 * + 'Njc4OTBhYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3' . //38 + 'h5ekFCQ0RFRkdISUpLTE1OT1BRUlNUVVZXWFla' . "\r\n" . //76 * + 'MTIzNDU2Nzg5MEFCQ0RFRkdISUpLTE1OT1BRUl' . //38 + 'NUVVZXWFla'; //48 + + $this->assertEqual( + $output, $this->_encoder->encodeString($input), + '%s: Lines should be no more than 76 characters' + ); + } + + public function testMaximumLineLengthCanBeSpecified() + { + $input = + 'abcdefghijklmnopqrstuvwxyz' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . + '1234567890' . + 'abcdefghijklmnopqrstuvwxyz' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . + '1234567890' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + $output = + 'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQk' . //38 + 'NERUZHSElKS0' . "\r\n" . //50 * + 'xNTk9QUVJTVFVWV1hZWjEyMzQ1Njc4OTBhYmNk' . //38 + 'ZWZnaGlqa2xt' . "\r\n" . //50 * + 'bm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpLTE1OT1' . //38 + 'BRUlNUVVZXWF' . "\r\n" . //50 * + 'laMTIzNDU2Nzg5MEFCQ0RFRkdISUpLTE1OT1BR' . //38 + 'UlNUVVZXWFla'; //50 * + + $this->assertEqual( + $output, $this->_encoder->encodeString($input, 0, 50), + '%s: Lines should be no more than 100 characters' + ); + } + + public function testFirstLineLengthCanBeDifferent() + { + $input = + 'abcdefghijklmnopqrstuvwxyz' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . + '1234567890' . + 'abcdefghijklmnopqrstuvwxyz' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' . + '1234567890' . + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + + $output = + 'YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQk' . //38 + 'NERUZHSElKS0xNTk9QU' . "\r\n" . //57 * + 'VJTVFVWV1hZWjEyMzQ1Njc4OTBhYmNkZWZnaGl' . //38 + 'qa2xtbm9wcXJzdHV2d3h5ekFCQ0RFRkdISUpLT' . "\r\n" . //76 * + 'E1OT1BRUlNUVVZXWFlaMTIzNDU2Nzg5MEFCQ0R' . //38 + 'FRkdISUpLTE1OT1BRUlNUVVZXWFla'; //67 + + $this->assertEqual( + $output, $this->_encoder->encodeString($input, 19), + '%s: First line offset is 19 so first line should be 57 chars long' + ); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php new file mode 100644 index 0000000..e87b26d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/QpEncoderTest.php @@ -0,0 +1,361 @@ +_createCharStream(); + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importString($char) + -> one($charStream)->readBytes(optional()) -> returns(array($ordinal)) + -> atLeast(1)->of($charStream)->readBytes(optional()) -> returns(false) + ); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + + $this->assertIdenticalBinary($char, $encoder->encodeString($char)); + } + } + + public function testWhiteSpaceAtLineEndingIsEncoded() + { + /* -- RFC 2045, 6.7 -- + (3) (White Space) Octets with values of 9 and 32 MAY be + represented as US-ASCII TAB (HT) and SPACE characters, + respectively, but MUST NOT be so represented at the end + of an encoded line. Any TAB (HT) or SPACE characters + on an encoded line MUST thus be followed on that line + by a printable character. In particular, an "=" at the + end of an encoded line, indicating a soft line break + (see rule #5) may follow one or more TAB (HT) or SPACE + characters. It follows that an octet with decimal + value 9 or 32 appearing at the end of an encoded line + must be represented according to Rule #1. This rule is + necessary because some MTAs (Message Transport Agents, + programs which transport messages from one user to + another, or perform a portion of such transfers) are + known to pad lines of text with SPACEs, and others are + known to remove "white space" characters from the end + of a line. Therefore, when decoding a Quoted-Printable + body, any trailing white space on a line must be + deleted, as it will necessarily have been added by + intermediate transport agents. + */ + + $HT = chr(0x09); //9 + $SPACE = chr(0x20); //32 + + //HT + $string = 'a' . $HT . $HT . "\r\n" . 'b'; + + $seq = $this->_mockery()->sequence('byte-sequence'); + $charStream = $this->_createCharStream(); + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importString($string) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('a'))) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x09)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x09)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0D)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0A)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('b'))) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(false) + ); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + $this->assertEqual( + 'a' . $HT . '=09' . "\r\n" . 'b', + $encoder->encodeString($string) + ); + + //SPACE + $string = 'a' . $SPACE . $SPACE . "\r\n" . 'b'; + + $seq = $this->_mockery()->sequence('byte-sequence'); + $charStream = $this->_createCharStream(); + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importString($string) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('a'))) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x20)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x20)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0D)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0A)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('b'))) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(false) + ); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + $this->assertEqual( + 'a' . $SPACE . '=20' . "\r\n" . 'b', + $encoder->encodeString($string) + ); + } + + public function testCRLFIsLeftAlone() + { + /* + (4) (Line Breaks) A line break in a text body, represented + as a CRLF sequence in the text canonical form, must be + represented by a (RFC 822) line break, which is also a + CRLF sequence, in the Quoted-Printable encoding. Since + the canonical representation of media types other than + text do not generally include the representation of + line breaks as CRLF sequences, no hard line breaks + (i.e. line breaks that are intended to be meaningful + and to be displayed to the user) can occur in the + quoted-printable encoding of such types. Sequences + like "=0D", "=0A", "=0A=0D" and "=0D=0A" will routinely + appear in non-text data represented in quoted- + printable, of course. + + Note that many implementations may elect to encode the + local representation of various content types directly + rather than converting to canonical form first, + encoding, and then converting back to local + representation. In particular, this may apply to plain + text material on systems that use newline conventions + other than a CRLF terminator sequence. Such an + implementation optimization is permissible, but only + when the combined canonicalization-encoding step is + equivalent to performing the three steps separately. + */ + + $string = 'a' . "\r\n" . 'b' . "\r\n" . 'c' . "\r\n"; + + $seq = $this->_mockery()->sequence('byte-sequence'); + $charStream = $this->_createCharStream(); + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importString($string) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('a'))) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0D)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0A)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('b'))) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0D)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0A)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('c'))) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0D)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(0x0A)) + -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(false) + ); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + $this->assertEqual($string, $encoder->encodeString($string)); + } + + public function testLinesLongerThan76CharactersAreSoftBroken() + { + /* + (5) (Soft Line Breaks) The Quoted-Printable encoding + REQUIRES that encoded lines be no more than 76 + characters long. If longer lines are to be encoded + with the Quoted-Printable encoding, "soft" line breaks + must be used. An equal sign as the last character on a + encoded line indicates such a non-significant ("soft") + line break in the encoded text. + */ + + $input = str_repeat('a', 140); + + $charStream = $this->_createCharStream(); + $seq = $this->_mockery()->sequence('byte-sequence'); + + $exps = Expectations::create(); + + $exps -> one($charStream)->flushContents() + -> one($charStream)->importString($input) + ; + + $output = ''; + for ($i = 0; $i < 140; ++$i) { + $exps -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('a'))); + + if (75 == $i) { + $output .= "=\r\n"; + } + $output .= 'a'; + } + + $exps -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(false); + + $this->_checking($exps); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + $this->assertEqual($output, $encoder->encodeString($input)); + } + + public function testMaxLineLengthCanBeSpecified() + { + $input = str_repeat('a', 100); + + $charStream = $this->_createCharStream(); + $seq = $this->_mockery()->sequence('byte-sequence'); + + $exps = Expectations::create(); + + $exps -> one($charStream)->flushContents() + -> one($charStream)->importString($input) + ; + + $output = ''; + for ($i = 0; $i < 100; ++$i) { + $exps -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('a'))); + + if (53 == $i) { + $output .= "=\r\n"; + } + $output .= 'a'; + } + $exps -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(false); + + $this->_checking($exps); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + $this->assertEqual($output, $encoder->encodeString($input, 0, 54)); + } + + public function testBytesBelowPermittedRangeAreEncoded() + { + /* + According to Rule (1 & 2) + */ + + foreach (range(0, 32) as $ordinal) { + $char = chr($ordinal); + + $charStream = $this->_createCharStream(); + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importString($char) + -> one($charStream)->readBytes(optional()) -> returns(array($ordinal)) + -> atLeast(1)->of($charStream)->readBytes(optional()) -> returns(false) + ); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + + $this->assertEqual( + sprintf('=%02X', $ordinal), $encoder->encodeString($char) + ); + } + } + + public function testDecimalByte61IsEncoded() + { + /* + According to Rule (1 & 2) + */ + + $char = '='; + + $charStream = $this->_createCharStream(); + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importString($char) + -> one($charStream)->readBytes(optional()) -> returns(array(61)) + -> atLeast(1)->of($charStream)->readBytes(optional()) -> returns(false) + ); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + + $this->assertEqual('=3D', $encoder->encodeString('=')); + } + + public function testBytesAbovePermittedRangeAreEncoded() + { + /* + According to Rule (1 & 2) + */ + + foreach (range(127, 255) as $ordinal) { + $char = chr($ordinal); + + $charStream = $this->_createCharStream(); + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importString($char) + -> one($charStream)->readBytes(optional()) -> returns(array($ordinal)) + -> atLeast(1)->of($charStream)->readBytes(optional()) -> returns(false) + ); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + + $this->assertEqual( + sprintf('=%02X', $ordinal), $encoder->encodeString($char) + ); + } + } + + public function testFirstLineLengthCanBeDifferent() + { + $input = str_repeat('a', 140); + + $charStream = $this->_createCharStream(); + $seq = $this->_mockery()->sequence('byte-sequence'); + + $exps = Expectations::create(); + + $exps -> one($charStream)->flushContents(); + $exps -> one($charStream)->importString($input); + + $output = ''; + for ($i = 0; $i < 140; ++$i) { + $exps -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(array(ord('a'))); + + if (53 == $i || 53 + 75 == $i) { + $output .= "=\r\n"; + } + $output .= 'a'; + } + + $exps -> one($charStream)->readBytes(optional()) -> inSequence($seq) -> returns(false); + + $this->_checking($exps); + + $encoder = new Swift_Encoder_QpEncoder($charStream); + $this->assertEqual( + $output, $encoder->encodeString($input, 22), + '%s: First line should start at offset 22 so can only have max length 54' + ); + } + + // -- Creation methods + + private function _createCharStream() + { + return $this->_mock('Swift_CharacterStream'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php new file mode 100644 index 0000000..62abb50 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Encoder/Rfc2231EncoderTest.php @@ -0,0 +1,144 @@ +_mock('Swift_CharacterStream'); + $seq = $this->_sequence('byte-sequence'); + + $string = ''; + foreach (range(0x00, 0x7F) as $octet) { + $char = pack('C', $octet); + $string .= $char; + $this->_checking(Expectations::create() + -> one($charStream)->read(optional()) -> inSequence($seq) -> returns($char) + ); + } + $this->_checking(Expectations::create() + -> atLeast(1)->of($charStream)->read(optional()) -> inSequence($seq) -> returns(false) + -> one($charStream)->importString($string) + -> ignoring($charStream)->flushContents() + ); + + $encoder = new Swift_Encoder_Rfc2231Encoder($charStream); + $encoded = $encoder->encodeString($string); + + foreach (explode("\r\n", $encoded) as $line) { + $this->assertPattern($this->_rfc2045Token, $line, + '%s: Encoder should always return a valid RFC 2045 token.'); + } + + + } + + public function testEncodingNonAsciiCharactersProducesValidToken() + { + $charStream = $this->_mock('Swift_CharacterStream'); + $seq = $this->_sequence('byte-sequence'); + + $string = ''; + foreach (range(0x80, 0xFF) as $octet) { + $char = pack('C', $octet); + $string .= $char; + $this->_checking(Expectations::create() + -> one($charStream)->read(optional()) -> inSequence($seq) -> returns($char) + ); + } + $this->_checking(Expectations::create() + -> atLeast(1)->of($charStream)->read(optional()) -> inSequence($seq) -> returns(false) + -> one($charStream)->importString($string) + -> ignoring($charStream)->flushContents() + ); + $encoder = new Swift_Encoder_Rfc2231Encoder($charStream); + + $encoded = $encoder->encodeString($string); + + foreach (explode("\r\n", $encoded) as $line) { + $this->assertPattern($this->_rfc2045Token, $line, + '%s: Encoder should always return a valid RFC 2045 token.'); + } + + + } + + public function testMaximumLineLengthCanBeSet() + { + $charStream = $this->_mock('Swift_CharacterStream'); + $seq = $this->_sequence('byte-sequence'); + + $string = ''; + for ($x = 0; $x < 200; ++$x) { + $char = 'a'; + $string .= $char; + $this->_checking(Expectations::create() + -> one($charStream)->read(optional()) -> inSequence($seq) -> returns($char) + ); + } + $this->_checking(Expectations::create() + -> atLeast(1)->of($charStream)->read(optional()) -> inSequence($seq) -> returns(false) + -> one($charStream)->importString($string) + -> ignoring($charStream)->flushContents() + ); + $encoder = new Swift_Encoder_Rfc2231Encoder($charStream); + + $encoded = $encoder->encodeString($string, 0, 75); + + $this->assertEqual( + str_repeat('a', 75) . "\r\n" . + str_repeat('a', 75) . "\r\n" . + str_repeat('a', 50), + $encoded, + '%s: Lines should be wrapped at each 75 characters' + ); + + + } + + public function testFirstLineCanHaveShorterLength() + { + $charStream = $this->_mock('Swift_CharacterStream'); + $seq = $this->_sequence('byte-sequence'); + + $string = ''; + for ($x = 0; $x < 200; ++$x) { + $char = 'a'; + $string .= $char; + $this->_checking(Expectations::create() + -> one($charStream)->read(optional()) -> inSequence($seq) -> returns($char) + ); + } + $this->_checking(Expectations::create() + -> atLeast(1)->of($charStream)->read(optional()) -> inSequence($seq) -> returns(false) + -> one($charStream)->importString($string) + -> ignoring($charStream)->flushContents() + ); + $encoder = new Swift_Encoder_Rfc2231Encoder($charStream); + $encoded = $encoder->encodeString($string, 25, 75); + + $this->assertEqual( + str_repeat('a', 50) . "\r\n" . + str_repeat('a', 75) . "\r\n" . + str_repeat('a', 75), + $encoded, + '%s: First line should be 25 bytes shorter than the others.' + ); + + + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php new file mode 100644 index 0000000..dee6613 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/CommandEventTest.php @@ -0,0 +1,41 @@ +_createEvent($this->_createTransport(), "FOO\r\n"); + $this->assertEqual("FOO\r\n", $evt->getCommand()); + } + + public function testSuccessCodesCanBeFetchedViaGetter() + { + $evt = $this->_createEvent($this->_createTransport(), "FOO\r\n", array(250)); + $this->assertEqual(array(250), $evt->getSuccessCodes()); + } + + public function testSourceIsBuffer() + { + $transport = $this->_createTransport(); + $evt = $this->_createEvent($transport, "FOO\r\n"); + $ref = $evt->getSource(); + $this->assertReference($transport, $ref); + } + + // -- Creation Methods + + private function _createEvent(Swift_Transport $source, $command, + $successCodes = array()) + { + return new Swift_Events_CommandEvent($source, $command, $successCodes); + } + + private function _createTransport() + { + return $this->_stub('Swift_Transport'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php new file mode 100644 index 0000000..f6fab7f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/EventObjectTest.php @@ -0,0 +1,37 @@ +_createEvent($source); + $ref = $evt->getSource(); + $this->assertReference($source, $ref); + } + + public function testEventDoesNotHaveCancelledBubbleWhenNew() + { + $source = new stdClass(); + $evt = $this->_createEvent($source); + $this->assertFalse($evt->bubbleCancelled()); + } + + public function testBubbleCanBeCancelledInEvent() + { + $source = new stdClass(); + $evt = $this->_createEvent($source); + $evt->cancelBubble(); + $this->assertTrue($evt->bubbleCancelled()); + } + + // -- Creation Methods + + private function _createEvent($source) + { + return new Swift_Events_EventObject($source); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php new file mode 100644 index 0000000..adb4700 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/ResponseEventTest.php @@ -0,0 +1,44 @@ +_createEvent($this->_createTransport(), "250 Ok\r\n", true); + $this->assertEqual("250 Ok\r\n", $evt->getResponse(), + '%s: Response should be available via getResponse()' + ); + } + + public function testResultCanBeFetchedViaGetter() + { + $evt = $this->_createEvent($this->_createTransport(), "250 Ok\r\n", false); + $this->assertFalse($evt->isValid(), + '%s: Result should be checkable via isValid()' + ); + } + + public function testSourceIsBuffer() + { + $transport = $this->_createTransport(); + $evt = $this->_createEvent($transport, "250 Ok\r\n", true); + $ref = $evt->getSource(); + $this->assertReference($transport, $ref); + } + + // -- Creation Methods + + private function _createEvent(Swift_Transport $source, $response, $result) + { + return new Swift_Events_ResponseEvent($source, $response, $result); + } + + private function _createTransport() + { + return $this->_stub('Swift_Transport'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php new file mode 100644 index 0000000..446a6e2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SendEventTest.php @@ -0,0 +1,103 @@ +_createMessage(); + $transport = $this->_createTransport(); + + $evt = $this->_createEvent($transport, $message); + + $ref = $evt->getMessage(); + $this->assertReference($message, $ref, + '%s: Message should be returned from getMessage()' + ); + } + + public function testTransportCanBeFetchViaGetter() + { + $message = $this->_createMessage(); + $transport = $this->_createTransport(); + + $evt = $this->_createEvent($transport, $message); + + $ref = $evt->getTransport(); + $this->assertReference($transport, $ref, + '%s: Transport should be returned from getTransport()' + ); + } + + public function testTransportCanBeFetchViaGetSource() + { + $message = $this->_createMessage(); + $transport = $this->_createTransport(); + + $evt = $this->_createEvent($transport, $message); + + $ref = $evt->getSource(); + $this->assertReference($transport, $ref, + '%s: Transport should be returned from getSource()' + ); + } + + public function testResultCanBeSetAndGet() + { + $message = $this->_createMessage(); + $transport = $this->_createTransport(); + + $evt = $this->_createEvent($transport, $message); + + $evt->setResult( + Swift_Events_SendEvent::RESULT_SUCCESS | Swift_Events_SendEvent::RESULT_TENTATIVE + ); + + $this->assertTrue($evt->getResult() & Swift_Events_SendEvent::RESULT_SUCCESS); + $this->assertTrue($evt->getResult() & Swift_Events_SendEvent::RESULT_TENTATIVE); + } + + public function testFailedRecipientsCanBeSetAndGet() + { + $message = $this->_createMessage(); + $transport = $this->_createTransport(); + + $evt = $this->_createEvent($transport, $message); + + $evt->setFailedRecipients(array('foo@bar', 'zip@button')); + + $this->assertEqual(array('foo@bar', 'zip@button'), $evt->getFailedRecipients(), + '%s: FailedRecipients should be returned from getter' + ); + } + + public function testFailedRecipientsGetsPickedUpCorrectly() { + $message = $this->_createMessage(); + $transport = $this->_createTransport(); + + $evt = $this->_createEvent($transport, $message); + $this->assertEqual(array(), $evt->getFailedRecipients()); + } + + // -- Creation Methods + + private function _createEvent(Swift_Transport $source, + Swift_Mime_Message $message) + { + return new Swift_Events_SendEvent($source, $message); + } + + private function _createTransport() + { + return $this->_stub('Swift_Transport'); + } + + private function _createMessage() + { + return $this->_stub('Swift_Mime_Message'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php new file mode 100644 index 0000000..e4449fa --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/SimpleEventDispatcherTest.php @@ -0,0 +1,166 @@ +_dispatcher = new Swift_Events_SimpleEventDispatcher(); + } + + public function testSendEventCanBeCreated() + { + $transport = $this->_stub('Swift_Transport'); + $message = $this->_stub('Swift_Mime_Message'); + $evt = $this->_dispatcher->createSendEvent($transport, $message); + $this->assertIsA($evt, 'Swift_Events_SendEvent'); + $this->assertSame($message, $evt->getMessage()); + $this->assertSame($transport, $evt->getTransport()); + } + + public function testCommandEventCanBeCreated() + { + $buf = $this->_stub('Swift_Transport'); + $evt = $this->_dispatcher->createCommandEvent($buf, "FOO\r\n", array(250)); + $this->assertIsA($evt, 'Swift_Events_CommandEvent'); + $this->assertSame($buf, $evt->getSource()); + $this->assertEqual("FOO\r\n", $evt->getCommand()); + $this->assertEqual(array(250), $evt->getSuccessCodes()); + } + + public function testResponseEventCanBeCreated() + { + $buf = $this->_stub('Swift_Transport'); + $evt = $this->_dispatcher->createResponseEvent($buf, "250 Ok\r\n", true); + $this->assertIsA($evt, 'Swift_Events_ResponseEvent'); + $this->assertSame($buf, $evt->getSource()); + $this->assertEqual("250 Ok\r\n", $evt->getResponse()); + $this->assertTrue($evt->isValid()); + } + + public function testTransportChangeEventCanBeCreated() + { + $transport = $this->_stub('Swift_Transport'); + $evt = $this->_dispatcher->createTransportChangeEvent($transport); + $this->assertIsA($evt, 'Swift_Events_TransportChangeEvent'); + $this->assertSame($transport, $evt->getSource()); + } + + public function testTransportExceptionEventCanBeCreated() + { + $transport = $this->_stub('Swift_Transport'); + $ex = new Swift_TransportException(''); + $evt = $this->_dispatcher->createTransportExceptionEvent($transport, $ex); + $this->assertIsA($evt, 'Swift_Events_TransportExceptionEvent'); + $this->assertSame($transport, $evt->getSource()); + $this->assertSame($ex, $evt->getException()); + } + + public function testListenersAreNotifiedOfDispatchedEvent() + { + $transport = $this->_stub('Swift_Transport'); + + $evt = $this->_dispatcher->createTransportChangeEvent($transport); + + $listenerA = $this->_mock('Swift_Events_TransportChangeListener'); + $listenerB = $this->_mock('Swift_Events_TransportChangeListener'); + + $this->_dispatcher->bindEventListener($listenerA); + $this->_dispatcher->bindEventListener($listenerB); + + $this->_checking(Expectations::create() + -> one($listenerA)->transportStarted($evt) + -> one($listenerB)->transportStarted($evt) + ); + + $this->_dispatcher->dispatchEvent($evt, 'transportStarted'); + } + + public function testListenersAreOnlyCalledIfImplementingCorrectInterface() + { + $transport = $this->_stub('Swift_Transport'); + $message = $this->_stub('Swift_Mime_Message'); + + $evt = $this->_dispatcher->createSendEvent($transport, $message); + + $targetListener = $this->_mock('Swift_Events_SendListener'); + $otherListener = $this->_mock('Swift_Events_TransportChangeListener'); + + $this->_dispatcher->bindEventListener($targetListener); + $this->_dispatcher->bindEventListener($otherListener); + + $this->_checking(Expectations::create() + -> one($targetListener)->sendPerformed($evt) + -> never($otherListener) + ); + + $this->_dispatcher->dispatchEvent($evt, 'sendPerformed'); + } + + public function testListenersCanCancelBubblingOfEvent() + { + $transport = $this->_stub('Swift_Transport'); + $message = $this->_stub('Swift_Mime_Message'); + + $evt = $this->_dispatcher->createSendEvent($transport, $message); + + $listenerA = $this->_mock('Swift_Events_SendListener'); + $listenerB = $this->_mock('Swift_Events_SendListener'); + + $this->_dispatcher->bindEventListener($listenerA); + $this->_dispatcher->bindEventListener($listenerB); + + $this->_checking(Expectations::create() + -> one($listenerA)->sendPerformed($evt) -> calls(array($this, '_cancelBubble')) + -> never($listenerB) + ); + + $this->_dispatcher->dispatchEvent($evt, 'sendPerformed'); + + $this->assertTrue($evt->bubbleCancelled()); + } + + public function testAddingListenerTwiceDoesNotReceiveEventTwice() + { + $transport = $this->_stub('Swift_Transport'); + + $evt = $this->_dispatcher->createTransportChangeEvent($transport); + + $listener = $this->_mock('Swift_Events_TransportChangeListener'); + + $this->_dispatcher->bindEventListener($listener); + $this->_dispatcher->bindEventListener($listener); + + $this->_checking(Expectations::create() + -> one($listener)->transportStarted($evt) + -> never($listener)->transportStarted($evt) + ); + + $this->_dispatcher->dispatchEvent($evt, 'transportStarted'); + } + + // -- Mock callbacks + + public function _cancelBubble(Yay_Invocation $inv) + { + $args = $inv->getArguments(); + $args[0]->cancelBubble(true); + } + + // -- Private methods + + private function _createDispatcher(array $map) + { + $dispatcher = new Swift_Events_SimpleEventDispatcher($map); + return $dispatcher; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php new file mode 100644 index 0000000..b78e315 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportChangeEventTest.php @@ -0,0 +1,36 @@ +_createTransport(); + $evt = $this->_createEvent($transport); + $ref = $evt->getTransport(); + $this->assertReference($transport, $ref); + } + + public function testSourceIsTransport() + { + $transport = $this->_createTransport(); + $evt = $this->_createEvent($transport); + $ref = $evt->getSource(); + $this->assertReference($transport, $ref); + } + + // -- Creation Methods + + private function _createEvent(Swift_Transport $source) + { + return new Swift_Events_TransportChangeEvent($source); + } + + private function _createTransport() + { + return $this->_stub('Swift_Transport'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php new file mode 100644 index 0000000..430117a --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Events/TransportExceptionEventTest.php @@ -0,0 +1,49 @@ +_createException(); + $transport = $this->_createTransport(); + $evt = $this->_createEvent($transport, $ex); + $ref = $evt->getException(); + $this->assertReference($ex, $ref, + '%s: Exception should be available via getException()' + ); + } + + public function testSourceIsTransport() + { + $ex = $this->_createException(); + $transport = $this->_createTransport(); + $evt = $this->_createEvent($transport, $ex); + $ref = $evt->getSource(); + $this->assertReference($transport, $ref, + '%s: Transport should be available via getSource()' + ); + } + + // -- Creation Methods + + private function _createEvent(Swift_Transport $transport, + Swift_TransportException $ex) + { + return new Swift_Events_TransportExceptionEvent($transport, $ex); + } + + private function _createTransport() + { + return $this->_stub('Swift_Transport'); + } + + private function _createException() + { + return new Swift_TransportException(''); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php new file mode 100644 index 0000000..68ea3d1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/ArrayKeyCacheTest.php @@ -0,0 +1,242 @@ +_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('test', $cache->getString($this->_key1, 'foo')); + } + + public function testStringDataCanBeOverwritten() + { + $is = $this->_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $cache->setString( + $this->_key1, 'foo', 'whatever', Swift_KeyCache::MODE_WRITE + ); + + $this->assertEqual('whatever', $cache->getString($this->_key1, 'foo')); + } + + public function testStringDataCanBeAppended() + { + $is = $this->_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $cache->setString( + $this->_key1, 'foo', 'ing', Swift_KeyCache::MODE_APPEND + ); + + $this->assertEqual('testing', $cache->getString($this->_key1, 'foo')); + } + + public function testHasKeyReturnValue() + { + $is = $this->_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + + $this->assertTrue($cache->hasKey($this->_key1, 'foo')); + } + + public function testNsKeyIsWellPartitioned() + { + $is = $this->_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $cache->setString( + $this->_key2, 'foo', 'ing', Swift_KeyCache::MODE_WRITE + ); + + $this->assertEqual('test', $cache->getString($this->_key1, 'foo')); + $this->assertEqual('ing', $cache->getString($this->_key2, 'foo')); + } + + public function testItemKeyIsWellPartitioned() + { + $is = $this->_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $cache->setString( + $this->_key1, 'bar', 'ing', Swift_KeyCache::MODE_WRITE + ); + + $this->assertEqual('test', $cache->getString($this->_key1, 'foo')); + $this->assertEqual('ing', $cache->getString($this->_key1, 'bar')); + } + + public function testByteStreamCanBeImported() + { + $os = $this->_createOutputStream(); + $this->_checking(Expectations::create() + -> one($os)->read(optional()) -> returns('abc') + -> one($os)->read(optional()) -> returns('def') + -> one($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + $is = $this->_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + $cache->importFromByteStream( + $this->_key1, 'foo', $os, Swift_KeyCache::MODE_WRITE + ); + $this->assertEqual('abcdef', $cache->getString($this->_key1, 'foo')); + } + + public function testByteStreamCanBeAppended() + { + $os1 = $this->_createOutputStream(); + $os2 = $this->_createOutputStream(); + $this->_checking(Expectations::create() + -> one($os1)->read(optional()) -> returns('abc') + -> one($os1)->read(optional()) -> returns('def') + -> one($os1)->read(optional()) -> returns(false) + -> ignoring($os1) + + -> one($os2)->read(optional()) -> returns('xyz') + -> one($os2)->read(optional()) -> returns('uvw') + -> one($os2)->read(optional()) -> returns(false) + -> ignoring($os2) + ); + $is = $this->_createKeyCacheInputStream(true); + + $cache = $this->_createCache($is); + + $cache->importFromByteStream( + $this->_key1, 'foo', $os1, Swift_KeyCache::MODE_APPEND + ); + $cache->importFromByteStream( + $this->_key1, 'foo', $os2, Swift_KeyCache::MODE_APPEND + ); + + $this->assertEqual('abcdefxyzuvw', $cache->getString($this->_key1, 'foo')); + } + + public function testByteStreamAndStringCanBeAppended() + { + $os = $this->_createOutputStream(); + $this->_checking(Expectations::create() + -> one($os)->read(optional()) -> returns('abc') + -> one($os)->read(optional()) -> returns('def') + -> one($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + $is = $this->_createKeyCacheInputStream(true); + + $cache = $this->_createCache($is); + + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_APPEND + ); + $cache->importFromByteStream( + $this->_key1, 'foo', $os, Swift_KeyCache::MODE_APPEND + ); + $this->assertEqual('testabcdef', $cache->getString($this->_key1, 'foo')); + } + + public function testDataCanBeExportedToByteStream() + { + //See acceptance test for more detail + $is = $this->_createInputStream(); + $this->_checking(Expectations::create() + -> atLeast(1)->of($is)->write(any()) + -> ignoring($is) + ); + $kcis = $this->_createKeyCacheInputStream(true); + + $cache = $this->_createCache($kcis); + + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + + $cache->exportToByteStream($this->_key1, 'foo', $is); + } + + public function testKeyCanBeCleared() + { + $is = $this->_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $this->assertTrue($cache->hasKey($this->_key1, 'foo')); + $cache->clearKey($this->_key1, 'foo'); + $this->assertFalse($cache->hasKey($this->_key1, 'foo')); + } + + public function testNsKeyCanBeCleared() + { + $is = $this->_createKeyCacheInputStream(true); + $cache = $this->_createCache($is); + + $cache->setString( + $this->_key1, 'foo', 'test', Swift_KeyCache::MODE_WRITE + ); + $cache->setString( + $this->_key1, 'bar', 'xyz', Swift_KeyCache::MODE_WRITE + ); + $this->assertTrue($cache->hasKey($this->_key1, 'foo')); + $this->assertTrue($cache->hasKey($this->_key1, 'bar')); + $cache->clearAll($this->_key1); + $this->assertFalse($cache->hasKey($this->_key1, 'foo')); + $this->assertFalse($cache->hasKey($this->_key1, 'bar')); + } + + // -- Creation methods + + private function _createCache($is) + { + return new Swift_KeyCache_ArrayKeyCache($is); + } + + private function _createKeyCacheInputStream($stub = false) + { + return $stub + ? $this->_stub('Swift_KeyCache_KeyCacheInputStream') + : $this->_mock('Swift_KeyCache_KeyCacheInputStream') + ; + } + + private function _createOutputStream($stub = false) + { + return $stub + ? $this->_stub('Swift_OutputByteStream') + : $this->_mock('Swift_OutputByteStream') + ; + } + + private function _createInputStream($stub = false) + { + return $stub + ? $this->_stub('Swift_InputByteStream') + : $this->_mock('Swift_InputByteStream') + ; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php new file mode 100644 index 0000000..94a86ba --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/KeyCache/SimpleKeyCacheInputStreamTest.php @@ -0,0 +1,77 @@ +_createKeyCache(); + $this->_checking(Expectations::create() + -> one($cache)->setString($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND) + -> one($cache)->setString($this->_nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND) + -> one($cache)->setString($this->_nsKey, 'foo', 'c', Swift_KeyCache::MODE_APPEND) + ); + + $stream = new Swift_KeyCache_SimpleKeyCacheInputStream(); + $stream->setKeyCache($cache); + $stream->setNsKey($this->_nsKey); + $stream->setItemKey('foo'); + + $stream->write('a'); + $stream->write('b'); + $stream->write('c'); + } + + public function testFlushContentClearsKey() + { + $cache = $this->_createKeyCache(); + $this->_checking(Expectations::create() + -> one($cache)->clearKey($this->_nsKey, 'foo') + ); + + $stream = new Swift_KeyCache_SimpleKeyCacheInputStream(); + $stream->setKeyCache($cache); + $stream->setNsKey($this->_nsKey); + $stream->setItemKey('foo'); + + $stream->flushBuffers(); + } + + public function testClonedStreamStillReferencesSameCache() + { + $cache = $this->_createKeyCache(); + $this->_checking(Expectations::create() + -> one($cache)->setString($this->_nsKey, 'foo', 'a', Swift_KeyCache::MODE_APPEND) + -> one($cache)->setString($this->_nsKey, 'foo', 'b', Swift_KeyCache::MODE_APPEND) + -> one($cache)->setString('test', 'bar', 'x', Swift_KeyCache::MODE_APPEND) + ); + + $stream = new Swift_KeyCache_SimpleKeyCacheInputStream(); + $stream->setKeyCache($cache); + $stream->setNsKey($this->_nsKey); + $stream->setItemKey('foo'); + + $stream->write('a'); + $stream->write('b'); + + $newStream = clone $stream; + $newStream->setKeyCache($cache); + $newStream->setNsKey('test'); + $newStream->setItemKey('bar'); + + $newStream->write('x'); + } + + // -- Creation Methods + + private function _createKeyCache() + { + return $this->_mock('Swift_KeyCache'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php new file mode 100644 index 0000000..f86b181 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mailer/ArrayRecipientIteratorTest.php @@ -0,0 +1,46 @@ +assertFalse($it->hasNext()); + } + + public function testHasNextReturnsTrueIfItemsLeft() + { + $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo')); + $this->assertTrue($it->hasNext()); + } + + public function testReadingToEndOfListCausesHasNextToReturnFalse() + { + $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo')); + $this->assertTrue($it->hasNext()); + $it->nextRecipient(); + $this->assertFalse($it->hasNext()); + } + + public function testReturnedValueHasPreservedKeyValuePair() + { + $it = new Swift_Mailer_ArrayRecipientIterator(array('foo@bar' => 'Foo')); + $this->assertEqual(array('foo@bar' => 'Foo'), $it->nextRecipient()); + } + + public function testIteratorMovesNextAfterEachIteration() + { + $it = new Swift_Mailer_ArrayRecipientIterator(array( + 'foo@bar' => 'Foo', + 'zip@button' => 'Zip thing', + 'test@test' => null + )); + $this->assertEqual(array('foo@bar' => 'Foo'), $it->nextRecipient()); + $this->assertEqual(array('zip@button' => 'Zip thing'), $it->nextRecipient()); + $this->assertEqual(array('test@test' => null), $it->nextRecipient()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php new file mode 100644 index 0000000..48c209d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/MailerTest.php @@ -0,0 +1,149 @@ +_createTransport(); + $message = $this->_createMessage(); + $con = $this->_states('Connection')->startsAs('off'); + $this->_checking(Expectations::create() + -> allowing($transport)->isStarted() -> returns(false) -> when($con->is('off')) + -> allowing($transport)->isStarted() -> returns(false) -> when($con->is('on')) + -> one($transport)->start() -> when($con->is('off')) -> then($con->is('on')) + -> ignoring($transport) + -> ignoring($message) + ); + + $mailer = $this->_createMailer($transport); + $mailer->send($message); + } + + public function testTransportIsOnlyStartedOnce() + { + $transport = $this->_createTransport(); + $message = $this->_createMessage(); + $con = $this->_states('Connection')->startsAs('off'); + $this->_checking(Expectations::create() + -> allowing($transport)->isStarted() -> returns(false) -> when($con->is('off')) + -> allowing($transport)->isStarted() -> returns(false) -> when($con->is('on')) + -> one($transport)->start() -> when($con->is('off')) -> then($con->is('on')) + -> ignoring($transport) + -> ignoring($message) + ); + $mailer = $this->_createMailer($transport); + for ($i = 0; $i < 10; ++$i) { + $mailer->send($message); + } + } + + public function testMessageIsPassedToTransport() + { + $transport = $this->_createTransport(); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> one($transport)->send($message, optional()) + -> ignoring($transport) + -> ignoring($message) + ); + + $mailer = $this->_createMailer($transport); + $mailer->send($message); + } + + public function testSendReturnsCountFromTransport() + { + $transport = $this->_createTransport(); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> one($transport)->send($message, optional()) -> returns(57) + -> ignoring($transport) + -> ignoring($message) + ); + + $mailer = $this->_createMailer($transport); + $this->assertEqual(57, $mailer->send($message)); + } + + public function testFailedRecipientReferenceIsPassedToTransport() + { + $failures = array(); + + $transport = $this->_createTransport(); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> one($transport)->send($message, reference($failures)) + -> ignoring($transport) + -> ignoring($message) + ); + + $mailer = $this->_createMailer($transport); + $mailer->send($message, $failures); + } + + public function testSendRecordsRfcComplianceExceptionAsEntireSendFailure() + { + $failures = array(); + + $rfcException = new Swift_RfcComplianceException('test'); + $transport = $this->_createTransport(); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array('foo&invalid' => 'Foo', 'bar@valid.tld' => 'Bar')) + -> one($transport)->send($message, reference($failures)) -> throws($rfcException) + -> ignoring($transport) + -> ignoring($message) + ); + + $mailer = $this->_createMailer($transport); + $this->assertEqual(0, $mailer->send($message, $failures), '%s: Should return 0'); + $this->assertEqual(array('foo&invalid', 'bar@valid.tld'), $failures, '%s: Failures should contain all addresses since the entire message failed to compile'); + } + + public function testRegisterPluginDelegatesToTransport() + { + $plugin = $this->_createPlugin(); + $transport = $this->_createTransport(); + $mailer = $this->_createMailer($transport); + + $this->_checking(Expectations::create() + -> one($transport)->registerPlugin($plugin) + ); + $mailer->registerPlugin($plugin); + } + + // -- Creation methods + + private function _createPlugin() + { + return $this->_mock('Swift_Events_EventListener'); + } + + private function _createTransport() + { + return $this->_mock('Swift_Transport'); + } + + private function _createMessage() + { + return $this->_mock('Swift_Mime_Message'); + } + + private function _createIterator() + { + return $this->_mock('Swift_Mailer_RecipientIterator'); + } + + private function _createMailer(Swift_Transport $transport) + { + return new Swift_Mailer($transport); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php new file mode 100644 index 0000000..a4fba32 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AbstractMimeEntityTest.php @@ -0,0 +1,1094 @@ +_createHeaderSet(); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $this->assertSame($headers, $entity->getHeaders()); + } + + public function testContentTypeIsReturnedFromHeader() + { + $ctype = $this->_createHeader('Content-Type', 'image/jpeg-test'); + $headers = $this->_createHeaderSet(array('Content-Type' => $ctype)); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $this->assertEqual('image/jpeg-test', $entity->getContentType()); + } + + public function testContentTypeIsSetInHeader() + { + $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false); + $headers = $this->_createHeaderSet(array('Content-Type' => $ctype)); + $this->_checking(Expectations::create() + -> one($ctype)->setFieldBodyModel('image/jpeg') + -> ignoring($ctype) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setContentType('image/jpeg'); + } + + public function testContentTypeHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addParameterizedHeader('Content-Type', 'image/jpeg') + -> ignoring($headers) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setContentType('image/jpeg'); + } + + public function testContentTypeCanBeSetViaSetBody() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addParameterizedHeader('Content-Type', 'text/html') + -> ignoring($headers) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setBody('foo', 'text/html'); + } + + public function testGetEncoderFromConstructor() + { + $encoder = $this->_createEncoder('base64'); + $entity = $this->_createEntity($this->_createHeaderSet(), $encoder, + $this->_createCache() + ); + $this->assertSame($encoder, $entity->getEncoder()); + } + + public function testSetAndGetEncoder() + { + $encoder = $this->_createEncoder('base64'); + $headers = $this->_createHeaderSet(); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setEncoder($encoder); + $this->assertSame($encoder, $entity->getEncoder()); + } + + public function testSettingEncoderUpdatesTransferEncoding() + { + $encoder = $this->_createEncoder('base64'); + $encoding = $this->_createHeader( + 'Content-Transfer-Encoding', '8bit', array(), false + ); + $headers = $this->_createHeaderSet(array( + 'Content-Transfer-Encoding' => $encoding + )); + $this->_checking(Expectations::create() + -> one($encoding)->setFieldBodyModel('base64') + -> ignoring($encoding) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setEncoder($encoder); + } + + public function testSettingEncoderAddsEncodingHeaderIfNonePresent() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addTextHeader('Content-Transfer-Encoding', 'something') + -> ignoring($headers) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setEncoder($this->_createEncoder('something')); + } + + public function testIdIsReturnedFromHeader() + { + /* -- RFC 2045, 7. + In constructing a high-level user agent, it may be desirable to allow + one body to make reference to another. Accordingly, bodies may be + labelled using the "Content-ID" header field, which is syntactically + identical to the "Message-ID" header field + */ + + $cid = $this->_createHeader('Content-ID', 'zip@button'); + $headers = $this->_createHeaderSet(array('Content-ID' => $cid)); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $this->assertEqual('zip@button', $entity->getId()); + } + + public function testIdIsSetInHeader() + { + $cid = $this->_createHeader('Content-ID', 'zip@button', array(), false); + $headers = $this->_createHeaderSet(array('Content-ID' => $cid)); + $this->_checking(Expectations::create() + -> one($cid)->setFieldBodyModel('foo@bar') + -> ignoring($cid) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setId('foo@bar'); + } + + public function testIdIsAutoGenerated() + { + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertPattern('/^.*?@.*?$/D', $entity->getId()); + } + + public function testGenerateIdCreatesNewId() + { + $headers = $this->_createHeaderSet(); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $id1 = $entity->generateId(); + $id2 = $entity->generateId(); + $this->assertNotEqual($id1, $id2); + } + + public function testGenerateIdSetsNewId() + { + $headers = $this->_createHeaderSet(); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $id = $entity->generateId(); + $this->assertEqual($id, $entity->getId()); + } + + public function testDescriptionIsReadFromHeader() + { + /* -- RFC 2045, 8. + The ability to associate some descriptive information with a given + body is often desirable. For example, it may be useful to mark an + "image" body as "a picture of the Space Shuttle Endeavor." Such text + may be placed in the Content-Description header field. This header + field is always optional. + */ + + $desc = $this->_createHeader('Content-Description', 'something'); + $headers = $this->_createHeaderSet(array('Content-Description' => $desc)); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $this->assertEqual('something', $entity->getDescription()); + } + + public function testDescriptionIsSetInHeader() + { + $desc = $this->_createHeader('Content-Description', '', array(), false); + $headers = $this->_createHeaderSet(array('Content-Description' => $desc)); + $this->_checking(Expectations::create() + -> one($desc)->setFieldBodyModel('whatever') + -> ignoring($desc) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setDescription('whatever'); + } + + public function testDescriptionHeaderIsAddedIfNotPresent() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addTextHeader('Content-Description', 'whatever') + -> ignoring($headers) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setDescription('whatever'); + } + + public function testSetAndGetMaxLineLength() + { + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setMaxLineLength(60); + $this->assertEqual(60, $entity->getMaxLineLength()); + } + + public function testEncoderIsUsedForStringGeneration() + { + $encoder = $this->_createEncoder('base64', false); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString('blah', optional()) + -> ignoring($encoder) + ); + $entity = $this->_createEntity($this->_createHeaderSet(), + $encoder, $this->_createCache() + ); + $entity->setBody("blah"); + $entity->toString(); + } + + public function testMaxLineLengthIsProvidedWhenEncoding() + { + $encoder = $this->_createEncoder('base64', false); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString('blah', 0, 65) + -> ignoring($encoder) + ); + $entity = $this->_createEntity($this->_createHeaderSet(), + $encoder, $this->_createCache() + ); + $entity->setBody("blah"); + $entity->setMaxLineLength(65); + $entity->toString(); + } + + public function testHeadersAppearInString() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" . + "X-MyHeader: foobar\r\n" + ) + -> ignoring($headers) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $this->assertEqual( + "Content-Type: text/plain; charset=utf-8\r\n" . + "X-MyHeader: foobar\r\n", + $entity->toString() + ); + } + + public function testSetAndGetBody() + { + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setBody("blah\r\nblah!"); + $this->assertEqual("blah\r\nblah!", $entity->getBody()); + } + + public function testBodyIsAppended() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" + ) + -> ignoring($headers) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setBody("blah\r\nblah!"); + $this->assertEqual( + "Content-Type: text/plain; charset=utf-8\r\n" . + "\r\n" . + "blah\r\nblah!", + $entity->toString() + ); + } + + public function testGetBodyReturnsStringFromByteStream() + { + $os = $this->_createOutputStream("byte stream string"); + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setBody($os); + $this->assertEqual("byte stream string", $entity->getBody()); + } + + public function testByteStreamBodyIsAppended() + { + $headers = $this->_createHeaderSet(array(), false); + $os = $this->_createOutputStream("streamed"); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" + ) + -> ignoring($headers) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setBody($os); + $this->assertEqual( + "Content-Type: text/plain; charset=utf-8\r\n" . + "\r\n" . + "streamed", + $entity->toString() + ); + } + + public function testBoundaryCanBeRetrieved() + { + /* -- RFC 2046, 5.1.1. + boundary := 0*69 bcharsnospace + + bchars := bcharsnospace / " " + + bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" / + "+" / "_" / "," / "-" / "." / + "/" / ":" / "=" / "?" + */ + + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertPattern( + '/^[a-zA-Z0-9\'\(\)\+_\-,\.\/:=\?\ ]{0,69}[a-zA-Z0-9\'\(\)\+_\-,\.\/:=\?]$/D', + $entity->getBoundary() + ); + } + + public function testBoundaryNeverChanges() + { + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $firstBoundary = $entity->getBoundary(); + for ($i = 0; $i < 10; $i++) { + $this->assertEqual($firstBoundary, $entity->getBoundary()); + } + } + + public function testBoundaryCanBeSet() + { + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setBoundary('foobar'); + $this->assertEqual('foobar', $entity->getBoundary()); + } + + public function testAddingChildrenGeneratesBoundaryInHeaders() + { + $child = $this->_createChild(); + $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false); + $this->_checking(Expectations::create() + -> one($cType)->setParameter('boundary', any()) + -> ignoring($cType) + ); + + $entity = $this->_createEntity($this->_createHeaderSet(array( + 'Content-Type' => $cType + )), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setChildren(array($child)); + } + + public function testChildrenOfLevelAttachmentAndLessCauseMultipartMixed() + { + for ($level = Swift_Mime_MimeEntity::LEVEL_MIXED; + $level > Swift_Mime_MimeEntity::LEVEL_TOP; $level /= 2) + { + $child = $this->_createChild($level); + $cType = $this->_createHeader( + 'Content-Type', 'text/plain', array(), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setFieldBodyModel('multipart/mixed') + -> ignoring($cType) + ); + $entity = $this->_createEntity($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setChildren(array($child)); + } + } + + public function testChildrenOfLevelAlternativeAndLessCauseMultipartAlternative() + { + for ($level = Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE; + $level > Swift_Mime_MimeEntity::LEVEL_MIXED; $level /= 2) + { + $child = $this->_createChild($level); + $cType = $this->_createHeader( + 'Content-Type', 'text/plain', array(), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setFieldBodyModel('multipart/alternative') + -> ignoring($cType) + ); + $entity = $this->_createEntity($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setChildren(array($child)); + } + } + + public function testChildrenOfLevelRelatedAndLessCauseMultipartRelated() + { + for ($level = Swift_Mime_MimeEntity::LEVEL_RELATED; + $level > Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE; $level /= 2) + { + $child = $this->_createChild($level); + $cType = $this->_createHeader( + 'Content-Type', 'text/plain', array(), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setFieldBodyModel('multipart/related') + -> ignoring($cType) + ); + $entity = $this->_createEntity($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setChildren(array($child)); + } + } + + public function testHighestLevelChildDeterminesContentType() + { + $combinations = array( + array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED, + Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + Swift_Mime_MimeEntity::LEVEL_RELATED + ), + 'type' => 'multipart/mixed' + ), + array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED, + Swift_Mime_MimeEntity::LEVEL_RELATED + ), + 'type' => 'multipart/mixed' + ), + array('levels' => array(Swift_Mime_MimeEntity::LEVEL_MIXED, + Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE + ), + 'type' => 'multipart/mixed' + ), + array('levels' => array(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + Swift_Mime_MimeEntity::LEVEL_RELATED + ), + 'type' => 'multipart/alternative' + ) + ); + + foreach ($combinations as $combination) { + $children = array(); + foreach ($combination['levels'] as $level) { + $children[] = $this->_createChild($level); + } + + $cType = $this->_createHeader( + 'Content-Type', 'text/plain', array(), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setFieldBodyModel($combination['type']) + -> ignoring($cType) + ); + $entity = $this->_createEntity($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setChildren($children); + } + } + + public function testChildrenAppearNestedInString() + { + /* -- RFC 2046, 5.1.1. + (excerpt too verbose to paste here) + */ + + $headers = $this->_createHeaderSet(array(), false); + + $child1 = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/plain\r\n" . + "\r\n" . + "foobar" + ); + + $child2 = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/html\r\n" . + "\r\n" . + "foobar" + ); + + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: multipart/alternative; boundary=\"xxx\"\r\n" + ) + -> ignoring($headers) + ); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setBoundary('xxx'); + $entity->setChildren(array($child1, $child2)); + + $this->assertEqual( + "Content-Type: multipart/alternative; boundary=\"xxx\"\r\n" . + "\r\n" . + "\r\n--xxx\r\n" . + "Content-Type: text/plain\r\n" . + "\r\n" . + "foobar\r\n" . + "\r\n--xxx\r\n" . + "Content-Type: text/html\r\n" . + "\r\n" . + "foobar\r\n" . + "\r\n--xxx--\r\n", + $entity->toString() + ); + } + + public function testMixingLevelsIsHierarchical() + { + $headers = $this->_createHeaderSet(array(), false); + $newHeaders = $this->_createHeaderSet(array(), false); + + $part = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/plain\r\n" . + "\r\n" . + "foobar" + ); + + $attachment = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_MIXED, + "Content-Type: application/octet-stream\r\n" . + "\r\n" . + "data" + ); + + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: multipart/mixed; boundary=\"xxx\"\r\n" + ) + -> ignoring($headers)->newInstance() -> returns($newHeaders) + -> ignoring($headers) + -> ignoring($newHeaders)->toString() -> returns( + "Content-Type: multipart/alternative; boundary=\"yyy\"\r\n" + ) + -> ignoring($newHeaders) + ); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setBoundary('xxx'); + $entity->setChildren(array($part, $attachment)); + + $this->assertPattern( + "~^" . + "Content-Type: multipart/mixed; boundary=\"xxx\"\r\n" . + "\r\n\r\n--xxx\r\n" . + "Content-Type: multipart/alternative; boundary=\"yyy\"\r\n" . + "\r\n\r\n--(.*?)\r\n" . + "Content-Type: text/plain\r\n" . + "\r\n" . + "foobar" . + "\r\n\r\n--\\1--\r\n" . + "\r\n\r\n--xxx\r\n" . + "Content-Type: application/octet-stream\r\n" . + "\r\n" . + "data" . + "\r\n\r\n--xxx--\r\n" . + "\$~", + $entity->toString() + ); + } + + public function testSettingEncoderNotifiesChildren() + { + $child = $this->_createChild(0, '', false); + $encoder = $this->_createEncoder('base64'); + + $this->_checking(Expectations::create() + -> one($child)->encoderChanged($encoder) + -> ignoring($child) + ); + + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setChildren(array($child)); + $entity->setEncoder($encoder); + } + + public function testReceiptOfEncoderChangeNotifiesChildren() + { + $child = $this->_createChild(0, '', false); + $encoder = $this->_createEncoder('base64'); + + $this->_checking(Expectations::create() + -> one($child)->encoderChanged($encoder) + -> ignoring($child) + ); + + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setChildren(array($child)); + $entity->encoderChanged($encoder); + } + + public function testReceiptOfCharsetChangeNotifiesChildren() + { + $child = $this->_createChild(0, '', false); + + $this->_checking(Expectations::create() + -> one($child)->charsetChanged('windows-874') + -> ignoring($child) + ); + + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $entity->setChildren(array($child)); + $entity->charsetChanged('windows-874'); + } + + public function testEntityIsWrittenToByteStream() + { + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $is = $this->_createInputStream(false); + $this->_checking(Expectations::create() + -> atLeast(1)->of($is)->write(any()) + -> ignoring($is) + ); + + $entity->toByteStream($is); + } + + public function testEntityHeadersAreComittedToByteStream() + { + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $is = $this->_createInputStream(false); + $this->_checking(Expectations::create() + -> atLeast(1)->of($is)->commit() + -> atLeast(1)->of($is)->write(any()) + -> ignoring($is) + ); + + $entity->toByteStream($is); + } + + public function testOrderingTextBeforeHtml() + { + $htmlChild = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/html\r\n" . + "\r\n" . + "HTML PART", + false + ); + $textChild = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, + "Content-Type: text/plain\r\n" . + "\r\n" . + "TEXT PART", + false + ); + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: multipart/alternative; boundary=\"xxx\"\r\n" + ) + -> ignoring($headers) + -> ignoring($htmlChild)->getContentType() -> returns('text/html') + -> ignoring($htmlChild) + -> ignoring($textChild)->getContentType() -> returns('text/plain') + -> ignoring($textChild) + ); + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $this->_createCache() + ); + $entity->setBoundary('xxx'); + $entity->setChildren(array($htmlChild, $textChild)); + + $this->assertEqual( + "Content-Type: multipart/alternative; boundary=\"xxx\"\r\n" . + "\r\n\r\n--xxx\r\n" . + "Content-Type: text/plain\r\n" . + "\r\n" . + "TEXT PART" . + "\r\n\r\n--xxx\r\n" . + "Content-Type: text/html\r\n" . + "\r\n" . + "HTML PART" . + "\r\n\r\n--xxx--\r\n", + $entity->toString() + ); + } + + public function testUnsettingChildrenRestoresContentType() + { + $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false); + $child = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE); + + $s = $this->_mockery()->sequence('Type setting'); + $this->_checking(Expectations::create() + -> one($cType)->setFieldBodyModel('image/jpeg') -> inSequence($s) + -> one($cType)->setFieldBodyModel('multipart/alternative') -> inSequence($s) + -> one($cType)->setFieldBodyModel('image/jpeg') -> inSequence($s) + -> ignoring($cType) + ); + + $entity = $this->_createEntity($this->_createHeaderSet(array( + 'Content-Type' => $cType + )), + $this->_createEncoder(), $this->_createCache() + ); + + $entity->setContentType('image/jpeg'); + $entity->setChildren(array($child)); + $entity->setChildren(array()); + } + + public function testBodyIsReadFromCacheWhenUsingToStringIfPresent() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" + ) + -> ignoring($headers) + ); + + $cache = $this->_createCache(false); + $this->_checking(Expectations::create() + -> one($cache)->hasKey(any(), 'body') -> returns(true) + -> one($cache)->getString(any(), 'body') -> returns("\r\ncache\r\ncache!") + -> ignoring($cache) + ); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $cache + ); + + $entity->setBody("blah\r\nblah!"); + $this->assertEqual( + "Content-Type: text/plain; charset=utf-8\r\n" . + "\r\n" . + "cache\r\ncache!", + $entity->toString() + ); + } + + public function testBodyIsAddedToCacheWhenUsingToString() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" + ) + -> ignoring($headers) + ); + + $cache = $this->_createCache(false); + $this->_checking(Expectations::create() + -> one($cache)->hasKey(any(), 'body') -> returns(false) + -> one($cache)->setString(any(), 'body', "\r\nblah\r\nblah!", Swift_KeyCache::MODE_WRITE) + -> ignoring($cache) + ); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $cache + ); + + $entity->setBody("blah\r\nblah!"); + $entity->toString(); + } + + public function testBodyIsClearedFromCacheIfNewBodySet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" + ) + -> ignoring($headers) + ); + + $cache = $this->_createCache(false); + $this->_checking(Expectations::create() + -> one($cache)->clearKey(any(), 'body') + -> ignoring($cache) + ); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $cache + ); + + $entity->setBody("blah\r\nblah!"); + $entity->toString(); + + $entity->setBody("new\r\nnew!"); + } + + public function testBodyIsNotClearedFromCacheIfSameBodySet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" + ) + -> ignoring($headers) + ); + + $cache = $this->_createCache(false); + $this->_checking(Expectations::create() + -> never($cache)->clearKey(any(), 'body') + -> ignoring($cache) + ); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $cache + ); + + $entity->setBody("blah\r\nblah!"); + $entity->toString(); + + $entity->setBody("blah\r\nblah!"); + } + + public function testBodyIsClearedFromCacheIfNewEncoderSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" + ) + -> ignoring($headers) + ); + + $cache = $this->_createCache(false); + $this->_checking(Expectations::create() + -> one($cache)->clearKey(any(), 'body') + -> ignoring($cache) + ); + + $otherEncoder = $this->_createEncoder(); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $cache + ); + + $entity->setBody("blah\r\nblah!"); + $entity->toString(); + + $entity->setEncoder($otherEncoder); + } + + public function testBodyIsReadFromCacheWhenUsingToByteStreamIfPresent() + { + $is = $this->_createInputStream(); + $cache = $this->_createCache(false); + + $this->_checking(Expectations::create() + -> one($cache)->hasKey(any(), 'body') -> returns(true) + -> one($cache)->exportToByteStream(any(), 'body', $is) + -> ignoring($cache) + ); + + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $cache + ); + $entity->setBody('foo'); + + $entity->toByteStream($is); + } + + public function testBodyIsAddedToCacheWhenUsingToByteStream() + { + $is = $this->_createInputStream(); + $cache = $this->_createCache(false); + + $this->_checking(Expectations::create() + -> one($cache)->hasKey(any(), 'body') -> returns(false) + //The input stream should be fetched for writing + // Proving that it's actually written to is possible, but extremely + // fragile. Best let the acceptance tests cover this aspect + -> one($cache)->getInputByteStream(any(), 'body') + -> ignoring($cache) + ); + + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $cache + ); + $entity->setBody('foo'); + + $entity->toByteStream($is); + } + + public function testFluidInterface() + { + $entity = $this->_createEntity($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + + $this->assertSame($entity, + $entity + ->setContentType('text/plain') + ->setEncoder($this->_createEncoder()) + ->setId('foo@bar') + ->setDescription('my description') + ->setMaxLineLength(998) + ->setBody('xx') + ->setBoundary('xyz') + ->setChildren(array()) + ); + } + + // -- Private helpers + + abstract protected function _createEntity($headers, $encoder, $cache); + + protected function _createChild($level = null, $string = '', $stub = true) + { + $child = $this->_mock('Swift_Mime_MimeEntity'); + if (isset($level)) { + $this->_checking(Expectations::create() + -> ignoring($child)->getNestingLevel() -> returns($level) + ); + } + $this->_checking(Expectations::create() + -> ignoring($child)->toString() -> returns($string) + ); + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($child) + ); + } + return $child; + } + + protected function _createEncoder($name = 'quoted-printable', $stub = true) + { + $encoder = $this->_mock('Swift_Mime_ContentEncoder'); + $this->_checking(Expectations::create() + -> ignoring($encoder)->getName() -> returns($name) + ); + + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($encoder)->encodeString(any(), optional()) + -> calls(array($this, 'returnStringFromEncoder')) + -> ignoring($encoder) + ); + } + return $encoder; + } + + protected function _createCache($stub = true) + { + $cache = $this->_mock('Swift_KeyCache'); + + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($cache) + ); + } + return $cache; + } + + protected function _createHeaderSet($headers = array(), $stub = true) + { + $set = $this->_mock('Swift_Mime_HeaderSet'); + foreach ($headers as $key => $header) { + $this->_checking(Expectations::create() + -> ignoring($set)->has($key) -> returns(true) + -> ignoring($set)->get($key) -> returns($header) + ); + } + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($set)->newInstance() -> returns($set) + -> ignoring($set) + ); + } + return $set; + } + + protected function _createHeader($name, $model = null, $params = array(), $stub = true) + { + $header = $this->_mock('Swift_Mime_ParameterizedHeader'); + $this->_checking(Expectations::create() + -> ignoring($header)->getFieldName() -> returns($name) + -> ignoring($header)->getFieldBodyModel() -> returns($model) + ); + foreach ($params as $key => $value) { + $this->_checking(Expectations::create() + -> ignoring($header)->getParameter($key) -> returns($value) + ); + } + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($header) + ); + } + return $header; + } + + protected function _createOutputStream($data = null, $stub = true) + { + $os = $this->_mock('Swift_OutputByteStream'); + if (isset($data)) { + $pos = $this->_mockery()->states('position')->startsAs('at beginning'); + $this->_checking(Expectations::create() + -> ignoring($os)->read(optional()) -> returns($data) + -> when($pos->isNot('at end')) -> then($pos->is('at end')) + + -> ignoring($os)->read(optional()) -> returns(false) + ); + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($os) + ); + } + } + return $os; + } + + protected function _createInputStream($stub = true) + { + $is = $this->_mock('Swift_InputByteStream'); + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($is) + ); + } + return $is; + } + + // -- Mock helpers + + public function returnStringFromEncoder(Yay_Invocation $invocation) + { + $args = $invocation->getArguments(); + return array_shift($args); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php new file mode 100644 index 0000000..ff3b810 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/AttachmentTest.php @@ -0,0 +1,297 @@ +_createAttachment($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual( + Swift_Mime_MimeEntity::LEVEL_MIXED, $attachment->getNestingLevel() + ); + } + + public function testDispositionIsReturnedFromHeader() + { + /* -- RFC 2183, 2.1, 2.2. + */ + + $disposition = $this->_createHeader('Content-Disposition', 'attachment'); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Disposition' => $disposition)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual('attachment', $attachment->getDisposition()); + } + + public function testDispositionIsSetInHeader() + { + $disposition = $this->_createHeader('Content-Disposition', 'attachment', + array(), false + ); + $this->_checking(Expectations::create() + -> one($disposition)->setFieldBodyModel('inline') + -> ignoring($disposition) + ); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Disposition' => $disposition)), + $this->_createEncoder(), $this->_createCache() + ); + $attachment->setDisposition('inline'); + } + + public function testDispositionIsAddedIfNonePresent() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addParameterizedHeader('Content-Disposition', 'inline') + -> ignoring($headers) + ); + $attachment = $this->_createAttachment($headers, $this->_createEncoder(), + $this->_createCache() + ); + $attachment->setDisposition('inline'); + } + + public function testDispositionIsAutoDefaultedToAttachment() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addParameterizedHeader('Content-Disposition', 'attachment') + -> ignoring($headers) + ); + $attachment = $this->_createAttachment($headers, $this->_createEncoder(), + $this->_createCache() + ); + } + + public function testDefaultContentTypeInitializedToOctetStream() + { + $cType = $this->_createHeader('Content-Type', '', + array(), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setFieldBodyModel('application/octet-stream') + -> ignoring($cType) + ); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + } + + public function testFilenameIsReturnedFromHeader() + { + /* -- RFC 2183, 2.3. + */ + + $disposition = $this->_createHeader('Content-Disposition', 'attachment', + array('filename'=>'foo.txt') + ); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Disposition' => $disposition)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual('foo.txt', $attachment->getFilename()); + } + + public function testFilenameIsSetInHeader() + { + $disposition = $this->_createHeader('Content-Disposition', 'attachment', + array('filename'=>'foo.txt'), false + ); + $this->_checking(Expectations::create() + -> one($disposition)->setParameter('filename', 'bar.txt') + -> ignoring($disposition) + ); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Disposition' => $disposition)), + $this->_createEncoder(), $this->_createCache() + ); + $attachment->setFilename('bar.txt'); + } + + public function testSettingFilenameSetsNameInContentType() + { + /* + This is a legacy requirement which isn't covered by up-to-date RFCs. + */ + + $cType = $this->_createHeader('Content-Type', 'text/plain', + array(), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setParameter('name', 'bar.txt') + -> ignoring($cType) + ); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $attachment->setFilename('bar.txt'); + } + + public function testSizeIsReturnedFromHeader() + { + /* -- RFC 2183, 2.7. + */ + + $disposition = $this->_createHeader('Content-Disposition', 'attachment', + array('size'=>1234) + ); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Disposition' => $disposition)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(1234, $attachment->getSize()); + } + + public function testSizeIsSetInHeader() + { + $disposition = $this->_createHeader('Content-Disposition', 'attachment', + array(), false + ); + $this->_checking(Expectations::create() + -> one($disposition)->setParameter('size', 12345) + -> ignoring($disposition) + ); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Disposition' => $disposition)), + $this->_createEncoder(), $this->_createCache() + ); + $attachment->setSize(12345); + } + + public function testFilnameCanBeReadFromFileStream() + { + $file = $this->_createFileStream('/bar/file.ext', ''); + $disposition = $this->_createHeader('Content-Disposition', 'attachment', + array('filename'=>'foo.txt'), false + ); + $this->_checking(Expectations::create() + -> one($disposition)->setParameter('filename', 'file.ext') + -> ignoring($disposition) + ); + $attachment = $this->_createAttachment($this->_createHeaderSet(array( + 'Content-Disposition' => $disposition)), + $this->_createEncoder(), $this->_createCache() + ); + $attachment->setFile($file); + } + + public function testContentTypeCanBeSetViaSetFile() + { + $file = $this->_createFileStream('/bar/file.ext', ''); + $disposition = $this->_createHeader('Content-Disposition', 'attachment', + array('filename'=>'foo.txt'), false + ); + $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false); + $headers = $this->_createHeaderSet(array( + 'Content-Disposition' => $disposition, + 'Content-Type' => $ctype + )); + $this->_checking(Expectations::create() + -> one($disposition)->setParameter('filename', 'file.ext') + -> one($ctype)->setFieldBodyModel('text/html') + -> ignoring($disposition) + -> ignoring($ctype) + ); + $attachment = $this->_createAttachment($headers, $this->_createEncoder(), + $this->_createCache() + ); + $attachment->setFile($file, 'text/html'); + } + + public function XtestContentTypeCanBeLookedUpFromCommonListIfNotProvided() + { + $file = $this->_createFileStream('/bar/file.zip', ''); + $disposition = $this->_createHeader('Content-Disposition', 'attachment', + array('filename'=>'foo.zip'), false + ); + $ctype = $this->_createHeader('Content-Type', 'text/plain', array(), false); + $headers = $this->_createHeaderSet(array( + 'Content-Disposition' => $disposition, + 'Content-Type' => $ctype + )); + $this->_checking(Expectations::create() + -> one($disposition)->setParameter('filename', 'file.zip') + -> one($ctype)->setFieldBodyModel('application/zip') + -> ignoring($disposition) + -> ignoring($ctype) + ); + $attachment = $this->_createAttachment($headers, $this->_createEncoder(), + $this->_createCache(), array('zip'=>'application/zip', 'txt'=>'text/plain') + ); + $attachment->setFile($file); + } + + public function testDataCanBeReadFromFile() + { + $file = $this->_createFileStream('/foo/file.ext', ''); + $attachment = $this->_createAttachment($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $attachment->setFile($file); + $this->assertEqual('', $attachment->getBody()); + } + + public function testFluidInterface() + { + $attachment = $this->_createAttachment($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertSame($attachment, + $attachment + ->setContentType('application/pdf') + ->setEncoder($this->_createEncoder()) + ->setId('foo@bar') + ->setDescription('my pdf') + ->setMaxLineLength(998) + ->setBody('xx') + ->setBoundary('xyz') + ->setChildren(array()) + ->setDisposition('inline') + ->setFilename('afile.txt') + ->setSize(123) + ->setFile($this->_createFileStream('foo.txt', '')) + ); + } + + // -- Private helpers + + protected function _createEntity($headers, $encoder, $cache) + { + return $this->_createAttachment($headers, $encoder, $cache); + } + + protected function _createAttachment($headers, $encoder, $cache, + $mimeTypes = array()) + { + return new Swift_Mime_Attachment($headers, $encoder, $cache, new Swift_Mime_Grammar(), $mimeTypes); + } + + protected function _createFileStream($path, $data, $stub = true) + { + $file = $this->_mock('Swift_FileStream'); + $pos = $this->_mockery()->states('position')->startsAs('at start'); + $this->_checking(Expectations::create() + -> ignoring($file)->getPath() -> returns($path) + -> ignoring($file)->read(optional()) -> returns($data) + -> when($pos->isNot('at end')) -> then($pos->is('at end')) + -> ignoring($file)->read(optional()) -> returns(false) + ); + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($file) + ); + } + return $file; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php new file mode 100644 index 0000000..54d63ac --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/Base64ContentEncoderTest.php @@ -0,0 +1,293 @@ +getArguments(); + $this->content .= current($args); + } + public function describeTo(Yay_Description $description) { + $description->appendText(' gathers input;'); + } +} + +class Swift_Mime_ContentEncoder_Base64ContentEncoderTest + extends Swift_Tests_SwiftUnitTestCase +{ + private $_encoder; + + public function setUp() + { + $this->_encoder = new Swift_Mime_ContentEncoder_Base64ContentEncoder(); + } + + public function testNameIsBase64() + { + $this->assertEqual('base64', $this->_encoder->getName()); + } + + /* + There's really no point in testing the entire base64 encoding to the + level QP encoding has been tested. base64_encode() has been in PHP for + years. + */ + + public function testInputOutputRatioIs3to4Bytes() + { + /* + RFC 2045, 6.8 + + The encoding process represents 24-bit groups of input bits as output + strings of 4 encoded characters. Proceeding from left to right, a + 24-bit input group is formed by concatenating 3 8bit input groups. + These 24 bits are then treated as 4 concatenated 6-bit groups, each + of which is translated into a single digit in the base64 alphabet. + */ + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('123') + -> allowing($os)->read(optional()) -> returns(false) + + -> ignoring($os) + ); + + $this->_encoder->encodeByteStream($os, $is); + $this->assertEqual('MTIz', $collection->content); + } + + public function testPadLength() + { + /* + RFC 2045, 6.8 + + Special processing is performed if fewer than 24 bits are available + at the end of the data being encoded. A full encoding quantum is + always completed at the end of a body. When fewer than 24 input bits + are available in an input group, zero bits are added (on the right) + to form an integral number of 6-bit groups. Padding at the end of + the data is performed using the "=" character. Since all base64 + input is an integral number of octets, only the following cases can + arise: (1) the final quantum of encoding input is an integral + multiple of 24 bits; here, the final unit of encoded output will be + an integral multiple of 4 characters with no "=" padding, (2) the + final quantum of encoding input is exactly 8 bits; here, the final + unit of encoded output will be two characters followed by two "=" + padding characters, or (3) the final quantum of encoding input is + exactly 16 bits; here, the final unit of encoded output will be three + characters followed by one "=" padding character. + */ + + for ($i = 0; $i < 30; ++$i) { + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns(pack('C', rand(0, 255))) + -> allowing($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + + $this->_encoder->encodeByteStream($os, $is); + $this->assertPattern('~^[a-zA-Z0-9/\+]{2}==$~', $collection->content, + '%s: A single byte should have 2 bytes of padding' + ); + } + + for ($i = 0; $i < 30; ++$i) { + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns(pack('C*', rand(0, 255), rand(0, 255))) + -> allowing($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + + $this->_encoder->encodeByteStream($os, $is); + $this->assertPattern('~^[a-zA-Z0-9/\+]{3}=$~', $collection->content, + '%s: Two bytes should have 1 byte of padding' + ); + } + + for ($i = 0; $i < 30; ++$i) { + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns(pack('C*', rand(0, 255), rand(0, 255), rand(0, 255))) + -> allowing($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + + $this->_encoder->encodeByteStream($os, $is); + $this->assertPattern('~^[a-zA-Z0-9/\+]{4}$~', $collection->content, + '%s: Three bytes should have no padding' + ); + } + } + + public function testMaximumLineLengthIs76Characters() + { + /* + The encoded output stream must be represented in lines of no more + than 76 characters each. All line breaks or other characters not + found in Table 1 must be ignored by decoding software. + */ + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('abcdefghijkl') //12 + -> one($os)->read(optional()) -> returns('mnopqrstuvwx') //24 + -> one($os)->read(optional()) -> returns('yzabc1234567') //36 + -> one($os)->read(optional()) -> returns('890ABCDEFGHI') //48 + -> one($os)->read(optional()) -> returns('JKLMNOPQRSTU') //60 + -> one($os)->read(optional()) -> returns('VWXYZ1234567') //72 + -> one($os)->read(optional()) -> returns('abcdefghijkl') //84 + -> allowing($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + + $this->_encoder->encodeByteStream($os, $is); + $this->assertEqual( + "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUFFS\r\n" . + "U1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts", + $collection->content + ); + } + + public function testMaximumLineLengthCanBeDifferent() + { + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('abcdefghijkl') //12 + -> one($os)->read(optional()) -> returns('mnopqrstuvwx') //24 + -> one($os)->read(optional()) -> returns('yzabc1234567') //36 + -> one($os)->read(optional()) -> returns('890ABCDEFGHI') //48 + -> one($os)->read(optional()) -> returns('JKLMNOPQRSTU') //60 + -> one($os)->read(optional()) -> returns('VWXYZ1234567') //72 + -> one($os)->read(optional()) -> returns('abcdefghijkl') //84 + -> allowing($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + + $this->_encoder->encodeByteStream($os, $is, 0, 50); + $this->assertEqual( + "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3OD\r\n" . + "kwQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVoxMjM0NTY3YWJj\r\n" . + "ZGVmZ2hpamts", + $collection->content + ); + } + + public function testMaximumLineLengthIsNeverMoreThan76Chars() + { + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('abcdefghijkl') //12 + -> one($os)->read(optional()) -> returns('mnopqrstuvwx') //24 + -> one($os)->read(optional()) -> returns('yzabc1234567') //36 + -> one($os)->read(optional()) -> returns('890ABCDEFGHI') //48 + -> one($os)->read(optional()) -> returns('JKLMNOPQRSTU') //60 + -> one($os)->read(optional()) -> returns('VWXYZ1234567') //72 + -> one($os)->read(optional()) -> returns('abcdefghijkl') //84 + -> allowing($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + + $this->_encoder->encodeByteStream($os, $is, 0, 100); + $this->assertEqual( + "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDREVGR0hJSktMTU5PUFFS\r\n" . + "U1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts", + $collection->content + ); + } + + public function testFirstLineLengthCanBeDifferent() + { + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('abcdefghijkl') //12 + -> one($os)->read(optional()) -> returns('mnopqrstuvwx') //24 + -> one($os)->read(optional()) -> returns('yzabc1234567') //36 + -> one($os)->read(optional()) -> returns('890ABCDEFGHI') //48 + -> one($os)->read(optional()) -> returns('JKLMNOPQRSTU') //60 + -> one($os)->read(optional()) -> returns('VWXYZ1234567') //72 + -> one($os)->read(optional()) -> returns('abcdefghijkl') //84 + -> allowing($os)->read(optional()) -> returns(false) + -> ignoring($os) + ); + + $this->_encoder->encodeByteStream($os, $is, 19); + $this->assertEqual( + "YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXphYmMxMjM0NTY3ODkwQUJDR\r\n" . + "EVGR0hJSktMTU5PUFFSU1RVVldYWVoxMjM0NTY3YWJjZGVmZ2hpamts", + $collection->content + ); + } + + // -- Private Methods + + private function _createOutputByteStream($stub = false) + { + return $stub + ? $this->_stub('Swift_OutputByteStream') + : $this->_mock('Swift_OutputByteStream') + ; + } + + private function _createInputByteStream($stub = false) + { + return $stub + ? $this->_stub('Swift_InputByteStream') + : $this->_mock('Swift_InputByteStream') + ; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php new file mode 100644 index 0000000..53f3fa8 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/PlainContentEncoderTest.php @@ -0,0 +1,275 @@ +getArguments(); + $this->content .= current($args); + } + public function describeTo(Yay_Description $description) { + $description->appendText(' gathers input;'); + } +} + +class Swift_Mime_ContentEncoder_PlainContentEncoderTest + extends Swift_Tests_SwiftUnitTestCase +{ + public function testNameCanBeSpecifiedInConstructor() + { + $encoder = $this->_getEncoder('7bit'); + $this->assertEqual('7bit', $encoder->getName()); + + $encoder = $this->_getEncoder('8bit'); + $this->assertEqual('8bit', $encoder->getName()); + } + + public function testNoOctetsAreModifiedInString() + { + $encoder = $this->_getEncoder('7bit'); + foreach (range(0x00, 0xFF) as $octet) { + $byte = pack('C', $octet); + $this->assertIdenticalBinary($byte, $encoder->encodeString($byte)); + } + } + + public function testNoOctetsAreModifiedInByteStream() + { + $encoder = $this->_getEncoder('7bit'); + foreach (range(0x00, 0xFF) as $octet) { + $byte = pack('C', $octet); + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns($byte) + -> allowing($os)->read(optional()) -> returns(false) + + -> ignoring($os) + ); + + $encoder->encodeByteStream($os, $is); + $this->assertIdenticalBinary($byte, $collection->content); + } + } + + public function testLineLengthCanBeSpecified() + { + $encoder = $this->_getEncoder('7bit'); + + $chars = array(); + for ($i = 0; $i < 50; $i++) { + $chars[] = 'a'; + } + $input = implode(' ', $chars); //99 chars long + + $this->assertEqual( + 'a a a a a a a a a a a a a a a a a a a a a a a a a ' . "\r\n" . //50 * + 'a a a a a a a a a a a a a a a a a a a a a a a a a', //99 + $encoder->encodeString($input, 0, 50), + '%s: Lines should be wrapped at 50 chars' + ); + } + + public function testLineLengthCanBeSpecifiedInByteStream() + { + $encoder = $this->_getEncoder('7bit'); + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + ); + + for ($i = 0; $i < 50; $i++) { + $this->_checking(Expectations::create() + -> one($os)->read(optional()) -> returns('a ') + ); + } + + $this->_checking(Expectations::create() + -> allowing($os)->read(optional()) -> returns(false) + ); + + $encoder->encodeByteStream($os, $is, 0, 50); + $this->assertEqual( + str_repeat('a ', 25) . "\r\n" . str_repeat('a ', 25), + $collection->content + ); + } + + public function testencodeStringGeneratesCorrectCrlf() + { + $encoder = $this->_getEncoder('7bit', true); + $this->assertEqual("a\r\nb", $encoder->encodeString("a\rb"), + '%s: Line endings should be standardized' + ); + $this->assertEqual("a\r\nb", $encoder->encodeString("a\nb"), + '%s: Line endings should be standardized' + ); + $this->assertEqual("a\r\n\r\nb", $encoder->encodeString("a\n\rb"), + '%s: Line endings should be standardized' + ); + $this->assertEqual("a\r\n\r\nb", $encoder->encodeString("a\r\rb"), + '%s: Line endings should be standardized' + ); + $this->assertEqual("a\r\n\r\nb", $encoder->encodeString("a\n\nb"), + '%s: Line endings should be standardized' + ); + } + + public function testCanonicEncodeByteStreamGeneratesCorrectCrlf_1() + { + $encoder = $this->_getEncoder('7bit', true); + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('a') + -> one($os)->read(optional()) -> returns("\r") + -> one($os)->read(optional()) -> returns('b') + -> allowing($os)->read(optional()) -> returns(false) + + -> ignoring($os) + ); + + $encoder->encodeByteStream($os, $is); + $this->assertEqual("a\r\nb", $collection->content); + } + + public function testCanonicEncodeByteStreamGeneratesCorrectCrlf_2() + { + $encoder = $this->_getEncoder('7bit', true); + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('a') + -> one($os)->read(optional()) -> returns("\n") + -> one($os)->read(optional()) -> returns('b') + -> allowing($os)->read(optional()) -> returns(false) + + -> ignoring($os) + ); + + $encoder->encodeByteStream($os, $is); + $this->assertEqual("a\r\nb", $collection->content); + } + + public function testCanonicEncodeByteStreamGeneratesCorrectCrlf_3() + { + $encoder = $this->_getEncoder('7bit', true); + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('a') + -> one($os)->read(optional()) -> returns("\n\r") + -> one($os)->read(optional()) -> returns('b') + -> allowing($os)->read(optional()) -> returns(false) + + -> ignoring($os) + ); + + $encoder->encodeByteStream($os, $is); + $this->assertEqual("a\r\n\r\nb", $collection->content); + } + + public function testCanonicEncodeByteStreamGeneratesCorrectCrlf_4() + { + $encoder = $this->_getEncoder('7bit', true); + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('a') + -> one($os)->read(optional()) -> returns("\n\n") + -> one($os)->read(optional()) -> returns('b') + -> allowing($os)->read(optional()) -> returns(false) + + -> ignoring($os) + ); + + $encoder->encodeByteStream($os, $is); + $this->assertEqual("a\r\n\r\nb", $collection->content); + } + + public function testCanonicEncodeByteStreamGeneratesCorrectCrlf_5() + { + $encoder = $this->_getEncoder('7bit', true); + + $os = $this->_createOutputByteStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> one($os)->read(optional()) -> returns('a') + -> one($os)->read(optional()) -> returns("\r\r") + -> one($os)->read(optional()) -> returns('b') + -> allowing($os)->read(optional()) -> returns(false) + + -> ignoring($os) + ); + + $encoder->encodeByteStream($os, $is); + $this->assertEqual("a\r\n\r\nb", $collection->content); + } + + // -- Private helpers + + private function _getEncoder($name, $canonical = false) + { + return new Swift_Mime_ContentEncoder_PlainContentEncoder($name, $canonical); + } + + private function _createOutputByteStream($stub = false) + { + return $stub + ? $this->_stub('Swift_OutputByteStream') + : $this->_mock('Swift_OutputByteStream') + ; + } + + private function _createInputByteStream($stub = false) + { + return $stub + ? $this->_stub('Swift_InputByteStream') + : $this->_mock('Swift_InputByteStream') + ; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php new file mode 100644 index 0000000..95b4d37 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/ContentEncoder/QpContentEncoderTest.php @@ -0,0 +1,474 @@ +getArguments(); + $this->content .= current($args); + } + public function describeTo(Yay_Description $description) { + $description->appendText(' gathers input;'); + } +} + +class Swift_Mime_ContentEncoder_QpContentEncoderTest + extends Swift_Tests_SwiftUnitTestCase +{ + public function testNameIsQuotedPrintable() + { + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder( + $this->_createCharacterStream(true) + ); + $this->assertEqual('quoted-printable', $encoder->getName()); + } + + /* -- RFC 2045, 6.7 -- + (1) (General 8bit representation) Any octet, except a CR or + LF that is part of a CRLF line break of the canonical + (standard) form of the data being encoded, may be + represented by an "=" followed by a two digit + hexadecimal representation of the octet's value. The + digits of the hexadecimal alphabet, for this purpose, + are "0123456789ABCDEF". Uppercase letters must be + used; lowercase letters are not allowed. Thus, for + example, the decimal value 12 (US-ASCII form feed) can + be represented by "=0C", and the decimal value 61 (US- + ASCII EQUAL SIGN) can be represented by "=3D". This + rule must be followed except when the following rules + allow an alternative encoding. + */ + + public function testPermittedCharactersAreNotEncoded() + { + /* -- RFC 2045, 6.7 -- + (2) (Literal representation) Octets with decimal values of + 33 through 60 inclusive, and 62 through 126, inclusive, + MAY be represented as the US-ASCII characters which + correspond to those octets (EXCLAMATION POINT through + LESS THAN, and GREATER THAN through TILDE, + respectively). + */ + + foreach (array_merge(range(33, 60), range(62, 126)) as $ordinal) { + $char = chr($ordinal); + + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + -> one($charStream)->readBytes(any()) -> returns(array($ordinal)) + -> allowing($charStream)->readBytes(any()) -> returns(false) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is); + $this->assertIdenticalBinary($char, $collection->content); + } + } + + public function testLinearWhiteSpaceAtLineEndingIsEncoded() + { + /* -- RFC 2045, 6.7 -- + (3) (White Space) Octets with values of 9 and 32 MAY be + represented as US-ASCII TAB (HT) and SPACE characters, + respectively, but MUST NOT be so represented at the end + of an encoded line. Any TAB (HT) or SPACE characters + on an encoded line MUST thus be followed on that line + by a printable character. In particular, an "=" at the + end of an encoded line, indicating a soft line break + (see rule #5) may follow one or more TAB (HT) or SPACE + characters. It follows that an octet with decimal + value 9 or 32 appearing at the end of an encoded line + must be represented according to Rule #1. This rule is + necessary because some MTAs (Message Transport Agents, + programs which transport messages from one user to + another, or perform a portion of such transfers) are + known to pad lines of text with SPACEs, and others are + known to remove "white space" characters from the end + of a line. Therefore, when decoding a Quoted-Printable + body, any trailing white space on a line must be + deleted, as it will necessarily have been added by + intermediate transport agents. + */ + + $HT = chr(0x09); //9 + $SPACE = chr(0x20); //32 + + //HT + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + -> one($charStream)->readBytes(any()) -> returns(array(0x09)) + -> one($charStream)->readBytes(any()) -> returns(array(0x09)) + -> one($charStream)->readBytes(any()) -> returns(array(0x0D)) + -> one($charStream)->readBytes(any()) -> returns(array(0x0A)) + -> one($charStream)->readBytes(any()) -> returns(array(ord('b'))) + -> allowing($charStream)->readBytes(any()) -> returns(false) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is); + + $this->assertEqual("a\t=09\r\nb", $collection->content); + + //SPACE + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + -> one($charStream)->readBytes(any()) -> returns(array(0x20)) + -> one($charStream)->readBytes(any()) -> returns(array(0x20)) + -> one($charStream)->readBytes(any()) -> returns(array(0x0D)) + -> one($charStream)->readBytes(any()) -> returns(array(0x0A)) + -> one($charStream)->readBytes(any()) -> returns(array(ord('b'))) + -> allowing($charStream)->readBytes(any()) -> returns(false) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is); + + $this->assertEqual("a =20\r\nb", $collection->content); + } + + public function testCRLFIsLeftAlone() + { + /* + (4) (Line Breaks) A line break in a text body, represented + as a CRLF sequence in the text canonical form, must be + represented by a (RFC 822) line break, which is also a + CRLF sequence, in the Quoted-Printable encoding. Since + the canonical representation of media types other than + text do not generally include the representation of + line breaks as CRLF sequences, no hard line breaks + (i.e. line breaks that are intended to be meaningful + and to be displayed to the user) can occur in the + quoted-printable encoding of such types. Sequences + like "=0D", "=0A", "=0A=0D" and "=0D=0A" will routinely + appear in non-text data represented in quoted- + printable, of course. + + Note that many implementations may elect to encode the + local representation of various content types directly + rather than converting to canonical form first, + encoding, and then converting back to local + representation. In particular, this may apply to plain + text material on systems that use newline conventions + other than a CRLF terminator sequence. Such an + implementation optimization is permissible, but only + when the combined canonicalization-encoding step is + equivalent to performing the three steps separately. + */ + + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + -> one($charStream)->readBytes(any()) -> returns(array(0x0D)) + -> one($charStream)->readBytes(any()) -> returns(array(0x0A)) + -> one($charStream)->readBytes(any()) -> returns(array(ord('b'))) + -> one($charStream)->readBytes(any()) -> returns(array(0x0D)) + -> one($charStream)->readBytes(any()) -> returns(array(0x0A)) + -> one($charStream)->readBytes(any()) -> returns(array(ord('c'))) + -> one($charStream)->readBytes(any()) -> returns(array(0x0D)) + -> one($charStream)->readBytes(any()) -> returns(array(0x0A)) + -> allowing($charStream)->readBytes(any()) -> returns(false) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is); + $this->assertEqual("a\r\nb\r\nc\r\n", $collection->content); + } + + public function testLinesLongerThan76CharactersAreSoftBroken() + { + /* + (5) (Soft Line Breaks) The Quoted-Printable encoding + REQUIRES that encoded lines be no more than 76 + characters long. If longer lines are to be encoded + with the Quoted-Printable encoding, "soft" line breaks + must be used. An equal sign as the last character on a + encoded line indicates such a non-significant ("soft") + line break in the encoded text. + */ + + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + for ($seq = 0; $seq <= 140; ++$seq) { + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + ); + } + $this->_checking(Expectations::create() + -> allowing($charStream)->readBytes(any()) -> returns(false) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is); + $this->assertEqual(str_repeat('a', 75) . "=\r\n" . str_repeat('a', 66), $collection->content); + } + + public function testMaxLineLengthCanBeSpecified() + { + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + + for ($seq = 0; $seq <= 100; ++$seq) { + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + ); + } + + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(false) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is, 0, 54); + $this->assertEqual(str_repeat('a', 53) . "=\r\n" . str_repeat('a', 48), $collection->content); + } + + public function testBytesBelowPermittedRangeAreEncoded() + { + /* + According to Rule (1 & 2) + */ + + foreach (range(0, 32) as $ordinal) { + $char = chr($ordinal); + + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + + -> one($charStream)->readBytes(any()) -> returns(array($ordinal)) + -> allowing($charStream)->readBytes(any()) -> returns(false) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is); + $this->assertEqual(sprintf('=%02X', $ordinal), $collection->content); + } + } + + public function testDecimalByte61IsEncoded() + { + /* + According to Rule (1 & 2) + */ + + $char = chr(61); + + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + + -> one($charStream)->readBytes(any()) -> returns(array(61)) + -> allowing($charStream)->readBytes(any()) -> returns(false) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is); + $this->assertEqual(sprintf('=%02X', 61), $collection->content); + } + + public function testBytesAbovePermittedRangeAreEncoded() + { + /* + According to Rule (1 & 2) + */ + + foreach (range(127, 255) as $ordinal) { + $char = chr($ordinal); + + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + + -> one($charStream)->readBytes(any()) -> returns(array($ordinal)) + -> allowing($charStream)->readBytes(any()) -> returns(false) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is); + $this->assertEqual(sprintf('=%02X', $ordinal), $collection->content); + } + } + + public function testFirstLineLengthCanBeDifferent() + { + $os = $this->_createOutputByteStream(true); + $charStream = $this->_createCharacterStream(); + $is = $this->_createInputByteStream(); + $collection = new Swift_StreamCollector(); + + $this->_checking(Expectations::create() + -> one($charStream)->flushContents() + -> one($charStream)->importByteStream($os) + + -> allowing($is)->write(any(), optional()) -> will($collection) + -> ignoring($is) + + -> ignoring($os) + ); + + for ($seq = 0; $seq <= 140; ++$seq) { + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + ); + } + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(false) + ); + + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($charStream); + $encoder->encodeByteStream($os, $is, 22); + $this->assertEqual( + str_repeat('a', 53) . "=\r\n" . str_repeat('a', 75) . "=\r\n" . str_repeat('a', 13), + $collection->content + ); + } + + public function testObserverInterfaceCanChangeCharset() + { + $stream = $this->_createCharacterStream(); + $this->_checking(Expectations::create() + -> one($stream)->setCharacterSet('windows-1252') + -> ignoring($stream) + ); + $encoder = new Swift_Mime_ContentEncoder_QpContentEncoder($stream); + $encoder->charsetChanged('windows-1252'); + } + + // -- Creation Methods + + private function _createCharacterStream($stub = false) + { + return $stub + ? $this->_stub('Swift_CharacterStream') + : $this->_mock('Swift_CharacterStream') + ; + } + + private function _createEncoder($charStream) + { + return new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream); + } + + private function _createOutputByteStream($stub = false) + { + return $stub + ? $this->_stub('Swift_OutputByteStream') + : $this->_mock('Swift_OutputByteStream') + ; + } + + private function _createInputByteStream($stub = false) + { + return $stub + ? $this->_stub('Swift_InputByteStream') + : $this->_mock('Swift_InputByteStream') + ; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php new file mode 100644 index 0000000..4b5c711 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/EmbeddedFileTest.php @@ -0,0 +1,63 @@ +_createEmbeddedFile($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual( + Swift_Mime_MimeEntity::LEVEL_RELATED, $file->getNestingLevel() + ); + } + + public function testIdIsAutoGenerated() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addIdHeader('Content-ID', pattern('/^.*?@.*?$/D')) + -> ignoring($headers) + ); + $file = $this->_createEmbeddedFile($headers, $this->_createEncoder(), + $this->_createCache() + ); + } + + public function testDefaultDispositionIsAttachment() + { //Overridden + } + + public function testDefaultDispositionIsInline() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addParameterizedHeader('Content-Disposition', 'inline') + -> ignoring($headers) + ); + $file = $this->_createEmbeddedFile($headers, $this->_createEncoder(), + $this->_createCache() + ); + } + + // -- Private helpers + + protected function _createAttachment($headers, $encoder, $cache, + $mimeTypes = array()) + { + return $this->_createEmbeddedFile($headers, $encoder, $cache, $mimeTypes); + } + + private function _createEmbeddedFile($headers, $encoder, $cache) + { + return new Swift_Mime_EmbeddedFile($headers, $encoder, $cache, new Swift_Mime_Grammar()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php new file mode 100644 index 0000000..780d353 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/Base64HeaderEncoderTest.php @@ -0,0 +1,15 @@ +assertEqual('B', $encoder->getName()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php new file mode 100644 index 0000000..92fd94e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/HeaderEncoder/QpHeaderEncoderTest.php @@ -0,0 +1,223 @@ +_createEncoder( + $this->_createCharacterStream(true) + ); + $this->assertEqual('Q', $encoder->getName()); + } + + public function testSpaceAndTabNeverAppear() + { + /* -- RFC 2047, 4. + Only a subset of the printable ASCII characters may be used in + 'encoded-text'. Space and tab characters are not allowed, so that + the beginning and end of an 'encoded-word' are obvious. + */ + + $charStream = $this->_createCharacterStream(); + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + -> one($charStream)->readBytes(any()) -> returns(array(0x20)) + -> one($charStream)->readBytes(any()) -> returns(array(0x09)) + -> one($charStream)->readBytes(any()) -> returns(array(0x20)) + -> one($charStream)->readBytes(any()) -> returns(array(ord('b'))) + -> allowing($charStream)->readBytes(any()) -> returns(false) + -> ignoring($charStream) + ); + + $encoder = $this->_createEncoder($charStream); + $this->assertNoPattern('~[ \t]~', $encoder->encodeString("a \t b"), + '%s: encoded-words in headers cannot contain LWSP as per RFC 2047.' + ); + } + + public function testSpaceIsRepresentedByUnderscore() + { + /* -- RFC 2047, 4.2. + (2) The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be + represented as "_" (underscore, ASCII 95.). (This character may + not pass through some internetwork mail gateways, but its use + will greatly enhance readability of "Q" encoded data with mail + readers that do not support this encoding.) Note that the "_" + always represents hexadecimal 20, even if the SPACE character + occupies a different code position in the character set in use. + */ + $charStream = $this->_createCharacterStream(); + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + -> one($charStream)->readBytes(any()) -> returns(array(0x20)) + -> one($charStream)->readBytes(any()) -> returns(array(ord('b'))) + -> allowing($charStream)->readBytes(any()) -> returns(false) + -> ignoring($charStream) + ); + + $encoder = $this->_createEncoder($charStream); + $this->assertEqual('a_b', $encoder->encodeString('a b'), + '%s: Spaces can be represented by more readable underscores as per RFC 2047.' + ); + } + + public function testEqualsAndQuestionAndUnderscoreAreEncoded() + { + /* -- RFC 2047, 4.2. + (3) 8-bit values which correspond to printable ASCII characters other + than "=", "?", and "_" (underscore), MAY be represented as those + characters. (But see section 5 for restrictions.) In + particular, SPACE and TAB MUST NOT be represented as themselves + within encoded words. + */ + $charStream = $this->_createCharacterStream(); + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array(ord('='))) + -> one($charStream)->readBytes(any()) -> returns(array(ord('?'))) + -> one($charStream)->readBytes(any()) -> returns(array(ord('_'))) + -> allowing($charStream)->readBytes(any()) -> returns(false) + -> ignoring($charStream) + ); + + $encoder = $this->_createEncoder($charStream); + $this->assertEqual('=3D=3F=5F', $encoder->encodeString('=?_'), + '%s: Chars =, ? and _ (underscore) may not appear as per RFC 2047.' + ); + } + + public function testParensAndQuotesAreEncoded() + { + /* -- RFC 2047, 5 (2). + A "Q"-encoded 'encoded-word' which appears in a 'comment' MUST NOT + contain the characters "(", ")" or " + */ + + $charStream = $this->_createCharacterStream(); + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array(ord('('))) + -> one($charStream)->readBytes(any()) -> returns(array(ord('"'))) + -> one($charStream)->readBytes(any()) -> returns(array(ord(')'))) + -> allowing($charStream)->readBytes(any()) -> returns(false) + -> ignoring($charStream) + ); + + $encoder = $this->_createEncoder($charStream); + $this->assertEqual('=28=22=29', $encoder->encodeString('(")'), + '%s: Chars (, " (DQUOTE) and ) may not appear as per RFC 2047.' + ); + } + + public function testOnlyCharactersAllowedInPhrasesAreUsed() + { + /* -- RFC 2047, 5. + (3) As a replacement for a 'word' entity within a 'phrase', for example, + one that precedes an address in a From, To, or Cc header. The ABNF + definition for 'phrase' from RFC 822 thus becomes: + + phrase = 1*( encoded-word / word ) + + In this case the set of characters that may be used in a "Q"-encoded + 'encoded-word' is restricted to: . An 'encoded-word' that appears within a + 'phrase' MUST be separated from any adjacent 'word', 'text' or + 'special' by 'linear-white-space'. + */ + + $allowedBytes = array_merge( + range(ord('a'), ord('z')), range(ord('A'), ord('Z')), + range(ord('0'), ord('9')), + array(ord('!'), ord('*'), ord('+'), ord('-'), ord('/')) + ); + + foreach (range(0x00, 0xFF) as $byte) { + $char = pack('C', $byte); + + $charStream = $this->_createCharacterStream(); + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array($byte)) + -> allowing($charStream)->readBytes(any()) -> returns(false) + -> ignoring($charStream) + ); + + $encoder = $this->_createEncoder($charStream); + $encodedChar = $encoder->encodeString($char); + + if (in_array($byte, $allowedBytes)) { + $this->assertEqual($char, $encodedChar, + '%s: Character ' . $char . ' should not be encoded.' + ); + } + elseif (0x20 == $byte) //Special case + { + $this->assertEqual('_', $encodedChar, + '%s: Space character should be replaced.' + ); + } else { + $this->assertEqual(sprintf('=%02X', $byte), $encodedChar, + '%s: Byte ' . $byte . ' should be encoded.' + ); + } + } + } + + public function testEqualsNeverAppearsAtEndOfLine() + { + /* -- RFC 2047, 5 (3). + The 'encoded-text' in an 'encoded-word' must be self-contained; + 'encoded-text' MUST NOT be continued from one 'encoded-word' to + another. This implies that the 'encoded-text' portion of a "B" + 'encoded-word' will be a multiple of 4 characters long; for a "Q" + 'encoded-word', any "=" character that appears in the 'encoded-text' + portion will be followed by two hexadecimal characters. + */ + + $input = str_repeat('a', 140); + + $charStream = $this->_createCharacterStream(); + + $output = ''; + $seq = 0; + for (; $seq < 140; ++$seq) { + $this->_checking(Expectations::create() + -> one($charStream)->readBytes(any()) -> returns(array(ord('a'))) + ); + + if (75 == $seq) { + $output .= "\r\n"; // =\r\n + } + $output .= 'a'; + } + + $this->_checking(Expectations::create() + -> allowing($charStream)->readBytes(any()) -> returns(false) + -> ignoring($charStream) + ); + + $encoder = $this->_createEncoder($charStream); + $this->assertEqual($output, $encoder->encodeString($input)); + } + + // -- Creation Methods + + private function _createEncoder($charStream) + { + return new Swift_Mime_HeaderEncoder_QpHeaderEncoder($charStream); + } + + private function _createCharacterStream($stub = false) + { + return $stub + ? $this->_stub('Swift_CharacterStream') + : $this->_mock('Swift_CharacterStream') + ; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php new file mode 100644 index 0000000..3fa3adf --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/DateHeaderTest.php @@ -0,0 +1,76 @@ +_getHeader('Date'); + $this->assertEqual(Swift_Mime_Header::TYPE_DATE, $header->getFieldType()); + } + + public function testGetTimestamp() + { + $timestamp = time(); + $header = $this->_getHeader('Date'); + $header->setTimestamp($timestamp); + $this->assertIdentical($timestamp, $header->getTimestamp()); + } + + public function testTimestampCanBeSetBySetter() + { + $timestamp = time(); + $header = $this->_getHeader('Date'); + $header->setTimestamp($timestamp); + $this->assertIdentical($timestamp, $header->getTimestamp()); + } + + public function testIntegerTimestampIsConvertedToRfc2822Date() + { + $timestamp = time(); + $header = $this->_getHeader('Date'); + $header->setTimestamp($timestamp); + $this->assertEqual(date('r', $timestamp), $header->getFieldBody()); + } + + public function testSetBodyModel() + { + $timestamp = time(); + $header = $this->_getHeader('Date'); + $header->setFieldBodyModel($timestamp); + $this->assertEqual(date('r', $timestamp), $header->getFieldBody()); + } + + public function testGetBodyModel() + { + $timestamp = time(); + $header = $this->_getHeader('Date'); + $header->setTimestamp($timestamp); + $this->assertEqual($timestamp, $header->getFieldBodyModel()); + } + + public function testToString() + { + $timestamp = time(); + $header = $this->_getHeader('Date'); + $header->setTimestamp($timestamp); + $this->assertEqual('Date: ' . date('r', $timestamp) . "\r\n", + $header->toString() + ); + } + + // -- Private methods + + private function _getHeader($name) + { + return new Swift_Mime_Headers_DateHeader($name, new Swift_Mime_Grammar()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php new file mode 100644 index 0000000..bf4ae96 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/IdentificationHeaderTest.php @@ -0,0 +1,199 @@ +_getHeader('Message-ID'); + $this->assertEqual(Swift_Mime_Header::TYPE_ID, $header->getFieldType()); + } + + public function testValueMatchesMsgIdSpec() + { + /* -- RFC 2822, 3.6.4. + message-id = "Message-ID:" msg-id CRLF + + in-reply-to = "In-Reply-To:" 1*msg-id CRLF + + references = "References:" 1*msg-id CRLF + + msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS] + + id-left = dot-atom-text / no-fold-quote / obs-id-left + + id-right = dot-atom-text / no-fold-literal / obs-id-right + + no-fold-quote = DQUOTE *(qtext / quoted-pair) DQUOTE + + no-fold-literal = "[" *(dtext / quoted-pair) "]" + */ + + $header = $this->_getHeader('Message-ID'); + $header->setId('id-left@id-right'); + $this->assertEqual('', $header->getFieldBody()); + } + + public function testIdCanBeRetrievedVerbatim() + { + $header = $this->_getHeader('Message-ID'); + $header->setId('id-left@id-right'); + $this->assertEqual('id-left@id-right', $header->getId()); + } + + public function testMultipleIdsCanBeSet() + { + $header = $this->_getHeader('References'); + $header->setIds(array('a@b', 'x@y')); + $this->assertEqual(array('a@b', 'x@y'), $header->getIds()); + } + + public function testSettingMultipleIdsProducesAListValue() + { + /* -- RFC 2822, 3.6.4. + The "References:" and "In-Reply-To:" field each contain one or more + unique message identifiers, optionally separated by CFWS. + + .. SNIP .. + + in-reply-to = "In-Reply-To:" 1*msg-id CRLF + + references = "References:" 1*msg-id CRLF + */ + + $header = $this->_getHeader('References'); + $header->setIds(array('a@b', 'x@y')); + $this->assertEqual(' ', $header->getFieldBody()); + } + + public function testIdLeftCanBeQuoted() + { + /* -- RFC 2822, 3.6.4. + id-left = dot-atom-text / no-fold-quote / obs-id-left + */ + + $header = $this->_getHeader('References'); + $header->setId('"ab"@c'); + $this->assertEqual('"ab"@c', $header->getId()); + $this->assertEqual('<"ab"@c>', $header->getFieldBody()); + } + + public function testIdLeftCanContainAnglesAsQuotedPairs() + { + /* -- RFC 2822, 3.6.4. + no-fold-quote = DQUOTE *(qtext / quoted-pair) DQUOTE + */ + + $header = $this->_getHeader('References'); + $header->setId('"a\\<\\>b"@c'); + $this->assertEqual('"a\\<\\>b"@c', $header->getId()); + $this->assertEqual('<"a\\<\\>b"@c>', $header->getFieldBody()); + } + + public function testIdLeftCanBeDotAtom() + { + $header = $this->_getHeader('References'); + $header->setId('a.b+&%$.c@d'); + $this->assertEqual('a.b+&%$.c@d', $header->getId()); + $this->assertEqual('', $header->getFieldBody()); + } + + public function testInvalidIdLeftThrowsException() + { + try { + $header = $this->_getHeader('References'); + $header->setId('a b c@d'); + $this->fail( + 'Exception should be thrown since "a b c" is not valid id-left.' + ); + } catch (Exception $e) { + $this->pass(); + } + } + + public function testIdRightCanBeDotAtom() + { + /* -- RFC 2822, 3.6.4. + id-right = dot-atom-text / no-fold-literal / obs-id-right + */ + + $header = $this->_getHeader('References'); + $header->setId('a@b.c+&%$.d'); + $this->assertEqual('a@b.c+&%$.d', $header->getId()); + $this->assertEqual('', $header->getFieldBody()); + } + + public function testIdRightCanBeLiteral() + { + /* -- RFC 2822, 3.6.4. + no-fold-literal = "[" *(dtext / quoted-pair) "]" + */ + + $header = $this->_getHeader('References'); + $header->setId('a@[1.2.3.4]'); + $this->assertEqual('a@[1.2.3.4]', $header->getId()); + $this->assertEqual('', $header->getFieldBody()); + } + + public function testInvalidIdRightThrowsException() + { + try { + $header = $this->_getHeader('References'); + $header->setId('a@b c d'); + $this->fail( + 'Exception should be thrown since "b c d" is not valid id-right.' + ); + } catch (Exception $e) { + $this->pass(); + } + } + + public function testMissingAtSignThrowsException() + { + /* -- RFC 2822, 3.6.4. + msg-id = [CFWS] "<" id-left "@" id-right ">" [CFWS] + */ + + try { + $header = $this->_getHeader('References'); + $header->setId('abc'); + $this->fail( + 'Exception should be thrown since "abc" is does not contain @.' + ); + } catch (Exception $e) { + $this->pass(); + } + } + + public function testSetBodyModel() + { + $header = $this->_getHeader('Message-ID'); + $header->setFieldBodyModel('a@b'); + $this->assertEqual(array('a@b'), $header->getIds()); + } + + public function testGetBodyModel() + { + $header = $this->_getHeader('Message-ID'); + $header->setId('a@b'); + $this->assertEqual(array('a@b'), $header->getFieldBodyModel()); + } + + public function testStringValue() + { + $header = $this->_getHeader('References'); + $header->setIds(array('a@b', 'x@y')); + $this->assertEqual('References: ' . "\r\n", $header->toString()); + } + + // -- Private methods + + private function _getHeader($name) + { + return new Swift_Mime_Headers_IdentificationHeader($name, new Swift_Mime_Grammar()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php new file mode 100644 index 0000000..c109da2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/MailboxHeaderTest.php @@ -0,0 +1,338 @@ +_getHeader('To', $this->_getEncoder('Q', true)); + $this->assertEqual(Swift_Mime_Header::TYPE_MAILBOX, $header->getFieldType()); + } + + public function testMailboxIsSetForAddress() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setAddresses('chris@swiftmailer.org'); + $this->assertEqual(array('chris@swiftmailer.org'), + $header->getNameAddressStrings() + ); + } + + public function testMailboxIsRenderedForNameAddress() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris Corbyn')); + $this->assertEqual( + array('Chris Corbyn '), $header->getNameAddressStrings() + ); + } + + public function testAddressCanBeReturnedForAddress() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setAddresses('chris@swiftmailer.org'); + $this->assertEqual(array('chris@swiftmailer.org'), $header->getAddresses()); + } + + public function testAddressCanBeReturnedForNameAddress() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array('chris@swiftmailer.org' => 'Chris Corbyn')); + $this->assertEqual(array('chris@swiftmailer.org'), $header->getAddresses()); + } + + public function testQuotesInNameAreQuoted() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn, "DHE"' + )); + $this->assertEqual( + array('"Chris Corbyn, \"DHE\"" '), + $header->getNameAddressStrings() + ); + } + + public function testEscapeCharsInNameAreQuoted() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn, \\escaped\\' + )); + $this->assertEqual( + array('"Chris Corbyn, \\\\escaped\\\\" '), + $header->getNameAddressStrings() + ); + } + + public function testGetMailboxesReturnsNameValuePairs() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn, DHE' + )); + $this->assertEqual( + array('chris@swiftmailer.org' => 'Chris Corbyn, DHE'), $header->getNameAddresses() + ); + } + + public function testMultipleAddressesCanBeSetAndFetched() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setAddresses(array( + 'chris@swiftmailer.org', 'mark@swiftmailer.org' + )); + $this->assertEqual( + array('chris@swiftmailer.org', 'mark@swiftmailer.org'), + $header->getAddresses() + ); + } + + public function testMultipleAddressesAsMailboxes() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setAddresses(array( + 'chris@swiftmailer.org', 'mark@swiftmailer.org' + )); + $this->assertEqual( + array('chris@swiftmailer.org'=>null, 'mark@swiftmailer.org'=>null), + $header->getNameAddresses() + ); + } + + public function testMultipleAddressesAsMailboxStrings() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setAddresses(array( + 'chris@swiftmailer.org', 'mark@swiftmailer.org' + )); + $this->assertEqual( + array('chris@swiftmailer.org', 'mark@swiftmailer.org'), + $header->getNameAddressStrings() + ); + } + + public function testMultipleNamedMailboxesReturnsMultipleAddresses() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + )); + $this->assertEqual( + array('chris@swiftmailer.org', 'mark@swiftmailer.org'), + $header->getAddresses() + ); + } + + public function testMultipleNamedMailboxesReturnsMultipleMailboxes() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + )); + $this->assertEqual(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + ), + $header->getNameAddresses() + ); + } + + public function testMultipleMailboxesProducesMultipleMailboxStrings() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + )); + $this->assertEqual(array( + 'Chris Corbyn ', + 'Mark Corbyn ' + ), + $header->getNameAddressStrings() + ); + } + + public function testSetAddressesOverwritesAnyMailboxes() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + )); + $this->assertEqual( + array('chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn'), + $header->getNameAddresses() + ); + $this->assertEqual( + array('chris@swiftmailer.org', 'mark@swiftmailer.org'), + $header->getAddresses() + ); + + $header->setAddresses(array('chris@swiftmailer.org', 'mark@swiftmailer.org')); + + $this->assertEqual( + array('chris@swiftmailer.org' => null, 'mark@swiftmailer.org' => null), + $header->getNameAddresses() + ); + $this->assertEqual( + array('chris@swiftmailer.org', 'mark@swiftmailer.org'), + $header->getAddresses() + ); + } + + public function testNameIsEncodedIfNonAscii() + { + $name = 'C' . pack('C', 0x8F) . 'rbyn'; + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($name, any(), any()) -> returns('C=8Frbyn') + -> ignoring($encoder) + ); + + $header = $this->_getHeader('From', $encoder); + $header->setNameAddresses(array('chris@swiftmailer.org'=>'Chris ' . $name)); + + $addresses = $header->getNameAddressStrings(); + $this->assertEqual( + 'Chris =?' . $this->_charset . '?Q?C=8Frbyn?= ', + array_shift($addresses) + ); + } + + public function testEncodingLineLengthCalculations() + { + /* -- RFC 2047, 2. + An 'encoded-word' may not be more than 75 characters long, including + 'charset', 'encoding', 'encoded-text', and delimiters. + */ + + $name = 'C' . pack('C', 0x8F) . 'rbyn'; + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($name, 6, 63) -> returns('C=8Frbyn') + -> ignoring($encoder) + ); + + $header = $this->_getHeader('From', $encoder); + $header->setNameAddresses(array('chris@swiftmailer.org'=>'Chris ' . $name)); + + $header->getNameAddressStrings(); + } + + public function testGetValueReturnsMailboxStringValue() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn' + )); + $this->assertEqual( + 'Chris Corbyn ', $header->getFieldBody() + ); + } + + public function testGetValueReturnsMailboxStringValueForMultipleMailboxes() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + )); + $this->assertEqual( + 'Chris Corbyn , Mark Corbyn ', + $header->getFieldBody() + ); + } + + public function testRemoveAddressesWithSingleValue() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + )); + $header->removeAddresses('chris@swiftmailer.org'); + $this->assertEqual(array('mark@swiftmailer.org'), + $header->getAddresses() + ); + } + + public function testRemoveAddressesWithList() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + )); + $header->removeAddresses( + array('chris@swiftmailer.org', 'mark@swiftmailer.org') + ); + $this->assertEqual(array(), $header->getAddresses()); + } + + public function testSetBodyModel() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setFieldBodyModel('chris@swiftmailer.org'); + $this->assertEqual(array('chris@swiftmailer.org'=>null), $header->getNameAddresses()); + } + + public function testGetBodyModel() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setAddresses(array('chris@swiftmailer.org')); + $this->assertEqual(array('chris@swiftmailer.org'=>null), $header->getFieldBodyModel()); + } + + public function testToString() + { + $header = $this->_getHeader('From', $this->_getEncoder('Q', true)); + $header->setNameAddresses(array( + 'chris@swiftmailer.org' => 'Chris Corbyn', + 'mark@swiftmailer.org' => 'Mark Corbyn' + )); + $this->assertEqual( + 'From: Chris Corbyn , ' . + 'Mark Corbyn ' . "\r\n", + $header->toString() + ); + } + + // -- Private methods + + private function _getHeader($name, $encoder) + { + $header = new Swift_Mime_Headers_MailboxHeader($name, $encoder, new Swift_Mime_Grammar()); + $header->setCharset($this->_charset); + return $header; + } + + private function _getEncoder($type, $stub = false) + { + $encoder = $this->_mock('Swift_Mime_HeaderEncoder'); + $this->_checking(Expectations::create() + -> ignoring($encoder)->getName() -> returns($type) + ); + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($encoder) + ); + } + return $encoder; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php new file mode 100644 index 0000000..c762340 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/ParameterizedHeaderTest.php @@ -0,0 +1,420 @@ +_getHeader('Content-Type', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $this->assertEqual(Swift_Mime_Header::TYPE_PARAMETERIZED, $header->getFieldType()); + } + + public function testValueIsReturnedVerbatim() + { + $header = $this->_getHeader('Content-Type', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $header->setValue('text/plain'); + $this->assertEqual('text/plain', $header->getValue()); + } + + public function testParametersAreAppended() + { + /* -- RFC 2045, 5.1 + parameter := attribute "=" value + + attribute := token + ; Matching of attributes + ; is ALWAYS case-insensitive. + + value := token / quoted-string + + token := 1* + + tspecials := "(" / ")" / "<" / ">" / "@" / + "," / ";" / ":" / "\" / <"> + "/" / "[" / "]" / "?" / "=" + ; Must be in quoted-string, + ; to use within parameter values + */ + + $header = $this->_getHeader('Content-Type', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $header->setValue('text/plain'); + $header->setParameters(array('charset' => 'utf-8')); + $this->assertEqual('text/plain; charset=utf-8', $header->getFieldBody()); + } + + public function testSpaceInParamResultsInQuotedString() + { + $header = $this->_getHeader('Content-Disposition', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $header->setValue('attachment'); + $header->setParameters(array('filename' => 'my file.txt')); + $this->assertEqual('attachment; filename="my file.txt"', + $header->getFieldBody() + ); + } + + public function testLongParamsAreBrokenIntoMultipleAttributeStrings() + { + /* -- RFC 2231, 3. + The asterisk character ("*") followed + by a decimal count is employed to indicate that multiple parameters + are being used to encapsulate a single parameter value. The count + starts at 0 and increments by 1 for each subsequent section of the + parameter value. Decimal values are used and neither leading zeroes + nor gaps in the sequence are allowed. + + The original parameter value is recovered by concatenating the + various sections of the parameter, in order. For example, the + content-type field + + Content-Type: message/external-body; access-type=URL; + URL*0="ftp://"; + URL*1="cs.utk.edu/pub/moore/bulk-mailer/bulk-mailer.tar" + + is semantically identical to + + Content-Type: message/external-body; access-type=URL; + URL="ftp://cs.utk.edu/pub/moore/bulk-mailer/bulk-mailer.tar" + + Note that quotes around parameter values are part of the value + syntax; they are NOT part of the value itself. Furthermore, it is + explicitly permitted to have a mixture of quoted and unquoted + continuation fields. + */ + + $value = str_repeat('a', 180); + + $encoder = $this->_getParameterEncoder(); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($value, any(), 63) + -> returns(str_repeat('a', 63) . "\r\n" . + str_repeat('a', 63) . "\r\n" . str_repeat('a', 54)) + + -> ignoring($encoder) + ); + + $header = $this->_getHeader('Content-Disposition', + $this->_getHeaderEncoder('Q', true), $encoder + ); + $header->setValue('attachment'); + $header->setParameters(array('filename' => $value)); + $header->setMaxLineLength(78); + $this->assertEqual( + 'attachment; ' . + 'filename*0*=utf-8\'\'' . str_repeat('a', 63) . ";\r\n " . + 'filename*1*=' . str_repeat('a', 63) . ";\r\n " . + 'filename*2*=' . str_repeat('a', 54), + $header->getFieldBody() + ); + } + + public function testEncodedParamDataIncludesCharsetAndLanguage() + { + /* -- RFC 2231, 4. + Asterisks ("*") are reused to provide the indicator that language and + character set information is present and encoding is being used. A + single quote ("'") is used to delimit the character set and language + information at the beginning of the parameter value. Percent signs + ("%") are used as the encoding flag, which agrees with RFC 2047. + + Specifically, an asterisk at the end of a parameter name acts as an + indicator that character set and language information may appear at + the beginning of the parameter value. A single quote is used to + separate the character set, language, and actual value information in + the parameter value string, and an percent sign is used to flag + octets encoded in hexadecimal. For example: + + Content-Type: application/x-stuff; + title*=us-ascii'en-us'This%20is%20%2A%2A%2Afun%2A%2A%2A + + Note that it is perfectly permissible to leave either the character + set or language field blank. Note also that the single quote + delimiters MUST be present even when one of the field values is + omitted. + */ + + $value = str_repeat('a', 20) . pack('C', 0x8F) . str_repeat('a', 10); + + $encoder = $this->_getParameterEncoder(); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($value, 12, 62) + -> returns(str_repeat('a', 20) . '%8F' . str_repeat('a', 10)) + + -> ignoring($encoder) + ); + + $header = $this->_getHeader('Content-Disposition', + $this->_getHeaderEncoder('Q', true), $encoder + ); + $header->setValue('attachment'); + $header->setParameters(array('filename' => $value)); + $header->setMaxLineLength(78); + $header->setLanguage($this->_lang); + $this->assertEqual( + 'attachment; filename*=' . $this->_charset . "'" . $this->_lang . "'" . + str_repeat('a', 20) . '%8F' . str_repeat('a', 10), + $header->getFieldBody() + ); + } + + public function testMultipleEncodedParamLinesAreFormattedCorrectly() + { + /* -- RFC 2231, 4.1. + Character set and language information may be combined with the + parameter continuation mechanism. For example: + + Content-Type: application/x-stuff + title*0*=us-ascii'en'This%20is%20even%20more%20 + title*1*=%2A%2A%2Afun%2A%2A%2A%20 + title*2="isn't it!" + + Note that: + + (1) Language and character set information only appear at + the beginning of a given parameter value. + + (2) Continuations do not provide a facility for using more + than one character set or language in the same + parameter value. + + (3) A value presented using multiple continuations may + contain a mixture of encoded and unencoded segments. + + (4) The first segment of a continuation MUST be encoded if + language and character set information are given. + + (5) If the first segment of a continued parameter value is + encoded the language and character set field delimiters + MUST be present even when the fields are left blank. + */ + + $value = str_repeat('a', 20) . pack('C', 0x8F) . str_repeat('a', 60); + + $encoder = $this->_getParameterEncoder(); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($value, 12, 62) + -> returns(str_repeat('a', 20) . '%8F' . str_repeat('a', 28) . "\r\n" . + str_repeat('a', 32)) + + -> ignoring($encoder) + ); + + $header = $this->_getHeader('Content-Disposition', + $this->_getHeaderEncoder('Q', true), $encoder + ); + $header->setValue('attachment'); + $header->setParameters(array('filename' => $value)); + $header->setMaxLineLength(78); + $header->setLanguage($this->_lang); + $this->assertEqual( + 'attachment; filename*0*=' . $this->_charset . "'" . $this->_lang . "'" . + str_repeat('a', 20) . '%8F' . str_repeat('a', 28) . ";\r\n " . + 'filename*1*=' . str_repeat('a', 32), + $header->getFieldBody() + ); + } + + public function testToString() + { + $header = $this->_getHeader('Content-Type', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $header->setValue('text/html'); + $header->setParameters(array('charset' => 'utf-8')); + $this->assertEqual('Content-Type: text/html; charset=utf-8' . "\r\n", + $header->toString() + ); + } + + public function testValueCanBeEncodedIfNonAscii() + { + $value = 'fo' . pack('C', 0x8F) .'bar'; + + $encoder = $this->_getHeaderEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($value, any(), any()) -> returns('fo=8Fbar') + -> ignoring($encoder) + ); + + $header = $this->_getHeader('X-Foo', $encoder, $this->_getParameterEncoder(true)); + $header->setValue($value); + $header->setParameters(array('lookslike' => 'foobar')); + $this->assertEqual('X-Foo: =?utf-8?Q?fo=8Fbar?=; lookslike=foobar' . "\r\n", + $header->toString() + ); + } + + public function testValueAndParamCanBeEncodedIfNonAscii() + { + $value = 'fo' . pack('C', 0x8F) .'bar'; + + $encoder = $this->_getHeaderEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($value, any(), any()) -> returns('fo=8Fbar') + -> ignoring($encoder) + ); + + $paramEncoder = $this->_getParameterEncoder(); + $this->_checking(Expectations::create() + -> one($paramEncoder)->encodeString($value, any(), any()) -> returns('fo%8Fbar') + -> ignoring($paramEncoder) + ); + + $header = $this->_getHeader('X-Foo', $encoder, $paramEncoder); + $header->setValue($value); + $header->setParameters(array('says' => $value)); + $this->assertEqual("X-Foo: =?utf-8?Q?fo=8Fbar?=; says*=utf-8''fo%8Fbar\r\n", + $header->toString() + ); + } + + public function testParamsAreEncodedWithEncodedWordsIfNoParamEncoderSet() + { + $value = 'fo' . pack('C', 0x8F) .'bar'; + + $encoder = $this->_getHeaderEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($value, any(), any()) -> returns('fo=8Fbar') + -> ignoring($encoder) + ); + + $header = $this->_getHeader('X-Foo', $encoder, null); + $header->setValue('bar'); + $header->setParameters(array('says' => $value)); + $this->assertEqual("X-Foo: bar; says=\"=?utf-8?Q?fo=8Fbar?=\"\r\n", + $header->toString() + ); + } + + public function testLanguageInformationAppearsInEncodedWords() + { + /* -- RFC 2231, 5. + 5. Language specification in Encoded Words + + RFC 2047 provides support for non-US-ASCII character sets in RFC 822 + message header comments, phrases, and any unstructured text field. + This is done by defining an encoded word construct which can appear + in any of these places. Given that these are fields intended for + display, it is sometimes necessary to associate language information + with encoded words as well as just the character set. This + specification extends the definition of an encoded word to allow the + inclusion of such information. This is simply done by suffixing the + character set specification with an asterisk followed by the language + tag. For example: + + From: =?US-ASCII*EN?Q?Keith_Moore?= + */ + + $value = 'fo' . pack('C', 0x8F) .'bar'; + + $encoder = $this->_getHeaderEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($value, any(), any()) -> returns('fo=8Fbar') + -> ignoring($encoder) + ); + + $paramEncoder = $this->_getParameterEncoder(); + $this->_checking(Expectations::create() + -> one($paramEncoder)->encodeString($value, any(), any()) -> returns('fo%8Fbar') + -> ignoring($paramEncoder) + ); + + $header = $this->_getHeader('X-Foo', $encoder, $paramEncoder); + $header->setLanguage('en'); + $header->setValue($value); + $header->setParameters(array('says' => $value)); + $this->assertEqual("X-Foo: =?utf-8*en?Q?fo=8Fbar?=; says*=utf-8'en'fo%8Fbar\r\n", + $header->toString() + ); + } + + public function testSetBodyModel() + { + $header = $this->_getHeader('Content-Type', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $header->setFieldBodyModel('text/html'); + $this->assertEqual('text/html', $header->getValue()); + } + + public function testGetBodyModel() + { + $header = $this->_getHeader('Content-Type', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $header->setValue('text/plain'); + $this->assertEqual('text/plain', $header->getFieldBodyModel()); + } + + public function testSetParameter() + { + $header = $this->_getHeader('Content-Type', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $header->setParameters(array('charset'=>'utf-8', 'delsp' => 'yes')); + $header->setParameter('delsp', 'no'); + $this->assertEqual(array('charset'=>'utf-8', 'delsp'=>'no'), + $header->getParameters() + ); + } + + public function testGetParameter() + { + $header = $this->_getHeader('Content-Type', + $this->_getHeaderEncoder('Q', true), $this->_getParameterEncoder(true) + ); + $header->setParameters(array('charset'=>'utf-8', 'delsp' => 'yes')); + $this->assertEqual('utf-8', $header->getParameter('charset')); + } + + // -- Private helper + + private function _getHeader($name, $encoder, $paramEncoder) + { + $header = new Swift_Mime_Headers_ParameterizedHeader($name, $encoder, + $paramEncoder, new Swift_Mime_Grammar() + ); + $header->setCharset($this->_charset); + return $header; + } + + private function _getHeaderEncoder($type, $stub = false) + { + $encoder = $this->_mock('Swift_Mime_HeaderEncoder'); + $this->_checking(Expectations::create() + -> ignoring($encoder)->getName() -> returns($type) + ); + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($encoder) + ); + } + return $encoder; + } + + private function _getParameterEncoder($stub = false) + { + if ($stub) { + return $this->_stub('Swift_Encoder'); + } else { + return $this->_mock('Swift_Encoder'); + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php new file mode 100644 index 0000000..5fa9df2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/PathHeaderTest.php @@ -0,0 +1,83 @@ +_getHeader('Return-Path'); + $this->assertEqual(Swift_Mime_Header::TYPE_PATH, $header->getFieldType()); + } + + public function testSingleAddressCanBeSetAndFetched() + { + $header = $this->_getHeader('Return-Path'); + $header->setAddress('chris@swiftmailer.org'); + $this->assertEqual('chris@swiftmailer.org', $header->getAddress()); + } + + public function testAddressMustComplyWithRfc2822() + { + try { + $header = $this->_getHeader('Return-Path'); + $header->setAddress('chr is@swiftmailer.org'); + $this->fail('Address must be valid according to RFC 2822 addr-spec grammar.'); + } catch (Exception $e) { + $this->pass(); + } + } + + public function testValueIsAngleAddrWithValidAddress() + { + /* -- RFC 2822, 3.6.7. + return = "Return-Path:" path CRLF + + path = ([CFWS] "<" ([CFWS] / addr-spec) ">" [CFWS]) / + obs-path + */ + + $header = $this->_getHeader('Return-Path'); + $header->setAddress('chris@swiftmailer.org'); + $this->assertEqual('', $header->getFieldBody()); + } + + public function testValueIsEmptyAngleBracketsIfEmptyAddressSet() + { + $header = $this->_getHeader('Return-Path'); + $header->setAddress(''); + $this->assertEqual('<>', $header->getFieldBody()); + } + + public function testSetBodyModel() + { + $header = $this->_getHeader('Return-Path'); + $header->setFieldBodyModel('foo@bar.tld'); + $this->assertEqual('foo@bar.tld', $header->getAddress()); + } + + public function testGetBodyModel() + { + $header = $this->_getHeader('Return-Path'); + $header->setAddress('foo@bar.tld'); + $this->assertEqual('foo@bar.tld', $header->getFieldBodyModel()); + } + + public function testToString() + { + $header = $this->_getHeader('Return-Path'); + $header->setAddress('chris@swiftmailer.org'); + $this->assertEqual('Return-Path: ' . "\r\n", + $header->toString() + ); + } + + // -- Private methods + + private function _getHeader($name) + { + return new Swift_Mime_Headers_PathHeader($name, new Swift_Mime_Grammar()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php new file mode 100644 index 0000000..47e4654 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/Headers/UnstructuredHeaderTest.php @@ -0,0 +1,364 @@ +_getHeader('Subject', $this->_getEncoder('Q', true)); + $this->assertEqual(Swift_Mime_Header::TYPE_TEXT, $header->getFieldType()); + } + + public function testGetNameReturnsNameVerbatim() + { + $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true)); + $this->assertEqual('Subject', $header->getFieldName()); + } + + public function testGetValueReturnsValueVerbatim() + { + $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true)); + $header->setValue('Test'); + $this->assertEqual('Test', $header->getValue()); + } + + public function testBasicStructureIsKeyValuePair() + { + /* -- RFC 2822, 2.2 + Header fields are lines composed of a field name, followed by a colon + (":"), followed by a field body, and terminated by CRLF. + */ + $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true)); + $header->setValue('Test'); + $this->assertEqual('Subject: Test' . "\r\n", $header->toString()); + } + + public function testLongHeadersAreFoldedAtWordBoundary() + { + /* -- RFC 2822, 2.2.3 + Each header field is logically a single line of characters comprising + the field name, the colon, and the field body. For convenience + however, and to deal with the 998/78 character limitations per line, + the field body portion of a header field can be split into a multiple + line representation; this is called "folding". The general rule is + that wherever this standard allows for folding white space (not + simply WSP characters), a CRLF may be inserted before any WSP. + */ + + $value = 'The quick brown fox jumped over the fence, he was a very very ' . + 'scary brown fox with a bushy tail'; + $header = $this->_getHeader('X-Custom-Header', + $this->_getEncoder('Q', true) + ); + $header->setValue($value); + $header->setMaxLineLength(78); //A safe [RFC 2822, 2.2.3] default + /* + X-Custom-Header: The quick brown fox jumped over the fence, he was a very very + scary brown fox with a bushy tail + */ + $this->assertEqual( + 'X-Custom-Header: The quick brown fox jumped over the fence, he was a' . + ' very very' . "\r\n" . //Folding + ' scary brown fox with a bushy tail' . "\r\n", + $header->toString(), '%s: The header should have been folded at 78th char' + ); + } + + public function testPrintableAsciiOnlyAppearsInHeaders() + { + /* -- RFC 2822, 2.2. + A field name MUST be composed of printable US-ASCII characters (i.e., + characters that have values between 33 and 126, inclusive), except + colon. A field body may be composed of any US-ASCII characters, + except for CR and LF. + */ + + $nonAsciiChar = pack('C', 0x8F); + $header = $this->_getHeader('X-Test', $this->_getEncoder('Q', true)); + $header->setValue($nonAsciiChar); + $this->assertPattern( + '~^[^:\x00-\x20\x80-\xFF]+: [^\x80-\xFF\r\n]+\r\n$~s', + $header->toString() + ); + } + + public function testEncodedWordsFollowGeneralStructure() + { + /* -- RFC 2047, 1. + Generally, an "encoded-word" is a sequence of printable ASCII + characters that begins with "=?", ends with "?=", and has two "?"s in + between. + */ + + $nonAsciiChar = pack('C', 0x8F); + $header = $this->_getHeader('X-Test', $this->_getEncoder('Q', true)); + $header->setValue($nonAsciiChar); + $this->assertPattern( + '~^X-Test: \=?.*?\?.*?\?.*?\?=\r\n$~s', + $header->toString() + ); + } + + public function testEncodedWordIncludesCharsetAndEncodingMethodAndText() + { + /* -- RFC 2047, 2. + An 'encoded-word' is defined by the following ABNF grammar. The + notation of RFC 822 is used, with the exception that white space + characters MUST NOT appear between components of an 'encoded-word'. + + encoded-word = "=?" charset "?" encoding "?" encoded-text "?=" + */ + + $nonAsciiChar = pack('C', 0x8F); + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($nonAsciiChar, any(), any()) -> returns('=8F') + -> ignoring($encoder) + ); + $header = $this->_getHeader('X-Test', $encoder); + $header->setValue($nonAsciiChar); + $this->assertEqual( + 'X-Test: =?' . $this->_charset . '?Q?=8F?=' . "\r\n", + $header->toString() + ); + } + + public function testEncodedWordsAreUsedToEncodedNonPrintableAscii() + { + //SPACE and TAB permitted + $nonPrintableBytes = array_merge( + range(0x00, 0x08), range(0x10, 0x19), array(0x7F) + ); + + foreach ($nonPrintableBytes as $byte) { + $char = pack('C', $byte); + $encodedChar = sprintf('=%02X', $byte); + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($char, any(), any()) -> returns($encodedChar) + -> ignoring($encoder) + ); + + $header = $this->_getHeader('X-A', $encoder); + $header->setValue($char); + + $this->assertEqual( + 'X-A: =?' . $this->_charset . '?Q?' . $encodedChar . '?=' . "\r\n", + $header->toString(), '%s: Non-printable ascii should be encoded' + ); + } + } + + public function testEncodedWordsAreUsedToEncode8BitOctets() + { + $_8BitBytes = range(0x80, 0xFF); + + foreach ($_8BitBytes as $byte) { + $char = pack('C', $byte); + $encodedChar = sprintf('=%02X', $byte); + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($char, any(), any()) -> returns($encodedChar) + -> ignoring($encoder) + ); + + $header = $this->_getHeader('X-A', $encoder); + $header->setValue($char); + + $this->assertEqual( + 'X-A: =?' . $this->_charset . '?Q?' . $encodedChar . '?=' . "\r\n", + $header->toString(), '%s: 8-bit octets should be encoded' + ); + } + } + + public function testEncodedWordsAreNoMoreThan75CharsPerLine() + { + /* -- RFC 2047, 2. + An 'encoded-word' may not be more than 75 characters long, including + 'charset', 'encoding', 'encoded-text', and delimiters. + + ... SNIP ... + + While there is no limit to the length of a multiple-line header + field, each line of a header field that contains one or more + 'encoded-word's is limited to 76 characters. + */ + + $nonAsciiChar = pack('C', 0x8F); + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($nonAsciiChar, 8, 63) -> returns('=8F') + -> ignoring($encoder) + ); + //Note that multi-line headers begin with LWSP which makes 75 + 1 = 76 + //Note also that =?utf-8?q??= is 12 chars which makes 75 - 12 = 63 + + //* X-Test: is 8 chars + $header = $this->_getHeader('X-Test', $encoder); + $header->setValue($nonAsciiChar); + + $this->assertEqual( + 'X-Test: =?' . $this->_charset . '?Q?=8F?=' . "\r\n", + $header->toString() + ); + } + + public function testFWSPIsUsedWhenEncoderReturnsMultipleLines() + { + /* --RFC 2047, 2. + If it is desirable to encode more text than will fit in an 'encoded-word' of + 75 characters, multiple 'encoded-word's (separated by CRLF SPACE) may + be used. + */ + + //Note the Mock does NOT return 8F encoded, the 8F merely triggers + // encoding for the sake of testing + $nonAsciiChar = pack('C', 0x8F); + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($nonAsciiChar, 8, 63) + -> returns('line_one_here' . "\r\n" . 'line_two_here') + -> ignoring($encoder) + ); + + //Note that multi-line headers begin with LWSP which makes 75 + 1 = 76 + //Note also that =?utf-8?q??= is 12 chars which makes 75 - 12 = 63 + + //* X-Test: is 8 chars + $header = $this->_getHeader('X-Test', $encoder); + $header->setValue($nonAsciiChar); + + $this->assertEqual( + 'X-Test: =?' . $this->_charset . '?Q?line_one_here?=' . "\r\n" . + ' =?' . $this->_charset . '?Q?line_two_here?=' . "\r\n", + $header->toString() + ); + } + + public function testAdjacentWordsAreEncodedTogether() + { + /* -- RFC 2047, 5 (1) + Ordinary ASCII text and 'encoded-word's may appear together in the + same header field. However, an 'encoded-word' that appears in a + header field defined as '*text' MUST be separated from any adjacent + 'encoded-word' or 'text' by 'linear-white-space'. + + -- RFC 2047, 2. + IMPORTANT: 'encoded-word's are designed to be recognized as 'atom's + by an RFC 822 parser. As a consequence, unencoded white space + characters (such as SPACE and HTAB) are FORBIDDEN within an + 'encoded-word'. + */ + + //It would be valid to encode all words needed, however it's probably + // easiest to encode the longest amount required at a time + + $word = 'w' . pack('C', 0x8F) . 'rd'; + $text = 'start ' . $word . ' ' . $word . ' then end ' . $word; + // 'start', ' word word', ' and end', ' word' + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($word . ' ' . $word, any(), any()) + -> returns('w=8Frd_w=8Frd') + -> one($encoder)->encodeString($word, any(), any()) -> returns('w=8Frd') + -> ignoring($encoder) + ); + + $header = $this->_getHeader('X-Test', $encoder); + $header->setValue($text); + + $headerString = $header->toString(); + + $this->assertEqual('X-Test: start =?' . $this->_charset . '?Q?' . + 'w=8Frd_w=8Frd?= then end =?' . $this->_charset . '?Q?'. + 'w=8Frd?=' . "\r\n", $headerString, + '%s: Adjacent encoded words should appear grouped with WSP encoded' + ); + } + + public function testLanguageInformationAppearsInEncodedWords() + { + /* -- RFC 2231, 5. + 5. Language specification in Encoded Words + + RFC 2047 provides support for non-US-ASCII character sets in RFC 822 + message header comments, phrases, and any unstructured text field. + This is done by defining an encoded word construct which can appear + in any of these places. Given that these are fields intended for + display, it is sometimes necessary to associate language information + with encoded words as well as just the character set. This + specification extends the definition of an encoded word to allow the + inclusion of such information. This is simply done by suffixing the + character set specification with an asterisk followed by the language + tag. For example: + + From: =?US-ASCII*EN?Q?Keith_Moore?= + */ + + $value = 'fo' . pack('C', 0x8F) . 'bar'; + + $encoder = $this->_getEncoder('Q'); + $this->_checking(Expectations::create() + -> one($encoder)->encodeString($value, any(), any()) -> returns('fo=8Fbar') + -> ignoring($encoder) + ); + + $header = $this->_getHeader('Subject', $encoder); + $header->setLanguage('en'); + $header->setValue($value); + $this->assertEqual("Subject: =?utf-8*en?Q?fo=8Fbar?=\r\n", + $header->toString() + ); + } + + public function testSetBodyModel() + { + $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true)); + $header->setFieldBodyModel('test'); + $this->assertEqual('test', $header->getValue()); + } + + public function testGetBodyModel() + { + $header = $this->_getHeader('Subject', $this->_getEncoder('Q', true)); + $header->setValue('test'); + $this->assertEqual('test', $header->getFieldBodyModel()); + } + + // -- Private methods + + private function _getHeader($name, $encoder) + { + $header = new Swift_Mime_Headers_UnstructuredHeader($name, $encoder, new Swift_Mime_Grammar()); + $header->setCharset($this->_charset); + return $header; + } + + private function _getEncoder($type, $stub = false) + { + $encoder = $this->_mock('Swift_Mime_HeaderEncoder'); + $this->_checking(Expectations::create() + -> ignoring($encoder)->getName() -> returns($type) + ); + if ($stub) { + $this->_checking(Expectations::create() + -> ignoring($encoder) + ); + } + return $encoder; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php new file mode 100644 index 0000000..aadf788 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/MimePartTest.php @@ -0,0 +1,252 @@ +_createMimePart($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual( + Swift_Mime_MimeEntity::LEVEL_ALTERNATIVE, $part->getNestingLevel() + ); + } + + public function testCharsetIsReturnedFromHeader() + { + /* -- RFC 2046, 4.1.2. + A critical parameter that may be specified in the Content-Type field + for "text/plain" data is the character set. This is specified with a + "charset" parameter, as in: + + Content-type: text/plain; charset=iso-8859-1 + + Unlike some other parameter values, the values of the charset + parameter are NOT case sensitive. The default character set, which + must be assumed in the absence of a charset parameter, is US-ASCII. + */ + + $cType = $this->_createHeader('Content-Type', 'text/plain', + array('charset' => 'iso-8859-1') + ); + $part = $this->_createMimePart($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual('iso-8859-1', $part->getCharset()); + } + + public function testCharsetIsSetInHeader() + { + $cType = $this->_createHeader('Content-Type', 'text/plain', + array('charset' => 'iso-8859-1'), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setParameter('charset', 'utf-8') + -> ignoring($cType) + ); + $part = $this->_createMimePart($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $part->setCharset('utf-8'); + } + + public function testCharsetIsSetInHeaderIfPassedToSetBody() + { + $cType = $this->_createHeader('Content-Type', 'text/plain', + array('charset' => 'iso-8859-1'), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setParameter('charset', 'utf-8') + -> ignoring($cType) + ); + $part = $this->_createMimePart($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $part->setBody('', 'text/plian', 'utf-8'); + } + + public function testSettingCharsetNotifiesEncoder() + { + $encoder = $this->_createEncoder('quoted-printable', false); + $this->_checking(Expectations::create() + -> one($encoder)->charsetChanged('utf-8') + -> ignoring($encoder) + ); + $part = $this->_createMimePart($this->_createHeaderSet(), + $encoder, $this->_createCache() + ); + $part->setCharset('utf-8'); + } + + public function testSettingCharsetNotifiesHeaders() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->charsetChanged('utf-8') + -> ignoring($headers) + ); + $part = $this->_createMimePart($headers, $this->_createEncoder(), + $this->_createCache() + ); + $part->setCharset('utf-8'); + } + + public function testSettingCharsetNotifiesChildren() + { + $child = $this->_createChild(0, '', false); + + $this->_checking(Expectations::create() + -> one($child)->charsetChanged('windows-874') + -> ignoring($child) + ); + + $part = $this->_createMimePart($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $part->setChildren(array($child)); + $part->setCharset('windows-874'); + } + + public function testCharsetChangeUpdatesCharset() + { + $cType = $this->_createHeader('Content-Type', 'text/plain', + array('charset' => 'iso-8859-1'), false + ); + $this->_checking(Expectations::create() + -> one($cType)->setParameter('charset', 'utf-8') + -> ignoring($cType) + ); + $part = $this->_createMimePart($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $part->charsetChanged('utf-8'); + } + + public function testSettingCharsetClearsCache() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> ignoring($headers)->toString() -> returns( + "Content-Type: text/plain; charset=utf-8\r\n" + ) + -> ignoring($headers) + ); + + $cache = $this->_createCache(false); + $this->_checking(Expectations::create() + -> one($cache)->clearKey(any(), 'body') + -> ignoring($cache) + ); + + $entity = $this->_createEntity($headers, $this->_createEncoder(), + $cache + ); + + $entity->setBody("blah\r\nblah!"); + $entity->toString(); + + $entity->setCharset('iso-2022'); + } + + public function testFormatIsReturnedFromHeader() + { + /* -- RFC 3676. + */ + + $cType = $this->_createHeader('Content-Type', 'text/plain', + array('format' => 'flowed') + ); + $part = $this->_createMimePart($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual('flowed', $part->getFormat()); + } + + public function testFormatIsSetInHeader() + { + $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false); + $this->_checking(Expectations::create() + -> one($cType)->setParameter('format', 'fixed') + -> ignoring($cType) + ); + $part = $this->_createMimePart($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $part->setFormat('fixed'); + } + + public function testDelSpIsReturnedFromHeader() + { + /* -- RFC 3676. + */ + + $cType = $this->_createHeader('Content-Type', 'text/plain', + array('delsp' => 'no') + ); + $part = $this->_createMimePart($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertIdentical(false, $part->getDelSp()); + } + + public function testDelSpIsSetInHeader() + { + $cType = $this->_createHeader('Content-Type', 'text/plain', array(), false); + $this->_checking(Expectations::create() + -> one($cType)->setParameter('delsp', 'yes') + -> ignoring($cType) + ); + $part = $this->_createMimePart($this->_createHeaderSet(array( + 'Content-Type' => $cType)), + $this->_createEncoder(), $this->_createCache() + ); + $part->setDelSp(true); + } + + public function testFluidInterface() + { + $part = $this->_createMimePart($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + + $this->assertSame($part, + $part + ->setContentType('text/plain') + ->setEncoder($this->_createEncoder()) + ->setId('foo@bar') + ->setDescription('my description') + ->setMaxLineLength(998) + ->setBody('xx') + ->setBoundary('xyz') + ->setChildren(array()) + ->setCharset('utf-8') + ->setFormat('flowed') + ->setDelSp(true) + ); + } + + // -- Private helpers + + //abstract + protected function _createEntity($headers, $encoder, $cache) + { + return $this->_createMimePart($headers, $encoder, $cache); + } + + protected function _createMimePart($headers, $encoder, $cache) + { + return new Swift_Mime_MimePart($headers, $encoder, $cache, new Swift_Mime_Grammar()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php new file mode 100644 index 0000000..4f56f52 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderFactoryTest.php @@ -0,0 +1,179 @@ +_factory = $this->_createFactory(); + } + + public function testMailboxHeaderIsCorrectType() + { + $header = $this->_factory->createMailboxHeader('X-Foo'); + $this->assertIsA($header, 'Swift_Mime_Headers_MailboxHeader'); + } + + public function testMailboxHeaderHasCorrectName() + { + $header = $this->_factory->createMailboxHeader('X-Foo'); + $this->assertEqual('X-Foo', $header->getFieldName()); + } + + public function testMailboxHeaderHasCorrectModel() + { + $header = $this->_factory->createMailboxHeader('X-Foo', + array('foo@bar'=>'FooBar') + ); + $this->assertEqual(array('foo@bar'=>'FooBar'), $header->getFieldBodyModel()); + } + + public function testDateHeaderHasCorrectType() + { + $header = $this->_factory->createDateHeader('X-Date'); + $this->assertIsA($header, 'Swift_Mime_Headers_DateHeader'); + } + + public function testDateHeaderHasCorrectName() + { + $header = $this->_factory->createDateHeader('X-Date'); + $this->assertEqual('X-Date', $header->getFieldName()); + } + + public function testDateHeaderHasCorrectModel() + { + $header = $this->_factory->createDateHeader('X-Date', 123); + $this->assertEqual(123, $header->getFieldBodyModel()); + } + + public function testTextHeaderHasCorrectType() + { + $header = $this->_factory->createTextHeader('X-Foo'); + $this->assertIsA($header, 'Swift_Mime_Headers_UnstructuredHeader'); + } + + public function testTextHeaderHasCorrectName() + { + $header = $this->_factory->createTextHeader('X-Foo'); + $this->assertEqual('X-Foo', $header->getFieldName()); + } + + public function testTextHeaderHasCorrectModel() + { + $header = $this->_factory->createTextHeader('X-Foo', 'bar'); + $this->assertEqual('bar', $header->getFieldBodyModel()); + } + + public function testParameterizedHeaderHasCorrectType() + { + $header = $this->_factory->createParameterizedHeader('X-Foo'); + $this->assertIsA($header, 'Swift_Mime_Headers_ParameterizedHeader'); + } + + public function testParameterizedHeaderHasCorrectName() + { + $header = $this->_factory->createParameterizedHeader('X-Foo'); + $this->assertEqual('X-Foo', $header->getFieldName()); + } + + public function testParameterizedHeaderHasCorrectModel() + { + $header = $this->_factory->createParameterizedHeader('X-Foo', 'bar'); + $this->assertEqual('bar', $header->getFieldBodyModel()); + } + + public function testParameterizedHeaderHasCorrectParams() + { + $header = $this->_factory->createParameterizedHeader('X-Foo', 'bar', + array('zip' => 'button') + ); + $this->assertEqual(array('zip'=>'button'), $header->getParameters()); + } + + public function testIdHeaderHasCorrectType() + { + $header = $this->_factory->createIdHeader('X-ID'); + $this->assertIsA($header, 'Swift_Mime_Headers_IdentificationHeader'); + } + + public function testIdHeaderHasCorrectName() + { + $header = $this->_factory->createIdHeader('X-ID'); + $this->assertEqual('X-ID', $header->getFieldName()); + } + + public function testIdHeaderHasCorrectModel() + { + $header = $this->_factory->createIdHeader('X-ID', 'xyz@abc'); + $this->assertEqual(array('xyz@abc'), $header->getFieldBodyModel()); + } + + public function testPathHeaderHasCorrectType() + { + $header = $this->_factory->createPathHeader('X-Path'); + $this->assertIsA($header, 'Swift_Mime_Headers_PathHeader'); + } + + public function testPathHeaderHasCorrectName() + { + $header = $this->_factory->createPathHeader('X-Path'); + $this->assertEqual('X-Path', $header->getFieldName()); + } + + public function testPathHeaderHasCorrectModel() + { + $header = $this->_factory->createPathHeader('X-Path', 'foo@bar'); + $this->assertEqual('foo@bar', $header->getFieldBodyModel()); + } + + public function testCharsetChangeNotificationNotifiesEncoders() + { + $encoder = $this->_createHeaderEncoder(false); + $paramEncoder = $this->_createParamEncoder(false); + + $factory = $this->_createFactory($encoder, $paramEncoder); + + $this->_checking(Expectations::create() + -> one($encoder)->charsetChanged('utf-8') + -> one($paramEncoder)->charsetChanged('utf-8') + -> ignoring($encoder) + -> ignoring($paramEncoder) + ); + + $factory->charsetChanged('utf-8'); + } + + // -- Creation methods + + private function _createFactory($encoder = null, $paramEncoder = null) + { + return new Swift_Mime_SimpleHeaderFactory( + $encoder + ? $encoder : $this->_createHeaderEncoder(), + $paramEncoder + ? $paramEncoder : $this->_createParamEncoder(), + new Swift_Mime_Grammar() + ); + } + + private function _createHeaderEncoder($stub = true) + { + return $stub + ? $this->_stub('Swift_Mime_HeaderEncoder') + : $this->_mock('Swift_Mime_HeaderEncoder'); + } + + private function _createParamEncoder($stub = true) + { + return $stub + ? $this->_stub('Swift_Encoder') + : $this->_mock('Swift_Encoder'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php new file mode 100644 index 0000000..943701d --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleHeaderSetTest.php @@ -0,0 +1,652 @@ +_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createMailboxHeader('From', array('person@domain'=>'Person')) + -> returns($this->_createHeader('From')) + ); + $set = $this->_createSet($factory); + $set->addMailboxHeader('From', array('person@domain'=>'Person')); + } + + public function testAddDateHeaderDelegatesToFactory() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createDateHeader('Date', 1234) + -> returns($this->_createHeader('Date')) + ); + $set = $this->_createSet($factory); + $set->addDateHeader('Date', 1234); + } + + public function testAddTextHeaderDelegatesToFactory() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createTextHeader('Subject', 'some text') + -> returns($this->_createHeader('Subject')) + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Subject', 'some text'); + } + + public function testAddParameterizedHeaderDelegatesToFactory() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createParameterizedHeader( + 'Content-Type', 'text/plain', array('charset'=>'utf-8') + ) -> returns($this->_createHeader('Content-Type')) + ); + $set = $this->_createSet($factory); + $set->addParameterizedHeader('Content-Type', 'text/plain', + array('charset'=>'utf-8') + ); + } + + public function testAddIdHeaderDelegatesToFactory() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($this->_createHeader('Message-ID')) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + } + + public function testAddPathHeaderDelegatesToFactory() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createPathHeader('Return-Path', 'some@path') + -> returns($this->_createHeader('Return-Path')) + ); + $set = $this->_createSet($factory); + $set->addPathHeader('Return-Path', 'some@path'); + } + + public function testHasReturnsFalseWhenNoHeaders() + { + $set = $this->_createSet($this->_createFactory()); + $this->assertFalse($set->has('Some-Header')); + } + + public function testAddedMailboxHeaderIsSeenByHas() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createMailboxHeader('From', array('person@domain'=>'Person')) + -> returns($this->_createHeader('From')) + ); + $set = $this->_createSet($factory); + $set->addMailboxHeader('From', array('person@domain'=>'Person')); + $this->assertTrue($set->has('From')); + } + + public function testAddedDateHeaderIsSeenByHas() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createDateHeader('Date', 1234) + -> returns($this->_createHeader('Date')) + ); + $set = $this->_createSet($factory); + $set->addDateHeader('Date', 1234); + $this->assertTrue($set->has('Date')); + } + + public function testAddedTextHeaderIsSeenByHas() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createTextHeader('Subject', 'some text') + -> returns($this->_createHeader('Subject')) + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Subject', 'some text'); + $this->assertTrue($set->has('Subject')); + } + + public function testAddedParameterizedHeaderIsSeenByHas() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createParameterizedHeader( + 'Content-Type', 'text/plain', array('charset'=>'utf-8') + ) -> returns($this->_createHeader('Content-Type')) + ); + $set = $this->_createSet($factory); + $set->addParameterizedHeader('Content-Type', 'text/plain', + array('charset'=>'utf-8') + ); + $this->assertTrue($set->has('Content-Type')); + } + + public function testAddedIdHeaderIsSeenByHas() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($this->_createHeader('Message-ID')) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $this->assertTrue($set->has('Message-ID')); + } + + public function testAddedPathHeaderIsSeenByHas() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createPathHeader('Return-Path', 'some@path') + -> returns($this->_createHeader('Return-Path')) + ); + $set = $this->_createSet($factory); + $set->addPathHeader('Return-Path', 'some@path'); + $this->assertTrue($set->has('Return-Path')); + } + + public function testNewlySetHeaderIsSeenByHas() + { + $factory = $this->_createFactory(); + $header = $this->_createHeader('X-Foo', 'bar'); + $set = $this->_createSet($factory); + $set->set($header); + $this->assertTrue($set->has('X-Foo')); + } + + public function testHasCanAcceptOffset() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($this->_createHeader('Message-ID')) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $this->assertTrue($set->has('Message-ID', 0)); + } + + public function testHasWithIllegalOffsetReturnsFalse() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($this->_createHeader('Message-ID')) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $this->assertFalse($set->has('Message-ID', 1)); + } + + public function testHasCanDistinguishMultipleHeaders() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($this->_createHeader('Message-ID')) + -> ignoring($factory)->createIdHeader('Message-ID', 'other@id') + -> returns($this->_createHeader('Message-ID')) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->addIdHeader('Message-ID', 'other@id'); + $this->assertTrue($set->has('Message-ID', 1)); + } + + public function testGetWithUnspecifiedOffset() + { + $header = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $this->assertSame($header, $set->get('Message-ID')); + } + + public function testGetWithSpeiciedOffset() + { + $header0 = $this->_createHeader('Message-ID'); + $header1 = $this->_createHeader('Message-ID'); + $header2 = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header0) + -> ignoring($factory)->createIdHeader('Message-ID', 'other@id') + -> returns($header1) + -> ignoring($factory)->createIdHeader('Message-ID', 'more@id') + -> returns($header2) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->addIdHeader('Message-ID', 'other@id'); + $set->addIdHeader('Message-ID', 'more@id'); + $this->assertSame($header1, $set->get('Message-ID', 1)); + } + + public function testGetReturnsNullIfHeaderNotSet() + { + $set = $this->_createSet($this->_createFactory()); + $this->assertNull($set->get('Message-ID', 99)); + } + + public function testGetAllReturnsAllHeadersMatchingName() + { + $header0 = $this->_createHeader('Message-ID'); + $header1 = $this->_createHeader('Message-ID'); + $header2 = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header0) + -> ignoring($factory)->createIdHeader('Message-ID', 'other@id') + -> returns($header1) + -> ignoring($factory)->createIdHeader('Message-ID', 'more@id') + -> returns($header2) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->addIdHeader('Message-ID', 'other@id'); + $set->addIdHeader('Message-ID', 'more@id'); + + $this->assertEqual(array($header0, $header1, $header2), + $set->getAll('Message-ID') + ); + } + + public function testGetAllReturnsAllHeadersIfNoArguments() + { + $header0 = $this->_createHeader('Message-ID'); + $header1 = $this->_createHeader('Subject'); + $header2 = $this->_createHeader('To'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header0) + -> ignoring($factory)->createIdHeader('Subject', 'thing') + -> returns($header1) + -> ignoring($factory)->createIdHeader('To', 'person@example.org') + -> returns($header2) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->addIdHeader('Subject', 'thing'); + $set->addIdHeader('To', 'person@example.org'); + + $this->assertEqual(array($header0, $header1, $header2), + $set->getAll() + ); + } + + public function testGetAllReturnsEmptyArrayIfNoneSet() + { + $set = $this->_createSet($this->_createFactory()); + $this->assertEqual(array(), $set->getAll('Received')); + } + + public function testRemoveWithUnspecifiedOffset() + { + $header = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->remove('Message-ID'); + $this->assertFalse($set->has('Message-ID')); + } + + public function testRemoveWithSpecifiedIndexRemovesHeader() + { + $header0 = $this->_createHeader('Message-ID'); + $header1 = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header0) + -> ignoring($factory)->createIdHeader('Message-ID', 'other@id') + -> returns($header1) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->addIdHeader('Message-ID', 'other@id'); + $set->remove('Message-ID', 1); + $this->assertFalse($set->has('Message-ID', 1)); + } + + public function testRemoveWithSpecifiedIndexLeavesOtherHeaders() + { + $header0 = $this->_createHeader('Message-ID'); + $header1 = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header0) + -> ignoring($factory)->createIdHeader('Message-ID', 'other@id') + -> returns($header1) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->addIdHeader('Message-ID', 'other@id'); + $set->remove('Message-ID', 1); + $this->assertTrue($set->has('Message-ID', 0)); + } + + public function testRemoveWithInvalidOffsetDoesNothing() + { + $header = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->remove('Message-ID', 50); + $this->assertTrue($set->has('Message-ID')); + } + + public function testRemoveAllRemovesAllHeadersWithName() + { + $header0 = $this->_createHeader('Message-ID'); + $header1 = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header0) + -> ignoring($factory)->createIdHeader('Message-ID', 'other@id') + -> returns($header1) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->addIdHeader('Message-ID', 'other@id'); + $set->removeAll('Message-ID'); + $this->assertFalse($set->has('Message-ID', 0)); + $this->assertFalse($set->has('Message-ID', 1)); + } + + public function testHasIsNotCaseSensitive() + { + $header = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $this->assertTrue($set->has('message-id')); + } + + public function testGetIsNotCaseSensitive() + { + $header = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $this->assertSame($header, $set->get('message-id')); + } + + public function testGetAllIsNotCaseSensitive() + { + $header = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $this->assertEqual(array($header), $set->getAll('message-id')); + } + + public function testRemoveIsNotCaseSensitive() + { + $header = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->remove('message-id'); + $this->assertFalse($set->has('Message-ID')); + } + + public function testRemoveAllIsNotCaseSensitive() + { + $header = $this->_createHeader('Message-ID'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createIdHeader('Message-ID', 'some@id') + -> returns($header) + ); + $set = $this->_createSet($factory); + $set->addIdHeader('Message-ID', 'some@id'); + $set->removeAll('message-id'); + $this->assertFalse($set->has('Message-ID')); + } + + public function testNewInstance() + { + $set = $this->_createSet($this->_createFactory()); + $instance = $set->newInstance(); + $this->assertIsA($instance, 'Swift_Mime_HeaderSet'); + } + + public function testToStringJoinsHeadersTogether() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createTextHeader('Foo', 'bar') + -> returns($this->_createHeader('Foo', 'bar')) + -> one($factory)->createTextHeader('Zip', 'buttons') + -> returns($this->_createHeader('Zip', 'buttons')) + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Foo', 'bar'); + $set->addTextHeader('Zip', 'buttons'); + $this->assertEqual( + "Foo: bar\r\n" . + "Zip: buttons\r\n", + $set->toString() + ); + } + + public function testHeadersWithoutBodiesAreNotDisplayed() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createTextHeader('Foo', 'bar') + -> returns($this->_createHeader('Foo', 'bar')) + -> one($factory)->createTextHeader('Zip', '') + -> returns($this->_createHeader('Zip', '')) + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Foo', 'bar'); + $set->addTextHeader('Zip', ''); + $this->assertEqual( + "Foo: bar\r\n", + $set->toString() + ); + } + + public function testHeadersWithoutBodiesCanBeForcedToDisplay() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createTextHeader('Foo', '') + -> returns($this->_createHeader('Foo', '')) + -> one($factory)->createTextHeader('Zip', '') + -> returns($this->_createHeader('Zip', '')) + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Foo', ''); + $set->addTextHeader('Zip', ''); + $set->setAlwaysDisplayed(array('Foo', 'Zip')); + $this->assertEqual( + "Foo: \r\n" . + "Zip: \r\n", + $set->toString() + ); + } + + public function testHeaderSequencesCanBeSpecified() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createTextHeader('First', 'one') + -> returns($this->_createHeader('First', 'one')) + -> one($factory)->createTextHeader('Second', 'two') + -> returns($this->_createHeader('Second', 'two')) + -> one($factory)->createTextHeader('Third', 'three') + -> returns($this->_createHeader('Third', 'three')) + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Third', 'three'); + $set->addTextHeader('First', 'one'); + $set->addTextHeader('Second', 'two'); + + $set->defineOrdering(array('First', 'Second', 'Third')); + + $this->assertEqual( + "First: one\r\n" . + "Second: two\r\n" . + "Third: three\r\n", + $set->toString() + ); + } + + public function testUnsortedHeadersAppearAtEnd() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createTextHeader('First', 'one') + -> returns($this->_createHeader('First', 'one')) + -> one($factory)->createTextHeader('Second', 'two') + -> returns($this->_createHeader('Second', 'two')) + -> one($factory)->createTextHeader('Third', 'three') + -> returns($this->_createHeader('Third', 'three')) + -> one($factory)->createTextHeader('Fourth', 'four') + -> returns($this->_createHeader('Fourth', 'four')) + -> one($factory)->createTextHeader('Fifth', 'five') + -> returns($this->_createHeader('Fifth', 'five')) + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Fourth', 'four'); + $set->addTextHeader('Fifth', 'five'); + $set->addTextHeader('Third', 'three'); + $set->addTextHeader('First', 'one'); + $set->addTextHeader('Second', 'two'); + + $set->defineOrdering(array('First', 'Second', 'Third')); + + $this->assertEqual( + "First: one\r\n" . + "Second: two\r\n" . + "Third: three\r\n" . + "Fourth: four\r\n" . + "Fifth: five\r\n", + $set->toString() + ); + } + + public function testSettingCharsetNotifiesAlreadyExistingHeaders() + { + $subject = $this->_createHeader('Subject', 'some text'); + $xHeader = $this->_createHeader('X-Header', 'some text'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createTextHeader('Subject', 'some text') + -> returns($subject) + -> ignoring($factory)->createTextHeader('X-Header', 'some text') + -> returns($xHeader) + -> ignoring($factory) + -> one($subject)->setCharset('utf-8') + -> one($xHeader)->setCharset('utf-8') + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Subject', 'some text'); + $set->addTextHeader('X-Header', 'some text'); + + $set->setCharset('utf-8'); + } + + public function testCharsetChangeNotifiesAlreadyExistingHeaders() + { + $subject = $this->_createHeader('Subject', 'some text'); + $xHeader = $this->_createHeader('X-Header', 'some text'); + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> ignoring($factory)->createTextHeader('Subject', 'some text') + -> returns($subject) + -> ignoring($factory)->createTextHeader('X-Header', 'some text') + -> returns($xHeader) + -> ignoring($factory) + -> one($subject)->setCharset('utf-8') + -> one($xHeader)->setCharset('utf-8') + ); + $set = $this->_createSet($factory); + $set->addTextHeader('Subject', 'some text'); + $set->addTextHeader('X-Header', 'some text'); + + $set->charsetChanged('utf-8'); + } + + public function testCharsetChangeNotifiesFactory() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->charsetChanged('utf-8') + -> ignoring($factory) + ); + $set = $this->_createSet($factory); + + $set->setCharset('utf-8'); + } + + // -- Creation methods + + private function _createSet($factory) + { + return new Swift_Mime_SimpleHeaderSet($factory); + } + + private function _createFactory() + { + return $this->_mock('Swift_Mime_HeaderFactory'); + } + + private function _createHeader($name, $body = '') + { + $header = $this->_mock('Swift_Mime_Header'); + $this->_checking(Expectations::create() + -> ignoring($header)->getFieldName() -> returns($name) + -> ignoring($header)->toString() -> returns(sprintf("%s: %s\r\n", $name, $body)) + -> ignoring($header)->getFieldBody() -> returns($body) + ); + return $header; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php new file mode 100644 index 0000000..831f2bf --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMessageTest.php @@ -0,0 +1,803 @@ +_createMessage($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual( + Swift_Mime_MimeEntity::LEVEL_TOP, $message->getNestingLevel() + ); + } + + public function testDateIsReturnedFromHeader() + { + $date = $this->_createHeader('Date', 123); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Date' => $date)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(123, $message->getDate()); + } + + public function testDateIsSetInHeader() + { + $date = $this->_createHeader('Date', 123, array(), false); + $this->_checking(Expectations::create() + -> one($date)->setFieldBodyModel(1234) + -> ignoring($date) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Date' => $date)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setDate(1234); + } + + public function testDateHeaderIsCreatedIfNonePresent() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addDateHeader('Date', 1234) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setDate(1234); + } + + public function testDateHeaderIsAddedDuringConstruction() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addDateHeader('Date', pattern('/^[0-9]+$/D')) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + } + + public function testIdIsReturnedFromHeader() + { + /* -- RFC 2045, 7. + In constructing a high-level user agent, it may be desirable to allow + one body to make reference to another. Accordingly, bodies may be + labelled using the "Content-ID" header field, which is syntactically + identical to the "Message-ID" header field + */ + + $messageId = $this->_createHeader('Message-ID', 'a@b'); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Message-ID' => $messageId)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual('a@b', $message->getId()); + } + + public function testIdIsSetInHeader() + { + $messageId = $this->_createHeader('Message-ID', 'a@b', array(), false); + $this->_checking(Expectations::create() + -> one($messageId)->setFieldBodyModel('x@y') + -> ignoring($messageId) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Message-ID' => $messageId)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setId('x@y'); + } + + public function testIdIsAutoGenerated() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addIdHeader('Message-ID', pattern('/^.*?@.*?$/D')) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + } + + public function testSubjectIsReturnedFromHeader() + { + /* -- RFC 2822, 3.6.5. + */ + + $subject = $this->_createHeader('Subject', 'example subject'); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Subject' => $subject)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual('example subject', $message->getSubject()); + } + + public function testSubjectIsSetInHeader() + { + $subject = $this->_createHeader('Subject', '', array(), false); + $this->_checking(Expectations::create() + -> one($subject)->setFieldBodyModel('foo') + -> ignoring($subject) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Subject' => $subject)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setSubject('foo'); + } + + public function testSubjectHeaderIsCreatedIfNotPresent() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addTextHeader('Subject', 'example subject') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setSubject('example subject'); + } + + public function testReturnPathIsReturnedFromHeader() + { + /* -- RFC 2822, 3.6.7. + */ + + $path = $this->_createHeader('Return-Path', 'bounces@domain'); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Return-Path' => $path)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual('bounces@domain', $message->getReturnPath()); + } + + public function testReturnPathIsSetInHeader() + { + $path = $this->_createHeader('Return-Path', '', array(), false); + $this->_checking(Expectations::create() + -> one($path)->setFieldBodyModel('bounces@domain') + -> ignoring($path) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Return-Path' => $path)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setReturnPath('bounces@domain'); + } + + public function testReturnPathHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addPathHeader('Return-Path', 'bounces@domain') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setReturnPath('bounces@domain'); + } + + public function testSenderIsReturnedFromHeader() + { + /* -- RFC 2822, 3.6.2. + */ + + $sender = $this->_createHeader('Sender', array('sender@domain'=>'Name')); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Sender' => $sender)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(array('sender@domain'=>'Name'), $message->getSender()); + } + + public function testSenderIsSetInHeader() + { + $sender = $this->_createHeader('Sender', array('sender@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($sender)->setFieldBodyModel(array('other@domain'=>'Other')) + -> ignoring($sender) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Sender' => $sender)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setSender(array('other@domain'=>'Other')); + } + + public function testSenderHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('Sender', (array) 'sender@domain') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setSender('sender@domain'); + } + + public function testNameCanBeUsedInSenderHeader() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('Sender', array('sender@domain'=>'Name')) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setSender('sender@domain', 'Name'); + } + + public function testFromIsReturnedFromHeader() + { + /* -- RFC 2822, 3.6.2. + */ + + $from = $this->_createHeader('From', array('from@domain'=>'Name')); + $message = $this->_createMessage( + $this->_createHeaderSet(array('From' => $from)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(array('from@domain'=>'Name'), $message->getFrom()); + } + + public function testFromIsSetInHeader() + { + $from = $this->_createHeader('From', array('from@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($from)->setFieldBodyModel(array('other@domain'=>'Other')) + -> ignoring($from) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('From' => $from)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setFrom(array('other@domain'=>'Other')); + } + + public function testFromIsAddedToHeadersDuringAddFrom() + { + $from = $this->_createHeader('From', array('from@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($from)->setFieldBodyModel(array('from@domain'=>'Name', 'other@domain'=>'Other')) + -> ignoring($from) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('From' => $from)), + $this->_createEncoder(), $this->_createCache() + ); + $message->addFrom('other@domain', 'Other'); + } + + public function testFromHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('From', (array) 'from@domain') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setFrom('from@domain'); + } + + public function testPersonalNameCanBeUsedInFromAddress() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('From', array('from@domain'=>'Name')) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setFrom('from@domain', 'Name'); + } + + public function testReplyToIsReturnedFromHeader() + { + /* -- RFC 2822, 3.6.2. + */ + + $reply = $this->_createHeader('Reply-To', array('reply@domain'=>'Name')); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Reply-To' => $reply)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(array('reply@domain'=>'Name'), $message->getReplyTo()); + } + + public function testReplyToIsSetInHeader() + { + $reply = $this->_createHeader('Reply-To', array('reply@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($reply)->setFieldBodyModel(array('other@domain'=>'Other')) + -> ignoring($reply) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Reply-To' => $reply)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setReplyTo(array('other@domain'=>'Other')); + } + + public function testReplyToIsAddedToHeadersDuringAddReplyTo() + { + $replyTo = $this->_createHeader('Reply-To', array('from@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($replyTo)->setFieldBodyModel(array('from@domain'=>'Name', 'other@domain'=>'Other')) + -> ignoring($replyTo) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Reply-To' => $replyTo)), + $this->_createEncoder(), $this->_createCache() + ); + $message->addReplyTo('other@domain', 'Other'); + } + + public function testReplyToHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('Reply-To', (array) 'reply@domain') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setReplyTo('reply@domain'); + } + + public function testNameCanBeUsedInReplyTo() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('Reply-To', array('reply@domain'=>'Name')) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setReplyTo('reply@domain', 'Name'); + } + + public function testToIsReturnedFromHeader() + { + /* -- RFC 2822, 3.6.3. + */ + + $to = $this->_createHeader('To', array('to@domain'=>'Name')); + $message = $this->_createMessage( + $this->_createHeaderSet(array('To' => $to)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(array('to@domain'=>'Name'), $message->getTo()); + } + + public function testToIsSetInHeader() + { + $to = $this->_createHeader('To', array('to@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($to)->setFieldBodyModel(array('other@domain'=>'Other')) + -> ignoring($to) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('To' => $to)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setTo(array('other@domain'=>'Other')); + } + + public function testToIsAddedToHeadersDuringAddTo() + { + $to = $this->_createHeader('To', array('from@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($to)->setFieldBodyModel(array('from@domain'=>'Name', 'other@domain'=>'Other')) + -> ignoring($to) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('To' => $to)), + $this->_createEncoder(), $this->_createCache() + ); + $message->addTo('other@domain', 'Other'); + } + + public function testToHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('To', (array) 'to@domain') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setTo('to@domain'); + } + + public function testNameCanBeUsedInToHeader() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('To', array('to@domain'=>'Name')) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setTo('to@domain', 'Name'); + } + + + public function testCcIsReturnedFromHeader() + { + /* -- RFC 2822, 3.6.3. + */ + + $cc = $this->_createHeader('Cc', array('cc@domain'=>'Name')); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Cc' => $cc)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(array('cc@domain'=>'Name'), $message->getCc()); + } + + public function testCcIsSetInHeader() + { + $cc = $this->_createHeader('Cc', array('cc@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($cc)->setFieldBodyModel(array('other@domain'=>'Other')) + -> ignoring($cc) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Cc' => $cc)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setCc(array('other@domain'=>'Other')); + } + + public function testCcIsAddedToHeadersDuringAddCc() + { + $cc = $this->_createHeader('Cc', array('from@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($cc)->setFieldBodyModel(array('from@domain'=>'Name', 'other@domain'=>'Other')) + -> ignoring($cc) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Cc' => $cc)), + $this->_createEncoder(), $this->_createCache() + ); + $message->addCc('other@domain', 'Other'); + } + + public function testCcHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('Cc', (array) 'cc@domain') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setCc('cc@domain'); + } + + public function testNameCanBeUsedInCcHeader() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('Cc', array('cc@domain'=>'Name')) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setCc('cc@domain', 'Name'); + } + + + public function testBccIsReturnedFromHeader() + { + /* -- RFC 2822, 3.6.3. + */ + + $bcc = $this->_createHeader('Bcc', array('bcc@domain'=>'Name')); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Bcc' => $bcc)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(array('bcc@domain'=>'Name'), $message->getBcc()); + } + + public function testBccIsSetInHeader() + { + $bcc = $this->_createHeader('Bcc', array('bcc@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($bcc)->setFieldBodyModel(array('other@domain'=>'Other')) + -> ignoring($bcc) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Bcc' => $bcc)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setBcc(array('other@domain'=>'Other')); + } + + public function testBccIsAddedToHeadersDuringAddBcc() + { + $bcc = $this->_createHeader('Bcc', array('from@domain'=>'Name'), + array(), false + ); + $this->_checking(Expectations::create() + -> one($bcc)->setFieldBodyModel(array('from@domain'=>'Name', 'other@domain'=>'Other')) + -> ignoring($bcc) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Bcc' => $bcc)), + $this->_createEncoder(), $this->_createCache() + ); + $message->addBcc('other@domain', 'Other'); + } + + public function testBccHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('Bcc', (array) 'bcc@domain') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setBcc('bcc@domain'); + } + + public function testNameCanBeUsedInBcc() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader('Bcc', array('bcc@domain'=>'Name')) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setBcc('bcc@domain', 'Name'); + } + + public function testPriorityIsReadFromHeader() + { + $prio = $this->_createHeader('X-Priority', '2 (High)'); + $message = $this->_createMessage( + $this->_createHeaderSet(array('X-Priority' => $prio)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(2, $message->getPriority()); + } + + public function testPriorityIsSetInHeader() + { + $prio = $this->_createHeader('X-Priority', '2 (High)', array(), false); + $this->_checking(Expectations::create() + -> one($prio)->setFieldBodyModel('5 (Lowest)') + -> ignoring($prio) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('X-Priority' => $prio)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setPriority(5); + } + + public function testPriorityHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addTextHeader('X-Priority', '4 (Low)') + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setPriority(4); + } + + public function testReadReceiptAddressReadFromHeader() + { + $rcpt = $this->_createHeader('Disposition-Notification-To', + array('chris@swiftmailer.org'=>'Chris') + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Disposition-Notification-To' => $rcpt)), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertEqual(array('chris@swiftmailer.org'=>'Chris'), + $message->getReadReceiptTo() + ); + } + + public function testReadReceiptIsSetInHeader() + { + $rcpt = $this->_createHeader('Disposition-Notification-To', array(), array(), false); + $this->_checking(Expectations::create() + -> one($rcpt)->setFieldBodyModel('mark@swiftmailer.org') + -> ignoring($rcpt) + ); + $message = $this->_createMessage( + $this->_createHeaderSet(array('Disposition-Notification-To' => $rcpt)), + $this->_createEncoder(), $this->_createCache() + ); + $message->setReadReceiptTo('mark@swiftmailer.org'); + } + + public function testReadReceiptHeaderIsAddedIfNoneSet() + { + $headers = $this->_createHeaderSet(array(), false); + $this->_checking(Expectations::create() + -> one($headers)->addMailboxHeader( + 'Disposition-Notification-To', 'mark@swiftmailer.org' + ) + -> ignoring($headers) + ); + $message = $this->_createMessage($headers, $this->_createEncoder(), + $this->_createCache() + ); + $message->setReadReceiptTo('mark@swiftmailer.org'); + } + + public function testChildrenCanBeAttached() + { + $child1 = $this->_createChild(); + $child2 = $this->_createChild(); + + $message = $this->_createMessage($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + + $message->attach($child1); + $message->attach($child2); + + $this->assertEqual(array($child1, $child2), $message->getChildren()); + } + + public function testChildrenCanBeDetached() + { + $child1 = $this->_createChild(); + $child2 = $this->_createChild(); + + $message = $this->_createMessage($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + + $message->attach($child1); + $message->attach($child2); + + $message->detach($child1); + + $this->assertEqual(array($child2), $message->getChildren()); + } + + public function testEmbedAttachesChild() + { + $child = $this->_createChild(); + + $message = $this->_createMessage($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + + $message->embed($child); + + $this->assertEqual(array($child), $message->getChildren()); + } + + public function testEmbedReturnsValidCid() + { + $child = $this->_createChild(Swift_Mime_MimeEntity::LEVEL_RELATED, '', + false + ); + $this->_checking(Expectations::create() + -> ignoring($child)->getId() -> returns('foo@bar') + -> ignoring($child) + ); + $message = $this->_createMessage($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + + $this->assertEqual('cid:foo@bar', $message->embed($child)); + } + + public function testFluidInterface() + { + $child = $this->_createChild(); + $message = $this->_createMessage($this->_createHeaderSet(), + $this->_createEncoder(), $this->_createCache() + ); + $this->assertSame($message, + $message + ->setContentType('text/plain') + ->setEncoder($this->_createEncoder()) + ->setId('foo@bar') + ->setDescription('my description') + ->setMaxLineLength(998) + ->setBody('xx') + ->setBoundary('xyz') + ->setChildren(array()) + ->setCharset('iso-8859-1') + ->setFormat('flowed') + ->setDelSp(false) + ->setSubject('subj') + ->setDate(123) + ->setReturnPath('foo@bar') + ->setSender('foo@bar') + ->setFrom(array('x@y' => 'XY')) + ->setReplyTo(array('ab@cd' => 'ABCD')) + ->setTo(array('chris@site.tld', 'mark@site.tld')) + ->setCc('john@somewhere.tld') + ->setBcc(array('one@site', 'two@site' => 'Two')) + ->setPriority(4) + ->setReadReceiptTo('a@b') + ->attach($child) + ->detach($child) + ); + } + + // -- Private helpers + + //abstract + protected function _createEntity($headers, $encoder, $cache) + { + return $this->_createMessage($headers, $encoder, $cache); + } + + protected function _createMimePart($headers, $encoder, $cache) + { + return $this->_createMessage($headers, $encoder, $cache); + } + + private function _createMessage($headers, $encoder, $cache) + { + return new Swift_Mime_SimpleMessage($headers, $encoder, $cache, new Swift_Mime_Grammar()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php new file mode 100644 index 0000000..02277e3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Mime/SimpleMimeEntityTest.php @@ -0,0 +1,15 @@ +assertEqual(10, $plugin->getThreshold()); + $plugin->setThreshold(100); + $this->assertEqual(100, $plugin->getThreshold()); + } + + public function testSleepTimeCanBeSetAndFetched() + { + $plugin = new Swift_Plugins_AntiFloodPlugin(10, 5); + $this->assertEqual(5, $plugin->getSleepTime()); + $plugin->setSleepTime(1); + $this->assertEqual(1, $plugin->getSleepTime()); + } + + public function testPluginStopsConnectionAfterThreshold() + { + $transport = $this->_createTransport(); + $evt = $this->_createSendEvent($transport); + $this->_checking(Expectations::create() + -> one($transport)->start() + -> one($transport)->stop() + -> ignoring($transport) + ); + + $plugin = new Swift_Plugins_AntiFloodPlugin(10); + for ($i = 0; $i < 12; $i++) { + $plugin->sendPerformed($evt); + } + } + + public function testPluginCanStopAndStartMultipleTimes() + { + $transport = $this->_createTransport(); + $evt = $this->_createSendEvent($transport); + $this->_checking(Expectations::create() + -> exactly(5)->of($transport)->start() + -> exactly(5)->of($transport)->stop() + -> ignoring($transport) + ); + + $plugin = new Swift_Plugins_AntiFloodPlugin(2); + for ($i = 0; $i < 11; $i++) { + $plugin->sendPerformed($evt); + } + } + + public function testPluginCanSleepDuringRestart() + { + $sleeper = $this->_createSleeper(); + $transport = $this->_createTransport(); + $evt = $this->_createSendEvent($transport); + $this->_checking(Expectations::create() + -> one($sleeper)->sleep(10) + -> one($transport)->start() + -> one($transport)->stop() + -> ignoring($transport) + ); + + $plugin = new Swift_Plugins_AntiFloodPlugin(99, 10, $sleeper); + for ($i = 0; $i < 101; $i++) { + $plugin->sendPerformed($evt); + } + } + + // -- Creation Methods + + private function _createTransport() + { + return $this->_mock('Swift_Transport'); + } + + private function _createSendEvent($transport) + { + $evt = $this->_mock('Swift_Events_SendEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getSource() -> returns($transport) + -> ignoring($evt)->getTransport() -> returns($transport) + ); + return $evt; + } + + private function _createSleeper() + { + return $this->_mock('Swift_Plugins_Sleeper'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php new file mode 100644 index 0000000..af97fe6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/BandwidthMonitorPluginTest.php @@ -0,0 +1,125 @@ +_monitor = new Swift_Plugins_BandwidthMonitorPlugin(); + } + + public function testBytesOutIncreasesAccordingToMessageLength() + { + $message = $this->_createMessageWithByteCount(6); + $evt = $this->_createSendEvent($message); + + $this->assertEqual(0, $this->_monitor->getBytesOut()); + $this->_monitor->sendPerformed($evt); + $this->assertEqual(6, $this->_monitor->getBytesOut()); + $this->_monitor->sendPerformed($evt); + $this->assertEqual(12, $this->_monitor->getBytesOut()); + } + + public function testBytesOutIncreasesWhenCommandsSent() + { + $evt = $this->_createCommandEvent("RCPT TO: \r\n"); + + $this->assertEqual(0, $this->_monitor->getBytesOut()); + $this->_monitor->commandSent($evt); + $this->assertEqual(24, $this->_monitor->getBytesOut()); + $this->_monitor->commandSent($evt); + $this->assertEqual(48, $this->_monitor->getBytesOut()); + } + + public function testBytesInIncreasesWhenResponsesReceived() + { + $evt = $this->_createResponseEvent("250 Ok\r\n"); + + $this->assertEqual(0, $this->_monitor->getBytesIn()); + $this->_monitor->responseReceived($evt); + $this->assertEqual(8, $this->_monitor->getBytesIn()); + $this->_monitor->responseReceived($evt); + $this->assertEqual(16, $this->_monitor->getBytesIn()); + } + + public function testCountersCanBeReset() + { + $evt = $this->_createResponseEvent("250 Ok\r\n"); + + $this->assertEqual(0, $this->_monitor->getBytesIn()); + $this->_monitor->responseReceived($evt); + $this->assertEqual(8, $this->_monitor->getBytesIn()); + $this->_monitor->responseReceived($evt); + $this->assertEqual(16, $this->_monitor->getBytesIn()); + + $evt = $this->_createCommandEvent("RCPT TO: \r\n"); + + $this->assertEqual(0, $this->_monitor->getBytesOut()); + $this->_monitor->commandSent($evt); + $this->assertEqual(24, $this->_monitor->getBytesOut()); + $this->_monitor->commandSent($evt); + $this->assertEqual(48, $this->_monitor->getBytesOut()); + + $this->_monitor->reset(); + + $this->assertEqual(0, $this->_monitor->getBytesOut()); + $this->assertEqual(0, $this->_monitor->getBytesIn()); + } + + // -- Creation Methods + + private function _createSendEvent($message) + { + $evt = $this->_mock('Swift_Events_SendEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getMessage() -> returns($message) + ); + return $evt; + } + + private function _createCommandEvent($command) + { + $evt = $this->_mock('Swift_Events_CommandEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getCommand() -> returns($command) + ); + return $evt; + } + + private function _createResponseEvent($response) + { + $evt = $this->_mock('Swift_Events_ResponseEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getResponse() -> returns($response) + ); + return $evt; + } + + private function _createMessageWithByteCount($bytes) + { + $this->_bytes = $bytes; + $msg = $this->_mock('Swift_Mime_Message'); + $this->_checking(Expectations::create() + -> ignoring($msg)->toByteStream(any()) -> calls(array($this, '_write')) + ); + return $msg; + } + + private $_bytes = 0; + public function _write($invocation) + { + $args = $invocation->getArguments(); + $is = $args[0]; + for ($i = 0; $i < $this->_bytes; ++$i) { + $is->write('x'); + } + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php new file mode 100644 index 0000000..2bd051b --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/DecoratorPluginTest.php @@ -0,0 +1,231 @@ +_createMessage( + $this->_createHeaders(), + array('zip@button.tld' => 'Zipathon'), + array('chris.corbyn@swiftmailer.org' => 'Chris'), + 'Subject', + 'Hello {name}, you are customer #{id}' + ); + $this->_checking(Expectations::create() + -> one($message)->setBody('Hello Zip, you are customer #456') + -> ignoring($message) + ); + + $plugin = $this->_createPlugin( + array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456')) + ); + + $evt = $this->_createSendEvent($message); + + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + } + + public function testReplacementsCanBeAppliedToSameMessageMultipleTimes() + { + $message = $this->_createMessage( + $this->_createHeaders(), + array('zip@button.tld' => 'Zipathon', 'foo@bar.tld' => 'Foo'), + array('chris.corbyn@swiftmailer.org' => 'Chris'), + 'Subject', + 'Hello {name}, you are customer #{id}' + ); + $this->_checking(Expectations::create() + -> one($message)->setBody('Hello Zip, you are customer #456') + -> one($message)->setBody('Hello {name}, you are customer #{id}') + -> one($message)->setBody('Hello Foo, you are customer #123') + -> ignoring($message) + ); + + $plugin = $this->_createPlugin( + array( + 'foo@bar.tld' => array('{name}' => 'Foo', '{id}' => '123'), + 'zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456') + ) + ); + + $evt = $this->_createSendEvent($message); + + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + } + + public function testReplacementsCanBeMadeInHeaders() + { + $headers = $this->_createHeaders(array( + $returnPathHeader = $this->_createHeader('Return-Path', 'foo-{id}@swiftmailer.org'), + $toHeader = $this->_createHeader('Subject', 'A message for {name}!') + )); + + $message = $this->_createMessage( + $headers, + array('zip@button.tld' => 'Zipathon'), + array('chris.corbyn@swiftmailer.org' => 'Chris'), + 'A message for {name}!', + 'Hello {name}, you are customer #{id}' + ); + $this->_checking(Expectations::create() + -> one($message)->setBody('Hello Zip, you are customer #456') + -> one($toHeader)->setFieldBodyModel('A message for Zip!') + -> one($returnPathHeader)->setFieldBodyModel('foo-456@swiftmailer.org') + -> ignoring($message) + -> ignoring($toHeader) + -> ignoring($returnPathHeader) + ); + + $plugin = $this->_createPlugin( + array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456')) + ); + + $evt = $this->_createSendEvent($message); + + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + } + + public function testReplacementsAreMadeOnSubparts() + { + $part1 = $this->_createPart('text/plain', 'Your name is {name}?', '1@x'); + $part2 = $this->_createPart('text/html', 'Your name is {name}?', '2@x'); + $message = $this->_createMessage( + $this->_createHeaders(), + array('zip@button.tld' => 'Zipathon'), + array('chris.corbyn@swiftmailer.org' => 'Chris'), + 'A message for {name}!', + 'Subject' + ); + $this->_checking(Expectations::create() + -> ignoring($message)->getChildren() -> returns(array($part1, $part2)) + -> one($part1)->setBody('Your name is Zip?') + -> one($part2)->setBody('Your name is Zip?') + -> ignoring($part1) + -> ignoring($part2) + -> ignoring($message) + ); + + $plugin = $this->_createPlugin( + array('zip@button.tld' => array('{name}' => 'Zip', '{id}' => '456')) + ); + + $evt = $this->_createSendEvent($message); + + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + } + + public function testReplacementsCanBeTakenFromCustomReplacementsObject() + { + $message = $this->_createMessage( + $this->_createHeaders(), + array('foo@bar' => 'Foobar', 'zip@zap' => 'Zip zap'), + array('chris.corbyn@swiftmailer.org' => 'Chris'), + 'Subject', + 'Something {a}' + ); + + $replacements = $this->_createReplacements(); + + $this->_checking(Expectations::create() + -> one($message)->setBody('Something b') + -> one($message)->setBody('Something c') + -> one($replacements)->getReplacementsFor('foo@bar') -> returns(array('{a}'=>'b')) + -> one($replacements)->getReplacementsFor('zip@zap') -> returns(array('{a}'=>'c')) + -> ignoring($message) + ); + + $plugin = $this->_createPlugin($replacements); + + $evt = $this->_createSendEvent($message); + + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + } + + // -- Creation methods + + private function _createMessage($headers, $to = array(), $from = null, $subject = null, + $body = null) + { + $message = $this->_mock('Swift_Mime_Message'); + foreach ($to as $addr => $name) { + $this->_checking(Expectations::create() + -> one($message)->getTo() -> returns(array($addr => $name)) + ); + } + $this->_checking(Expectations::create() + -> allowing($message)->getHeaders() -> returns($headers) + -> ignoring($message)->getFrom() -> returns($from) + -> ignoring($message)->getSubject() -> returns($subject) + -> ignoring($message)->getBody() -> returns($body) + ); + return $message; + } + + private function _createPlugin($replacements) + { + return new Swift_Plugins_DecoratorPlugin($replacements); + } + + private function _createReplacements() + { + return $this->_mock('Swift_Plugins_Decorator_Replacements'); + } + + private function _createSendEvent(Swift_Mime_Message $message) + { + $evt = $this->_mock('Swift_Events_SendEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getMessage() -> returns($message) + -> ignoring($evt) + ); + return $evt; + } + + private function _createPart($type, $body, $id) + { + $part = $this->_mock('Swift_Mime_MimeEntity'); + $this->_checking(Expectations::create() + -> ignoring($part)->getContentType() -> returns($type) + -> ignoring($part)->getBody() -> returns($body) + -> ignoring($part)->getId() -> returns($id) + ); + return $part; + } + + private function _createHeaders($headers = array()) + { + $set = $this->_mock('Swift_Mime_HeaderSet'); + + $this->_checking(Expectations::create() + -> allowing($set)->getAll() -> returns($headers) + -> ignoring($set) + ); + + foreach ($headers as $header) { + $set->set($header); + } + + return $set; + } + + private function _createHeader($name, $body = '') + { + $header = $this->_mock('Swift_Mime_Header'); + $this->_checking(Expectations::create() + -> ignoring($header)->getFieldName() -> returns($name) + -> ignoring($header)->getFieldBodyModel() -> returns($body) + ); + return $header; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php new file mode 100644 index 0000000..32147c6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/LoggerPluginTest.php @@ -0,0 +1,194 @@ +_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->add('foo') + ); + + $plugin = $this->_createPlugin($logger); + $plugin->add('foo'); + } + + public function testLoggerDelegatesDumpingEntries() + { + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->dump() -> returns('foobar') + ); + + $plugin = $this->_createPlugin($logger); + $this->assertEqual('foobar', $plugin->dump()); + } + + public function testLoggerDelegatesClearingEntries() + { + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->clear() + ); + + $plugin = $this->_createPlugin($logger); + $plugin->clear(); + } + + public function testCommandIsSentToLogger() + { + $evt = $this->_createCommandEvent("foo\r\n"); + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->add(pattern('~foo\r\n~')) + ); + + $plugin = $this->_createPlugin($logger); + $plugin->commandSent($evt); + } + + public function testResponseIsSentToLogger() + { + $evt = $this->_createResponseEvent("354 Go ahead\r\n"); + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->add(pattern('~354 Go ahead\r\n~')) + ); + + $plugin = $this->_createPlugin($logger); + $plugin->responseReceived($evt); + } + + public function testTransportBeforeStartChangeIsSentToLogger() + { + $evt = $this->_createTransportChangeEvent(); + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->add(any()) + ); + + $plugin = $this->_createPlugin($logger); + $plugin->beforeTransportStarted($evt); + } + + public function testTransportStartChangeIsSentToLogger() + { + $evt = $this->_createTransportChangeEvent(); + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->add(any()) + ); + + $plugin = $this->_createPlugin($logger); + $plugin->transportStarted($evt); + } + + public function testTransportStopChangeIsSentToLogger() + { + $evt = $this->_createTransportChangeEvent(); + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->add(any()) + ); + + $plugin = $this->_createPlugin($logger); + $plugin->transportStopped($evt); + } + + public function testTransportBeforeStopChangeIsSentToLogger() + { + $evt = $this->_createTransportChangeEvent(); + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->add(any()) + ); + + $plugin = $this->_createPlugin($logger); + $plugin->beforeTransportStopped($evt); + } + + public function testExceptionsArePassedToDelegateAndLeftToBubbleUp() + { + $transport = $this->_createTransport(); + $evt = $this->_createTransportExceptionEvent(); + $logger = $this->_createLogger(); + $this->_checking(Expectations::create() + -> one($logger)->add(any()) + -> allowing($logger) + ); + + $plugin = $this->_createPlugin($logger); + try { + $plugin->exceptionThrown($evt); + $this->fail('Exception should bubble up.'); + } catch (Swift_TransportException $ex) { + } + } + + // -- Creation Methods + + private function _createLogger() + { + return $this->_mock('Swift_Plugins_Logger'); + } + + private function _createPlugin($logger) + { + return new Swift_Plugins_LoggerPlugin($logger); + } + + private function _createCommandEvent($command) + { + $evt = $this->_mock('Swift_Events_CommandEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getCommand() -> returns($command) + -> ignoring($evt) + ); + return $evt; + } + + private function _createResponseEvent($response) + { + $evt = $this->_mock('Swift_Events_ResponseEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getResponse() -> returns($response) + -> ignoring($evt) + ); + return $evt; + } + + private function _createTransport() + { + return $this->_mock('Swift_Transport'); + } + + private function _createTransportChangeEvent() + { + $evt = $this->_mock('Swift_Events_TransportChangeEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getSource() -> returns($this->_createTransport()) + -> ignoring($evt) + ); + return $evt; + } + + private function _createTransportExceptionEvent() + { + $evt = $this->_mock('Swift_Events_TransportExceptionEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getException() -> returns(new Swift_TransportException('')) + -> ignoring($evt) + ); + return $evt; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php new file mode 100644 index 0000000..464154e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/ArrayLoggerTest.php @@ -0,0 +1,70 @@ +add(">> Foo\r\n"); + $this->assertEqual(">> Foo\r\n", $logger->dump()); + } + + public function testAddingMultipleEntriesDumpsMultipleLines() + { + $logger = new Swift_Plugins_Loggers_ArrayLogger(); + $logger->add(">> FOO\r\n"); + $logger->add("<< 502 That makes no sense\r\n"); + $logger->add(">> RSET\r\n"); + $logger->add("<< 250 OK\r\n"); + + $this->assertEqual( + ">> FOO\r\n" . PHP_EOL . + "<< 502 That makes no sense\r\n" . PHP_EOL . + ">> RSET\r\n" . PHP_EOL . + "<< 250 OK\r\n", + $logger->dump() + ); + } + + public function testLogCanBeCleared() + { + $logger = new Swift_Plugins_Loggers_ArrayLogger(); + $logger->add(">> FOO\r\n"); + $logger->add("<< 502 That makes no sense\r\n"); + $logger->add(">> RSET\r\n"); + $logger->add("<< 250 OK\r\n"); + + $this->assertEqual( + ">> FOO\r\n" . PHP_EOL . + "<< 502 That makes no sense\r\n" . PHP_EOL . + ">> RSET\r\n" . PHP_EOL . + "<< 250 OK\r\n", + $logger->dump() + ); + + $logger->clear(); + + $this->assertEqual('', $logger->dump()); + } + + public function testLengthCanBeTruncated() + { + $logger = new Swift_Plugins_Loggers_ArrayLogger(2); + $logger->add(">> FOO\r\n"); + $logger->add("<< 502 That makes no sense\r\n"); + $logger->add(">> RSET\r\n"); + $logger->add("<< 250 OK\r\n"); + + $this->assertEqual( + ">> RSET\r\n" . PHP_EOL . + "<< 250 OK\r\n", + $logger->dump(), + '%s: Log should be truncated to last 2 entries' + ); + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php new file mode 100644 index 0000000..5615354 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Loggers/EchoLoggerTest.php @@ -0,0 +1,29 @@ +add(">> Foo"); + $data = ob_get_clean(); + + $this->assertEqual(">> Foo" . PHP_EOL, $data); + } + + public function testAddingEntryDumpsEscapedLineWithHtml() + { + $logger = new Swift_Plugins_Loggers_EchoLogger(true); + ob_start(); + $logger->add(">> Foo"); + $data = ob_get_clean(); + + $this->assertEqual(">> Foo
    " . PHP_EOL, $data); + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php new file mode 100644 index 0000000..ff92315 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/PopBeforeSmtpPluginTest.php @@ -0,0 +1,113 @@ +_createConnection(); + + $plugin = $this->_createPlugin('pop.host.tld', 110); + $plugin->setConnection($connection); + + $transport = $this->_createTransport(); + $evt = $this->_createTransportChangeEvent($transport); + + $this->_checking(Expectations::create() + -> one($connection)->connect() + -> ignoring($connection) + ); + + $plugin->beforeTransportStarted($evt); + } + + public function testPluginDisconnectsFromPop3HostBeforeTransportStarts() + { + $connection = $this->_createConnection(); + + $plugin = $this->_createPlugin('pop.host.tld', 110); + $plugin->setConnection($connection); + + $transport = $this->_createTransport(); + $evt = $this->_createTransportChangeEvent($transport); + + $this->_checking(Expectations::create() + -> one($connection)->disconnect() + -> ignoring($connection) + ); + + $plugin->beforeTransportStarted($evt); + } + + public function testPluginDoesNotConnectToSmtpIfBoundToDifferentTransport() + { + $connection = $this->_createConnection(); + + $smtp = $this->_createTransport(); + + $plugin = $this->_createPlugin('pop.host.tld', 110); + $plugin->setConnection($connection); + $plugin->bindSmtp($smtp); + + $transport = $this->_createTransport(); + $evt = $this->_createTransportChangeEvent($transport); + + $this->_checking(Expectations::create() + -> never($connection) + ); + + $plugin->beforeTransportStarted($evt); + } + + public function testPluginCanBindToSpecificTransport() + { + $connection = $this->_createConnection(); + + $smtp = $this->_createTransport(); + + $plugin = $this->_createPlugin('pop.host.tld', 110); + $plugin->setConnection($connection); + $plugin->bindSmtp($smtp); + + $evt = $this->_createTransportChangeEvent($smtp); + + $this->_checking(Expectations::create() + -> one($connection)->connect() + -> ignoring($connection) + ); + + $plugin->beforeTransportStarted($evt); + } + + // -- Creation Methods + + private function _createTransport() + { + return $this->_mock('Swift_Transport'); + } + + private function _createTransportChangeEvent($transport) + { + $evt = $this->_mock('Swift_Events_TransportChangeEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getSource() -> returns($transport) + -> ignoring($evt)->getTransport() -> returns($transport) + ); + return $evt; + } + + public function _createConnection() + { + return $this->_mock('Swift_Plugins_Pop_Pop3Connection'); + } + + public function _createPlugin($host, $port, $crypto = null) + { + return new Swift_Plugins_PopBeforeSmtpPlugin($host, $port, $crypto); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php new file mode 100644 index 0000000..432428e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/RedirectingPluginTest.php @@ -0,0 +1,66 @@ +assertEqual('fabien@example.com', $plugin->getRecipient()); + $plugin->setRecipient('chris@example.com'); + $this->assertEqual('chris@example.com', $plugin->getRecipient()); + } + + public function testPluginChangesRecipients() + { + $message = Swift_Message::newInstance() + ->setSubject('...') + ->setFrom(array('john@example.com' => 'John Doe')) + ->setTo($to = array( + 'fabien-to@example.com' => 'Fabien (To)', + 'chris-to@example.com' => 'Chris (To)', + )) + ->setCc($cc = array( + 'fabien-cc@example.com' => 'Fabien (Cc)', + 'chris-cc@example.com' => 'Chris (Cc)', + )) + ->setBcc($bcc = array( + 'fabien-bcc@example.com' => 'Fabien (Bcc)', + 'chris-bcc@example.com' => 'Chris (Bcc)', + )) + ->setBody('...') + ; + + $plugin = new Swift_Plugins_RedirectingPlugin('god@example.com'); + + $evt = $this->_createSendEvent($message); + + $plugin->beforeSendPerformed($evt); + + $this->assertEqual($message->getTo(), array('god@example.com' => '')); + $this->assertEqual($message->getCc(), array()); + $this->assertEqual($message->getBcc(), array()); + + $plugin->sendPerformed($evt); + + $this->assertEqual($message->getTo(), $to); + $this->assertEqual($message->getCc(), $cc); + $this->assertEqual($message->getBcc(), $bcc); + } + + // -- Creation Methods + + private function _createSendEvent(Swift_Mime_Message $message) + { + $evt = $this->_mock('Swift_Events_SendEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getMessage() -> returns($message) + -> ignoring($evt) + ); + return $evt; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php new file mode 100644 index 0000000..72279d7 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ReporterPluginTest.php @@ -0,0 +1,120 @@ +_createMessage(); + $evt = $this->_createSendEvent(); + $reporter = $this->_createReporter(); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array('foo@bar.tld' => 'Foo')) + -> allowing($evt)->getMessage() -> returns($message) + -> allowing($evt)->getFailedRecipients() -> returns(array()) + -> one($reporter)->notify($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS) + -> ignoring($message) + -> ignoring($evt) + ); + + $plugin = new Swift_Plugins_ReporterPlugin($reporter); + $plugin->sendPerformed($evt); + } + + public function testReportingFailedTo() + { + $message = $this->_createMessage(); + $evt = $this->_createSendEvent(); + $reporter = $this->_createReporter(); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array( + 'foo@bar.tld' => 'Foo', 'zip@button' => 'Zip' + )) + -> allowing($evt)->getMessage() -> returns($message) + -> allowing($evt)->getFailedRecipients() -> returns(array('zip@button')) + -> one($reporter)->notify($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS) + -> one($reporter)->notify($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL) + -> ignoring($message) + -> ignoring($evt) + ); + + $plugin = new Swift_Plugins_ReporterPlugin($reporter); + $plugin->sendPerformed($evt); + } + + public function testReportingFailedCc() + { + $message = $this->_createMessage(); + $evt = $this->_createSendEvent(); + $reporter = $this->_createReporter(); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array( + 'foo@bar.tld' => 'Foo' + )) + -> allowing($message)->getCc() -> returns(array( + 'zip@button' => 'Zip', 'test@test.com' => 'Test' + )) + -> allowing($evt)->getMessage() -> returns($message) + -> allowing($evt)->getFailedRecipients() -> returns(array('zip@button')) + -> one($reporter)->notify($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS) + -> one($reporter)->notify($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL) + -> one($reporter)->notify($message, 'test@test.com', Swift_Plugins_Reporter::RESULT_PASS) + -> ignoring($message) + -> ignoring($evt) + ); + + $plugin = new Swift_Plugins_ReporterPlugin($reporter); + $plugin->sendPerformed($evt); + } + + public function testReportingFailedBcc() + { + $message = $this->_createMessage(); + $evt = $this->_createSendEvent(); + $reporter = $this->_createReporter(); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array( + 'foo@bar.tld' => 'Foo' + )) + -> allowing($message)->getBcc() -> returns(array( + 'zip@button' => 'Zip', 'test@test.com' => 'Test' + )) + -> allowing($evt)->getMessage() -> returns($message) + -> allowing($evt)->getFailedRecipients() -> returns(array('zip@button')) + -> one($reporter)->notify($message, 'foo@bar.tld', Swift_Plugins_Reporter::RESULT_PASS) + -> one($reporter)->notify($message, 'zip@button', Swift_Plugins_Reporter::RESULT_FAIL) + -> one($reporter)->notify($message, 'test@test.com', Swift_Plugins_Reporter::RESULT_PASS) + -> ignoring($message) + -> ignoring($evt) + ); + + $plugin = new Swift_Plugins_ReporterPlugin($reporter); + $plugin->sendPerformed($evt); + } + + // -- Creation Methods + + private function _createMessage() + { + return $this->_mock('Swift_Mime_Message'); + } + + private function _createSendEvent() + { + return $this->_mock('Swift_Events_SendEvent'); + } + + private function _createReporter() + { + return $this->_mock('Swift_Plugins_Reporter'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php new file mode 100644 index 0000000..3d4e310 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HitReporterTest.php @@ -0,0 +1,69 @@ +_hitReporter = new Swift_Plugins_Reporters_HitReporter(); + $this->_message = $this->_mock('Swift_Mime_Message'); + } + + public function testReportingFail() + { + $this->_hitReporter->notify($this->_message, 'foo@bar.tld', + Swift_Plugins_Reporter::RESULT_FAIL + ); + $this->assertEqual(array('foo@bar.tld'), + $this->_hitReporter->getFailedRecipients() + ); + } + + public function testMultipleReports() + { + $this->_hitReporter->notify($this->_message, 'foo@bar.tld', + Swift_Plugins_Reporter::RESULT_FAIL + ); + $this->_hitReporter->notify($this->_message, 'zip@button', + Swift_Plugins_Reporter::RESULT_FAIL + ); + $this->assertEqual(array('foo@bar.tld', 'zip@button'), + $this->_hitReporter->getFailedRecipients() + ); + } + + public function testReportingPassIsIgnored() + { + $this->_hitReporter->notify($this->_message, 'foo@bar.tld', + Swift_Plugins_Reporter::RESULT_FAIL + ); + $this->_hitReporter->notify($this->_message, 'zip@button', + Swift_Plugins_Reporter::RESULT_PASS + ); + $this->assertEqual(array('foo@bar.tld'), + $this->_hitReporter->getFailedRecipients() + ); + } + + public function testBufferCanBeCleared() + { + $this->_hitReporter->notify($this->_message, 'foo@bar.tld', + Swift_Plugins_Reporter::RESULT_FAIL + ); + $this->_hitReporter->notify($this->_message, 'zip@button', + Swift_Plugins_Reporter::RESULT_FAIL + ); + $this->assertEqual(array('foo@bar.tld', 'zip@button'), + $this->_hitReporter->getFailedRecipients() + ); + $this->_hitReporter->clear(); + $this->assertEqual(array(), $this->_hitReporter->getFailedRecipients()); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php new file mode 100644 index 0000000..76ab3e3 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/Reporters/HtmlReporterTest.php @@ -0,0 +1,59 @@ +_html = new Swift_Plugins_Reporters_HtmlReporter(); + $this->_message = $this->_mock('Swift_Mime_Message'); + } + + public function testReportingPass() + { + ob_start(); + $this->_html->notify($this->_message, 'foo@bar.tld', + Swift_Plugins_Reporter::RESULT_PASS + ); + $html = ob_get_clean(); + + $this->assertPattern('~ok|pass~i', $html, '%s: Reporter should indicate pass'); + $this->assertPattern('~foo@bar\.tld~', $html, '%s: Reporter should show address'); + } + + public function testReportingFail() + { + ob_start(); + $this->_html->notify($this->_message, 'zip@button', + Swift_Plugins_Reporter::RESULT_FAIL + ); + $html = ob_get_clean(); + + $this->assertPattern('~fail~i', $html, '%s: Reporter should indicate fail'); + $this->assertPattern('~zip@button~', $html, '%s: Reporter should show address'); + } + + public function testMultipleReports() + { + ob_start(); + $this->_html->notify($this->_message, 'foo@bar.tld', + Swift_Plugins_Reporter::RESULT_PASS + ); + $this->_html->notify($this->_message, 'zip@button', + Swift_Plugins_Reporter::RESULT_FAIL + ); + $html = ob_get_clean(); + + $this->assertPattern('~ok|pass~i', $html, '%s: Reporter should indicate pass'); + $this->assertPattern('~foo@bar\.tld~', $html, '%s: Reporter should show address'); + $this->assertPattern('~fail~i', $html, '%s: Reporter should indicate fail'); + $this->assertPattern('~zip@button~', $html, '%s: Reporter should show address'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php new file mode 100644 index 0000000..86e24d6 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Plugins/ThrottlerPluginTest.php @@ -0,0 +1,124 @@ +_createSleeper(); + $timer = $this->_createTimer(); + + //10MB/min + $plugin = new Swift_Plugins_ThrottlerPlugin( + 10000000, Swift_Plugins_ThrottlerPlugin::BYTES_PER_MINUTE, + $sleeper, $timer + ); + + $this->_checking(Expectations::create() + -> one($timer)->getTimestamp() -> returns(0) + -> one($timer)->getTimestamp() -> returns(1) //expected 0.6 + -> one($timer)->getTimestamp() -> returns(1) //expected 1.2 (sleep 1) + -> one($timer)->getTimestamp() -> returns(2) //expected 1.8 + -> one($timer)->getTimestamp() -> returns(2) //expected 2.4 (sleep 1) + -> ignoring($timer) + + -> exactly(2)->of($sleeper)->sleep(1) + ); + + //10,000,000 bytes per minute + //100,000 bytes per email + + // .: (10,000,000/100,000)/60 emails per second = 1.667 emais/sec + + $message = $this->_createMessageWithByteCount(100000); //100KB + + $evt = $this->_createSendEvent($message); + + for ($i = 0; $i < 5; ++$i) { + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + } + } + + public function testMessagesPerMinuteThrottling() + { + $sleeper = $this->_createSleeper(); + $timer = $this->_createTimer(); + + //60/min + $plugin = new Swift_Plugins_ThrottlerPlugin( + 60, Swift_Plugins_ThrottlerPlugin::MESSAGES_PER_MINUTE, + $sleeper, $timer + ); + + $this->_checking(Expectations::create() + -> one($timer)->getTimestamp() -> returns(0) + -> one($timer)->getTimestamp() -> returns(0) //expected 1 (sleep 1) + -> one($timer)->getTimestamp() -> returns(2) //expected 2 + -> one($timer)->getTimestamp() -> returns(2) //expected 3 (sleep 1) + -> one($timer)->getTimestamp() -> returns(4) //expected 4 + -> ignoring($timer) + + -> exactly(2)->of($sleeper)->sleep(1) + ); + + //60 messages per minute + //1 message per second + + $message = $this->_createMessageWithByteCount(10); + + $evt = $this->_createSendEvent($message); + + for ($i = 0; $i < 5; ++$i) { + $plugin->beforeSendPerformed($evt); + $plugin->sendPerformed($evt); + } + } + + // -- Creation Methods + + private function _createSleeper() + { + return $this->_mock('Swift_Plugins_Sleeper'); + } + + private function _createTimer() + { + return $this->_mock('Swift_Plugins_Timer'); + } + + private function _createMessageWithByteCount($bytes) + { + $this->_bytes = $bytes; + $msg = $this->_mock('Swift_Mime_Message'); + $this->_checking(Expectations::create() + -> ignoring($msg)->toByteStream(any()) -> calls(array($this, '_write')) + ); + return $msg; + } + + private function _createSendEvent($message) + { + $evt = $this->_mock('Swift_Events_SendEvent'); + $this->_checking(Expectations::create() + -> ignoring($evt)->getMessage() -> returns($message) + ); + return $evt; + } + + private $_bytes = 0; + public function _write($invocation) + { + $args = $invocation->getArguments(); + $is = $args[0]; + for ($i = 0; $i < $this->_bytes; ++$i) { + $is->write('x'); + } + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php new file mode 100644 index 0000000..5a6977f --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/ByteArrayReplacementFilterTest.php @@ -0,0 +1,135 @@ +_createFilter(array(0x61, 0x62), array(0x63, 0x64)); + $this->assertEqual( + array(0x59, 0x60, 0x63, 0x64, 0x65), + $filter->filter(array(0x59, 0x60, 0x61, 0x62, 0x65)) + ); + } + + public function testShouldBufferReturnsTrueIfPartialMatchAtEndOfBuffer() + { + $filter = $this->_createFilter(array(0x61, 0x62), array(0x63, 0x64)); + $this->assertTrue($filter->shouldBuffer(array(0x59, 0x60, 0x61)), + '%s: Filter should buffer since 0x61 0x62 is the needle and the ending ' . + '0x61 could be from 0x61 0x62' + ); + } + + public function testFilterCanMakeMultipleReplacements() + { + $filter = $this->_createFilter(array(array(0x61), array(0x62)), array(0x63)); + $this->assertEqual( + array(0x60, 0x63, 0x60, 0x63, 0x60), + $filter->filter(array(0x60, 0x61, 0x60, 0x62, 0x60)) + ); + } + + public function testMultipleReplacementsCanBeDifferent() + { + $filter = $this->_createFilter(array(array(0x61), array(0x62)), array(array(0x63), array(0x64))); + $this->assertEqual( + array(0x60, 0x63, 0x60, 0x64, 0x60), + $filter->filter(array(0x60, 0x61, 0x60, 0x62, 0x60)) + ); + } + + public function testShouldBufferReturnsFalseIfPartialMatchNotAtEndOfString() + { + $filter = $this->_createFilter(array(0x0D, 0x0A), array(0x0A)); + $this->assertFalse($filter->shouldBuffer(array(0x61, 0x62, 0x0D, 0x0A, 0x63)), + '%s: Filter should not buffer since x0Dx0A is the needle and is not at EOF' + ); + } + + public function testShouldBufferReturnsTrueIfAnyOfMultipleMatchesAtEndOfString() + { + $filter = $this->_createFilter(array(array(0x61, 0x62), array(0x63)), array(0x64)); + $this->assertTrue($filter->shouldBuffer(array(0x59, 0x60, 0x61)), + '%s: Filter should buffer since 0x61 0x62 is a needle and the ending ' . + '0x61 could be from 0x61 0x62' + ); + } + + public function testConvertingAllLineEndingsToCRLFWhenInputIsLF() + { + $filter = $this->_createFilter( + array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), + array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) + ); + + $this->assertEqual( + array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63), + $filter->filter(array(0x60, 0x0A, 0x61, 0x0A, 0x62, 0x0A, 0x63)) + ); + } + + public function testConvertingAllLineEndingsToCRLFWhenInputIsCR() + { + $filter = $this->_createFilter( + array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), + array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) + ); + + $this->assertEqual( + array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63), + $filter->filter(array(0x60, 0x0D, 0x61, 0x0D, 0x62, 0x0D, 0x63)) + ); + } + + public function testConvertingAllLineEndingsToCRLFWhenInputIsCRLF() + { + $filter = $this->_createFilter( + array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), + array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) + ); + + $this->assertEqual( + array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63), + $filter->filter(array(0x60, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x63)) + ); + } + + public function testConvertingAllLineEndingsToCRLFWhenInputIsLFCR() + { + $filter = $this->_createFilter( + array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), + array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) + ); + + $this->assertEqual( + array(0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63), + $filter->filter(array(0x60, 0x0A, 0x0D, 0x61, 0x0A, 0x0D, 0x62, 0x0A, 0x0D, 0x63)) + ); + } + + public function testConvertingAllLineEndingsToCRLFWhenInputContainsLFLF() + { + //Lighthouse Bug #23 + + $filter = $this->_createFilter( + array(array(0x0D, 0x0A), array(0x0D), array(0x0A)), + array(array(0x0A), array(0x0A), array(0x0D, 0x0A)) + ); + + $this->assertEqual( + array(0x60, 0x0D, 0x0A, 0x0D, 0x0A, 0x61, 0x0D, 0x0A, 0x0D, 0x0A, 0x62, 0x0D, 0x0A, 0x0D, 0x0A, 0x63), + $filter->filter(array(0x60, 0x0A, 0x0A, 0x61, 0x0A, 0x0A, 0x62, 0x0A, 0x0A, 0x63)) + ); + } + + // -- Creation methods + + private function _createFilter($search, $replace) + { + return new Swift_StreamFilters_ByteArrayReplacementFilter($search, $replace); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php new file mode 100644 index 0000000..8190988 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterFactoryTest.php @@ -0,0 +1,41 @@ +_createFactory(); + $this->assertIsA($factory->createFilter('a', 'b'), + 'Swift_StreamFilters_StringReplacementFilter' + ); + } + + public function testSameInstancesAreCached() + { + $factory = $this->_createFactory(); + $filter1 = $factory->createFilter('a', 'b'); + $filter2 = $factory->createFilter('a', 'b'); + $this->assertSame($filter1, $filter2, '%s: Instances should be cached'); + } + + public function testDifferingInstancesAreNotCached() + { + $factory = $this->_createFactory(); + $filter1 = $factory->createFilter('a', 'b'); + $filter2 = $factory->createFilter('a', 'c'); + $this->assertNotEqual($filter1, $filter2, + '%s: Differing instances should not be cached' + ); + } + + // -- Creation methods + + private function _createFactory() + { + return new Swift_StreamFilters_StringReplacementFilterFactory(); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php new file mode 100644 index 0000000..712f1dc --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/StreamFilters/StringReplacementFilterTest.php @@ -0,0 +1,59 @@ +_createFilter('foo', 'bar'); + $this->assertEqual('XbarYbarZ', $filter->filter('XfooYfooZ')); + } + + public function testShouldBufferReturnsTrueIfPartialMatchAtEndOfBuffer() + { + $filter = $this->_createFilter('foo', 'bar'); + $this->assertTrue($filter->shouldBuffer('XfooYf'), + '%s: Filter should buffer since "foo" is the needle and the ending ' . + '"f" could be from "foo"' + ); + } + + public function testFilterCanMakeMultipleReplacements() + { + $filter = $this->_createFilter(array('a', 'b'), 'foo'); + $this->assertEqual('XfooYfooZ', $filter->filter('XaYbZ')); + } + + public function testMultipleReplacementsCanBeDifferent() + { + $filter = $this->_createFilter(array('a', 'b'), array('foo', 'zip')); + $this->assertEqual('XfooYzipZ', $filter->filter('XaYbZ')); + } + + public function testShouldBufferReturnsFalseIfPartialMatchNotAtEndOfString() + { + $filter = $this->_createFilter("\r\n", "\n"); + $this->assertFalse($filter->shouldBuffer("foo\r\nbar"), + '%s: Filter should not buffer since x0Dx0A is the needle and is not at EOF' + ); + } + + public function testShouldBufferReturnsTrueIfAnyOfMultipleMatchesAtEndOfString() + { + $filter = $this->_createFilter(array('foo', 'zip'), 'bar'); + $this->assertTrue($filter->shouldBuffer('XfooYzi'), + '%s: Filter should buffer since "zip" is a needle and the ending ' . + '"zi" could be from "zip"' + ); + } + + // -- Creation methods + + private function _createFilter($search, $replace) + { + return new Swift_StreamFilters_StringReplacementFilter($search, $replace); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php new file mode 100644 index 0000000..e1749f2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpEventSupportTest.php @@ -0,0 +1,378 @@ +_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $listener = $this->_mock('Swift_Events_EventListener'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> one($dispatcher)->bindEventListener($listener) + ); + $smtp->registerPlugin($listener); + } + + public function testSendingDispatchesBeforeSendEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $message = $this->_createMessage(); + $smtp = $this->_getTransport($buf, $dispatcher); + $evt = $this->_mock('Swift_Events_SendEvent'); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('chris@swiftmailer.org'=>null)) + -> allowing($message)->getTo() -> returns(array('mark@swiftmailer.org'=>'Mark')) + -> ignoring($message) + -> one($dispatcher)->createSendEvent(optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'beforeSendPerformed') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(1, $smtp->send($message)); + } + + public function testSendingDispatchesSendEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $message = $this->_createMessage(); + $smtp = $this->_getTransport($buf, $dispatcher); + $evt = $this->_mock('Swift_Events_SendEvent'); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('chris@swiftmailer.org'=>null)) + -> allowing($message)->getTo() -> returns(array('mark@swiftmailer.org'=>'Mark')) + -> ignoring($message) + -> one($dispatcher)->createSendEvent(optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'sendPerformed') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(1, $smtp->send($message)); + } + + public function testSendEventCapturesFailures() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_SendEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('chris@swiftmailer.org'=>null)) + -> allowing($message)->getTo() -> returns(array('mark@swiftmailer.org'=>'Mark')) + -> ignoring($message) + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns("500 Not now\r\n") + -> allowing($dispatcher)->createSendEvent($smtp, optional()) -> returns($evt) + -> one($evt)->setFailedRecipients(array('mark@swiftmailer.org')) + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(0, $smtp->send($message)); + } + + public function testSendEventHasResultFailedIfAllFailures() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_SendEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('chris@swiftmailer.org'=>null)) + -> allowing($message)->getTo() -> returns(array('mark@swiftmailer.org'=>'Mark')) + -> ignoring($message) + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns("500 Not now\r\n") + -> allowing($dispatcher)->createSendEvent($smtp, optional()) -> returns($evt) + -> one($evt)->setResult(Swift_Events_SendEvent::RESULT_FAILED) + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(0, $smtp->send($message)); + } + + public function testSendEventHasResultTentativeIfSomeFailures() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_SendEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('chris@swiftmailer.org'=>null)) + -> allowing($message)->getTo() -> returns(array( + 'mark@swiftmailer.org'=>'Mark', 'chris@site.tld'=>'Chris' + )) + -> ignoring($message) + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns("500 Not now\r\n") + -> allowing($dispatcher)->createSendEvent($smtp, optional()) -> returns($evt) + -> one($evt)->setResult(Swift_Events_SendEvent::RESULT_TENTATIVE) + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(1, $smtp->send($message)); + } + + public function testSendEventHasResultSuccessIfNoFailures() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_SendEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('chris@swiftmailer.org'=>null)) + -> allowing($message)->getTo() -> returns(array( + 'mark@swiftmailer.org'=>'Mark', 'chris@site.tld'=>'Chris' + )) + -> ignoring($message) + -> allowing($dispatcher)->createSendEvent($smtp, optional()) -> returns($evt) + -> one($evt)->setResult(Swift_Events_SendEvent::RESULT_SUCCESS) + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(2, $smtp->send($message)); + } + + public function testCancellingEventBubbleBeforeSendStopsEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_SendEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('chris@swiftmailer.org'=>null)) + -> allowing($message)->getTo() -> returns(array('mark@swiftmailer.org'=>'Mark')) + -> ignoring($message) + -> allowing($dispatcher)->createSendEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'beforeSendPerformed') + -> ignoring($dispatcher) + -> atLeast(1)->of($evt)->bubbleCancelled() -> returns(true) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(0, $smtp->send($message)); + } + + public function testStartingTransportDispatchesTransportChangeEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_TransportChangeEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> allowing($dispatcher)->createTransportChangeEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'transportStarted') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + } + + public function testStartingTransportDispatchesBeforeTransportChangeEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_TransportChangeEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> allowing($dispatcher)->createTransportChangeEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'beforeTransportStarted') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + } + + public function testCancellingBubbleBeforeTransportStartStopsEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_TransportChangeEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> allowing($dispatcher)->createTransportChangeEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'beforeTransportStarted') + -> allowing($evt)->bubbleCancelled() -> returns(true) + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + + $this->assertFalse($smtp->isStarted(), + '%s: Transport should not be started since event bubble was cancelled' + ); + } + + public function testStoppingTransportDispatchesTransportChangeEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_TransportChangeEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> allowing($dispatcher)->createTransportChangeEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'transportStopped') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->stop(); + } + + public function testStoppingTransportDispatchesBeforeTransportChangeEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_TransportChangeEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> allowing($dispatcher)->createTransportChangeEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'beforeTransportStopped') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->stop(); + } + + public function testCancellingBubbleBeforeTransportStoppedStopsEvent() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_TransportChangeEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $seq = $this->_sequence('stopping transport'); + $this->_checking(Expectations::create() + -> allowing($dispatcher)->createTransportChangeEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'beforeTransportStopped') -> inSequence($seq) + -> allowing($evt)->bubbleCancelled() -> inSequence($seq) -> returns(true) + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->stop(); + + $this->assertTrue($smtp->isStarted(), + '%s: Transport should not be stopped since event bubble was cancelled' + ); + } + + public function testResponseEventsAreGenerated() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_ResponseEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> allowing($dispatcher)->createResponseEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'responseReceived') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + } + + public function testCommandEventsAreGenerated() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_CommandEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> allowing($dispatcher)->createCommandEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'commandSent') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + } + + public function testExceptionsCauseExceptionEvents() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_TransportExceptionEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> atLeast(1)->of($buf)->readLine(any()) -> returns("503 I'm sleepy, go away!\r\n") + -> allowing($dispatcher)->createTransportExceptionEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'exceptionThrown') + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + $this->fail('TransportException should be thrown on invalid response'); + } catch (Swift_TransportException $e) { + } + } + + public function testExceptionBubblesCanBeCancelled() + { + $buf = $this->_getBuffer(); + $dispatcher = $this->_createEventDispatcher(false); + $evt = $this->_mock('Swift_Events_TransportExceptionEvent'); + $smtp = $this->_getTransport($buf, $dispatcher); + $this->_checking(Expectations::create() + -> atLeast(1)->of($buf)->readLine(any()) -> returns("503 I'm sleepy, go away!\r\n") + -> allowing($dispatcher)->createTransportExceptionEvent($smtp, optional()) -> returns($evt) + -> one($dispatcher)->dispatchEvent($evt, 'exceptionThrown') + -> atLeast(1)->of($evt)->bubbleCancelled() -> returns(true) + -> ignoring($dispatcher) + -> ignoring($evt) + ); + $this->_finishBuffer($buf); + $smtp->start(); + } + + // -- Creation Methods + + protected function _createEventDispatcher($stub = true) + { + return $stub + ? $this->_stub('Swift_Events_EventDispatcher') + : $this->_mock('Swift_Events_EventDispatcher') + ; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php new file mode 100644 index 0000000..298969e --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/AbstractSmtpTest.php @@ -0,0 +1,924 @@ +_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + ); + $this->_finishBuffer($buf); + try { + $this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started'); + $smtp->start(); + $this->assertTrue($smtp->isStarted(), '%s: start() should have started connection'); + } catch (Exception $e) { + $this->fail('220 is a valid SMTP greeting and should be accepted'); + } + } + + public function testBadGreetingCausesException() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("554 I'm busy\r\n") + ); + $this->_finishBuffer($buf); + try { + $this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started'); + $smtp->start(); + $this->fail('554 greeting indicates an error and should cause an exception'); + } catch (Exception $e) { + $this->assertFalse($smtp->isStarted(), '%s: start() should have failed'); + } + } + + public function testStartSendsHeloToInitiate() + { + /* -- RFC 2821, 3.2. + + 3.2 Client Initiation + + Once the server has sent the welcoming message and the client has + received it, the client normally sends the EHLO command to the + server, indicating the client's identity. In addition to opening the + session, use of EHLO indicates that the client is able to process + service extensions and requests that the server provide a list of the + extensions it supports. Older SMTP systems which are unable to + support service extensions and contemporary clients which do not + require service extensions in the mail session being initiated, MAY + use HELO instead of EHLO. Servers MUST NOT return the extended + EHLO-style response to a HELO command. For a particular connection + attempt, if the server returns a "command not recognized" response to + EHLO, the client SHOULD be able to fall back and send HELO. + + In the EHLO command the host sending the command identifies itself; + the command may be interpreted as saying "Hello, I am " (and, + in the case of EHLO, "and I support service extension requests"). + + -- RFC 2281, 4.1.1.1. + + ehlo = "EHLO" SP Domain CRLF + helo = "HELO" SP Domain CRLF + + -- RFC 2821, 4.3.2. + + EHLO or HELO + S: 250 + E: 504, 550 + + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + -> one($buf)->write(pattern('~^HELO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns('250 ServerName' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + } catch (Exception $e) { + $this->fail('Starting SMTP should send HELO and accept 250 response'); + } + } + + public function testInvalidHeloResponseCausesException() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + -> one($buf)->write(pattern('~^HELO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns('504 WTF' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started'); + $smtp->start(); + $this->fail('Non 250 HELO response should raise Exception'); + } catch (Exception $e) { + $this->assertFalse($smtp->isStarted(), '%s: SMTP start() should have failed'); + } + } + + public function testDomainNameIsPlacedInHelo() + { + /* -- RFC 2821, 4.1.4. + + The SMTP client MUST, if possible, ensure that the domain parameter + to the EHLO command is a valid principal host name (not a CNAME or MX + name) for its host. If this is not possible (e.g., when the client's + address is dynamically assigned and the client does not have an + obvious name), an address literal SHOULD be substituted for the + domain name and supplemental information provided that will assist in + identifying the client. + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + -> one($buf)->write("HELO mydomain.com\r\n") -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns('250 ServerName' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->setLocalDomain('mydomain.com'); + $smtp->start(); + } + + public function testSuccessfulMailCommand() + { + /* -- RFC 2821, 3.3. + + There are three steps to SMTP mail transactions. The transaction + starts with a MAIL command which gives the sender identification. + + ..... + + The first step in the procedure is the MAIL command. + + MAIL FROM: [SP ] + + -- RFC 2821, 4.1.1.2. + + Syntax: + + "MAIL FROM:" ("<>" / Reverse-Path) + [SP Mail-parameters] CRLF + -- RFC 2821, 4.1.2. + + Reverse-path = Path + Forward-path = Path + Path = "<" [ A-d-l ":" ] Mailbox ">" + A-d-l = At-domain *( "," A-d-l ) + ; Note that this form, the so-called "source route", + ; MUST BE accepted, SHOULD NOT be generated, and SHOULD be + ; ignored. + At-domain = "@" domain + + -- RFC 2821, 4.3.2. + + MAIL + S: 250 + E: 552, 451, 452, 550, 553, 503 + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> allowing($message) + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('250 OK' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + $smtp->send($message); + } catch (Exception $e) { + $this->fail('MAIL FROM should accept a 250 response'); + } + } + + public function testInvalidResponseCodeFromMailCausesException() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> allowing($message) + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('553 Bad' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + $smtp->send($message); + $this->fail('MAIL FROM should accept a 250 response'); + } catch (Exception $e) { + } + } + + public function testSenderIsPreferredOverFrom() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getSender() -> returns(array('another@domain.com'=>'Someone')) + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> allowing($message) + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('250 OK' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->send($message); + } + + public function testReturnPathIsPreferredOverSender() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getSender() -> returns(array('another@domain.com'=>'Someone')) + -> allowing($message)->getReturnPath() -> returns('more@domain.com') + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> allowing($message) + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('250 OK' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->send($message); + } + + public function testSuccessfulRcptCommandWith250Response() + { + /* -- RFC 2821, 3.3. + + The second step in the procedure is the RCPT command. + + RCPT TO: [ SP ] + + The first or only argument to this command includes a forward-path + (normally a mailbox and domain, always surrounded by "<" and ">" + brackets) identifying one recipient. If accepted, the SMTP server + returns a 250 OK reply and stores the forward-path. If the recipient + is known not to be a deliverable address, the SMTP server returns a + 550 reply, typically with a string such as "no such user - " and the + mailbox name (other circumstances and reply codes are possible). + This step of the procedure can be repeated any number of times. + + -- RFC 2821, 4.1.1.3. + + This command is used to identify an individual recipient of the mail + data; multiple recipients are specified by multiple use of this + command. The argument field contains a forward-path and may contain + optional parameters. + + The forward-path normally consists of the required destination + mailbox. Sending systems SHOULD not generate the optional list of + hosts known as a source route. + + ....... + + "RCPT TO:" ("" / "" / Forward-Path) + [SP Rcpt-parameters] CRLF + + -- RFC 2821, 4.2.2. + + 250 Requested mail action okay, completed + 251 User not local; will forward to + (See section 3.4) + 252 Cannot VRFY user, but will accept message and attempt + delivery + + -- RFC 2821, 4.3.2. + + RCPT + S: 250, 251 (but see section 3.4 for discussion of 251 and 551) + E: 550, 551, 552, 553, 450, 451, 452, 503, 550 + */ + + //We'll treat 252 as accepted since it isn't really a failure + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $s = $this->_sequence('SMTP-envelope'); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> allowing($message) + + -> one($buf)->write("MAIL FROM: \r\n") -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> returns('250 OK' . "\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> returns('250 OK' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + $smtp->send($message); + } catch (Exception $e) { + $this->fail('RCPT TO should accept a 250 response'); + } + } + + public function testMailFromCommandIsOnlySentOncePerMessage() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $s = $this->_sequence('SMTP-envelope'); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> allowing($message) + + -> one($buf)->write("MAIL FROM: \r\n") -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> returns('250 OK' . "\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> returns('250 OK' . "\r\n") + -> never($buf)->write("MAIL FROM: \r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->send($message); + } + + public function testMultipleRecipientsSendsMultipleRcpt() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array( + 'foo@bar' => null, + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> allowing($message) + + -> one($buf)->write("RCPT TO: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('250 OK' . "\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns('250 OK' . "\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(3) + -> one($buf)->readLine(3) -> returns('250 OK' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->send($message); + } + + public function testCcRecipientsSendsMultipleRcpt() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message)->getCc() -> returns(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> allowing($message) + + -> one($buf)->write("RCPT TO: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('250 OK' . "\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns('250 OK' . "\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(3) + -> one($buf)->readLine(3) -> returns('250 OK' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->send($message); + } + + public function testSendReturnsNumberOfSuccessfulRecipients() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message)->getCc() -> returns(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> allowing($message) + + -> one($buf)->write("RCPT TO: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('250 OK' . "\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns('501 Nobody here' . "\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(3) + -> one($buf)->readLine(3) -> returns('250 OK' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(2, $smtp->send($message), + '%s: 1 of 3 recipients failed so 2 should be returned' + ); + } + + public function testRsetIsSentIfNoSuccessfulRecipients() + { + /* --RFC 2821, 4.1.1.5. + + This command specifies that the current mail transaction will be + aborted. Any stored sender, recipients, and mail data MUST be + discarded, and all buffers and state tables cleared. The receiver + MUST send a "250 OK" reply to a RSET command with no arguments. A + reset command may be issued by the client at any time. + + -- RFC 2821, 4.3.2. + + RSET + S: 250 + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message) + + -> one($buf)->write("RCPT TO: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('503 Bad' . "\r\n") + -> one($buf)->write("RSET\r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns('250 OK' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(0, $smtp->send($message), + '%s: 1 of 1 recipients failed so 0 should be returned' + ); + } + + public function testSuccessfulDataCommand() + { + /* -- RFC 2821, 3.3. + + The third step in the procedure is the DATA command (or some + alternative specified in a service extension). + + DATA + + If accepted, the SMTP server returns a 354 Intermediate reply and + considers all succeeding lines up to but not including the end of + mail data indicator to be the message text. + + -- RFC 2821, 4.1.1.4. + + The receiver normally sends a 354 response to DATA, and then treats + the lines (strings ending in sequences, as described in + section 2.3.7) following the command as mail data from the sender. + This command causes the mail data to be appended to the mail data + buffer. The mail data may contain any of the 128 ASCII character + codes, although experience has indicated that use of control + characters other than SP, HT, CR, and LF may cause problems and + SHOULD be avoided when possible. + + -- RFC 2821, 4.3.2. + + DATA + I: 354 -> data -> S: 250 + E: 552, 554, 451, 452 + E: 451, 554, 503 + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message) + + -> one($buf)->write("DATA\r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('354 Go ahead' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + $smtp->send($message); + } catch (Exception $e) { + $this->fail('354 is the expected response to DATA'); + } + } + + public function testBadDataResponseCausesException() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message) + + -> one($buf)->write("DATA\r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns('451 Bad' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + $smtp->send($message); + $this->fail('354 is the expected response to DATA (not observed)'); + } catch (Exception $e) { + } + } + + public function testMessageIsStreamedToBufferForData() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $s = $this->_sequence('DATA Streaming'); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + + -> one($buf)->write("DATA\r\n") -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> returns('354 OK' . "\r\n") + -> one($message)->toByteStream($buf) -> inSequence($s) + -> one($buf)->write("\r\n.\r\n") -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> returns('250 OK' . "\r\n") + + -> allowing($message) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->send($message); + } + + public function testBadResponseAfterDataTransmissionCausesException() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $s = $this->_sequence('DATA Streaming'); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + + -> one($buf)->write("DATA\r\n") -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> returns('354 OK' . "\r\n") + -> one($message)->toByteStream($buf) -> inSequence($s) + -> one($buf)->write("\r\n.\r\n") -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> returns('554 Error' . "\r\n") + + -> allowing($message) + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + $smtp->send($message); + $this->fail('250 is the expected response after a DATA transmission (not observed)'); + } catch (Exception $e) { + } + } + + public function testBccRecipientsAreRemovedFromHeaders() + { + /* -- RFC 2821, 7.2. + + Addresses that do not appear in the message headers may appear in the + RCPT commands to an SMTP server for a number of reasons. The two + most common involve the use of a mailing address as a "list exploder" + (a single address that resolves into multiple addresses) and the + appearance of "blind copies". Especially when more than one RCPT + command is present, and in order to avoid defeating some of the + purpose of these mechanisms, SMTP clients and servers SHOULD NOT copy + the full set of RCPT command arguments into the headers, either as + part of trace headers or as informational or private-extension + headers. Since this rule is often violated in practice, and cannot + be enforced, sending SMTP systems that are aware of "bcc" use MAY + find it helpful to send each blind copy as a separate message + transaction containing only a single RCPT command. + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message)->getBcc() -> returns(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> atLeast(1)->of($message)->setBcc(array()) + -> allowing($message) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->send($message); + } + + public function testEachBccRecipientIsSentASeparateMessage() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message)->getBcc() -> returns(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> atLeast(1)->of($message)->setBcc(array()) + -> one($message)->setBcc(array('zip@button' => 'Zip Button')) + -> one($message)->setBcc(array('test@domain' => 'Test user')) + -> atLeast(1)->of($message)->setBcc(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> allowing($message) + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns("250 OK\r\n") + -> one($buf)->write("DATA\r\n") -> returns(3) + -> one($buf)->readLine(3) -> returns("354 OK\r\n") + -> one($buf)->write("\r\n.\r\n") -> returns(4) + -> one($buf)->readLine(4) -> returns("250 OK\r\n") + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(5) + -> one($buf)->readLine(5) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(6) + -> one($buf)->readLine(6) -> returns("250 OK\r\n") + -> one($buf)->write("DATA\r\n") -> returns(7) + -> one($buf)->readLine(7) -> returns("354 OK\r\n") + -> one($buf)->write("\r\n.\r\n") -> returns(8) + -> one($buf)->readLine(8) -> returns("250 OK\r\n") + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(9) + -> one($buf)->readLine(9) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(10) + -> one($buf)->readLine(10) -> returns("250 OK\r\n") + -> one($buf)->write("DATA\r\n") -> returns(11) + -> one($buf)->readLine(11) -> returns("354 OK\r\n") + -> one($buf)->write("\r\n.\r\n") -> returns(12) + -> one($buf)->readLine(12) -> returns("250 OK\r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(3, $smtp->send($message)); + } + + public function testMessageStateIsRestoredOnFailure() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message)->getBcc() -> returns(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> one($message)->setBcc(array()) + -> one($message)->setBcc(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> allowing($message) + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns("250 OK\r\n") + -> one($buf)->write("DATA\r\n") -> returns(3) + -> one($buf)->readLine(3) -> returns("451 No\r\n") + ); + $this->_finishBuffer($buf); + + $smtp->start(); + try { + $smtp->send($message); + $this->fail('A bad response was given so exception is expected'); + } catch (Exception $e) { + } + } + + public function testStopSendsQuitCommand() + { + /* -- RFC 2821, 4.1.1.10. + + This command specifies that the receiver MUST send an OK reply, and + then close the transmission channel. + + The receiver MUST NOT intentionally close the transmission channel + until it receives and replies to a QUIT command (even if there was an + error). The sender MUST NOT intentionally close the transmission + channel until it sends a QUIT command and SHOULD wait until it + receives the reply (even if there was an error response to a previous + command). If the connection is closed prematurely due to violations + of the above or system or network failure, the server MUST cancel any + pending transaction, but not undo any previously completed + transaction, and generally MUST act as if the command or transaction + in progress had received a temporary error (i.e., a 4yz response). + + The QUIT command may be issued at any time. + + Syntax: + "QUIT" CRLF + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> one($buf)->initialize() + -> one($buf)->write("QUIT\r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("221 Bye\r\n") + -> one($buf)->terminate() + ); + $this->_finishBuffer($buf); + + $this->assertFalse($smtp->isStarted()); + $smtp->start(); + $this->assertTrue($smtp->isStarted()); + $smtp->stop(); + $this->assertFalse($smtp->isStarted()); + } + + public function testBufferCanBeFetched() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ref = $smtp->getBuffer(); + $this->assertReference($buf, $ref); + } + + public function testBufferCanBeWrittenToUsingExecuteCommand() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> one($buf)->write("FOO\r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("250 OK\r\n") + -> ignoring($buf) + ); + + $res = $smtp->executeCommand("FOO\r\n"); + $this->assertEqual("250 OK\r\n", $res); + } + + public function testResponseCodesAreValidated() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> one($buf)->write("FOO\r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("551 Not ok\r\n") + -> ignoring($buf) + ); + + try { + $smtp->executeCommand("FOO\r\n", array(250, 251)); + $this->fail('A 250 or 251 response was needed but 551 was returned.'); + } catch (Exception $e) { + } + } + + public function testFailedRecipientsCanBeCollectedByReference() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar' => null)) + -> allowing($message)->getBcc() -> returns(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> atLeast(1)->of($message)->setBcc(array()) + -> one($message)->setBcc(array('zip@button' => 'Zip Button')) + -> one($message)->setBcc(array('test@domain' => 'Test user')) + -> atLeast(1)->of($message)->setBcc(array( + 'zip@button' => 'Zip Button', + 'test@domain' => 'Test user' + )) + -> allowing($message) + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(1) + -> one($buf)->readLine(1) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(2) + -> one($buf)->readLine(2) -> returns("250 OK\r\n") + -> one($buf)->write("DATA\r\n") -> returns(3) + -> one($buf)->readLine(3) -> returns("354 OK\r\n") + -> one($buf)->write("\r\n.\r\n") -> returns(4) + -> one($buf)->readLine(4) -> returns("250 OK\r\n") + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(5) + -> one($buf)->readLine(5) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(6) + -> one($buf)->readLine(6) -> returns("500 Bad\r\n") + -> one($buf)->write("RSET\r\n") -> returns(7) + -> one($buf)->readLine(7) -> returns("250 OK\r\n") + + -> one($buf)->write("MAIL FROM: \r\n") -> returns(8) + -> one($buf)->readLine(8) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> returns(9) + -> one($buf)->readLine(9) -> returns("500 Bad\r\n") + -> one($buf)->write("RSET\r\n") -> returns(10) + -> one($buf)->readLine(10) -> returns("250 OK\r\n") + ); + $this->_finishBuffer($buf); + $smtp->start(); + $this->assertEqual(1, $smtp->send($message, $failures)); + $this->assertEqual(array('zip@button', 'test@domain'), $failures, + '%s: Failures should be caught in an array' + ); + } + + public function testSendingRegeneratesMessageId() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $message = $this->_createMessage(); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain.com'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> one($message)->generateId() + -> allowing($message) + ); + $this->_finishBuffer($buf); + $smtp->start(); + $smtp->send($message); + } + + // -- Protected methods + + protected function _getBuffer() + { + return $this->_mock('Swift_Transport_IoBuffer'); + } + + protected function _createMessage() + { + return $this->_mock('Swift_Mime_Message'); + } + + protected function _finishBuffer($buf) + { + $this->_checking(Expectations::create() + -> ignoring($buf)->readLine(0) -> returns('220 server.com foo' . "\r\n") + -> ignoring($buf)->write(pattern('~^(EH|HE)LO .*?\r\n$~D')) -> returns($x = uniqid()) + -> ignoring($buf)->readLine($x) -> returns('250 ServerName' . "\r\n") + -> ignoring($buf)->write(pattern('~^MAIL FROM: <.*?>\r\n$~D')) -> returns($x = uniqid()) + -> ignoring($buf)->readLine($x) -> returns('250 OK' . "\r\n") + -> ignoring($buf)->write(pattern('~^RCPT TO: <.*?>\r\n$~D')) -> returns($x = uniqid()) + -> ignoring($buf)->readLine($x) -> returns('250 OK' . "\r\n") + -> ignoring($buf)->write("DATA\r\n") -> returns($x = uniqid()) + -> ignoring($buf)->readLine($x) -> returns('354 OK' . "\r\n") + -> ignoring($buf)->write("\r\n.\r\n") -> returns($x = uniqid()) + -> ignoring($buf)->readLine($x) -> returns('250 OK' . "\r\n") + -> ignoring($buf)->write("RSET\r\n") -> returns($x = uniqid()) + -> ignoring($buf)->readLine($x) -> returns("250 OK\r\n") + -> ignoring($buf) -> returns(false) + ); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php new file mode 100644 index 0000000..ee0eab9 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/CramMd5AuthenticatorTest.php @@ -0,0 +1,67 @@ +_agent = $this->_mock('Swift_Transport_SmtpAgent'); + } + + public function testKeywordIsCramMd5() + { + /* -- RFC 2195, 2. + The authentication type associated with CRAM is "CRAM-MD5". + */ + + $cram = $this->_getAuthenticator(); + $this->assertEqual('CRAM-MD5', $cram->getAuthKeyword()); + } + + public function testSuccessfulAuthentication() + { + $cram = $this->_getAuthenticator(); + $this->_checking(Expectations::create() + -> one($this->_agent)->executeCommand("AUTH CRAM-MD5\r\n", array(334)) + -> returns('334 ' . base64_encode('') . "\r\n") + // The use of any() is controversial, but here to avoid crazy test logic + -> one($this->_agent)->executeCommand(any(), array(235)) + ); + + $this->assertTrue($cram->authenticate($this->_agent, 'jack', 'pass'), + '%s: The buffer accepted all commands authentication should succeed' + ); + } + + public function testAuthenticationFailureSendRsetAndReturnFalse() + { + $cram = $this->_getAuthenticator(); + $this->_checking(Expectations::create() + -> one($this->_agent)->executeCommand("AUTH CRAM-MD5\r\n", array(334)) + -> returns('334 ' . base64_encode('') . "\r\n") + // The use of any() is controversial, but here to avoid crazy test logic + -> one($this->_agent)->executeCommand(any(), array(235)) + -> throws(new Swift_TransportException("")) + + -> one($this->_agent)->executeCommand("RSET\r\n", array(250)) + ); + + $this->assertFalse($cram->authenticate($this->_agent, 'jack', 'pass'), + '%s: Authentication fails, so RSET should be sent' + ); + } + + // -- Private helpers + + private function _getAuthenticator() + { + return new Swift_Transport_Esmtp_Auth_CramMd5Authenticator(); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php new file mode 100644 index 0000000..7a9f0b4 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/LoginAuthenticatorTest.php @@ -0,0 +1,60 @@ +_agent = $this->_mock('Swift_Transport_SmtpAgent'); + } + + public function testKeywordIsLogin() + { + $login = $this->_getAuthenticator(); + $this->assertEqual('LOGIN', $login->getAuthKeyword()); + } + + public function testSuccessfulAuthentication() + { + $login = $this->_getAuthenticator(); + $this->_checking(Expectations::create() + -> one($this->_agent)->executeCommand("AUTH LOGIN\r\n", array(334)) + -> one($this->_agent)->executeCommand(base64_encode('jack') . "\r\n", array(334)) + -> one($this->_agent)->executeCommand(base64_encode('pass') . "\r\n", array(235)) + ); + + $this->assertTrue($login->authenticate($this->_agent, 'jack', 'pass'), + '%s: The buffer accepted all commands authentication should succeed' + ); + } + + public function testAuthenticationFailureSendRsetAndReturnFalse() + { + $login = $this->_getAuthenticator(); + $this->_checking(Expectations::create() + -> one($this->_agent)->executeCommand("AUTH LOGIN\r\n", array(334)) + -> one($this->_agent)->executeCommand(base64_encode('jack') . "\r\n", array(334)) + -> one($this->_agent)->executeCommand(base64_encode('pass') . "\r\n", array(235)) + -> throws(new Swift_TransportException("")) + -> one($this->_agent)->executeCommand("RSET\r\n", array(250)) + ); + + $this->assertFalse($login->authenticate($this->_agent, 'jack', 'pass'), + '%s: Authentication fails, so RSET should be sent' + ); + } + + // -- Private helpers + + private function _getAuthenticator() + { + return new Swift_Transport_Esmtp_Auth_LoginAuthenticator(); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php new file mode 100644 index 0000000..19c2bc2 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/Auth/PlainAuthenticatorTest.php @@ -0,0 +1,71 @@ +_agent = $this->_mock('Swift_Transport_SmtpAgent'); + } + + public function testKeywordIsPlain() + { + /* -- RFC 4616, 1. + The name associated with this mechanism is "PLAIN". + */ + + $login = $this->_getAuthenticator(); + $this->assertEqual('PLAIN', $login->getAuthKeyword()); + } + + public function testSuccessfulAuthentication() + { + /* -- RFC 4616, 2. + The client presents the authorization identity (identity to act as), + followed by a NUL (U+0000) character, followed by the authentication + identity (identity whose password will be used), followed by a NUL + (U+0000) character, followed by the clear-text password. + */ + + $plain = $this->_getAuthenticator(); + $this->_checking(Expectations::create() + -> one($this->_agent)->executeCommand('AUTH PLAIN ' . base64_encode( + 'jack' . chr(0) . 'jack' . chr(0) . 'pass' + ) . "\r\n", array(235)) + ); + + $this->assertTrue($plain->authenticate($this->_agent, 'jack', 'pass'), + '%s: The buffer accepted all commands authentication should succeed' + ); + } + + public function testAuthenticationFailureSendRsetAndReturnFalse() + { + $plain = $this->_getAuthenticator(); + $this->_checking(Expectations::create() + -> one($this->_agent)->executeCommand('AUTH PLAIN ' . base64_encode( + 'jack' . chr(0) . 'jack' . chr(0) . 'pass' + ) . "\r\n", array(235)) -> throws(new Swift_TransportException("")) + + -> one($this->_agent)->executeCommand("RSET\r\n", array(250)) + ); + + $this->assertFalse($plain->authenticate($this->_agent, 'jack', 'pass'), + '%s: Authentication fails, so RSET should be sent' + ); + } + + // -- Private helpers + + private function _getAuthenticator() + { + return new Swift_Transport_Esmtp_Auth_PlainAuthenticator(); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php new file mode 100644 index 0000000..7dbc040 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/Esmtp/AuthHandlerTest.php @@ -0,0 +1,156 @@ +_agent = $this->_mock('Swift_Transport_SmtpAgent'); + } + + public function testKeywordIsAuth() + { + $auth = $this->_createHandler(array()); + $this->assertEqual('AUTH', $auth->getHandledKeyword()); + } + + public function testUsernameCanBeSetAndFetched() + { + $auth = $this->_createHandler(array()); + $auth->setUsername('jack'); + $this->assertEqual('jack', $auth->getUsername()); + } + + public function testPasswordCanBeSetAndFetched() + { + $auth = $this->_createHandler(array()); + $auth->setPassword('pass'); + $this->assertEqual('pass', $auth->getPassword()); + } + + public function testAuthModeCanBeSetAndFetched() + { + $auth = $this->_createHandler(array()); + $auth->setAuthMode('PLAIN'); + $this->assertEqual('PLAIN', $auth->getAuthMode()); + } + + public function testMixinMethods() + { + $auth = $this->_createHandler(array()); + $mixins = $auth->exposeMixinMethods(); + $this->assertTrue(in_array('getUsername', $mixins), + '%s: getUsername() should be accessible via mixin' + ); + $this->assertTrue(in_array('setUsername', $mixins), + '%s: setUsername() should be accessible via mixin' + ); + $this->assertTrue(in_array('getPassword', $mixins), + '%s: getPassword() should be accessible via mixin' + ); + $this->assertTrue(in_array('setPassword', $mixins), + '%s: setPassword() should be accessible via mixin' + ); + $this->assertTrue(in_array('setAuthMode', $mixins), + '%s: setAuthMode() should be accessible via mixin' + ); + $this->assertTrue(in_array('getAuthMode', $mixins), + '%s: getAuthMode() should be accessible via mixin' + ); + } + + public function testAuthenticatorsAreCalledAccordingToParamsAfterEhlo() + { + $a1 = $this->_createMockAuthenticator('PLAIN'); + $a2 = $this->_createMockAuthenticator('LOGIN'); + + $this->_checking(Expectations::create() + -> never($a1)->authenticate($this->_agent, 'jack', 'pass') + -> one($a2)->authenticate($this->_agent, 'jack', 'pass') -> returns(true) + ); + + $auth = $this->_createHandler(array($a1, $a2)); + $auth->setUsername('jack'); + $auth->setPassword('pass'); + + $auth->setKeywordParams(array('CRAM-MD5', 'LOGIN')); + $auth->afterEhlo($this->_agent); + } + + public function testAuthenticatorsAreNotUsedIfNoUsernameSet() + { + $a1 = $this->_createMockAuthenticator('PLAIN'); + $a2 = $this->_createMockAuthenticator('LOGIN'); + + $this->_checking(Expectations::create() + -> never($a1)->authenticate($this->_agent, 'jack', 'pass') + -> never($a2)->authenticate($this->_agent, 'jack', 'pass') -> returns(true) + ); + + $auth = $this->_createHandler(array($a1, $a2)); + + $auth->setKeywordParams(array('CRAM-MD5', 'LOGIN')); + $auth->afterEhlo($this->_agent); + } + + public function testSeveralAuthenticatorsAreTriedIfNeeded() + { + $a1 = $this->_createMockAuthenticator('PLAIN'); + $a2 = $this->_createMockAuthenticator('LOGIN'); + + $this->_checking(Expectations::create() + -> one($a1)->authenticate($this->_agent, 'jack', 'pass') -> returns(false) + -> one($a2)->authenticate($this->_agent, 'jack', 'pass') -> returns(true) + ); + + $auth = $this->_createHandler(array($a1, $a2)); + $auth->setUsername('jack'); + $auth->setPassword('pass'); + + $auth->setKeywordParams(array('PLAIN', 'LOGIN')); + $auth->afterEhlo($this->_agent); + } + + public function testFirstAuthenticatorToPassBreaksChain() + { + $a1 = $this->_createMockAuthenticator('PLAIN'); + $a2 = $this->_createMockAuthenticator('LOGIN'); + $a3 = $this->_createMockAuthenticator('CRAM-MD5'); + + $this->_checking(Expectations::create() + -> one($a1)->authenticate($this->_agent, 'jack', 'pass') -> returns(false) + -> one($a2)->authenticate($this->_agent, 'jack', 'pass') -> returns(true) + -> never($a3)->authenticate($this->_agent, 'jack', 'pass') + ); + + $auth = $this->_createHandler(array($a1, $a2)); + $auth->setUsername('jack'); + $auth->setPassword('pass'); + + $auth->setKeywordParams(array('PLAIN', 'LOGIN', 'CRAM-MD5')); + $auth->afterEhlo($this->_agent); + } + + // -- Private helpers + + private function _createHandler($authenticators) + { + return new Swift_Transport_Esmtp_AuthHandler($authenticators); + } + + private function _createMockAuthenticator($type) + { + $authenticator = $this->_mock('Swift_Transport_Esmtp_Authenticator'); + $this->_checking(Expectations::create() + -> ignoring($authenticator)->getAuthKeyword() -> returns($type) + ); + return $authenticator; + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php new file mode 100644 index 0000000..d4fb6fd --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransport/ExtensionSupportTest.php @@ -0,0 +1,312 @@ +_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $this->_checking(Expectations::create() + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> allowing($ext1)->getPriorityOver('STARTTLS') -> returns(0) + -> allowing($ext2)->getHandledKeyword() -> returns('STARTTLS') + -> allowing($ext2)->getPriorityOver('AUTH') -> returns(-1) + -> ignoring($ext1) + -> ignoring($ext2) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2)); + $this->assertEqual(array($ext2, $ext1), $smtp->getExtensionHandlers()); + } + + public function testHandlersAreNotifiedOfParams() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $s = $this->_sequence('Initiation-sequence'); + $this->_checking(Expectations::create() + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 server.com foo\r\n") + -> one($buf)->write(pattern('~^EHLO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-ServerName.tld\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-AUTH PLAIN LOGIN\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250 SIZE=123456\r\n") + + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> one($ext1)->setKeywordParams(array('PLAIN', 'LOGIN')) + -> allowing($ext2)->getHandledKeyword() -> returns('SIZE') + -> allowing($ext2)->setKeywordParams(array('123456')) + -> ignoring($ext1) + -> ignoring($ext2) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2)); + $smtp->start(); + } + + public function testSupportedExtensionHandlersAreRunAfterEhlo() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext3 = $this->_mock('Swift_Transport_EsmtpHandler'); + $s = $this->_sequence('Initiation-sequence'); + $this->_checking(Expectations::create() + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 server.com foo\r\n") + -> one($buf)->write(pattern('~^EHLO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-ServerName.tld\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-AUTH PLAIN LOGIN\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250 SIZE=123456\r\n") + + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> one($ext1)->afterEhlo($smtp) + -> allowing($ext2)->getHandledKeyword() -> returns('SIZE') + -> allowing($ext2)->afterEhlo($smtp) + -> allowing($ext3)->getHandledKeyword() -> returns('STARTTLS') + -> never($ext3)->afterEhlo(any()) + -> ignoring($ext1) + -> ignoring($ext2) + -> ignoring($ext3) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3)); + $smtp->start(); + } + + public function testExtensionsCanModifyMailFromParams() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext3 = $this->_mock('Swift_Transport_EsmtpHandler'); + $message = $this->_createMessage(); + $s = $this->_sequence('Initiation-sequence'); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> ignoring($message) + + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 server.com foo\r\n") + -> one($buf)->write(pattern('~^EHLO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-ServerName.tld\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-AUTH PLAIN LOGIN\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250 SIZE=123456\r\n") + -> one($buf)->write("MAIL FROM: FOO ZIP\r\n") -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> inSequence($s) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: \r\n") -> inSequence($s) -> returns(3) + -> one($buf)->readLine(3) -> inSequence($s) -> returns("250 OK\r\n") + + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> one($ext1)->getMailParams() -> returns('FOO') + -> allowing($ext1)->getPriorityOver('AUTH') -> returns(-1) + -> allowing($ext2)->getHandledKeyword() -> returns('SIZE') + -> one($ext2)->getMailParams() -> returns('ZIP') + -> allowing($ext2)->getPriorityOver('AUTH') -> returns(1) + -> allowing($ext3)->getHandledKeyword() -> returns('STARTTLS') + -> never($ext3)->getMailParams() + -> ignoring($ext1) + -> ignoring($ext2) + -> ignoring($ext3) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3)); + $smtp->start(); + $smtp->send($message); + } + + public function testExtensionsCanModifyRcptParams() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext3 = $this->_mock('Swift_Transport_EsmtpHandler'); + $message = $this->_createMessage(); + $s = $this->_sequence('Initiation-sequence'); + $this->_checking(Expectations::create() + -> allowing($message)->getFrom() -> returns(array('me@domain'=>'Me')) + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null)) + -> ignoring($message) + + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 server.com foo\r\n") + -> one($buf)->write(pattern('~^EHLO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-ServerName.tld\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-AUTH PLAIN LOGIN\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250 SIZE=123456\r\n") + -> one($buf)->write("MAIL FROM: \r\n") -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> inSequence($s) -> returns("250 OK\r\n") + -> one($buf)->write("RCPT TO: FOO ZIP\r\n") -> inSequence($s) -> returns(3) + -> one($buf)->readLine(3) -> inSequence($s) -> returns("250 OK\r\n") + + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> one($ext1)->getRcptParams() -> returns('FOO') + -> allowing($ext1)->getPriorityOver('AUTH') -> returns(-1) + -> allowing($ext2)->getHandledKeyword() -> returns('SIZE') + -> one($ext2)->getRcptParams() -> returns('ZIP') + -> allowing($ext2)->getPriorityOver('AUTH') -> returns(1) + -> allowing($ext3)->getHandledKeyword() -> returns('STARTTLS') + -> never($ext3)->getRcptParams() + -> ignoring($ext1) + -> ignoring($ext2) + -> ignoring($ext3) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3)); + $smtp->start(); + $smtp->send($message); + } + + public function testExtensionsAreNotifiedOnCommand() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext3 = $this->_mock('Swift_Transport_EsmtpHandler'); + $s = $this->_sequence('Initiation-sequence'); + $this->_checking(Expectations::create() + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 server.com foo\r\n") + -> one($buf)->write(pattern('~^EHLO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-ServerName.tld\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-AUTH PLAIN LOGIN\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250 SIZE=123456\r\n") + -> one($buf)->write("FOO\r\n") -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> inSequence($s) -> returns("250 Cool\r\n") + + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> one($ext1)->onCommand($smtp, "FOO\r\n", array(250, 251), optional()) + -> allowing($ext2)->getHandledKeyword() -> returns('SIZE') + -> one($ext2)->onCommand($smtp, "FOO\r\n", array(250, 251), optional()) + -> allowing($ext3)->getHandledKeyword() -> returns('STARTTLS') + -> never($ext3)->onCommand(any(), any(), any(), optional()) + -> ignoring($ext1) + -> ignoring($ext2) + -> ignoring($ext3) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3)); + $smtp->start(); + $smtp->executeCommand("FOO\r\n", array(250, 251)); + } + + public function testChainOfCommandAlgorithmWhenNotifyingExtensions() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $ext3 = $this->_mock('Swift_Transport_EsmtpHandler'); + $s = $this->_sequence('Initiation-sequence'); + $this->_checking(Expectations::create() + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 server.com foo\r\n") + -> one($buf)->write(pattern('~^EHLO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-ServerName.tld\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250-AUTH PLAIN LOGIN\r\n") + -> one($buf)->readLine(1) -> inSequence($s) -> returns("250 SIZE=123456\r\n") + -> never($buf)->write("FOO\r\n") + + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> one($ext1)->onCommand($smtp, "FOO\r\n", array(250, 251), optional()) -> calls(array($this, 'cbStopCommand')) + -> allowing($ext2)->getHandledKeyword() -> returns('SIZE') + -> never($ext2)->onCommand(any(), any(), any(), optional()) + -> allowing($ext3)->getHandledKeyword() -> returns('STARTTLS') + -> never($ext3)->onCommand(any(), any(), any(), optional()) + -> ignoring($ext1) + -> ignoring($ext2) + -> ignoring($ext3) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2, $ext3)); + $smtp->start(); + $smtp->executeCommand("FOO\r\n", array(250, 251)); + } + + public function cbStopCommand(Yay_Invocation $invocation) + { + $args =& $invocation->getArguments(); + $stop =& $args[4]; + $stop = true; + return "250 ok"; + } + + public function testExtensionsCanExposeMixinMethods() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandlerMixin'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $this->_checking(Expectations::create() + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> allowing($ext1)->exposeMixinMethods() -> returns(array('setUsername', 'setPassword')) + -> one($ext1)->setUsername('mick') + -> one($ext1)->setPassword('pass') + -> allowing($ext2)->getHandledKeyword() -> returns('STARTTLS') + -> ignoring($ext1) + -> ignoring($ext2) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2)); + $smtp->setUsername('mick'); + $smtp->setPassword('pass'); + } + + public function testMixinMethodsBeginningWithSetAndNullReturnAreFluid() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandlerMixin'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $this->_checking(Expectations::create() + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> allowing($ext1)->exposeMixinMethods() -> returns(array('setUsername', 'setPassword')) + -> one($ext1)->setUsername('mick') -> returns(NULL) + -> one($ext1)->setPassword('pass') -> returns(NULL) + -> allowing($ext2)->getHandledKeyword() -> returns('STARTTLS') + -> ignoring($ext1) + -> ignoring($ext2) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2)); + $ret = $smtp->setUsername('mick'); + $this->assertReference($smtp, $ret); + $ret = $smtp->setPassword('pass'); + $this->assertReference($smtp, $ret); + } + + public function testMixinSetterWhichReturnValuesAreNotFluid() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $ext1 = $this->_mock('Swift_Transport_EsmtpHandlerMixin'); + $ext2 = $this->_mock('Swift_Transport_EsmtpHandler'); + $this->_checking(Expectations::create() + -> allowing($ext1)->getHandledKeyword() -> returns('AUTH') + -> allowing($ext1)->exposeMixinMethods() -> returns(array('setUsername', 'setPassword')) + -> one($ext1)->setUsername('mick') -> returns('x') + -> one($ext1)->setPassword('pass') -> returns('x') + -> allowing($ext2)->getHandledKeyword() -> returns('STARTTLS') + -> ignoring($ext1) + -> ignoring($ext2) + ); + $this->_finishBuffer($buf); + $smtp->setExtensionHandlers(array($ext1, $ext2)); + $this->assertEqual('x', $smtp->setUsername('mick')); + $this->assertEqual('x', $smtp->setPassword('pass')); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php new file mode 100644 index 0000000..6987907 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/EsmtpTransportTest.php @@ -0,0 +1,234 @@ +_createEventDispatcher(); + } + return new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher); + } + + public function testHostCanBeSetAndFetched() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $smtp->setHost('foo'); + $this->assertEqual('foo', $smtp->getHost(), '%s: Host should be returned'); + } + + public function testPortCanBeSetAndFetched() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $smtp->setPort(25); + $this->assertEqual(25, $smtp->getPort(), '%s: Port should be returned'); + } + + public function testTimeoutCanBeSetAndFetched() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $this->_checking(Expectations::create() + -> one($buf)->setParam('timeout', 10)); + $smtp->setTimeout(10); + $this->assertEqual(10, $smtp->getTimeout(), '%s: Timeout should be returned'); + } + + public function testEncryptionCanBeSetAndFetched() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $smtp->setEncryption('tls'); + $this->assertEqual('tls', $smtp->getEncryption(), '%s: Crypto should be returned'); + } + + public function testStartSendsHeloToInitiate() + {//Overridden for EHLO instead + } + + public function testStartSendsEhloToInitiate() + { + /* -- RFC 2821, 3.2. + + 3.2 Client Initiation + + Once the server has sent the welcoming message and the client has + received it, the client normally sends the EHLO command to the + server, indicating the client's identity. In addition to opening the + session, use of EHLO indicates that the client is able to process + service extensions and requests that the server provide a list of the + extensions it supports. Older SMTP systems which are unable to + support service extensions and contemporary clients which do not + require service extensions in the mail session being initiated, MAY + use HELO instead of EHLO. Servers MUST NOT return the extended + EHLO-style response to a HELO command. For a particular connection + attempt, if the server returns a "command not recognized" response to + EHLO, the client SHOULD be able to fall back and send HELO. + + In the EHLO command the host sending the command identifies itself; + the command may be interpreted as saying "Hello, I am " (and, + in the case of EHLO, "and I support service extension requests"). + + -- RFC 2281, 4.1.1.1. + + ehlo = "EHLO" SP Domain CRLF + helo = "HELO" SP Domain CRLF + + -- RFC 2821, 4.3.2. + + EHLO or HELO + S: 250 + E: 504, 550 + + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + -> one($buf)->write(pattern('~^EHLO .+?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns('250 ServerName' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + } catch (Exception $e) { + $this->fail('Starting Esmtp should send EHLO and accept 250 response'); + } + } + + public function testHeloIsUsedAsFallback() + { + /* -- RFC 2821, 4.1.4. + + If the EHLO command is not acceptable to the SMTP server, 501, 500, + or 502 failure replies MUST be returned as appropriate. The SMTP + server MUST stay in the same state after transmitting these replies + that it was in before the EHLO was received. + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + -> one($buf)->write(pattern('~^EHLO .+?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns('501 WTF' . "\r\n") + -> one($buf)->write(pattern('~^HELO .+?\r\n$~D')) -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> inSequence($s) -> returns('250 HELO' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $smtp->start(); + } catch (Exception $e) { + $this->fail( + 'Starting Esmtp should fallback to HELO if needed and accept 250 response' + ); + } + } + + public function testInvalidHeloResponseCausesException() + {//Overridden to first try EHLO + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + -> one($buf)->write(pattern('~^EHLO .*?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns('501 WTF' . "\r\n") + -> one($buf)->write(pattern('~^HELO .*?\r\n$~D')) -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> inSequence($s) -> returns('504 WTF' . "\r\n") + ); + $this->_finishBuffer($buf); + try { + $this->assertFalse($smtp->isStarted(), '%s: SMTP should begin non-started'); + $smtp->start(); + $this->fail('Non 250 HELO response should raise Exception'); + } catch (Exception $e) { + $this->assertFalse($smtp->isStarted(), '%s: SMTP start() should have failed'); + } + } + + public function testDomainNameIsPlacedInEhlo() + { + /* -- RFC 2821, 4.1.4. + + The SMTP client MUST, if possible, ensure that the domain parameter + to the EHLO command is a valid principal host name (not a CNAME or MX + name) for its host. If this is not possible (e.g., when the client's + address is dynamically assigned and the client does not have an + obvious name), an address literal SHOULD be substituted for the + domain name and supplemental information provided that will assist in + identifying the client. + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + -> one($buf)->write("EHLO mydomain.com\r\n") -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns('250 ServerName' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->setLocalDomain('mydomain.com'); + $smtp->start(); + } + + public function testDomainNameIsPlacedInHelo() + { //Overridden to include ESMTP + /* -- RFC 2821, 4.1.4. + + The SMTP client MUST, if possible, ensure that the domain parameter + to the EHLO command is a valid principal host name (not a CNAME or MX + name) for its host. If this is not possible (e.g., when the client's + address is dynamically assigned and the client does not have an + obvious name), an address literal SHOULD be substituted for the + domain name and supplemental information provided that will assist in + identifying the client. + */ + + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $s = $this->_sequence('SMTP-convo'); + $this->_checking(Expectations::create() + -> one($buf)->initialize() -> inSequence($s) + -> one($buf)->readLine(0) -> inSequence($s) -> returns("220 some.server.tld bleh\r\n") + -> one($buf)->write(pattern('~^EHLO .+?\r\n$~D')) -> inSequence($s) -> returns(1) + -> one($buf)->readLine(1) -> inSequence($s) -> returns('501 WTF' . "\r\n") + -> one($buf)->write("HELO mydomain.com\r\n") -> inSequence($s) -> returns(2) + -> one($buf)->readLine(2) -> inSequence($s) -> returns('250 ServerName' . "\r\n") + ); + $this->_finishBuffer($buf); + $smtp->setLocalDomain('mydomain.com'); + $smtp->start(); + } + + public function testFluidInterface() + { + $buf = $this->_getBuffer(); + $smtp = $this->_getTransport($buf); + $this->_checking(Expectations::create() + -> one($buf)->setParam('timeout', 30)); + + $ref = $smtp + ->setHost('foo') + ->setPort(25) + ->setEncryption('tls') + ->setTimeout(30) + ; + $this->assertReference($ref, $smtp); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php new file mode 100644 index 0000000..bd4ddf1 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/FailoverTransportTest.php @@ -0,0 +1,334 @@ +mock('Swift_Mime_Message'); + $message2 = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message1) + -> ignoring($message2) + -> allowing($t1)->isStarted() -> returns(false) -> when($con->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con->is('on')) + -> one($t1)->start() -> when($con->isNot('on')) -> then($con->is('on')) + -> one($t1)->send($message1, optional()) -> returns(1) -> when($con->is('on')) + -> one($t1)->send($message2, optional()) -> returns(1) -> when($con->is('on')) + -> ignoring($t1) + -> never($t2)->start() + -> never($t2)->send(any(), optional()) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertEqual(1, $transport->send($message1)); + $this->assertEqual(1, $transport->send($message2)); + $context->assertIsSatisfied(); + } + + public function testMessageCanBeTriedOnNextTransportIfExceptionThrown() + { + $e = new Swift_TransportException('b0rken'); + + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message, optional()) -> throws($e) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message, optional()) -> returns(1) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertEqual(1, $transport->send($message)); + $context->assertIsSatisfied(); + } + + public function testZeroIsReturnedIfTransportReturnsZero() + { + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $con = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con->is('on')) + -> one($t1)->start() -> when($con->isNot('on')) -> then($con->is('on')) + -> one($t1)->send($message, optional()) -> returns(0) -> when($con->is('on')) + -> ignoring($t1) + ); + + $transport = $this->_getTransport(array($t1)); + $transport->start(); + $this->assertEqual(0, $transport->send($message)); + $context->assertIsSatisfied(); + } + + public function testTransportsWhichThrowExceptionsAreNotRetried() + { + $e = new Swift_TransportException('maur b0rken'); + + $context = new Mockery(); + $message1 = $context->mock('Swift_Mime_Message'); + $message2 = $context->mock('Swift_Mime_Message'); + $message3 = $context->mock('Swift_Mime_Message'); + $message4 = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message1) + -> ignoring($message2) + -> ignoring($message3) + -> ignoring($message4) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message1, optional()) -> throws($e) -> when($con1->is('on')) + -> never($t1)->send($message2, optional()) + -> never($t1)->send($message3, optional()) + -> never($t1)->send($message4, optional()) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message1, optional()) -> returns(1) -> when($con2->is('on')) + -> one($t2)->send($message2, optional()) -> returns(1) -> when($con2->is('on')) + -> one($t2)->send($message3, optional()) -> returns(1) -> when($con2->is('on')) + -> one($t2)->send($message4, optional()) -> returns(1) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertEqual(1, $transport->send($message1)); + $this->assertEqual(1, $transport->send($message2)); + $this->assertEqual(1, $transport->send($message3)); + $this->assertEqual(1, $transport->send($message4)); + } + + public function testExceptionIsThrownIfAllTransportsDie() + { + $e = new Swift_TransportException('b0rken'); + + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message, optional()) -> throws($e) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message, optional()) -> throws($e) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + try { + $transport->send($message); + $this->fail('All transports failed so Exception should be thrown'); + } catch (Exception $e) { + } + $context->assertIsSatisfied(); + } + + public function testStoppingTransportStopsAllDelegates() + { + $context = new Mockery(); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('on'); + $con2 = $context->states('Connection')->startsAs('on'); + $context->checking(Expectations::create() + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->stop() -> when($con1->is('on')) -> then($con1->is('off')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->stop() -> when($con2->is('on')) -> then($con2->is('off')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $transport->stop(); + $context->assertIsSatisfied(); + } + + public function testTransportShowsAsNotStartedIfAllDelegatesDead() + { + $e = new Swift_TransportException('b0rken'); + + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message, optional()) -> throws($e) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message, optional()) -> throws($e) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertTrue($transport->isStarted()); + try { + $transport->send($message); + $this->fail('All transports failed so Exception should be thrown'); + } catch (Exception $e) { + $this->assertFalse($transport->isStarted()); + } + $context->assertIsSatisfied(); + } + + public function testRestartingTransportRestartsDeadDelegates() + { + $e = new Swift_TransportException('b0rken'); + + $context = new Mockery(); + $message1 = $context->mock('Swift_Mime_Message'); + $message2 = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message1) + -> ignoring($message2) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> exactly(2)->of($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message1, optional()) -> throws($e) -> when($con1->is('on')) -> then($con1->is('off')) + -> one($t1)->send($message2, optional()) -> returns(10) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message1, optional()) -> throws($e) -> when($con2->is('on')) + -> never($t2)->send($message2, optional()) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertTrue($transport->isStarted()); + try { + $transport->send($message1); + $this->fail('All transports failed so Exception should be thrown'); + } catch (Exception $e) { + $this->assertFalse($transport->isStarted()); + } + //Restart and re-try + $transport->start(); + $this->assertTrue($transport->isStarted()); + $this->assertEqual(10, $transport->send($message2)); + $context->assertIsSatisfied(); + } + + public function testFailureReferenceIsPassedToDelegates() + { + $failures = array(); + + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $con = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con->is('on')) + -> one($t1)->start() -> when($con->isNot('on')) -> then($con->is('on')) + -> one($t1)->send($message, reference($failures)) -> returns(1) -> when($con->is('on')) + -> ignoring($t1) + ); + + $transport = $this->_getTransport(array($t1)); + $transport->start(); + $transport->send($message, $failures); + $context->assertIsSatisfied(); + } + + public function testRegisterPluginDelegatesToLoadedTransports() + { + $context = new Mockery(); + + $plugin = $this->_createPlugin($context); + + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $context->checking(Expectations::create() + -> one($t1)->registerPlugin($plugin) + -> one($t2)->registerPlugin($plugin) + -> ignoring($t1) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->registerPlugin($plugin); + + $context->assertIsSatisfied(); + } + + // -- Private helpers + + private function _getTransport(array $transports) + { + $transport = new Swift_Transport_FailoverTransport(); + $transport->setTransports($transports); + return $transport; + } + + private function _createPlugin($context) + { + return $context->mock('Swift_Events_EventListener'); + } + + private function _createInnerTransport() + { + return $this->_mockery()->mock('Swift_Transport'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php new file mode 100644 index 0000000..d0cffff --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/LoadBalancedTransportTest.php @@ -0,0 +1,418 @@ +mock('Swift_Mime_Message'); + $message2 = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection 1')->startsAs('off'); + $con2 = $context->states('Connection 2')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message1) + -> ignoring($message2) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> allowing($t1)->start() -> when($con1->is('off')) -> then($con1->is('on')) + -> one($t1)->send($message1, optional()) -> returns(1) -> when($con1->is('on')) + -> never($t1)->send($message2, optional()) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> allowing($t2)->start() -> when($con2->is('off')) -> then($con2->is('on')) + -> one($t2)->send($message2, optional()) -> returns(1) -> when($con2->is('on')) + -> never($t2)->send($message1, optional()) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertEqual(1, $transport->send($message1)); + $this->assertEqual(1, $transport->send($message2)); + + $context->assertIsSatisfied(); + } + + public function testTransportsAreReusedInRotatingFashion() + { + $context = new Mockery(); + $message1 = $context->mock('Swift_Mime_Message'); + $message2 = $context->mock('Swift_Mime_Message'); + $message3 = $context->mock('Swift_Mime_Message'); + $message4 = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection 1')->startsAs('off'); + $con2 = $context->states('Connection 2')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message1) + -> ignoring($message2) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> allowing($t1)->start() -> when($con1->is('off')) -> then($con1->is('on')) + -> one($t1)->send($message1, optional()) -> returns(1) -> when($con1->is('on')) + -> never($t1)->send($message2, optional()) + -> one($t1)->send($message3, optional()) -> returns(1) -> when($con1->is('on')) + -> never($t1)->send($message4, optional()) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> allowing($t2)->start() -> when($con2->is('off')) -> then($con2->is('on')) + -> one($t2)->send($message2, optional()) -> returns(1) -> when($con2->is('on')) + -> never($t2)->send($message1, optional()) + -> one($t2)->send($message4, optional()) -> returns(1) -> when($con2->is('on')) + -> never($t2)->send($message3, optional()) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + + $this->assertEqual(1, $transport->send($message1)); + $this->assertEqual(1, $transport->send($message2)); + $this->assertEqual(1, $transport->send($message3)); + $this->assertEqual(1, $transport->send($message4)); + + $context->assertIsSatisfied(); + } + + public function testMessageCanBeTriedOnNextTransportIfExceptionThrown() + { + $e = new Swift_TransportException('b0rken'); + + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message, optional()) -> throws($e) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message, optional()) -> returns(1) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertEqual(1, $transport->send($message)); + $context->assertIsSatisfied(); + } + + public function testMessageIsTriedOnNextTransportIfZeroReturned() + { + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message, optional()) -> returns(0) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message, optional()) -> returns(1) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertEqual(1, $transport->send($message)); + $context->assertIsSatisfied(); + } + + public function testZeroIsReturnedIfAllTransportsReturnZero() + { + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message, optional()) -> returns(0) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message, optional()) -> returns(0) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertEqual(0, $transport->send($message)); + $context->assertIsSatisfied(); + } + + public function testTransportsWhichThrowExceptionsAreNotRetried() + { + $e = new Swift_TransportException('maur b0rken'); + + $context = new Mockery(); + $message1 = $context->mock('Swift_Mime_Message'); + $message2 = $context->mock('Swift_Mime_Message'); + $message3 = $context->mock('Swift_Mime_Message'); + $message4 = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message1) + -> ignoring($message2) + -> ignoring($message3) + -> ignoring($message4) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message1, optional()) -> throws($e) -> when($con1->is('on')) + -> never($t1)->send($message2, optional()) + -> never($t1)->send($message3, optional()) + -> never($t1)->send($message4, optional()) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message1, optional()) -> returns(1) -> when($con2->is('on')) + -> one($t2)->send($message2, optional()) -> returns(1) -> when($con2->is('on')) + -> one($t2)->send($message3, optional()) -> returns(1) -> when($con2->is('on')) + -> one($t2)->send($message4, optional()) -> returns(1) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertEqual(1, $transport->send($message1)); + $this->assertEqual(1, $transport->send($message2)); + $this->assertEqual(1, $transport->send($message3)); + $this->assertEqual(1, $transport->send($message4)); + } + + public function testExceptionIsThrownIfAllTransportsDie() + { + $e = new Swift_TransportException('b0rken'); + + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message, optional()) -> throws($e) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message, optional()) -> throws($e) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + try { + $transport->send($message); + $this->fail('All transports failed so Exception should be thrown'); + } catch (Exception $e) { + } + $context->assertIsSatisfied(); + } + + public function testStoppingTransportStopsAllDelegates() + { + $context = new Mockery(); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('on'); + $con2 = $context->states('Connection')->startsAs('on'); + $context->checking(Expectations::create() + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->stop() -> when($con1->is('on')) -> then($con1->is('off')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->stop() -> when($con2->is('on')) -> then($con2->is('off')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $transport->stop(); + $context->assertIsSatisfied(); + } + + public function testTransportShowsAsNotStartedIfAllDelegatesDead() + { + $e = new Swift_TransportException('b0rken'); + + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> one($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message, optional()) -> throws($e) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message, optional()) -> throws($e) -> when($con2->is('on')) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertTrue($transport->isStarted()); + try { + $transport->send($message); + $this->fail('All transports failed so Exception should be thrown'); + } catch (Exception $e) { + $this->assertFalse($transport->isStarted()); + } + $context->assertIsSatisfied(); + } + + public function testRestartingTransportRestartsDeadDelegates() + { + $e = new Swift_TransportException('b0rken'); + + $context = new Mockery(); + $message1 = $context->mock('Swift_Mime_Message'); + $message2 = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $con1 = $context->states('Connection')->startsAs('off'); + $con2 = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message1) + -> ignoring($message2) + -> allowing($t1)->isStarted() -> returns(false) -> when($con1->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con1->is('on')) + -> exactly(2)->of($t1)->start() -> when($con1->isNot('on')) -> then($con1->is('on')) + -> one($t1)->send($message1, optional()) -> throws($e) -> when($con1->is('on')) -> then($con1->is('off')) + -> one($t1)->send($message2, optional()) -> returns(10) -> when($con1->is('on')) + -> ignoring($t1) + -> allowing($t2)->isStarted() -> returns(false) -> when($con2->is('off')) + -> allowing($t2)->isStarted() -> returns(true) -> when($con2->is('on')) + -> one($t2)->start() -> when($con2->isNot('on')) -> then($con2->is('on')) + -> one($t2)->send($message1, optional()) -> throws($e) -> when($con2->is('on')) + -> never($t2)->send($message2, optional()) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->start(); + $this->assertTrue($transport->isStarted()); + try { + $transport->send($message1); + $this->fail('All transports failed so Exception should be thrown'); + } catch (Exception $e) { + $this->assertFalse($transport->isStarted()); + } + //Restart and re-try + $transport->start(); + $this->assertTrue($transport->isStarted()); + $this->assertEqual(10, $transport->send($message2)); + $context->assertIsSatisfied(); + } + + public function testFailureReferenceIsPassedToDelegates() + { + $failures = array(); + + $context = new Mockery(); + $message = $context->mock('Swift_Mime_Message'); + $t1 = $context->mock('Swift_Transport'); + $con = $context->states('Connection')->startsAs('off'); + $context->checking(Expectations::create() + -> ignoring($message) + -> allowing($t1)->isStarted() -> returns(false) -> when($con->is('off')) + -> allowing($t1)->isStarted() -> returns(true) -> when($con->is('on')) + -> one($t1)->start() -> when($con->isNot('on')) -> then($con->is('on')) + -> one($t1)->send($message, reference($failures)) -> returns(1) -> when($con->is('on')) + -> ignoring($t1) + ); + + $transport = $this->_getTransport(array($t1)); + $transport->start(); + $transport->send($message, $failures); + $context->assertIsSatisfied(); + } + + public function testRegisterPluginDelegatesToLoadedTransports() + { + $context = new Mockery(); + + $plugin = $this->_createPlugin($context); + + $t1 = $context->mock('Swift_Transport'); + $t2 = $context->mock('Swift_Transport'); + $context->checking(Expectations::create() + -> one($t1)->registerPlugin($plugin) + -> one($t2)->registerPlugin($plugin) + -> ignoring($t1) + -> ignoring($t2) + ); + + $transport = $this->_getTransport(array($t1, $t2)); + $transport->registerPlugin($plugin); + + $context->assertIsSatisfied(); + } + + // -- Private helpers + + private function _getTransport(array $transports) + { + $transport = new Swift_Transport_LoadBalancedTransport(); + $transport->setTransports($transports); + return $transport; + } + + private function _createPlugin($context) + { + return $context->mock('Swift_Events_EventListener'); + } + + private function _createInnerTransport() + { + return $this->_mockery()->mock('Swift_Transport'); + } + +} \ No newline at end of file diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php new file mode 100644 index 0000000..90833cf --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/MailTransportTest.php @@ -0,0 +1,315 @@ +_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> one($invoker)->mail(any(), any(), any(), any(), optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + ); + + $transport->send($message); + } + + public function testTransportUsesToFieldBodyInSending() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $to = $this->_createHeader(); + $headers = $this->_createHeaders(array( + 'To' => $to + )); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> allowing($to)->getFieldBody() -> returns("Foo ") + -> one($invoker)->mail("Foo ", any(), any(), any(), optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + -> ignoring($to) + ); + + $transport->send($message); + } + + public function testTransportUsesSubjectFieldBodyInSending() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $subj = $this->_createHeader(); + $headers = $this->_createHeaders(array( + 'Subject' => $subj + )); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> allowing($subj)->getFieldBody() -> returns("Thing") + -> one($invoker)->mail(any(), "Thing", any(), any(), optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + -> ignoring($subj) + ); + + $transport->send($message); + } + + public function testTransportUsesBodyOfMessage() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> allowing($message)->toString() -> returns( + "To: Foo \r\n" . + "\r\n" . + "This body" + ) + -> one($invoker)->mail(any(), any(), "This body", any(), optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + ); + + $transport->send($message); + } + + public function testTransportUsesHeadersFromMessage() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> allowing($message)->toString() -> returns( + "Subject: Stuff\r\n" . + "\r\n" . + "This body" + ) + -> one($invoker)->mail(any(), any(), any(), "Subject: Stuff" . PHP_EOL, optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + ); + + $transport->send($message); + } + + public function testTransportReturnsCountOfAllRecipientsIfInvokerReturnsTrue() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null, 'zip@button'=>null)) + -> allowing($message)->getCc() -> returns(array('test@test'=>null)) + -> one($invoker)->mail(any(), any(), any(), any(), optional()) -> returns(true) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + ); + + $this->assertEqual(3, $transport->send($message)); + } + + public function testTransportReturnsZeroIfInvokerReturnsFalse() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $headers = $this->_createHeaders(); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array('foo@bar'=>null, 'zip@button'=>null)) + -> allowing($message)->getCc() -> returns(array('test@test'=>null)) + -> one($invoker)->mail(any(), any(), any(), any(), optional()) -> returns(false) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + ); + + $this->assertEqual(0, $transport->send($message)); + } + + public function testToHeaderIsRemovedFromHeaderSetDuringSending() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $to = $this->_createHeader(); + $headers = $this->_createHeaders(array( + 'To' => $to + )); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> one($headers)->remove('To') + -> one($invoker)->mail(any(), any(), any(), any(), optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + -> ignoring($to) + ); + + $transport->send($message); + } + + public function testSubjectHeaderIsRemovedFromHeaderSetDuringSending() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $subject = $this->_createHeader(); + $headers = $this->_createHeaders(array( + 'Subject' => $subject + )); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> one($headers)->remove('Subject') + -> one($invoker)->mail(any(), any(), any(), any(), optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + -> ignoring($subject) + ); + + $transport->send($message); + } + + public function testToHeaderIsPutBackAfterSending() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $to = $this->_createHeader(); + $headers = $this->_createHeaders(array( + 'To' => $to + )); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> one($headers)->set($to, optional()) + -> one($invoker)->mail(any(), any(), any(), any(), optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + -> ignoring($to) + ); + + $transport->send($message); + } + + public function testSubjectHeaderIsPutBackAfterSending() + { + $invoker = $this->_createInvoker(); + $dispatcher = $this->_createEventDispatcher(); + $transport = $this->_createTransport($invoker, $dispatcher); + + $subject = $this->_createHeader(); + $headers = $this->_createHeaders(array( + 'Subject' => $subject + )); + $message = $this->_createMessage($headers); + + $this->_checking(Expectations::create() + -> one($headers)->set($subject, optional()) + -> one($invoker)->mail(any(), any(), any(), any(), optional()) + -> ignoring($dispatcher) + -> ignoring($headers) + -> ignoring($message) + -> ignoring($subject) + ); + + $transport->send($message); + } + + // -- Creation Methods + + private function _createTransport($invoker, $dispatcher) + { + return new Swift_Transport_MailTransport($invoker, $dispatcher); + } + + private function _createEventDispatcher() + { + return $this->_mock('Swift_Events_EventDispatcher'); + } + + private function _createInvoker() + { + return $this->_mock('Swift_Transport_MailInvoker'); + } + + private function _createMessage($headers) + { + $message = $this->_mock('Swift_Mime_Message'); + + $this->_checking(Expectations::create() + -> allowing($message)->getHeaders() -> returns($headers) + ); + + return $message; + } + + private function _createHeaders($headers = array()) + { + $set = $this->_mock('Swift_Mime_HeaderSet'); + + if (count($headers) > 0) { + foreach ($headers as $name => $header) { + $this->_checking(Expectations::create() + -> allowing($set)->get($name) -> returns($header) + -> allowing($set)->has($name) -> returns(true) + ); + } + } + + $header = $this->_createHeader(); + $this->_checking(Expectations::create() + -> allowing($set)->get(any()) -> returns($header) + -> allowing($set)->has(any()) -> returns(true) + -> ignoring($header) + ); + + return $set; + } + + private function _createHeader() + { + return $this->_mock('Swift_Mime_Header'); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php new file mode 100644 index 0000000..a58a354 --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/SendmailTransportTest.php @@ -0,0 +1,133 @@ +_createEventDispatcher(); + } + $transport = new Swift_Transport_SendmailTransport($buf, $dispatcher); + $transport->setCommand($command); + return $transport; + } + + protected function _getSendmail($buf, $dispatcher = null) + { + if (!$dispatcher) { + $dispatcher = $this->_createEventDispatcher(); + } + $sendmail = new Swift_Transport_SendmailTransport($buf, $dispatcher); + return $sendmail; + } + + public function testCommandCanBeSetAndFetched() + { + $buf = $this->_getBuffer(); + $sendmail = $this->_getSendmail($buf); + + $sendmail->setCommand('/usr/sbin/sendmail -bs'); + $this->assertEqual('/usr/sbin/sendmail -bs', $sendmail->getCommand()); + $sendmail->setCommand('/usr/sbin/sendmail -oi -t'); + $this->assertEqual('/usr/sbin/sendmail -oi -t', $sendmail->getCommand()); + } + + public function testSendingMessageIn_t_ModeUsesSimplePipe() + { + $buf = $this->_getBuffer(); + $sendmail = $this->_getSendmail($buf); + $message = $this->_createMessage(); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array('foo@bar'=>'Foobar', 'zip@button'=>'Zippy')) + -> one($message)->toByteStream($buf) + -> ignoring($message) + -> one($buf)->initialize() + -> one($buf)->terminate() + -> one($buf)->setWriteTranslations(array("\r\n"=>"\n", "\n." => "\n..")) + -> one($buf)->setWriteTranslations(array()) + -> ignoring($buf) + ); + + $sendmail->setCommand('/usr/sbin/sendmail -t'); + $this->assertEqual(2, $sendmail->send($message)); + } + + public function testSendingIn_t_ModeWith_i_FlagDoesntEscapeDot() + { + $buf = $this->_getBuffer(); + $sendmail = $this->_getSendmail($buf); + $message = $this->_createMessage(); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array('foo@bar'=>'Foobar', 'zip@button'=>'Zippy')) + -> one($message)->toByteStream($buf) + -> ignoring($message) + -> one($buf)->initialize() + -> one($buf)->terminate() + -> one($buf)->setWriteTranslations(array("\r\n"=>"\n")) + -> one($buf)->setWriteTranslations(array()) + -> ignoring($buf) + ); + + $sendmail->setCommand('/usr/sbin/sendmail -i -t'); + $this->assertEqual(2, $sendmail->send($message)); + } + + public function testSendingInTModeWith_oi_FlagDoesntEscapeDot() + { + $buf = $this->_getBuffer(); + $sendmail = $this->_getSendmail($buf); + $message = $this->_createMessage(); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array('foo@bar'=>'Foobar', 'zip@button'=>'Zippy')) + -> one($message)->toByteStream($buf) + -> ignoring($message) + -> one($buf)->initialize() + -> one($buf)->terminate() + -> one($buf)->setWriteTranslations(array("\r\n"=>"\n")) + -> one($buf)->setWriteTranslations(array()) + -> ignoring($buf) + ); + + $sendmail->setCommand('/usr/sbin/sendmail -oi -t'); + $this->assertEqual(2, $sendmail->send($message)); + } + + public function testSendingMessageRegeneratesId() + { + $buf = $this->_getBuffer(); + $sendmail = $this->_getSendmail($buf); + $message = $this->_createMessage(); + + $this->_checking(Expectations::create() + -> allowing($message)->getTo() -> returns(array('foo@bar'=>'Foobar', 'zip@button'=>'Zippy')) + -> one($message)->generateId() + -> ignoring($message) + -> one($buf)->initialize() + -> one($buf)->terminate() + -> one($buf)->setWriteTranslations(array("\r\n"=>"\n", "\n." => "\n..")) + -> one($buf)->setWriteTranslations(array()) + -> ignoring($buf) + ); + + $sendmail->setCommand('/usr/sbin/sendmail -t'); + $this->assertEqual(2, $sendmail->send($message)); + } + + public function testFluidInterface() + { + $buf = $this->_getBuffer(); + $sendmail = $this->_getTransport($buf); + + $ref = $sendmail->setCommand('/foo'); + $this->assertReference($ref, $sendmail); + } +} diff --git a/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php new file mode 100644 index 0000000..8b225af --- /dev/null +++ b/vendor/swiftmailer/swiftmailer/tests/unit/Swift/Transport/StreamBufferTest.php @@ -0,0 +1,50 @@ +_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createFilter('a', 'b') -> returns($this->_createFilter()) + -> never($factory) + ); + $buffer = $this->_createBuffer($factory); + $buffer->setWriteTranslations(array('a' => 'b')); + } + + public function testOverridingTranslationsOnlyAddsNeededFilters() + { + $factory = $this->_createFactory(); + $this->_checking(Expectations::create() + -> one($factory)->createFilter('a', 'b') -> returns($this->_createFilter()) + -> one($factory)->createFilter('x', 'y') -> returns($this->_createFilter()) + -> never($factory) + ); + $buffer = $this->_createBuffer($factory); + $buffer->setWriteTranslations(array('a' => 'b')); + $buffer->setWriteTranslations(array('x' => 'y', 'a' => 'b')); + } + + // -- Creation methods + + private function _createBuffer($replacementFactory) + { + return new Swift_Transport_StreamBuffer($replacementFactory); + } + + private function _createFactory() + { + return $this->_mock('Swift_ReplacementFilterFactory'); + } + + private function _createFilter() + { + return $this->_stub('Swift_StreamFilter'); + } +} diff --git a/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/.gitignore b/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/.gitignore new file mode 100644 index 0000000..57be4e3 --- /dev/null +++ b/vendor/symfony/assetic-bundle/Symfony/Bundle/AsseticBundle/.gitignore @@ -0,0 +1 @@ +phpunit.xml \ No newline at end of file diff --git a/vendor/symfony/monolog-bundle/Symfony/Bundle/MonologBundle/.gitignore b/vendor/symfony/monolog-bundle/Symfony/Bundle/MonologBundle/.gitignore new file mode 100644 index 0000000..1d034f4 --- /dev/null +++ b/vendor/symfony/monolog-bundle/Symfony/Bundle/MonologBundle/.gitignore @@ -0,0 +1,4 @@ +vendor +composer.phar +composer.lock +phpunit.xml diff --git a/vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/.gitignore b/vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/.gitignore new file mode 100644 index 0000000..d95451e --- /dev/null +++ b/vendor/symfony/swiftmailer-bundle/Symfony/Bundle/SwiftmailerBundle/.gitignore @@ -0,0 +1,3 @@ +/vendor/ +/composer.lock + diff --git a/vendor/symfony/symfony/.gitignore b/vendor/symfony/symfony/.gitignore new file mode 100644 index 0000000..fc673fa --- /dev/null +++ b/vendor/symfony/symfony/.gitignore @@ -0,0 +1,5 @@ +phpunit.xml +composer.lock +composer.phar +autoload.php +/vendor/ diff --git a/vendor/symfony/symfony/README.md b/vendor/symfony/symfony/README.md new file mode 100644 index 0000000..fcac8d1 --- /dev/null +++ b/vendor/symfony/symfony/README.md @@ -0,0 +1,57 @@ +README +====== + +[![Build Status](https://secure.travis-ci.org/symfony/symfony.png?branch=master)](http://travis-ci.org/symfony/symfony) + +What is Symfony2? +----------------- + +Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and +flexibility in mind. It allows developers to build better and easy to maintain +websites with PHP. + +Symfony can be used to develop all kind of websites, from your personal blog +to high traffic ones like Dailymotion or Yahoo! Answers. + +Requirements +------------ + +Symfony2 is only supported on PHP 5.3.3 and up. + +Be warned that PHP versions before 5.3.8 are known to be buggy and might not +work for you: + + * before PHP 5.3.4, if you get "Notice: Trying to get property of + non-object", you've hit a known PHP bug (see + https://bugs.php.net/bug.php?id=52083 and + https://bugs.php.net/bug.php?id=50027); + + * before PHP 5.3.8, if you get an error involving annotations, you've hit a + known PHP bug (see https://bugs.php.net/bug.php?id=55156). + +Installation +------------ + +The best way to install Symfony2 is to download the Symfony Standard Edition +available at [http://symfony.com/download][1]. + +Documentation +------------- + +The "[Quick Tour][2]" tutorial gives you a first feeling of the framework. If, +like us, you think that Symfony2 can help speed up your development and take +the quality of your work to the next level, read the official +[Symfony2 documentation][3]. + +Contributing +------------ + +Symfony2 is an open source, community-driven project. If you'd like to contribute, +please read the [Contributing Code][4] part of the documentation. If you're submitting +a pull request, please follow the guidelines in the [Submitting a Patch][5] section. + +[1]: http://symfony.com/download +[2]: http://symfony.com/get_started +[3]: http://symfony.com/doc/current/ +[4]: http://symfony.com/doc/current/contributing/code/index.html +[5]: http://symfony.com/doc/current/contributing/code/patches.html#check-list diff --git a/vendor/symfony/symfony/UPGRADE-2.1.md b/vendor/symfony/symfony/UPGRADE-2.1.md index 76f7102..b949f53 100644 --- a/vendor/symfony/symfony/UPGRADE-2.1.md +++ b/vendor/symfony/symfony/UPGRADE-2.1.md @@ -13,6 +13,15 @@ configuration (i.e. `config.yml`), merging could yield a set of base URL's for multiple environments. + * The priorities for the built-in listeners have changed: + + 2.0 2.1 + security.firewall request 64 8 + locale listener early_request 253 255 + request -1 16 + router listener early_request 255 128 + request 10 32 + ### Doctrine * The DoctrineBundle is moved from the Symfony repository to the Doctrine repository. @@ -67,7 +76,7 @@ ### HttpFoundation - * [BC BREAK] The current locale for the user is not stored anymore in the session + * The current locale for the user is not stored anymore in the session You can simulate the old behavior by registering a listener that looks like the following, if the paramater which handle locale value in the request is `_locale`: @@ -134,7 +143,7 @@ public function equals(UserInterface $user) { /* ... */ } // ... } -``` + ``` After: @@ -146,6 +155,7 @@ // ... } ``` + * The custom factories for the firewall configuration are now registered during the build method of bundles instead of being registered by the end-user. This means that you will you need to remove the 'factories' @@ -190,7 +200,7 @@ implementations of this interface to reflect this change. * The `UserPassword` constraint has moved from the Security Bundle to the Security Component: - + Before: ``` @@ -239,6 +249,16 @@ public function finishView(FormViewInterface $view, FormInterface $form, array $options) ``` + * The method `createBuilder` was removed from `FormTypeInterface` for performance + reasons. It is now not possible anymore to use custom implementations of + `FormBuilderInterface` for specific form types. + + If you are in such a situation, you can subclass `FormRegistry` instead and override + `resolveType` to return a custom `ResolvedFormTypeInterface` implementation, within + which you can create your own `FormBuilderInterface` implementation. You should + register this custom registry class under the service name "form.registry" in order + to replace the default implementation. + * If you previously inherited from `FieldType`, you should now inherit from `FormType`. You should also set the option `compound` to `false` if your field is not supposed to contain child fields. @@ -556,6 +576,30 @@ {% endblock %} ```` + * Custom styling of individual rows of a collection form has been removed for + performance reasons. Instead, all rows now have the same block name, where + the word "entry" replaces the previous occurence of the row index. + + Before: + + ``` + {% block _author_tags_0_label %} + {# ... #} + {% endblock %} + + {% block _author_tags_1_label %} + {# ... #} + {% endblock %} + ``` + + After: + + ``` + {% block _author_tags_entry_label %} + {# ... #} + {% endblock %} + ``` + #### Other BC Breaks * The order of the first two arguments of the methods `createNamed` and @@ -635,6 +679,20 @@ `getChoices()` and `getChoicesByValues()`. For the latter two, no replacement exists. + * HTML attributes are now passed in the `label_attr` variable for the `form_label` function. + + Before: + + ``` + {{ form_label(form.name, 'Your Name', { 'attr': {'class': 'foo'} }) }} + ``` + + After: + + ``` + {{ form_label(form.name, 'Your Name', { 'label_attr': {'class': 'foo'} }) }} + ``` + * `EntitiesToArrayTransformer` and `EntityToIdTransformer` were removed. The former was replaced by `CollectionToArrayTransformer` in combination with `EntityChoiceList`, the latter is not required in the core anymore. @@ -860,6 +918,7 @@ * `getClientData` * `getChildren` * `hasChildren` + * `bindRequest` Before: @@ -891,6 +950,20 @@ if (count($form) > 0) { ``` + Instead of `bindRequest`, you should now simply call `bind`: + + Before: + + ``` + $form->bindRequest($request); + ``` + + After: + + ``` + $form->bind($request); + ``` + * The option "validation_constraint" was deprecated and will be removed in Symfony 2.3. You should use the option "constraints" instead, where you can pass one or more constraints for a form. @@ -922,6 +995,64 @@ )); ``` + Be aware that constraints will now only be validated if they belong + to the validated group! So if you validate a form in group "Custom" + and previously did: + + ``` + $builder->add('name', 'text', array( + 'validation_constraint' => new NotBlank(), + )); + ``` + + Then you need to add the constraint to the group "Custom" now: + + ``` + $builder->add('name', 'text', array( + 'constraints' => new NotBlank(array('groups' => 'Custom')), + )); + ``` + + * The options "data_timezone" and "user_timezone" in `DateType`, + `DateTimeType` and `TimeType` were deprecated and will be removed in + Symfony 2.3. They were renamed to "model_timezone" and "view_timezone". + + Before: + + ``` + $builder->add('scheduledFor', 'date', array( + 'data_timezone' => 'UTC', + 'user_timezone' => 'America/New_York', + )); + ``` + + After: + + ``` + $builder->add('scheduledFor', 'date', array( + 'model_timezone' => 'UTC', + 'view_timezone' => 'America/New_York', + )); + ``` + + * The methods `addType`, `hasType` and `getType` in `FormFactory` are deprecated + and will be removed in Symfony 2.3. You should use the methods with the same + name on the `FormRegistry` instead. + + Before: + + ``` + $this->get('form.factory')->addType(new MyFormType()); + ``` + + After: + + ``` + $registry = $this->get('form.registry'); + + $registry->addType($registry->resolveType(new MyFormType())); + ``` + ### Validator * The methods `setMessage()`, `getMessageTemplate()` and @@ -1057,6 +1188,54 @@ private $recursiveCollection; ``` + * The `Size`, `Min` and `Max` constraints were deprecated and will be removed in + Symfony 2.3. You should use the new constraint `Range` instead. + + Before: + + ``` + /** @Assert\Size(min = 2, max = 16) */ + private $numberOfCpus; + ``` + + After: + + ``` + /** @Assert\Range(min = 2, max = 16) */ + private $numberOfCpus; + ``` + + Before: + + ``` + /** @Assert\Min(2) */ + private $numberOfCpus; + ``` + + After: + + ``` + /** @Assert\Range(min = 2) */ + private $numberOfCpus; + ``` + + * The `MinLength` and `MaxLength` constraints were deprecated and will be + removed in Symfony 2.3. You should use the new constraint `Length` instead. + + Before: + + ``` + /** @Assert\MinLength(8) */ + private $password; + ``` + + After: + + ``` + /** @Assert\Length(min = 8) */ + private $password; + ``` + ### Session * Flash messages now return an array based on their type. The old method is diff --git a/vendor/symfony/symfony/phpunit.xml.dist b/vendor/symfony/symfony/phpunit.xml.dist new file mode 100644 index 0000000..64f0b50 --- /dev/null +++ b/vendor/symfony/symfony/phpunit.xml.dist @@ -0,0 +1,45 @@ + + + + + + + + + + ./src/Symfony/Bridge/*/Tests/ + ./src/Symfony/Component/*/Tests/ + ./src/Symfony/Bundle/*/Tests/ + + + + + + benchmark + + + + + + ./src/Symfony/ + + ./src/Symfony/Bridge/*/Tests + ./src/Symfony/Component/*/Tests + ./src/Symfony/Bundle/*/Tests + ./src/Symfony/Bundle/*/Resources + ./src/Symfony/Component/*/Resources + ./src/Symfony/Component/*/*/Resources + + + + diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/CHANGELOG.md index 1a5334e..30c3fe2 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/CHANGELOG.md @@ -7,3 +7,4 @@ CHANGELOG * added a default implementation of the ManagerRegistry * added a session storage for Doctrine DBAL * DoctrineOrmTypeGuesser now guesses "collection" for array Doctrine type + * DoctrineType now caches its choice lists in order to improve performance diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php index 389ca83..d450e49 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php @@ -15,6 +15,12 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +/** + * Registers event listeners and subscribers to the available doctrine connections. + * + * @author Jeremy Mikola + * @author Alexander + */ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface { private $connections; @@ -38,6 +44,9 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface $this->tagPrefix = $tagPrefix; } + /** + * {@inheritDoc} + */ public function process(ContainerBuilder $container) { if (!$container->hasParameter($this->connections)) { @@ -80,35 +89,34 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface private function groupByConnection(array $services, $isListener = false) { $grouped = array(); - foreach (array_keys($this->connections) as $con) { + foreach ($allCons = array_keys($this->connections) as $con) { $grouped[$con] = array(); } foreach ($services as $id => $instances) { foreach ($instances as $instance) { - $cons = isset($instance['connection']) ? array($instance['connection']) : array_keys($this->connections); + if ($isListener) { + if (!isset($instance['event'])) { + throw new \InvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id)); + } + $instance['event'] = array($instance['event']); + + if (isset($instance['lazy']) && $instance['lazy']) { + $this->container->getDefinition($id)->setPublic(true); + } + } + + $cons = isset($instance['connection']) ? array($instance['connection']) : $allCons; foreach ($cons as $con) { if (!isset($grouped[$con])) { throw new \RuntimeException(sprintf('The Doctrine connection "%s" referenced in service "%s" does not exist. Available connections names: %s', $con, $id, implode(', ', array_keys($this->connections)))); } - if ($isListener) { - if (!isset($instance['event'])) { - throw new \InvalidArgumentException(sprintf('Doctrine event listener "%s" must specify the "event" attribute.', $id)); - } - $instance['event'] = array($instance['event']); - - if (isset($instance['lazy']) && $instance['lazy']) { - $this->container->getDefinition($id)->setPublic(true); - } - - if (isset($grouped[$con][$id])) { - $grouped[$con][$id]['event'] = array_merge($grouped[$con][$id]['event'], $instance['event']); - continue; - } + if ($isListener && isset($grouped[$con][$id])) { + $grouped[$con][$id]['event'] = array_merge($grouped[$con][$id]['event'], $instance['event']); + } else { + $grouped[$con][$id] = $instance; } - - $grouped[$con][$id] = $instance; } } } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityLoaderInterface.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityLoaderInterface.php index 3b9fab2..4f53986 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityLoaderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityLoaderInterface.php @@ -23,7 +23,7 @@ interface EntityLoaderInterface * * @return array The entities. */ - function getEntities(); + public function getEntities(); /** * Returns an array of entities matching the given identifiers. @@ -35,5 +35,5 @@ interface EntityLoaderInterface * * @return array The entities. */ - function getEntitiesByIds($identifier, array $values); + public function getEntitiesByIds($identifier, array $values); } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php index 69a4d3d..7b7f580 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php @@ -26,7 +26,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; */ class MergeDoctrineCollectionListener implements EventSubscriberInterface { - static public function getSubscribedEvents() + public static function getSubscribedEvents() { // Higher priority than core MergeCollectionListener so that this one // is called before diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index f94e10e..31216ea 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -29,6 +29,11 @@ abstract class DoctrineType extends AbstractType */ protected $registry; + /** + * @var array + */ + private $choiceListCache = array(); + public function __construct(ManagerRegistry $registry) { $this->registry = $registry; @@ -46,6 +51,7 @@ abstract class DoctrineType extends AbstractType public function setDefaultOptions(OptionsResolverInterface $resolver) { + $choiceListCache =& $this->choiceListCache; $registry = $this->registry; $type = $this; @@ -59,17 +65,57 @@ abstract class DoctrineType extends AbstractType return null; }; - $choiceList = function (Options $options) use ($registry) { + $choiceList = function (Options $options) use ($registry, &$choiceListCache, &$time) { $manager = $registry->getManager($options['em']); - return new EntityChoiceList( - $manager, + // Support for closures + $propertyHash = is_object($options['property']) + ? spl_object_hash($options['property']) + : $options['property']; + + $choiceHashes = $options['choices']; + + // Support for recursive arrays + if (is_array($choiceHashes)) { + // A second parameter ($key) is passed, so we cannot use + // spl_object_hash() directly (which strictly requires + // one parameter) + array_walk_recursive($choiceHashes, function ($value) { + return spl_object_hash($value); + }); + } + + // Support for custom loaders (with query builders) + $loaderHash = is_object($options['loader']) + ? spl_object_hash($options['loader']) + : $options['loader']; + + // Support for closures + $groupByHash = is_object($options['group_by']) + ? spl_object_hash($options['group_by']) + : $options['group_by']; + + $hash = md5(json_encode(array( + spl_object_hash($manager), $options['class'], - $options['property'], - $options['loader'], - $options['choices'], - $options['group_by'] - ); + $propertyHash, + $loaderHash, + $choiceHashes, + $groupByHash + ))); + + if (!isset($choiceListCache[$hash])) { + $choiceListCache[$hash] = new EntityChoiceList( + $manager, + $options['class'], + $options['property'], + $options['loader'], + $options['choices'], + $options['group_by'] + ); + } + + return $choiceListCache[$hash]; }; $resolver->setDefaults(array( diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/RegistryInterface.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/RegistryInterface.php index f941d2f..dbba073 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/RegistryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/RegistryInterface.php @@ -26,7 +26,7 @@ interface RegistryInterface extends ManagerRegistryInterface * * @return string The default entity manager name */ - function getDefaultEntityManagerName(); + public function getDefaultEntityManagerName(); /** * Gets a named entity manager. @@ -35,14 +35,14 @@ interface RegistryInterface extends ManagerRegistryInterface * * @return EntityManager */ - function getEntityManager($name = null); + public function getEntityManager($name = null); /** * Gets an array of all registered entity managers * * @return array An array of EntityManager instances */ - function getEntityManagers(); + public function getEntityManagers(); /** * Resets a named entity manager. @@ -61,7 +61,7 @@ interface RegistryInterface extends ManagerRegistryInterface * * @return EntityManager */ - function resetEntityManager($name = null); + public function resetEntityManager($name = null); /** * Resolves a registered namespace alias to the full namespace. @@ -74,14 +74,14 @@ interface RegistryInterface extends ManagerRegistryInterface * * @see Configuration::getEntityNamespace */ - function getEntityNamespace($alias); + public function getEntityNamespace($alias); /** * Gets all connection names. * * @return array An array of connection names */ - function getEntityManagerNames(); + public function getEntityManagerNames(); /** * Gets the entity manager associated with a given class. @@ -90,5 +90,5 @@ interface RegistryInterface extends ManagerRegistryInterface * * @return EntityManager|null */ - function getEntityManagerForClass($class); + public function getEntityManagerForClass($class); } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php index 5c72fbf..e679aaf 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php @@ -51,6 +51,27 @@ class RegisterEventListenersAndSubscribersPassTest extends \PHPUnit_Framework_Te $this->assertEquals(array('foo', 'bar'), $calls[1][1][0]); } + public function testProcessEventListenersWithMultipleConnections() + { + $container = $this->createBuilder(true); + + $container + ->register('a', 'stdClass') + ->addTag('doctrine.event_listener', array( + 'event' => 'onFlush', + )) + ; + $this->process($container); + + $callsDefault = $container->getDefinition('doctrine.dbal.default_connection.event_manager')->getMethodCalls(); + + $this->assertEquals('addEventListener', $callsDefault[0][0]); + $this->assertEquals(array('onFlush'), $callsDefault[0][1][0]); + + $callsSecond = $container->getDefinition('doctrine.dbal.second_connection.event_manager')->getMethodCalls(); + $this->assertEquals($callsDefault, $callsSecond); + } + public function testProcessEventSubscribersWithPriorities() { $container = $this->createBuilder(); @@ -114,12 +135,22 @@ class RegisterEventListenersAndSubscribersPassTest extends \PHPUnit_Framework_Te return $order; } - private function createBuilder() + private function createBuilder($multipleConnections = false) { $container = new ContainerBuilder(); + + $connections = array('default' => 'doctrine.dbal.default_connection'); + $container->register('doctrine.dbal.default_connection.event_manager', 'stdClass'); $container->register('doctrine.dbal.default_connection', 'stdClass'); - $container->setParameter('doctrine.connections', array('default' => 'doctrine.dbal.default_connection')); + + if ($multipleConnections) { + $container->register('doctrine.dbal.second_connection.event_manager', 'stdClass'); + $container->register('doctrine.dbal.second_connection', 'stdClass'); + $connections['second'] = 'doctrine.dbal.second_connection'; + } + + $container->setParameter('doctrine.connections', $connections); return $container; } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/DoctrineOrmTestCase.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/DoctrineOrmTestCase.php index 44c42c5..005c807 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/DoctrineOrmTestCase.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/DoctrineOrmTestCase.php @@ -35,7 +35,7 @@ abstract class DoctrineOrmTestCase extends \PHPUnit_Framework_TestCase /** * @return EntityManager */ - static public function createTestEntityManager($paths = array()) + public static function createTestEntityManager($paths = array()) { if (!class_exists('PDO') || !in_array('sqlite', \PDO::getAvailableDrivers())) { self::markTestSkipped('This test requires SQLite support in your environment'); diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleIdentEntity.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleIdentEntity.php index 6eab851..09ee18a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleIdentEntity.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleIdentEntity.php @@ -32,6 +32,6 @@ class SingleIdentEntity public function __toString() { - return (string)$this->name; + return (string) $this->name; } } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php new file mode 100644 index 0000000..ea068c2 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php @@ -0,0 +1,112 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Bridge\Doctrine\Tests\Form\Type; + +use Symfony\Component\Form\Tests\FormPerformanceTestCase; +use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIdentEntity; +use Doctrine\ORM\Tools\SchemaTool; +use Symfony\Bridge\Doctrine\Tests\DoctrineOrmTestCase; +use Symfony\Component\Form\Extension\Core\CoreExtension; +use Symfony\Bridge\Doctrine\Form\DoctrineOrmExtension; + +/** + * @author Bernhard Schussek + */ +class EntityTypePerformanceTest extends FormPerformanceTestCase +{ + const ENTITY_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIdentEntity'; + + /** + * @var \Doctrine\ORM\EntityManager + */ + private $em; + + protected function getExtensions() + { + $manager = $this->getMock('Doctrine\Common\Persistence\ManagerRegistry'); + $manager->expects($this->any()) + ->method('getManager') + ->will($this->returnValue($this->em)); + + return array( + new CoreExtension(), + new DoctrineOrmExtension($manager) + ); + } + + protected function setUp() + { + if (!class_exists('Symfony\Component\Form\Form')) { + $this->markTestSkipped('The "Form" component is not available'); + } + + if (!class_exists('Doctrine\DBAL\Platforms\MySqlPlatform')) { + $this->markTestSkipped('Doctrine DBAL is not available.'); + } + + if (!class_exists('Doctrine\Common\Version')) { + $this->markTestSkipped('Doctrine Common is not available.'); + } + + if (!class_exists('Doctrine\ORM\EntityManager')) { + $this->markTestSkipped('Doctrine ORM is not available.'); + } + + $this->em = DoctrineOrmTestCase::createTestEntityManager(); + + parent::setUp(); + + $schemaTool = new SchemaTool($this->em); + $classes = array( + $this->em->getClassMetadata(self::ENTITY_CLASS), + ); + + try { + $schemaTool->dropSchema($classes); + } catch (\Exception $e) { + } + + try { + $schemaTool->createSchema($classes); + } catch (\Exception $e) { + } + + $ids = range(1, 300); + + foreach ($ids as $id) { + $name = 65 + chr($id % 57); + $this->em->persist(new SingleIdentEntity($id, $name)); + } + + $this->em->flush(); + } + + /** + * This test case is realistic in collection forms where each + * row contains the same entity field. + * + * @group benchmark + */ + public function testCollapsedEntityField() + { + $this->setMaxRunningTime(1); + + for ($i = 0; $i < 20; ++$i) { + $form = $this->factory->create('entity', null, array( + 'class' => self::ENTITY_CLASS, + )); + + // force loading of the choice list + $form->createView(); + } + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php index 9dac62d..1e8c07f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Tests/Validator/Constraints/UniqueValidatorTest.php @@ -69,7 +69,7 @@ class UniqueValidatorTest extends DoctrineOrmTestCase return $validatorFactory; } - public function createValidator($entityManagerName, $em, $validateClass = null, $uniqueFields = null) + public function createValidator($entityManagerName, $em, $validateClass = null, $uniqueFields = null, $errorPath = null) { if (!$validateClass) { $validateClass = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIdentEntity'; @@ -83,7 +83,7 @@ class UniqueValidatorTest extends DoctrineOrmTestCase $uniqueValidator = new UniqueEntityValidator($registry); $metadata = new ClassMetadata($validateClass); - $metadata->addConstraint(new UniqueEntity(array('fields' => $uniqueFields, 'em' => $entityManagerName))); + $metadata->addConstraint(new UniqueEntity(array('fields' => $uniqueFields, 'em' => $entityManagerName, 'errorPath' => $errorPath))); $metadataFactory = $this->createMetadataFactoryMock($metadata); $validatorFactory = $this->createValidatorFactory($uniqueValidator); @@ -132,6 +132,29 @@ class UniqueValidatorTest extends DoctrineOrmTestCase $this->assertEquals('Foo', $violation->getInvalidValue()); } + public function testValidateCustomErrorPath() + { + $entityManagerName = "foo"; + $em = $this->createTestEntityManager(); + $this->createSchema($em); + $validator = $this->createValidator($entityManagerName, $em, null, null, 'bar'); + + $entity1 = new SingleIdentEntity(1, 'Foo'); + + $em->persist($entity1); + $em->flush(); + + $entity2 = new SingleIdentEntity(2, 'Foo'); + + $violationsList = $validator->validate($entity2); + $this->assertEquals(1, $violationsList->count(), "No violations found on entity after it was saved to the database."); + + $violation = $violationsList[0]; + $this->assertEquals('This value is already used.', $violation->getMessage()); + $this->assertEquals('bar', $violation->getPropertyPath()); + $this->assertEquals('Foo', $violation->getInvalidValue()); + } + public function testValidateUniquenessWithNull() { $entityManagerName = "foo"; diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php index be9b9ee..55af119 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php @@ -25,6 +25,7 @@ class UniqueEntity extends Constraint public $service = 'doctrine.orm.validator.unique'; public $em = null; public $fields = array(); + public $errorPath = null; public function getRequiredOptions() { diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index 38929b0..13b7b25 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -47,6 +47,10 @@ class UniqueEntityValidator extends ConstraintValidator throw new UnexpectedTypeException($constraint->fields, 'array'); } + if (null !== $constraint->errorPath && !is_string($constraint->errorPath)) { + throw new UnexpectedTypeException($constraint->errorPath, 'string or null'); + } + $fields = (array) $constraint->fields; if (0 === count($fields)) { @@ -114,6 +118,8 @@ class UniqueEntityValidator extends ConstraintValidator return; } - $this->context->addViolationAtSubPath($fields[0], $constraint->message, array(), $criteria[$fields[0]]); + $errorPath = null !== $constraint->errorPath ? $constraint->errorPath : $fields[0]; + + $this->context->addViolationAtSubPath($errorPath, $constraint->message, array(), $criteria[$fields[0]]); } } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Form/Type/ModelType.php b/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Form/Type/ModelType.php index f509dca..820153c 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Form/Type/ModelType.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Form/Type/ModelType.php @@ -65,6 +65,6 @@ class ModelType extends AbstractType public function getName() { - return 'propel_model'; + return 'model'; } } diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Tests/Form/PropelTypeGuesserTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Tests/Form/PropelTypeGuesserTest.php index f60fc8f..a9ed9a0 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Tests/Form/PropelTypeGuesserTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Propel1/Tests/Form/PropelTypeGuesserTest.php @@ -105,7 +105,7 @@ class PropelTypeGuesserTest extends Propel1TestCase $this->assertEquals($confidence, $value->getConfidence()); } - static public function dataProviderForGuessType() + public static function dataProviderForGuessType() { return array( array('is_active', 'checkbox', Guess::HIGH_CONFIDENCE), diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/.gitignore b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/CHANGELOG.md index 31d0045..630fc2a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 2.1.0 ----- + * added global variables access in a form theme * added TwigEngine * added TwigExtractor * added a csrf_token function diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Extension/FormExtension.php b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Extension/FormExtension.php index d21fe05..f77965f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Extension/FormExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Extension/FormExtension.php @@ -245,7 +245,7 @@ class FormExtension extends \Twig_Extension $this->varStack[$rendering]['variables'] = array_replace_recursive($this->varStack[$rendering]['variables'], $variables); } else { $types = $view->getVar('types'); - $types[] = $custom; + $types[] = $view->getVar('full_block_name'); $typeIndex = count($types) - 1; $this->varStack[$rendering] = array( 'variables' => array_replace_recursive($view->getVars(), $variables), @@ -259,9 +259,11 @@ class FormExtension extends \Twig_Extension if (isset($blocks[$types[$typeIndex]])) { $this->varStack[$rendering]['typeIndex'] = $typeIndex; + $context = $this->environment->mergeGlobals($this->varStack[$rendering]['variables']); + // we do not call renderBlock here to avoid too many nested level calls (XDebug limits the level to 100 by default) ob_start(); - $this->template->displayBlock($types[$typeIndex], $this->varStack[$rendering]['variables'], $blocks); + $this->template->displayBlock($types[$typeIndex], $context, $blocks); $html = ob_get_clean(); if ($mainTemplate) { diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig index 1d15e50..13ead74 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig @@ -20,6 +20,9 @@ {% block form_widget_compound %} {% spaceless %}
    + {% if form.parent is empty %} + {{ form_errors(form) }} + {% endif %} {{ block('form_rows') }} {{ form_rest(form) }}
    @@ -236,6 +239,10 @@ {% block repeated_row %} {% spaceless %} + {# + No need to render the errors here, as all errors are mapped + to the first child (see RepeatedTypeValidatorExtension). + #} {{ block('form_rows') }} {% endspaceless %} {% endblock repeated_row %} @@ -244,13 +251,7 @@ {% spaceless %}
    {{ form_label(form, label|default(null)) }} - {# - If the child is a compound form, the errors are rendered inside - the container. See also block form_rows. - #} - {% if not compound %} - {{ form_errors(form) }} - {% endif %} + {{ form_errors(form) }} {{ form_widget(form) }}
    {% endspaceless %} @@ -298,7 +299,6 @@ {% block form_rows %} {% spaceless %} - {{ form_errors(form) }} {% for child in form %} {{ form_row(child) }} {% endfor %} diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig index fbfe96a..27f830f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig @@ -7,31 +7,13 @@ {{ form_label(form, label|default(null)) }}
    - {% if not compound %} - {{ form_errors(form) }} - {% endif %} + {{ form_errors(form) }} {{ form_widget(form) }}
    - {{ parent() }} -
    + {% if form.parent is empty and errors|length > 0 %} + + + + {% endif %} {{ block('form_rows') }} {{ form_rest(form) }}
    + {{ form_errors(form) }} +
    diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php index 5b6e446..c2f8ed1 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php @@ -52,9 +52,10 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest 'custom_widgets.html.twig', )); - $environment = new \Twig_Environment($loader); + $environment = new \Twig_Environment($loader, array('strict_variables' => true)); $environment->addExtension($this->extension); $environment->addExtension(new TranslationExtension(new StubTranslator())); + $environment->addGlobal('global', ''); $this->extension->initRuntime($environment); } @@ -98,32 +99,32 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest protected function renderEnctype(FormView $view) { - return (string)$this->extension->renderEnctype($view); + return (string) $this->extension->renderEnctype($view); } protected function renderLabel(FormView $view, $label = null, array $vars = array()) { - return (string)$this->extension->renderLabel($view, $label, $vars); + return (string) $this->extension->renderLabel($view, $label, $vars); } protected function renderErrors(FormView $view) { - return (string)$this->extension->renderErrors($view); + return (string) $this->extension->renderErrors($view); } protected function renderWidget(FormView $view, array $vars = array()) { - return (string)$this->extension->renderWidget($view, $vars); + return (string) $this->extension->renderWidget($view, $vars); } protected function renderRow(FormView $view, array $vars = array()) { - return (string)$this->extension->renderRow($view, $vars); + return (string) $this->extension->renderRow($view, $vars); } protected function renderRest(FormView $view, array $vars = array()) { - return (string)$this->extension->renderRest($view, $vars); + return (string) $this->extension->renderRest($view, $vars); } protected function setTheme(FormView $view, array $themes) @@ -131,14 +132,14 @@ class FormExtensionDivLayoutTest extends AbstractDivLayoutTest $this->extension->setTheme($view, $themes); } - static public function themeBlockInheritanceProvider() + public static function themeBlockInheritanceProvider() { return array( array(array('theme.html.twig')) ); } - static public function themeInheritanceProvider() + public static function themeInheritanceProvider() { return array( array(array('parent_label.html.twig'), array('child_label.html.twig')) diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php index bfcce48..dc979b9 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php @@ -52,9 +52,10 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest 'custom_widgets.html.twig', )); - $environment = new \Twig_Environment($loader); + $environment = new \Twig_Environment($loader, array('strict_variables' => true)); $environment->addExtension($this->extension); $environment->addExtension(new TranslationExtension(new StubTranslator())); + $environment->addGlobal('global', ''); $this->extension->initRuntime($environment); } @@ -68,32 +69,32 @@ class FormExtensionTableLayoutTest extends AbstractTableLayoutTest protected function renderEnctype(FormView $view) { - return (string)$this->extension->renderEnctype($view); + return (string) $this->extension->renderEnctype($view); } protected function renderLabel(FormView $view, $label = null, array $vars = array()) { - return (string)$this->extension->renderLabel($view, $label, $vars); + return (string) $this->extension->renderLabel($view, $label, $vars); } protected function renderErrors(FormView $view) { - return (string)$this->extension->renderErrors($view); + return (string) $this->extension->renderErrors($view); } protected function renderWidget(FormView $view, array $vars = array()) { - return (string)$this->extension->renderWidget($view, $vars); + return (string) $this->extension->renderWidget($view, $vars); } protected function renderRow(FormView $view, array $vars = array()) { - return (string)$this->extension->renderRow($view, $vars); + return (string) $this->extension->renderRow($view, $vars); } protected function renderRest(FormView $view, array $vars = array()) { - return (string)$this->extension->renderRest($view, $vars); + return (string) $this->extension->renderRest($view, $vars); } protected function setTheme(FormView $view, array $themes) diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/child_label.html.twig b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/child_label.html.twig index 061ef42..8c7c248 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/child_label.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/child_label.html.twig @@ -1,3 +1,3 @@ {% block form_label %} - + {% endblock form_label %} diff --git a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/custom_widgets.html.twig b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/custom_widgets.html.twig index 6b9c0bb..12fd7c6 100644 --- a/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/custom_widgets.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Tests/Extension/custom_widgets.html.twig @@ -1,5 +1,16 @@ {% block _text_id_widget %} -
    - {{ form_widget(form) }} -
    +{% spaceless %} +
    + {{ form_widget(form) }} +
    +{% endspaceless %} {% endblock _text_id_widget %} + +{% block _name_entry_label %} +{% spaceless %} + {% if label is empty %} + {% set label = name|humanize %} + {% endif %} + +{% endspaceless %} +{% endblock _name_entry_label %} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index da9db7c..986ca4f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -26,7 +26,7 @@ CHANGELOG * [BC BREAK] following session options: 'lifetime', 'path', 'domain', 'secure', 'httponly' are now prefixed with cookie_ when dumped to the container * Added `handler_id` configuration under `session` key to represent `session.handler` - service, defaults to `session.handler.file`. + service, defaults to `session.handler.native_file`. * Added `gc_maxlifetime`, `gc_probability`, and `gc_divisor` to session configuration. This means session garbage collection has a `gc_probability`/`gc_divisor` chance of being run. The `gc_maxlifetime` defines @@ -36,5 +36,8 @@ CHANGELOG start on demand. * [BC BREAK] TemplateNameParser::parseFromFilename() has been moved to a dedicated parser: TemplateFilenameParser::parse(). - * [BC BREAK] Kernel parameters are replaced by their value whereever they appear + * [BC BREAK] Kernel parameters are replaced by their value wherever they appear in Route patterns, requirements and defaults. Use '%%' as the escaped value for '%'. + * [BC BREAK] Switched behavior of flash messages to expire flash messages on retrieval + using Symfony\Component\HttpFoundation\Session\Flash\FlashBag as opposed to on + next pageload regardless of whether they are displayed or not. \ No newline at end of file diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinderInterface.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinderInterface.php index a2ef3aa..433ed8f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/CacheWarmer/TemplateFinderInterface.php @@ -11,7 +11,6 @@ namespace Symfony\Bundle\FrameworkBundle\CacheWarmer; - /** * Interface for finding all the templates. * @@ -24,5 +23,5 @@ interface TemplateFinderInterface * * @return array An array of templates of type TemplateReferenceInterface */ - function findAllTemplates(); + public function findAllTemplates(); } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DataCollector/RequestDataCollector.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DataCollector/RequestDataCollector.php index bae7438..70c7a8f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DataCollector/RequestDataCollector.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DataCollector/RequestDataCollector.php @@ -64,9 +64,7 @@ class RequestDataCollector extends BaseRequestDataCollector } /** - * Gets the route. - * - * @return string The route + * {@inheritdoc} */ public function getRoute() { @@ -74,9 +72,7 @@ class RequestDataCollector extends BaseRequestDataCollector } /** - * Returns the route parameters. - * - * @return array The parameters + * {@inheritdoc} */ public function getRouteParams() { @@ -84,9 +80,7 @@ class RequestDataCollector extends BaseRequestDataCollector } /** - * Gets the controller. - * - * @return string The controller as a string + * {@inheritdoc} */ public function getController() { diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php index 5aa12b4..b7289e7 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DataCollector/RouterDataCollector.php @@ -11,94 +11,27 @@ namespace Symfony\Bundle\FrameworkBundle\DataCollector; +use Symfony\Component\HttpKernel\DataCollector\RouterDataCollector as BaseRouterDataCollector; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\DataCollector\DataCollector; use Symfony\Bundle\FrameworkBundle\Controller\RedirectController; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; /** * RouterDataCollector. * * @author Fabien Potencier */ -class RouterDataCollector extends DataCollector +class RouterDataCollector extends BaseRouterDataCollector { - protected $controllers; - - public function __construct() + public function guessRoute(Request $request, $controller) { - $this->controllers = new \SplObjectStorage(); - - $this->data = array( - 'redirect' => false, - 'url' => null, - 'route' => null, - ); - } - - /** - * {@inheritdoc} - */ - public function collect(Request $request, Response $response, \Exception $exception = null) - { - if ($response instanceof RedirectResponse) { - $this->data['redirect'] = true; - $this->data['url'] = $response->getTargetUrl(); - - if ($this->controllers->contains($request)) { - $controller = $this->controllers[$request]; - if (is_array($controller)) { - $controller = $controller[0]; - } - - if ($controller instanceof RedirectController) { - $this->data['route'] = $request->attributes->get('_route', 'n/a'); - } - } + if (is_array($controller)) { + $controller = $controller[0]; } - } - /** - * Remembers the controller associated to each request. - * - * @param FilterControllerEvent The filter controller event - */ - public function onKernelController(FilterControllerEvent $event) - { - $this->controllers[$event->getRequest()] = $event->getController(); - } + if ($controller instanceof RedirectController) { + return $request->attributes->get('_route'); + } - /** - * @return Boolean Whether this request will result in a redirect - */ - public function getRedirect() - { - return $this->data['redirect']; - } - - /** - * @return string|null The target URL - */ - public function getTargetUrl() - { - return $this->data['url']; - } - - /** - * @return string|null The target route - */ - public function getTargetRoute() - { - return $this->data['route']; - } - - /** - * {@inheritdoc} - */ - public function getName() - { - return 'router'; + return parent::guessRoute($request, $controller); } } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php index 620edc2..ad93d7b 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/CompilerDebugDumpPass.php @@ -24,7 +24,7 @@ class CompilerDebugDumpPass implements CompilerPassInterface $cache->write(implode("\n", $container->getCompiler()->getLog())); } - static public function getCompilerLogFilename(ContainerInterface $container) + public static function getCompilerLogFilename(ContainerInterface $container) { $class = $container->getParameter('kernel.container_class'); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 9518506..8cfef35 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -11,7 +11,6 @@ namespace Symfony\Bundle\FrameworkBundle\DependencyInjection; -use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\DefinitionDecorator; use Symfony\Component\DependencyInjection\Reference; @@ -303,7 +302,7 @@ class FrameworkExtension extends Extension $this->addClassesToCompile(array( 'Symfony\\Bundle\\FrameworkBundle\\EventListener\\SessionListener', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\FileSessionHandler', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeFileSessionHandler', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\AbstractProxy', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Proxy\\SessionHandlerProxy', $container->getDefinition('session')->getClass(), diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php index 87f4c3e..f8155a9 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/SessionListener.php @@ -52,7 +52,7 @@ class SessionListener implements EventSubscriberInterface $request->setSession($this->container->get('session')); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array('onKernelRequest', 128), diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php index 55fbb75..9e06177 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/EventListener/TestSessionListener.php @@ -49,7 +49,7 @@ class TestSessionListener implements EventSubscriberInterface $session = $this->container->get('session'); $cookies = $event->getRequest()->cookies; - + if ($cookies->has($session->getName())) { $session->setId($cookies->get($session->getName())); } else { @@ -78,7 +78,7 @@ class TestSessionListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array('onKernelRequest', 192), diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml index 33763c3..d3956ee 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml @@ -18,7 +18,7 @@ - + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml index d3efd46..8bef4bc 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml @@ -6,13 +6,14 @@ Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension + Symfony\Component\Form\FormRegistry Symfony\Component\Form\FormFactory Symfony\Component\Form\Extension\Validator\ValidatorTypeGuesser - - + + + + + + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml index 2763158..a89cf9a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/session.xml @@ -6,11 +6,11 @@ Symfony\Component\HttpFoundation\Session\Session - Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag + Symfony\Component\HttpFoundation\Session\Flash\FlashBag Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage - Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler + Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler Symfony\Bundle\FrameworkBundle\EventListener\SessionListener @@ -34,7 +34,7 @@ %kernel.cache_dir%/sessions - + %session.save_path% @@ -45,6 +45,5 @@ - diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css index 86454c1..22c9387 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/public/css/exception.css @@ -83,6 +83,10 @@ build: 56 color: #AA3333; background: #f9ecec; } +.sf-exceptionreset #logs .traces li.warning { + font-style: normal; + background: #ffcc00; +} /* fix for Opera not liking empty
  • */ .sf-exceptionreset .traces li:after { content: "\00A0"; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php index 6f99415..0918070 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_row.html.php @@ -1,7 +1,5 @@
    label($form, isset($label) ? $label : null) ?> - - errors($form) ?> - + errors($form) ?> widget($form) ?>
    diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_rows.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_rows.html.php index a5f1dfb..8c3ba86 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_rows.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_rows.html.php @@ -1,4 +1,3 @@ -errors($form) ?> row($child) ?> diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_compound.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_compound.html.php index 705664b..9321a69 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_compound.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/form_widget_compound.html.php @@ -1,4 +1,11 @@
    renderBlock('widget_container_attributes') ?>> + hasParent() && $errors): ?> + + + errors($form) ?> + + + renderBlock('form_rows') ?> rest($form) ?>
    diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php index 154b6e2..339e3d0 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_errors.html.php @@ -1,51 +1,21 @@ - - -
      - -
    • getMessagePluralization()) { - echo $view['translator']->trans( - $error->getMessageTemplate(), - $error->getMessageParameters(), - 'validators' - ); - } else { - echo $view['translator']->transChoice( - $error->getMessageTemplate(), - $error->getMessagePluralization(), - $error->getMessageParameters(), - 'validators' - ); - }?>
    • - -
    - - - 0): ?> - - - -
      - -
    • getMessagePluralization()) { - echo $view['translator']->trans( - $error->getMessageTemplate(), - $error->getMessageParameters(), - 'validators' - ); - } else { - echo $view['translator']->transChoice( - $error->getMessageTemplate(), - $error->getMessagePluralization(), - $error->getMessageParameters(), - 'validators' - ); - }?>
    • - -
    - - - - - + +
      + +
    • getMessagePluralization()) { + echo $view['translator']->trans( + $error->getMessageTemplate(), + $error->getMessageParameters(), + 'validators' + ); + } else { + echo $view['translator']->transChoice( + $error->getMessageTemplate(), + $error->getMessagePluralization(), + $error->getMessageParameters(), + 'validators' + ); + }?>
    • + +
    + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php index 03daaf1..b9e5c56 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_row.html.php @@ -3,9 +3,7 @@ label($form, isset($label) ? $label : null) ?> - - errors($form) ?> - + errors($form) ?> widget($form) ?> diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_widget_compound.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_widget_compound.html.php index 9c90f15..b022830 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_widget_compound.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/form_widget_compound.html.php @@ -1,4 +1,7 @@ renderBlock('widget_container_attributes') ?>> + hasParent()): ?> + errors($form) ?> + renderBlock('form_rows') ?> rest($form) ?>
    diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/hidden_row.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/hidden_row.html.php index dd433ea..491ece3 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/hidden_row.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views/FormTable/hidden_row.html.php @@ -3,4 +3,3 @@ widget($form) ?> - diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php index 3f9b5cf..49c3dda 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Routing/Router.php @@ -103,9 +103,9 @@ class Router extends BaseRouter implements WarmableInterface /** * Replaces placeholders with the service container parameters in the given string. * - * @param string $value The source string which might contain %placeholders% + * @param mixed $value The source string which might contain %placeholders% * - * @return string A string where the placeholders have been replaced. + * @return mixed A string where the placeholders have been replaced, or the original value if not a string. * * @throws ParameterNotFoundException When a placeholder does not exist as a container parameter * @throws RuntimeException When a container value is not a string or a numeric value @@ -114,6 +114,10 @@ class Router extends BaseRouter implements WarmableInterface { $container = $this->container; + if (null === $value || false === $value || true === $value || is_object($value)) { + return $value; + } + $escapedValue = preg_replace_callback('/%%|%([^%\s]+)%/', function ($match) use ($container, $value) { // skip %% if (!isset($match[1])) { diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php index d7a62c1..c5f1a3e 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php @@ -84,12 +84,6 @@ class DelegatingEngine extends BaseDelegatingEngine implements EngineInterface */ public function renderResponse($view, array $parameters = array(), Response $response = null) { - if (null === $response) { - $response = new Response(); - } - - $response->setContent($this->render($view, $parameters)); - - return $response; + return $this->getEngine($view)->renderResponse($view, $parameters, $response); } } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/EngineInterface.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/EngineInterface.php index 0b12570..edc087e 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/EngineInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/EngineInterface.php @@ -30,5 +30,5 @@ interface EngineInterface extends BaseEngineInterface * * @return Response A Response instance */ - function renderResponse($view, array $parameters = array(), Response $response = null); + public function renderResponse($view, array $parameters = array(), Response $response = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php index 1997df9..3fdad98 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/Helper/CodeHelper.php @@ -201,7 +201,7 @@ class CodeHelper extends Helper return 'code'; } - static protected function fixCodeMarkup($line) + protected static function fixCodeMarkup($line) { // ending tag from previous line $opening = strpos($line, 'varStack[$rendering]['variables'], $variables); } else { $types = $view->getVar('types'); - $types[] = $custom; + $types[] = $view->getVar('full_block_name'); $typeIndex = count($types) - 1; $variables = array_replace_recursive($view->getVars(), $variables); $this->varStack[$rendering]['types'] = $types; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php index 506466d..ea0c49e 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php @@ -22,8 +22,8 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; */ abstract class WebTestCase extends \PHPUnit_Framework_TestCase { - static protected $class; - static protected $kernel; + protected static $class; + protected static $kernel; /** * Creates a Client. @@ -33,7 +33,7 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase * * @return Client A Client instance */ - static protected function createClient(array $options = array(), array $server = array()) + protected static function createClient(array $options = array(), array $server = array()) { if (null !== static::$kernel) { static::$kernel->shutdown(); @@ -56,7 +56,7 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase * * @return string The directory where phpunit.xml(.dist) is stored */ - static protected function getPhpUnitXmlDir() + protected static function getPhpUnitXmlDir() { if (!isset($_SERVER['argv']) || false === strpos($_SERVER['argv'][0], 'phpunit')) { throw new \RuntimeException('You must override the WebTestCase::createKernel() method.'); @@ -89,7 +89,7 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase * * @return string The value of the phpunit cli configuration option */ - static private function getPhpUnitCliConfigArgument() + private static function getPhpUnitCliConfigArgument() { $dir = null; $reversedArgs = array_reverse($_SERVER['argv']); @@ -114,7 +114,7 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase * * @return string The Kernel class name */ - static protected function getKernelClass() + protected static function getKernelClass() { $dir = isset($_SERVER['KERNEL_DIR']) ? $_SERVER['KERNEL_DIR'] : static::getPhpUnitXmlDir(); @@ -145,7 +145,7 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase * * @return HttpKernelInterface A HttpKernelInterface instance */ - static protected function createKernel(array $options = array()) + protected static function createKernel(array $options = array()) { if (null === static::$class) { static::$class = static::getKernelClass(); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php index 6b066dd..f2e756a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/CacheWarmer/TemplateFinderTest.php @@ -16,7 +16,6 @@ use Symfony\Bundle\FrameworkBundle\Templating\TemplateFilenameParser; use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinder; use Symfony\Bundle\FrameworkBundle\Tests\Fixtures\BaseBundle\BaseBundle; - class TemplateFinderTest extends TestCase { public function testFindAllTemplates() diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php index dc19ad9..b64021e 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/RedirectControllerTest.php @@ -68,7 +68,6 @@ class RedirectControllerTest extends TestCase $container = $this->getMock('Symfony\Component\DependencyInjection\ContainerInterface'); - $container ->expects($this->at(0)) ->method('get') diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/RegisterKernelListenersPassTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/RegisterKernelListenersPassTest.php index 8e30138..670052f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/RegisterKernelListenersPassTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/RegisterKernelListenersPassTest.php @@ -85,5 +85,5 @@ class RegisterKernelListenersPassTest extends \PHPUnit_Framework_TestCase class SubscriberService implements \Symfony\Component\EventDispatcher\EventSubscriberInterface { - static function getSubscribedEvents() {} + public static function getSubscribedEvents() {} } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php index 07b07fa..b7a56d6 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_full.php @@ -18,4 +18,3 @@ $container->loadFromExtension('framework', array( 'cookie_httponly' => true, ), )); - diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php index 8706696..5d56c1c 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/deprecated_merge_partial.php @@ -15,4 +15,3 @@ $container->loadFromExtension('framework', array( 'cookie_httponly' => true, ), )); - diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml index 7462fbf..69a8e6d 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/Resources/config/routing.yml @@ -17,4 +17,3 @@ session_setflash: session_showflash: pattern: /session_showflash defaults: { _controller: TestBundle:Session:showFlash} - diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php index e5bbe87..affbeb9 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/WebTestCase.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpKernel\Kernel; class WebTestCase extends BaseWebTestCase { - static public function assertRedirect($response, $location) + public static function assertRedirect($response, $location) { self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.$response->getStatusCode()); self::assertEquals('http://localhost'.$location, $response->headers->get('Location')); @@ -42,14 +42,14 @@ class WebTestCase extends BaseWebTestCase $fs->remove($dir); } - static protected function getKernelClass() + protected static function getKernelClass() { require_once __DIR__.'/app/AppKernel.php'; return 'Symfony\Bundle\FrameworkBundle\Tests\Functional\AppKernel'; } - static protected function createKernel(array $options = array()) + protected static function createKernel(array $options = array()) { $class = self::getKernelClass(); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Session/config.yml b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Session/config.yml index 7b67b7d..65dd6c7 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Session/config.yml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/Session/config.yml @@ -1,3 +1,2 @@ imports: - { resource: ./../config/default.yml } - diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php index fefb64a..3c02f4f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/HttpKernelTest.php @@ -48,7 +48,7 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase $resolver = $this->getMock('Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface'); $kernel = new HttpKernel($dispatcher, $container, $resolver); - $controller = function() use($expected) { + $controller = function() use ($expected) { return $expected; }; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php index 1d50d7a..2c6a031 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Routing/RouterTest.php @@ -144,6 +144,28 @@ class RoutingTest extends \PHPUnit_Framework_TestCase $router->getRouteCollection()->get('foo'); } + /** + * @dataProvider getNonStringValues + */ + public function testDefaultValuesAsNonStrings($value) + { + $routes = new RouteCollection(); + $routes->add('foo', new Route('foo', array('foo' => $value), array('foo' => '\d+'))); + + $sc = $this->getServiceContainer($routes); + + $router = new Router($sc, 'foo'); + + $route = $router->getRouteCollection()->get('foo'); + + $this->assertSame($value, $route->getDefault('foo')); + } + + public function getNonStringValues() + { + return array(array(null), array(false), array(true), array(new \stdClass()), array(array('foo', 'bar'))); + } + private function getServiceContainer(RouteCollection $routes) { $loader = $this->getMock('Symfony\Component\Config\Loader\LoaderInterface'); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/CodeHelperTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/CodeHelperTest.php index 357170d..0d53544 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/CodeHelperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/CodeHelperTest.php @@ -17,7 +17,7 @@ class CodeHelperTest extends \PHPUnit_Framework_TestCase { protected static $helper; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$helper = new CodeHelper('txmt://open?url=file://%f&line=%l', '/root', 'UTF-8'); } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php index dbb6fa1..7d3a6f1 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php @@ -33,6 +33,7 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest $templateNameParser = new StubTemplateNameParser($root, $rootTheme); $loader = new FilesystemLoader(array()); $engine = new PhpEngine($templateNameParser, $loader); + $engine->addGlobal('global', ''); $this->helper = new FormHelper($engine, $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface'), array('FrameworkBundle:Form')); @@ -82,14 +83,14 @@ class FormHelperDivLayoutTest extends AbstractDivLayoutTest $this->helper->setTheme($view, $themes); } - static public function themeBlockInheritanceProvider() + public static function themeBlockInheritanceProvider() { return array( array(array('TestBundle:Parent')) ); } - static public function themeInheritanceProvider() + public static function themeInheritanceProvider() { return array( array(array('TestBundle:Parent'), array('TestBundle:Child')) diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php index 22c1e19..21a2645 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php @@ -33,6 +33,7 @@ class FormHelperTableLayoutTest extends AbstractTableLayoutTest $templateNameParser = new StubTemplateNameParser($root, $rootTheme); $loader = new FilesystemLoader(array()); $engine = new PhpEngine($templateNameParser, $loader); + $engine->addGlobal('global', ''); $this->helper = new FormHelper($engine, $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface'), array( 'FrameworkBundle:Form', diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Child/form_label.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Child/form_label.html.php index 3dec64b..0c1af40 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Child/form_label.html.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Child/form_label.html.php @@ -1 +1 @@ - + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php new file mode 100644 index 0000000..0efecf0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/Resources/Custom/_name_entry_label.html.php @@ -0,0 +1,2 @@ +humanize($name); } ?> + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php index 9d598ed..c7b631e 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php @@ -277,7 +277,7 @@ class MainConfiguration implements ConfigurationInterface ->ifTrue(function($v) { return true === $v['security'] && isset($v['pattern']) && !isset($v['request_matcher']); }) - ->then(function($firewall) use($abstractFactoryKeys) { + ->then(function($firewall) use ($abstractFactoryKeys) { foreach ($abstractFactoryKeys as $k) { if (!isset($firewall[$k]['check_path'])) { continue; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php index 611b028..a83de65 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/AbstractFactory.php @@ -28,14 +28,21 @@ abstract class AbstractFactory implements SecurityFactoryInterface { protected $options = array( 'check_path' => '/login_check', - 'login_path' => '/login', 'use_forward' => false, + ); + + protected $defaultSuccessHandlerOptions = array( 'always_use_default_target_path' => false, 'default_target_path' => '/', + 'login_path' => '/login', 'target_path_parameter' => '_target_path', 'use_referer' => false, + ); + + protected $defaultFailureHandlerOptions = array( 'failure_path' => null, 'failure_forward' => false, + 'login_path' => '/login', ); public function create(ContainerBuilder $container, $id, $config, $userProviderId, $defaultEntryPointId) @@ -71,7 +78,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface ->scalarNode('failure_handler')->end() ; - foreach ($this->options as $name => $default) { + foreach (array_merge($this->options, $this->defaultSuccessHandlerOptions, $this->defaultFailureHandlerOptions) as $name => $default) { if (is_bool($default)) { $builder->booleanNode($name)->defaultValue($default); } else { @@ -80,7 +87,7 @@ abstract class AbstractFactory implements SecurityFactoryInterface } } - public final function addOption($name, $default = null) + final public function addOption($name, $default = null) { $this->options[$name] = $default; } @@ -149,21 +156,42 @@ abstract class AbstractFactory implements SecurityFactoryInterface $listenerId = $this->getListenerId(); $listener = new DefinitionDecorator($listenerId); $listener->replaceArgument(4, $id); - $listener->replaceArgument(5, array_intersect_key($config, $this->options)); - - // success handler - if (isset($config['success_handler'])) { - $listener->replaceArgument(6, new Reference($config['success_handler'])); - } - - // failure handler - if (isset($config['failure_handler'])) { - $listener->replaceArgument(7, new Reference($config['failure_handler'])); - } + $listener->replaceArgument(5, new Reference($this->createAuthenticationSuccessHandler($container, $id, $config))); + $listener->replaceArgument(6, new Reference($this->createAuthenticationFailureHandler($container, $id, $config))); + $listener->replaceArgument(7, array_intersect_key($config, $this->options)); $listenerId .= '.'.$id; $container->setDefinition($listenerId, $listener); return $listenerId; } + + protected function createAuthenticationSuccessHandler($container, $id, $config) + { + if (isset($config['success_handler'])) { + return $config['success_handler']; + } + + $successHandlerId = 'security.authentication.success_handler.'.$id; + + $successHandler = $container->setDefinition($successHandlerId, new DefinitionDecorator('security.authentication.success_handler')); + $successHandler->replaceArgument(1, array_intersect_key($config, $this->defaultSuccessHandlerOptions)); + $successHandler->addMethodCall('setProviderKey', array($id)); + + return $successHandlerId; + } + + protected function createAuthenticationFailureHandler($container, $id, $config) + { + if (isset($config['failure_handler'])) { + return $config['failure_handler']; + } + + $id = 'security.authentication.failure_handler.'.$id; + + $failureHandler = $container->setDefinition($id, new DefinitionDecorator('security.authentication.failure_handler')); + $failureHandler->replaceArgument(2, array_intersect_key($config, $this->defaultFailureHandlerOptions)); + + return $id; + } } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php index 5ef4c00..5e8773b 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/SecurityFactoryInterface.php @@ -21,11 +21,11 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; */ interface SecurityFactoryInterface { - function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint); + public function create(ContainerBuilder $container, $id, $config, $userProvider, $defaultEntryPoint); - function getPosition(); + public function getPosition(); - function getKey(); + public function getKey(); - function addConfiguration(NodeDefinition $builder); + public function addConfiguration(NodeDefinition $builder); } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php index 9f7eaf6..df25035 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/UserProviderFactoryInterface.php @@ -22,9 +22,9 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; */ interface UserProviderFactoryInterface { - function create(ContainerBuilder $container, $id, $config); + public function create(ContainerBuilder $container, $id, $config); - function getKey(); + public function getKey(); - function addConfiguration(NodeDefinition $builder); + public function addConfiguration(NodeDefinition $builder); } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php index b856a91..de1001a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php @@ -279,18 +279,22 @@ class SecurityExtension extends Extension if (isset($firewall['logout'])) { $listenerId = 'security.logout_listener.'.$id; $listener = $container->setDefinition($listenerId, new DefinitionDecorator('security.logout_listener')); - $listener->replaceArgument(2, array( + $listener->replaceArgument(3, array( 'csrf_parameter' => $firewall['logout']['csrf_parameter'], 'intention' => $firewall['logout']['intention'], 'logout_path' => $firewall['logout']['path'], - 'target_url' => $firewall['logout']['target'], )); $listeners[] = new Reference($listenerId); // add logout success handler if (isset($firewall['logout']['success_handler'])) { - $listener->replaceArgument(3, new Reference($firewall['logout']['success_handler'])); + $logoutSuccessHandlerId = $firewall['logout']['success_handler']; + } else { + $logoutSuccessHandlerId = 'security.logout.success_handler.'.$id; + $logoutSuccessHandler = $container->setDefinition($logoutSuccessHandlerId, new DefinitionDecorator('security.logout.success_handler')); + $logoutSuccessHandler->replaceArgument(1, $firewall['logout']['target']); } + $listener->replaceArgument(2, new Reference($logoutSuccessHandlerId)); // add CSRF provider if (isset($firewall['logout']['csrf_provider'])) { @@ -625,4 +629,3 @@ class SecurityExtension extends Extension return new MainConfiguration($this->factories, $this->userProviderFactories); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml index b6cd020..6148337 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml @@ -27,6 +27,7 @@ Symfony\Component\Security\Http\Firewall\LogoutListener Symfony\Component\Security\Http\Logout\SessionLogoutHandler Symfony\Component\Security\Http\Logout\CookieClearingLogoutHandler + Symfony\Component\Security\Http\Logout\DefaultLogoutSuccessHandler Symfony\Component\Security\Http\Firewall\AccessListener Symfony\Component\Security\Http\AccessMap @@ -37,6 +38,9 @@ Symfony\Component\Security\Core\Authentication\Provider\PreAuthenticatedAuthenticationProvider Symfony\Component\Security\Core\Authentication\Provider\AnonymousAuthenticationProvider + + Symfony\Component\Security\Http\Authentication\DefaultAuthenticationSuccessHandler + Symfony\Component\Security\Http\Authentication\DefaultAuthenticationFailureHandler @@ -81,12 +85,17 @@ + - + + + / + + @@ -98,13 +107,26 @@ + + - - + + + + + + + + + + + + + getFactory(); + list($container, + $authProviderId, + $listenerId, + $entryPointId + ) = $this->callFactory('foo', array('use_forward' => true, 'failure_path' => '/foo', 'success_handler' => 'qux', 'failure_handler' => 'bar', 'remember_me' => true), 'user_provider', 'entry_point'); + + // auth provider + $this->assertEquals('auth_provider', $authProviderId); + + // listener + $this->assertEquals('abstract_listener.foo', $listenerId); + $this->assertTrue($container->hasDefinition('abstract_listener.foo')); + $definition = $container->getDefinition('abstract_listener.foo'); + $this->assertEquals(array( + 'index_4' => 'foo', + 'index_5' => new Reference('qux'), + 'index_6' => new Reference('bar'), + 'index_7' => array( + 'use_forward' => true, + ), + ), $definition->getArguments()); + + // entry point + $this->assertEquals('entry_point', $entryPointId, '->create() does not change the default entry point.'); + } + + public function testDefaultFailureHandler() + { + list($container, + $authProviderId, + $listenerId, + $entryPointId + ) = $this->callFactory('foo', array('remember_me' => true), 'user_provider', 'entry_point'); + + $definition = $container->getDefinition('abstract_listener.foo'); + $arguments = $definition->getArguments(); + $this->assertEquals(new Reference('security.authentication.failure_handler.foo'), $arguments['index_6']); + } + + public function testDefaultSuccessHandler() + { + list($container, + $authProviderId, + $listenerId, + $entryPointId + ) = $this->callFactory('foo', array('remember_me' => true), 'user_provider', 'entry_point'); + + $definition = $container->getDefinition('abstract_listener.foo'); + $arguments = $definition->getArguments(); + $this->assertEquals(new Reference('security.authentication.success_handler.foo'), $arguments['index_5']); + } + + protected function callFactory($id, $config, $userProviderId, $defaultEntryPointId) + { + $factory = $this->getMockForAbstractClass('Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory', array()); $factory ->expects($this->once()) @@ -37,30 +91,8 @@ class AbstractFactoryTest extends \PHPUnit_Framework_TestCase list($authProviderId, $listenerId, $entryPointId - ) = $factory->create($container, 'foo', array('use_forward' => true, 'failure_path' => '/foo', 'success_handler' => 'foo', 'remember_me' => true), 'user_provider', 'entry_point'); + ) = $factory->create($container, $id, $config, $userProviderId, $defaultEntryPointId); - // auth provider - $this->assertEquals('auth_provider', $authProviderId); - - // listener - $this->assertEquals('abstract_listener.foo', $listenerId); - $this->assertTrue($container->hasDefinition('abstract_listener.foo')); - $definition = $container->getDefinition('abstract_listener.foo'); - $this->assertEquals(array( - 'index_4' => 'foo', - 'index_5' => array( - 'use_forward' => true, - 'failure_path' => '/foo', - ), - 'index_6' => new Reference('foo'), - ), $definition->getArguments()); - - // entry point - $this->assertEquals('entry_point', $entryPointId, '->create() does not change the default entry point.'); - } - - protected function getFactory() - { - return $this->getMockForAbstractClass('Symfony\Bundle\SecurityBundle\DependencyInjection\Security\Factory\AbstractFactory', array()); + return array($container, $authProviderId, $listenerId, $entryPointId); } } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php index 4440a3e..3c78d10 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/SecurityBundle/Tests/Functional/WebTestCase.php @@ -17,7 +17,7 @@ use Symfony\Component\HttpKernel\Kernel; class WebTestCase extends BaseWebTestCase { - static public function assertRedirect($response, $location) + public static function assertRedirect($response, $location) { self::assertTrue($response->isRedirect(), 'Response is not a redirect, got status code: '.substr($response, 0, 2000)); self::assertEquals('http://localhost'.$location, $response->headers->get('Location')); @@ -42,14 +42,14 @@ class WebTestCase extends BaseWebTestCase $fs->remove($dir); } - static protected function getKernelClass() + protected static function getKernelClass() { require_once __DIR__.'/app/AppKernel.php'; return 'Symfony\Bundle\SecurityBundle\Tests\Functional\AppKernel'; } - static protected function createKernel(array $options = array()) + protected static function createKernel(array $options = array()) { $class = self::getKernelClass(); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/CHANGELOG.md index 0da6ea2..59f86af 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/CHANGELOG.md @@ -4,6 +4,7 @@ CHANGELOG 2.1.0 ----- + * added a new setting ("paths") to configure more paths for the Twig filesystem loader * added contextual escaping based on the template file name (disabled if you explicitly pass an autoescape option) * added a command that extracts translation messages from templates * added the real template name when an error occurs in a Twig template diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php index d898f54..33e44a5 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Command/LintCommand.php @@ -74,7 +74,7 @@ EOF } if (0 !== strpos($filename, '@') && !is_readable($filename)) { - throw new \RuntimeException("File or directory '%s' is not readable"); + throw new \RuntimeException(sprintf('File or directory "%s" is not readable', $filename)); } $files = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php index 7601be9..54be66a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php @@ -45,7 +45,7 @@ class ExceptionController extends ContainerAware $templating = $this->container->get('templating'); $code = $exception->getStatusCode(); - $response = $templating->renderResponse( + return $templating->renderResponse( $this->findTemplate($templating, $format, $code, $this->container->get('kernel')->isDebug()), array( 'status_code' => $code, @@ -55,11 +55,6 @@ class ExceptionController extends ContainerAware 'currentContent' => $currentContent, ) ); - - $response->setStatusCode($code); - $response->headers->replace($exception->getHeaders()); - - return $response; } /** diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php index ff2a9ef..7936d21 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/Configuration.php @@ -115,6 +115,7 @@ class Configuration implements ConfigurationInterface private function addTwigOptions(ArrayNodeDefinition $rootNode) { $rootNode + ->fixXmlConfig('path') ->children() ->scalarNode('autoescape')->end() ->scalarNode('base_template_class')->example('Twig_Template')->end() @@ -124,6 +125,9 @@ class Configuration implements ConfigurationInterface ->scalarNode('strict_variables')->end() ->scalarNode('auto_reload')->end() ->scalarNode('optimizations')->end() + ->arrayNode('paths') + ->prototype('variable')->end() + ->end() ->end() ; } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php index 1de263f..d65dc9f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php @@ -60,6 +60,12 @@ class TwigExtension extends Extension $reflClass = new \ReflectionClass('Symfony\Bridge\Twig\Extension\FormExtension'); $container->getDefinition('twig.loader')->addMethodCall('addPath', array(dirname(dirname($reflClass->getFileName())).'/Resources/views/Form')); + if (!empty($config['paths'])) { + foreach ($config['paths'] as $path) { + $container->getDefinition('twig.loader')->addMethodCall('addPath', array($path)); + } + } + if (!empty($config['globals'])) { $def = $container->getDefinition('twig'); foreach ($config['globals'] as $key => $global) { diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd index 810e24f..2a72ef6 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/config/schema/twig-1.0.xsd @@ -11,6 +11,7 @@ + diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig index 88a3528..f75ec58 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views/Exception/logs.html.twig @@ -1,7 +1,7 @@
      {% for log in logs %} - - {{ log.message }} + = 400 %} class="error"{% elseif log.priority >= 300 %} class="warning"{% endif %}> + {{ log.priorityName }} - {{ log.message }} {% endfor %}
    diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php index b35b0fc..3940083 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php @@ -35,10 +35,6 @@ class ExceptionControllerTest extends TestCase ->expects($this->once()) ->method('getStatusCode') ->will($this->returnValue(404)); - $this->flatten - ->expects($this->once()) - ->method('getHeaders') - ->will($this->returnValue(array())); $this->controller = new ExceptionController(); $this->kernel = $this->getMock('Symfony\\Component\\HttpKernel\\KernelInterface'); $this->templating = $this->getMockBuilder('Symfony\\Bundle\\TwigBundle\\TwigEngine') diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php index 7733f17..ba3150e 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/php/full.php @@ -18,4 +18,5 @@ $container->loadFromExtension('twig', array( 'charset' => 'ISO-8859-1', 'debug' => true, 'strict_variables' => true, + 'paths' => array('path1', 'path2'), )); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/full.xml index dacc523..63cbe3e 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/full.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/xml/full.xml @@ -12,5 +12,7 @@ 3.14 + path1 + path2 diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/full.yml index baf7661..8378e33 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/full.yml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/Fixtures/yml/full.yml @@ -13,3 +13,4 @@ twig: charset: ISO-8859-1 debug: true strict_variables: true + paths: [path1, path2] diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php index d917db3..3eebc77 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php @@ -41,8 +41,8 @@ class ProfilerController extends ContainerAware $profiler = $this->container->get('profiler'); $profiler->disable(); - $panel = $this->container->get('request')->query->get('panel', 'request'); - $page = $this->container->get('request')->query->get('page', 'home'); + $panel = $request->query->get('panel', 'request'); + $page = $request->query->get('page', 'home'); if (!$profile = $profiler->loadProfile($token)) { return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:info.html.twig', array('about' => 'no_token', 'token' => $token)); @@ -104,14 +104,14 @@ class ProfilerController extends ContainerAware * * @return Response A Response instance */ - public function importAction() + public function importAction(Request $request) { $profiler = $this->container->get('profiler'); $profiler->disable(); $router = $this->container->get('router'); - $file = $this->container->get('request')->files->get('file'); + $file = $request->files->get('file'); if (empty($file) || !$file->isValid()) { return new RedirectResponse($router->generate('_profiler_info', array('about' => 'upload_error'))); @@ -144,14 +144,14 @@ class ProfilerController extends ContainerAware /** * Renders the Web Debug Toolbar. * - * @param string $token The profiler token - * @param string $position The toolbar position (top, bottom, normal, or null -- use the configuration) + * @param Request $request The current Request + * @param string $token The profiler token + * @param string $position The toolbar position (top, bottom, normal, or null -- use the configuration) * * @return Response A Response instance */ - public function toolbarAction($token, $position = null) + public function toolbarAction(Request $request, $token, $position = null) { - $request = $this->container->get('request'); $session = $request->getSession(); if (null !== $session && $session->getFlashBag() instanceof AutoExpireFlashBag) { @@ -192,14 +192,16 @@ class ProfilerController extends ContainerAware /** * Renders the profiler search bar. * + * @param Request $request The current Request + * * @return Response A Response instance */ - public function searchBarAction() + public function searchBarAction(Request $request) { $profiler = $this->container->get('profiler'); $profiler->disable(); - if (null === $session = $this->container->get('request')->getSession()) { + if (null === $session = $request->getSession()) { $ip = $method = $url = @@ -225,21 +227,22 @@ class ProfilerController extends ContainerAware /** * Search results. * - * @param string $token The token + * @param Request $request The current Request + * @param string $token The token * * @return Response A Response instance */ - public function searchResultsAction($token) + public function searchResultsAction(Request $request, $token) { $profiler = $this->container->get('profiler'); $profiler->disable(); $profile = $profiler->loadProfile($token); - $ip = $this->container->get('request')->query->get('ip'); - $method = $this->container->get('request')->query->get('method'); - $url = $this->container->get('request')->query->get('url'); - $limit = $this->container->get('request')->query->get('limit'); + $ip = $request->query->get('ip'); + $method = $request->query->get('method'); + $url = $request->query->get('url'); + $limit = $request->query->get('limit'); return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:results.html.twig', array( 'token' => $token, @@ -256,15 +259,15 @@ class ProfilerController extends ContainerAware /** * Narrow the search bar. * + * @param Request $request The current Request + * * @return Response A Response instance */ - public function searchAction() + public function searchAction(Request $request) { $profiler = $this->container->get('profiler'); $profiler->disable(); - $request = $this->container->get('request'); - $ip = preg_replace('/[^:\d\.]/', '', $request->query->get('ip')); $method = $request->query->get('method'); $url = $request->query->get('url'); diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php index 27a0be4..6d48730 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/EventListener/WebDebugToolbarListener.php @@ -12,10 +12,12 @@ namespace Symfony\Bundle\WebProfilerBundle\EventListener; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Bundle\TwigBundle\TwigEngine; -use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; /** * WebDebugToolbarListener injects the Web Debug Toolbar. @@ -27,7 +29,7 @@ use Symfony\Component\HttpFoundation\Session\Flash\AutoExpireFlashBag; * * @author Fabien Potencier */ -class WebDebugToolbarListener +class WebDebugToolbarListener implements EventSubscriberInterface { const DISABLED = 1; const ENABLED = 2; @@ -124,4 +126,11 @@ class WebDebugToolbarListener $response->setContent($content); } } + + public static function getSubscribedEvents() + { + return array( + KernelEvents::RESPONSE => array('onKernelResponse', -128), + ); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml index 5ce61a0..908a32d 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/config/toolbar.xml @@ -10,7 +10,7 @@ - + %web_profiler.debug_toolbar.intercept_redirects% %web_profiler.debug_toolbar.mode% diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/public/css/profiler.css b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/public/css/profiler.css index 548530d..8381a9a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/public/css/profiler.css +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/public/css/profiler.css @@ -309,6 +309,11 @@ ul.alt li.error { margin-bottom: 1px; } +ul.alt li.warning { + background-color: #ffcc00; + margin-bottom: 1px; +} + td.main, td.menu { text-align: left; margin: 0; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig index 33733b1..2e1428f 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig @@ -146,19 +146,20 @@ -

    Active bundles

    - - - - - - {% set bundles = collector.bundles %} - {% for name in bundles|keys|sort %} - - - - - {% endfor %} -
    NamePath
    {{ name }}{{ bundles[name] }}
    - + {% if collector.bundles %} +

    Active bundles

    + + + + + + {% set bundles = collector.bundles %} + {% for name in bundles|keys|sort %} + + + + + {% endfor %} +
    NamePath
    {{ name }}{{ bundles[name] }}
    + {% endif %} {% endblock %} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig index badce63..5d6ed4a 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig @@ -41,7 +41,7 @@ @@ -56,8 +56,8 @@ {% if collector.logs %}
      {% for log in collector.logs if log.priority >= priority %} -
    • - {{ log.message }} +
    • + {{ log.priorityName }} - {{ log.message }} {% if log.context is defined and log.context is not empty %}
      @@ -65,6 +65,8 @@ {% endif %}
    • + {% else %} +
    • No logs available for this priority.
    • {% endfor %}
    {% else %} diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig index b44e312..dee250b 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_style.html.twig @@ -55,7 +55,7 @@ .sf-toolbar-block .sf-toolbar-info-piece:last-child { padding-bottom: 0; } - + .sf-toolbar-block .sf-toolbar-info-piece a, .sf-toolbar-block .sf-toolbar-info-piece abbr { color: #2f2f2f; diff --git a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php index 372040a..48f3cc7 100644 --- a/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Bundle/WebProfilerBundle/Tests/DependencyInjection/WebProfilerExtensionTest.php @@ -28,7 +28,7 @@ class WebProfilerExtensionTest extends TestCase */ private $container; - static public function assertSaneContainer(Container $container, $message = '') + public static function assertSaneContainer(Container $container, $message = '') { $errors = array(); foreach ($container->getServiceIds() as $id) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Cookie.php b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Cookie.php index 16063ee..148767d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Cookie.php +++ b/vendor/symfony/symfony/src/Symfony/Component/BrowserKit/Cookie.php @@ -117,7 +117,7 @@ class Cookie * * @api */ - static public function fromString($cookie, $url = null) + public static function fromString($cookie, $url = null) { $parts = explode(';', $cookie); diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php index b01beb7..7f5bdd1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassCollectionLoader.php @@ -18,8 +18,8 @@ namespace Symfony\Component\ClassLoader; */ class ClassCollectionLoader { - static private $loaded; - static private $seen; + private static $loaded; + private static $seen; /** * Loads a list of classes and caches them in one big file. @@ -33,7 +33,7 @@ class ClassCollectionLoader * * @throws \InvalidArgumentException When class can't be loaded */ - static public function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php') + public static function load($classes, $cacheDir, $name, $autoReload, $adaptive = false, $extension = '.php') { // each $name can only be loaded once per PHP process if (isset(self::$loaded[$name])) { @@ -133,7 +133,7 @@ class ClassCollectionLoader * * @return string Namespaces with brackets */ - static public function fixNamespaceDeclarations($source) + public static function fixNamespaceDeclarations($source) { if (!function_exists('token_get_all')) { return $source; @@ -188,7 +188,7 @@ class ClassCollectionLoader * * @throws \RuntimeException when a cache file cannot be written */ - static private function writeCacheFile($file, $content) + private static function writeCacheFile($file, $content) { $tmpFile = tempnam(dirname($file), basename($file)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { @@ -210,7 +210,7 @@ class ClassCollectionLoader * * @return string The PHP string with the comments removed */ - static private function stripComments($source) + private static function stripComments($source) { if (!function_exists('token_get_all')) { return $source; @@ -240,7 +240,7 @@ class ClassCollectionLoader * * @throws \InvalidArgumentException When a class can't be loaded */ - static private function getOrderedClasses(array $classes) + private static function getOrderedClasses(array $classes) { $map = array(); self::$seen = array(); @@ -257,7 +257,7 @@ class ClassCollectionLoader return $map; } - static private function getClassHierarchy(\ReflectionClass $class) + private static function getClassHierarchy(\ReflectionClass $class) { if (isset(self::$seen[$class->getName()])) { return array(); @@ -283,18 +283,27 @@ class ClassCollectionLoader } } - foreach ($class->getInterfaces() as $interface) { - if ($interface->isUserDefined() && !isset(self::$seen[$interface->getName()])) { - self::$seen[$interface->getName()] = true; + return array_merge(self::getInterfaces($class), $classes); + } - array_unshift($classes, $interface); - } + private static function getInterfaces(\ReflectionClass $class) + { + $classes = array(); + + foreach ($class->getInterfaces() as $interface) { + $classes = array_merge($classes, self::getInterfaces($interface)); + } + + if ($class->isUserDefined() && $class->isInterface() && !isset(self::$seen[$class->getName()])) { + self::$seen[$class->getName()] = true; + + $classes[] = $class; } return $classes; } - static private function getTraits(\ReflectionClass $class) + private static function getTraits(\ReflectionClass $class) { $traits = $class->getTraits(); $classes = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassMapGenerator.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassMapGenerator.php index 91ea9af..b0e6580 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassMapGenerator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/ClassMapGenerator.php @@ -24,7 +24,7 @@ class ClassMapGenerator * @param array|string $dirs Directories or a single path to search in * @param string $file The name of the class map file */ - static public function dump($dirs, $file) + public static function dump($dirs, $file) { $dirs = (array) $dirs; $maps = array(); @@ -43,7 +43,7 @@ class ClassMapGenerator * * @return array A class map array */ - static public function createMap($dir) + public static function createMap($dir) { if (is_string($dir)) { $dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($dir)); @@ -80,7 +80,7 @@ class ClassMapGenerator * * @return array The found classes */ - static private function findClasses($path) + private static function findClasses($path) { $contents = file_get_contents($path); $tokens = token_get_all($contents); diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugClassLoader.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugClassLoader.php index da7d289..dbfb5ab 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugClassLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugClassLoader.php @@ -42,7 +42,7 @@ class DebugClassLoader /** * Replaces all autoloaders implementing a findFile method by a DebugClassLoader wrapper. */ - static public function enable() + public static function enable() { if (!is_array($functions = spl_autoload_functions())) { return; diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php index 8cc6747..96c6290 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/DebugUniversalClassLoader.php @@ -21,7 +21,7 @@ class DebugUniversalClassLoader extends UniversalClassLoader /** * Replaces all regular UniversalClassLoader instances by a DebugUniversalClassLoader ones. */ - static public function enable() + public static function enable() { if (!is_array($functions = spl_autoload_functions())) { return; diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php index 58d96d8..90eca1d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/ClassCollectionLoaderTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\ClassLoader\Tests; use Symfony\Component\ClassLoader\ClassCollectionLoader; +require_once __DIR__.'/Fixtures/ClassesWithParents/GInterface.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/CInterface.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/B.php'; require_once __DIR__.'/Fixtures/ClassesWithParents/A.php'; @@ -25,6 +26,7 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase public function testClassReordering(array $classes) { $expected = array( + 'ClassesWithParents\\GInterface', 'ClassesWithParents\\CInterface', 'ClassesWithParents\\B', 'ClassesWithParents\\A', @@ -45,6 +47,7 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase array(array( 'ClassesWithParents\\A', 'ClassesWithParents\\CInterface', + 'ClassesWithParents\\GInterface', 'ClassesWithParents\\B', )), array(array( @@ -81,6 +84,7 @@ class ClassCollectionLoaderTest extends \PHPUnit_Framework_TestCase require_once __DIR__.'/Fixtures/ClassesWithParents/E.php'; $expected = array( + 'ClassesWithParents\\GInterface', 'ClassesWithParents\\CInterface', 'ClassesWithParents\\CTrait', 'ClassesWithParents\\ATrait', diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CInterface.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CInterface.php index 12074f6..8eec389 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/CInterface.php @@ -2,4 +2,6 @@ namespace ClassesWithParents; -interface CInterface {} +interface CInterface extends GInterface +{ +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/GInterface.php b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/GInterface.php new file mode 100644 index 0000000..208a19d --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/ClassLoader/Tests/Fixtures/ClassesWithParents/GInterface.php @@ -0,0 +1,7 @@ +=5.3.3" }, diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php index 2c422c8..170a903 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ArrayNode.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Config\Definition; - use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\Definition\Exception\InvalidTypeException; use Symfony\Component\Config\Definition\Exception\UnsetKeyException; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php index 91d5175..099da4b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/BaseNode.php @@ -221,7 +221,7 @@ abstract class BaseNode implements NodeInterface * * @throws ForbiddenOverwriteException */ - public final function merge($leftSide, $rightSide) + final public function merge($leftSide, $rightSide) { if (!$this->allowOverwrite) { throw new ForbiddenOverwriteException(sprintf( @@ -245,7 +245,7 @@ abstract class BaseNode implements NodeInterface * * @return mixed The normalized value. */ - public final function normalize($value) + final public function normalize($value) { // run custom normalization closures foreach ($this->normalizationClosures as $closure) { @@ -273,7 +273,7 @@ abstract class BaseNode implements NodeInterface * * @return mixed The finalized value */ - public final function finalize($value) + final public function finalize($value) { $this->validateType($value); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php index ff47958..1db01de 100755 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/EnumNodeDefinition.php @@ -12,30 +12,32 @@ use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition; */ class EnumNodeDefinition extends ScalarNodeDefinition { - private $values; - - public function values(array $values) - { - $values = array_unique($values); - - if (count($values) <= 1) { - throw new \InvalidArgumentException('->values() must be called with at least two distinct values.'); - } - - $this->values = $values; - } + private $values; - /** - * Instantiate a Node - * - * @return EnumNode The node - */ - protected function instantiateNode() + public function values(array $values) + { + $values = array_unique($values); + + if (count($values) <= 1) { + throw new \InvalidArgumentException('->values() must be called with at least two distinct values.'); + } + + $this->values = $values; + + return $this; + } + + /** + * Instantiate a Node + * + * @return EnumNode The node + */ + protected function instantiateNode() { if (null === $this->values) { throw new \RuntimeException('You must call ->values() on enum nodes.'); } - - return new EnumNode($this->name, $this->parent, $this->values); - } + + return new EnumNode($this->name, $this->parent, $this->values); + } } \ No newline at end of file diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php index 28474fd..10d2e00 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/ExprBuilder.php @@ -214,11 +214,11 @@ class ExprBuilder * * @return array */ - static public function buildExpressions(array $expressions) + public static function buildExpressions(array $expressions) { foreach ($expressions as $k => $expr) { if ($expr instanceof ExprBuilder) { - $expressions[$k] = function($v) use($expr) { + $expressions[$k] = function($v) use ($expr) { return call_user_func($expr->ifPart, $v) ? call_user_func($expr->thenPart, $v) : $v; }; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php index 2d95954..005c26b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Builder/ParentNodeDefinitionInterface.php @@ -18,9 +18,9 @@ namespace Symfony\Component\Config\Definition\Builder; */ interface ParentNodeDefinitionInterface { - function children(); + public function children(); - function append(NodeDefinition $node); + public function append(NodeDefinition $node); - function setBuilder(NodeBuilder $builder); + public function setBuilder(NodeBuilder $builder); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ConfigurationInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ConfigurationInterface.php index dc189e2..336cb00 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ConfigurationInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/ConfigurationInterface.php @@ -23,5 +23,5 @@ interface ConfigurationInterface * * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder */ - function getConfigTreeBuilder(); + public function getConfigTreeBuilder(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/EnumNode.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/EnumNode.php index 301dfd7..9bfb467 100755 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/EnumNode.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/EnumNode.php @@ -47,4 +47,4 @@ class EnumNode extends ScalarNode return $value; } -} \ No newline at end of file +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/NodeInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/NodeInterface.php index 89c4360..cdbc0ef 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/NodeInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/NodeInterface.php @@ -26,28 +26,28 @@ interface NodeInterface * * @return string The name of the node */ - function getName(); + public function getName(); /** * Returns the path of the node. * * @return string The node path */ - function getPath(); + public function getPath(); /** * Returns true when the node is required. * * @return Boolean If the node is required */ - function isRequired(); + public function isRequired(); /** * Returns true when the node has a default value. * * @return Boolean If the node has a default value */ - function hasDefaultValue(); + public function hasDefaultValue(); /** * Returns the default value of the node. @@ -55,7 +55,7 @@ interface NodeInterface * @return mixed The default value * @throws \RuntimeException if the node has no default value */ - function getDefaultValue(); + public function getDefaultValue(); /** * Normalizes the supplied value. @@ -64,7 +64,7 @@ interface NodeInterface * * @return mixed The normalized value */ - function normalize($value); + public function normalize($value); /** * Merges two values together. @@ -74,7 +74,7 @@ interface NodeInterface * * @return mixed The merged values */ - function merge($leftSide, $rightSide); + public function merge($leftSide, $rightSide); /** * Finalizes a value. @@ -83,5 +83,5 @@ interface NodeInterface * * @return mixed The finalized value */ - function finalize($value); + public function finalize($value); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php index a6c3181..a40d2c7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/Processor.php @@ -65,7 +65,7 @@ class Processor * * @return array the config with normalized keys */ - static public function normalizeKeys(array $config) + public static function normalizeKeys(array $config) { foreach ($config as $key => $value) { if (is_array($value)) { @@ -104,7 +104,7 @@ class Processor * * @return array */ - static public function normalizeConfig($config, $key, $plural = null) + public static function normalizeConfig($config, $key, $plural = null) { if (null === $plural) { $plural = $key.'s'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/PrototypeNodeInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/PrototypeNodeInterface.php index 8f08c98..8bbb84d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/PrototypeNodeInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Definition/PrototypeNodeInterface.php @@ -23,5 +23,5 @@ interface PrototypeNodeInterface extends NodeInterface * * @param string $name The name of the node */ - function setName($name); + public function setName($name); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/FileLocatorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Config/FileLocatorInterface.php index d756b83..4ff19b4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/FileLocatorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/FileLocatorInterface.php @@ -27,5 +27,5 @@ interface FileLocatorInterface * * @throws \InvalidArgumentException When file is not found */ - function locate($name, $currentPath = null, $first = true); + public function locate($name, $currentPath = null, $first = true); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php index 39c36b4..c4e3ced 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php @@ -22,7 +22,7 @@ use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceExceptio */ abstract class FileLoader extends Loader { - static protected $loading = array(); + protected static $loading = array(); protected $locator; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/LoaderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/LoaderInterface.php index 10bfefc..d0ac5b8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/LoaderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/LoaderInterface.php @@ -24,7 +24,7 @@ interface LoaderInterface * @param mixed $resource The resource * @param string $type The resource type */ - function load($resource, $type = null); + public function load($resource, $type = null); /** * Returns true if this class supports the given resource. @@ -34,20 +34,20 @@ interface LoaderInterface * * @return Boolean true if this class supports the given resource, false otherwise */ - function supports($resource, $type = null); + public function supports($resource, $type = null); /** * Gets the loader resolver. * * @return LoaderResolverInterface A LoaderResolverInterface instance */ - function getResolver(); + public function getResolver(); /** * Sets the loader resolver. * * @param LoaderResolverInterface $resolver A LoaderResolverInterface instance */ - function setResolver(LoaderResolverInterface $resolver); + public function setResolver(LoaderResolverInterface $resolver); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php index f660401..57d8781 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/LoaderResolverInterface.php @@ -26,5 +26,5 @@ interface LoaderResolverInterface * * @return LoaderInterface A LoaderInterface instance */ - function resolve($resource, $type = null); + public function resolve($resource, $type = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ResourceInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ResourceInterface.php index 024f2e9..d624a57 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ResourceInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Resource/ResourceInterface.php @@ -23,7 +23,7 @@ interface ResourceInterface * * @return string A string representation of the Resource */ - function __toString(); + public function __toString(); /** * Returns true if the resource has not been updated since the given timestamp. @@ -32,12 +32,12 @@ interface ResourceInterface * * @return Boolean true if the resource has not been updated, false otherwise */ - function isFresh($timestamp); + public function isFresh($timestamp); /** * Returns the resource tied to this Resource. * * @return mixed The resource */ - function getResource(); + public function getResource(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php index 8369f71..ea5fffe 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php @@ -58,4 +58,3 @@ class BooleanNodeTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php index 9f1955e..b3c9f87 100755 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/EnumNodeDefinitionTest.php @@ -34,4 +34,4 @@ class EnumNodeDefinitionTest extends \PHPUnit_Framework_TestCase $node = $def->getNode(); $this->assertEquals(array('foo', 'bar'), $node->getValues()); } -} \ No newline at end of file +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php index 7d4c72b..6e7480f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Config\Tests\Definition\Builder; use Symfony\Component\Config\Definition\Builder\TreeBuilder; - class ExprBuilderTest extends \PHPUnit_Framework_TestCase { @@ -160,6 +159,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase protected function getTestBuilder() { $builder = new TreeBuilder(); + return $builder ->root('test') ->children() @@ -191,7 +191,8 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase * @param $val The value that the closure must return * @return Closure */ - protected function returnClosure($val) { + protected function returnClosure($val) + { return function($v) use ($val) { return $val; }; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php index 9c18da6..8e3d66a 100755 --- a/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Config/Tests/Definition/EnumNodeTest.php @@ -38,4 +38,4 @@ class EnumNodeTest extends \PHPUnit_Framework_TestCase $node = new EnumNode('foo', null, array('foo', 'bar')); $node->finalize('foobar'); } -} \ No newline at end of file +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php index ec65e69..cab5fe5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php @@ -619,7 +619,7 @@ class Application * * @return array An array of abbreviations */ - static public function getAbbreviations($names) + public static function getAbbreviations($names) { $abbrevs = array(); foreach ($names as $name) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatter.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatter.php index 62e0754..e509ade 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatter.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatter.php @@ -23,12 +23,24 @@ class OutputFormatter implements OutputFormatterInterface /** * The pattern to phrase the format. */ - const FORMAT_PATTERN = '#<(/?)([a-z][a-z0-9_=;-]+)?>([^<]*)#is'; + const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?:(?!\\\\?<).)*)#is'; private $decorated; private $styles = array(); private $styleStack; + /** + * Escapes "<" special char in given text. + * + * @param string $text Text to escape + * + * @return string Escaped text + */ + public static function escape($text) + { + return preg_replace('/([^\\\\]?)" tag $this->styleStack->pop(); - return $this->applyStyle($this->styleStack->getCurrent(), $match[3]); + return $this->applyStyle($this->styleStack->getCurrent(), $match[4]); } // we got "<>" tag - return '<>'.$match[3]; + return '<>'.$match[4]; } - if (isset($this->styles[strtolower($match[2])])) { - $style = $this->styles[strtolower($match[2])]; + if (isset($this->styles[strtolower($match[3])])) { + $style = $this->styles[strtolower($match[3])]; } else { - $style = $this->createStyleFromString($match[2]); + $style = $this->createStyleFromString($match[3]); if (false === $style) { return $match[0]; } } - if ('/' === $match[1]) { + if ('/' === $match[2]) { $this->styleStack->pop($style); } else { $this->styleStack->push($style); } - return $this->applyStyle($this->styleStack->getCurrent(), $match[3]); + return $this->applyStyle($this->styleStack->getCurrent(), $match[4]); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php index ca9f9d0..0836084 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterInterface.php @@ -27,7 +27,7 @@ interface OutputFormatterInterface * * @api */ - function setDecorated($decorated); + public function setDecorated($decorated); /** * Gets the decorated flag. @@ -36,7 +36,7 @@ interface OutputFormatterInterface * * @api */ - function isDecorated(); + public function isDecorated(); /** * Sets a new style. @@ -46,7 +46,7 @@ interface OutputFormatterInterface * * @api */ - function setStyle($name, OutputFormatterStyleInterface $style); + public function setStyle($name, OutputFormatterStyleInterface $style); /** * Checks if output formatter has style with specified name. @@ -57,7 +57,7 @@ interface OutputFormatterInterface * * @api */ - function hasStyle($name); + public function hasStyle($name); /** * Gets style options from style with specified name. @@ -68,7 +68,7 @@ interface OutputFormatterInterface * * @api */ - function getStyle($name); + public function getStyle($name); /** * Formats a message according to the given styles. @@ -79,5 +79,5 @@ interface OutputFormatterInterface * * @api */ - function format($message); + public function format($message); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php index ad02b94..3c6b8ad 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php @@ -20,7 +20,7 @@ namespace Symfony\Component\Console\Formatter; */ class OutputFormatterStyle implements OutputFormatterStyleInterface { - static private $availableForegroundColors = array( + private static $availableForegroundColors = array( 'black' => 30, 'red' => 31, 'green' => 32, @@ -30,7 +30,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface 'cyan' => 36, 'white' => 37 ); - static private $availableBackgroundColors = array( + private static $availableBackgroundColors = array( 'black' => 40, 'red' => 41, 'green' => 42, @@ -40,7 +40,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface 'cyan' => 46, 'white' => 47 ); - static private $availableOptions = array( + private static $availableOptions = array( 'bold' => 1, 'underscore' => 4, 'blink' => 5, diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php index 3d84d96..b5a55fe 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php @@ -27,7 +27,7 @@ interface OutputFormatterStyleInterface * * @api */ - function setForeground($color = null); + public function setForeground($color = null); /** * Sets style background color. @@ -36,7 +36,7 @@ interface OutputFormatterStyleInterface * * @api */ - function setBackground($color = null); + public function setBackground($color = null); /** * Sets some specific style option. @@ -45,21 +45,21 @@ interface OutputFormatterStyleInterface * * @api */ - function setOption($option); + public function setOption($option); /** * Unsets some specific style option. * * @param string $option Theoption name */ - function unsetOption($option); + public function unsetOption($option); /** * Sets multiple style options at once. * * @param array $options */ - function setOptions(array $options); + public function setOptions(array $options); /** * Applies the style to a given text. @@ -68,5 +68,5 @@ interface OutputFormatterStyleInterface * * @return string */ - function apply($text); + public function apply($text); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/FormatterHelper.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/FormatterHelper.php index dd9615b..34ae394 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/FormatterHelper.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/FormatterHelper.php @@ -11,6 +11,8 @@ namespace Symfony\Component\Console\Helper; +use Symfony\Component\Console\Formatter\OutputFormatter; + /** * The Formatter class provides helpers to format messages. * @@ -48,6 +50,7 @@ class FormatterHelper extends Helper $len = 0; $lines = array(); foreach ($messages as $message) { + $message = OutputFormatter::escape($message); $lines[] = sprintf($large ? ' %s ' : ' %s ', $message); $len = max($this->strlen($message) + ($large ? 4 : 2), $len); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/HelperInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/HelperInterface.php index 25ee513..6d39449 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/HelperInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Helper/HelperInterface.php @@ -27,7 +27,7 @@ interface HelperInterface * * @api */ - function setHelperSet(HelperSet $helperSet = null); + public function setHelperSet(HelperSet $helperSet = null); /** * Gets the helper set associated with this helper. @@ -36,7 +36,7 @@ interface HelperInterface * * @api */ - function getHelperSet(); + public function getHelperSet(); /** * Returns the canonical name of this helper. @@ -45,5 +45,5 @@ interface HelperInterface * * @api */ - function getName(); + public function getName(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Input/InputDefinition.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Input/InputDefinition.php index 9551e96..2db9222 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Input/InputDefinition.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Input/InputDefinition.php @@ -526,10 +526,6 @@ class InputDefinition private function formatDefaultValue($default) { - if (is_array($default) && $default === array_values($default)) { - return sprintf("array('%s')", implode("', '", $default)); - } - - return str_replace("\n", '', var_export($default, true)); + return json_encode($default); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Input/InputInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Input/InputInterface.php index 8a3d519..c39429d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Input/InputInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Input/InputInterface.php @@ -23,7 +23,7 @@ interface InputInterface * * @return string The value of the first argument or null otherwise */ - function getFirstArgument(); + public function getFirstArgument(); /** * Returns true if the raw parameters (not parsed) contain a value. @@ -35,7 +35,7 @@ interface InputInterface * * @return Boolean true if the value is contained in the raw parameters */ - function hasParameterOption($values); + public function hasParameterOption($values); /** * Returns the value of a raw option (not parsed). @@ -48,14 +48,14 @@ interface InputInterface * * @return mixed The option value */ - function getParameterOption($values, $default = false); + public function getParameterOption($values, $default = false); /** * Binds the current Input instance with the given arguments and options. * * @param InputDefinition $definition A InputDefinition instance */ - function bind(InputDefinition $definition); + public function bind(InputDefinition $definition); /** * Validates if arguments given are correct. @@ -64,14 +64,14 @@ interface InputInterface * * @throws \RuntimeException */ - function validate(); + public function validate(); /** * Returns all the given arguments merged with the default values. * * @return array */ - function getArguments(); + public function getArguments(); /** * Gets argument by name. @@ -80,7 +80,7 @@ interface InputInterface * * @return mixed */ - function getArgument($name); + public function getArgument($name); /** * Sets an argument value by name. @@ -90,7 +90,7 @@ interface InputInterface * * @throws \InvalidArgumentException When argument given doesn't exist */ - function setArgument($name, $value); + public function setArgument($name, $value); /** * Returns true if an InputArgument object exists by name or position. @@ -99,14 +99,14 @@ interface InputInterface * * @return Boolean true if the InputArgument object exists, false otherwise */ - function hasArgument($name); + public function hasArgument($name); /** * Returns all the given options merged with the default values. * * @return array */ - function getOptions(); + public function getOptions(); /** * Gets an option by name. @@ -115,7 +115,7 @@ interface InputInterface * * @return mixed */ - function getOption($name); + public function getOption($name); /** * Sets an option value by name. @@ -125,7 +125,7 @@ interface InputInterface * * @throws \InvalidArgumentException When option given doesn't exist */ - function setOption($name, $value); + public function setOption($name, $value); /** * Returns true if an InputOption object exists by name. @@ -134,19 +134,19 @@ interface InputInterface * * @return Boolean true if the InputOption object exists, false otherwise */ - function hasOption($name); + public function hasOption($name); /** * Is this input means interactive? * * @return Boolean */ - function isInteractive(); + public function isInteractive(); /** * Sets the input interactivity. * * @param Boolean $interactive If the input should be interactive */ - function setInteractive($interactive); + public function setInteractive($interactive); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Output/OutputInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Output/OutputInterface.php index 8423d48..88ffba8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Output/OutputInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Output/OutputInterface.php @@ -41,7 +41,7 @@ interface OutputInterface * * @api */ - function write($messages, $newline = false, $type = 0); + public function write($messages, $newline = false, $type = 0); /** * Writes a message to the output and adds a newline at the end. @@ -51,7 +51,7 @@ interface OutputInterface * * @api */ - function writeln($messages, $type = 0); + public function writeln($messages, $type = 0); /** * Sets the verbosity of the output. @@ -60,7 +60,7 @@ interface OutputInterface * * @api */ - function setVerbosity($level); + public function setVerbosity($level); /** * Gets the current verbosity of the output. @@ -69,7 +69,7 @@ interface OutputInterface * * @api */ - function getVerbosity(); + public function getVerbosity(); /** * Sets the decorated flag. @@ -78,7 +78,7 @@ interface OutputInterface * * @api */ - function setDecorated($decorated); + public function setDecorated($decorated); /** * Gets the decorated flag. @@ -87,7 +87,7 @@ interface OutputInterface * * @api */ - function isDecorated(); + public function isDecorated(); /** * Sets output formatter. @@ -96,7 +96,7 @@ interface OutputInterface * * @api */ - function setFormatter(OutputFormatterInterface $formatter); + public function setFormatter(OutputFormatterInterface $formatter); /** * Returns current output formatter instance. @@ -105,5 +105,5 @@ interface OutputInterface * * @api */ - function getFormatter(); + public function getFormatter(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php index 6fa4cff..9746507 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php @@ -21,9 +21,9 @@ use Symfony\Component\Console\Tester\ApplicationTester; class ApplicationTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/Fixtures/'); require_once self::$fixturesPath.'/FooCommand.php'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Command/CommandTest.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Command/CommandTest.php index 557116e..e248cff 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Command/CommandTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Command/CommandTest.php @@ -25,9 +25,9 @@ use Symfony\Component\Console\Tester\CommandTester; class CommandTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/../Fixtures/'; require_once self::$fixturesPath.'/TestCommand.php'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt index f717033..cad7dd5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Fixtures/application_run2.txt @@ -3,7 +3,7 @@ Usage: Arguments: command The command to execute - command_name The command name (default: 'help') + command_name The command name (default: "help") Options: --xml To output help as XML diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Fixtures/definition_astext.txt b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Fixtures/definition_astext.txt index 2ad6078..9dd5390 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Fixtures/definition_astext.txt +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Fixtures/definition_astext.txt @@ -1,11 +1,11 @@ Arguments: foo The foo argument baz The baz argument (default: true) - bar The bar argument (default: array('bar')) + bar The bar argument (default: ["bar"]) Options: --foo (-f) The foo option --baz The baz option (default: false) - --bar (-b) The bar option (default: 'bar') - --qux The qux option (default: array('foo', 'bar')) (multiple values allowed) - --qux2 The qux2 option (default: array ( 'foo' => 'bar',)) (multiple values allowed) + --bar (-b) The bar option (default: "bar") + --qux The qux option (default: ["foo","bar"]) (multiple values allowed) + --qux2 The qux2 option (default: {"foo":"bar"}) (multiple values allowed) diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php index 0d1bf41..6a5ffda 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterTest.php @@ -9,6 +9,7 @@ * file that was distributed with this source code. */ + namespace Symfony\Component\Console\Tests\Formatter; use Symfony\Component\Console\Formatter\OutputFormatter; @@ -22,6 +23,20 @@ class FormatterStyleTest extends \PHPUnit_Framework_TestCase $this->assertEquals("foo<>bar", $formatter->format('foo<>bar')); } + public function testLGCharEscaping() + { + $formatter = new OutputFormatter(true); + + $this->assertEquals("fooformat('foo\\assertEquals("some info", $formatter->format('\\some info\\')); + $this->assertEquals("\\some info\\", OutputFormatter::escape('some info')); + + $this->assertEquals( + "\033[33mSymfony\\Component\\Console does work very well!\033[0m", + $formatter->format('Symfony\Component\Console does work very well!') + ); + } + public function testBundledStyles() { $formatter = new OutputFormatter(true); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php index 430c077..5ab62a3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Helper/FormatterHelperTest.php @@ -68,4 +68,17 @@ class FormatterHelperTest extends \PHPUnit_Framework_TestCase '::formatBlock() formats a message in a block' ); } + + public function testFormatBlockLGEscaping() + { + $formatter = new FormatterHelper(); + + $this->assertEquals( + ' ' . "\n" . + ' \some info\ ' . "\n" . + ' ', + $formatter->formatBlock('some info', 'error', true), + '::formatBlock() escapes \'<\' chars' + ); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php index 2b339f0..20554ec 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Input/InputDefinitionTest.php @@ -17,11 +17,11 @@ use Symfony\Component\Console\Input\InputOption; class InputDefinitionTest extends \PHPUnit_Framework_TestCase { - static protected $fixtures; + protected static $fixtures; protected $foo, $bar, $foo1, $foo2; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixtures = __DIR__.'/../Fixtures/'; } @@ -97,7 +97,6 @@ class InputDefinitionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Cannot add an argument after an array argument.', $e->getMessage()); } - // cannot add a required argument after an optional one $definition = new InputDefinition(); $definition->addArgument($this->foo); diff --git a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/CssSelector.php b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/CssSelector.php index f5566be..f624fff 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/CssSelector.php +++ b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/CssSelector.php @@ -42,7 +42,7 @@ class CssSelector * * @api */ - static public function toXPath($cssExpr, $prefix = 'descendant-or-self::') + public static function toXPath($cssExpr, $prefix = 'descendant-or-self::') { if (is_string($cssExpr)) { if (!$cssExpr) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php index d37e4f1..13e3927 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php +++ b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/CombinedSelectorNode.php @@ -23,7 +23,7 @@ use Symfony\Component\CssSelector\Exception\ParseException; */ class CombinedSelectorNode implements NodeInterface { - static protected $methodMapping = array( + protected static $methodMapping = array( ' ' => 'descendant', '>' => 'child', '+' => 'direct_adjacent', diff --git a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/FunctionNode.php b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/FunctionNode.php index 959f29d..b392b27 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/FunctionNode.php +++ b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/FunctionNode.php @@ -24,7 +24,7 @@ use Symfony\Component\CssSelector\XPathExpr; */ class FunctionNode implements NodeInterface { - static protected $unsupported = array('target', 'lang', 'enabled', 'disabled'); + protected static $unsupported = array('target', 'lang', 'enabled', 'disabled'); protected $selector; protected $type; diff --git a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/NodeInterface.php b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/NodeInterface.php index 534f0dd..113b1b7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/NodeInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/NodeInterface.php @@ -26,12 +26,12 @@ interface NodeInterface * * @return string The string representation */ - function __toString(); + public function __toString(); /** * @return XPathExpr The XPath expression * * @throws ParseException When unknown operator is found */ - function toXpath(); + public function toXpath(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/PseudoNode.php b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/PseudoNode.php index 3f93b70..67f0beb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/PseudoNode.php +++ b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/Node/PseudoNode.php @@ -23,7 +23,7 @@ use Symfony\Component\CssSelector\Exception\ParseException; */ class PseudoNode implements NodeInterface { - static protected $unsupported = array( + protected static $unsupported = array( 'indeterminate', 'first-line', 'first-letter', 'selection', 'before', 'after', 'link', 'visited', 'active', 'focus', 'hover', diff --git a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/XPathExpr.php b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/XPathExpr.php index 2e239dd..507b8ac 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/CssSelector/XPathExpr.php +++ b/vendor/symfony/symfony/src/Symfony/Component/CssSelector/XPathExpr.php @@ -219,7 +219,7 @@ class XPathExpr * * @return string */ - static public function xpathLiteral($s) + public static function xpathLiteral($s) { if ($s instanceof Node\ElementNode) { // This is probably a symbol that looks like an expression... diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php index 1ae8bb9..beacda9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/CompilerPassInterface.php @@ -29,5 +29,5 @@ interface CompilerPassInterface * * @api */ - function process(ContainerBuilder $container); + public function process(ContainerBuilder $container); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php index 0c6c90d..6bd6161 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/LoggingFormatter.php @@ -11,7 +11,6 @@ namespace Symfony\Component\DependencyInjection\Compiler; - /** * Used to format logging messages during the compilation. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php index 81209c3..d60ae35 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Compiler/RepeatablePassInterface.php @@ -24,5 +24,5 @@ interface RepeatablePassInterface extends CompilerPassInterface * * @param RepeatedPass $repeatedPass */ - function setRepeatedPass(RepeatedPass $repeatedPass); + public function setRepeatedPass(RepeatedPass $repeatedPass); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php index 23bdbd6..88e1f26 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php @@ -448,7 +448,7 @@ class Container implements IntrospectableContainerInterface * * @return string The camelized string */ - static public function camelize($id) + public static function camelize($id) { return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $id); } @@ -460,7 +460,7 @@ class Container implements IntrospectableContainerInterface * * @return string The underscored string */ - static public function underscore($id) + public static function underscore($id) { return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.'))); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php index 1879ec0..eb96632 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerAwareInterface.php @@ -27,5 +27,5 @@ interface ContainerAwareInterface * * @api */ - function setContainer(ContainerInterface $container = null); + public function setContainer(ContainerInterface $container = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index 223ceea..692cf91 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -854,7 +854,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface * * @return array An array of Service conditionals */ - static public function getServiceConditionals($value) + public static function getServiceConditionals($value) { $services = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerInterface.php index 6a5988e..d5e07a0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ContainerInterface.php @@ -38,7 +38,7 @@ interface ContainerInterface * * @api */ - function set($id, $service, $scope = self::SCOPE_CONTAINER); + public function set($id, $service, $scope = self::SCOPE_CONTAINER); /** * Gets a service. @@ -54,7 +54,7 @@ interface ContainerInterface * * @api */ - function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); + public function get($id, $invalidBehavior = self::EXCEPTION_ON_INVALID_REFERENCE); /** * Returns true if the given service is defined. @@ -65,7 +65,7 @@ interface ContainerInterface * * @api */ - function has($id); + public function has($id); /** * Gets a parameter. @@ -78,7 +78,7 @@ interface ContainerInterface * * @api */ - function getParameter($name); + public function getParameter($name); /** * Checks if a parameter exists. @@ -89,7 +89,7 @@ interface ContainerInterface * * @api */ - function hasParameter($name); + public function hasParameter($name); /** * Sets a parameter. @@ -99,7 +99,7 @@ interface ContainerInterface * * @api */ - function setParameter($name, $value); + public function setParameter($name, $value); /** * Enters the given scope @@ -108,7 +108,7 @@ interface ContainerInterface * * @api */ - function enterScope($name); + public function enterScope($name); /** * Leaves the current scope, and re-enters the parent scope @@ -117,7 +117,7 @@ interface ContainerInterface * * @api */ - function leaveScope($name); + public function leaveScope($name); /** * Adds a scope to the container @@ -126,7 +126,7 @@ interface ContainerInterface * * @api */ - function addScope(ScopeInterface $scope); + public function addScope(ScopeInterface $scope); /** * Whether this container has the given scope @@ -137,7 +137,7 @@ interface ContainerInterface * * @api */ - function hasScope($name); + public function hasScope($name); /** * Determines whether the given scope is currently active. @@ -150,5 +150,5 @@ interface ContainerInterface * * @api */ - function isScopeActive($name); + public function isScopeActive($name); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php index 6972cbf..ba146f6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/DumperInterface.php @@ -29,5 +29,5 @@ interface DumperInterface * * @api */ - function dump(array $options = array()); + public function dump(array $options = array()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php index 113a242..d8791ce 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php @@ -281,7 +281,7 @@ class XmlDumper extends Dumper * * @param mixed $value Value to convert */ - static public function phpToXml($value) + public static function phpToXml($value) { switch (true) { case null === $value: diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php index 4f33a9b..1d96d24 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/ConfigurationExtensionInterface.php @@ -28,5 +28,5 @@ interface ConfigurationExtensionInterface * * @return ConfigurationInterface|null The configuration or null */ - function getConfiguration(array $config, ContainerBuilder $container); + public function getConfiguration(array $config, ContainerBuilder $container); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php index 09ebcd8..fc015e1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Extension/ExtensionInterface.php @@ -32,7 +32,7 @@ interface ExtensionInterface * * @api */ - function load(array $config, ContainerBuilder $container); + public function load(array $config, ContainerBuilder $container); /** * Returns the namespace to be used for this extension (XML namespace). @@ -41,7 +41,7 @@ interface ExtensionInterface * * @api */ - function getNamespace(); + public function getNamespace(); /** * Returns the base path for the XSD files. @@ -50,7 +50,7 @@ interface ExtensionInterface * * @api */ - function getXsdValidationBasePath(); + public function getXsdValidationBasePath(); /** * Returns the recommended alias to use in XML. @@ -61,5 +61,5 @@ interface ExtensionInterface * * @api */ - function getAlias(); + public function getAlias(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php index 0ffc729..34d6cad 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/IntrospectableContainerInterface.php @@ -28,6 +28,6 @@ interface IntrospectableContainerInterface extends ContainerInterface * @return Boolean true if the service has been initialized, false otherwise * */ - function initialized($id); + public function initialized($id); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php index 564cb36..7525027 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php @@ -448,7 +448,7 @@ EOF * * @return array A PHP array */ - static public function convertDomElementToArray(\DomElement $element) + public static function convertDomElementToArray(\DomElement $element) { $empty = true; $config = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php index a9a4f02..a26d6ae 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php @@ -27,7 +27,7 @@ interface ParameterBagInterface * * @api */ - function clear(); + public function clear(); /** * Adds parameters to the service container parameters. @@ -36,7 +36,7 @@ interface ParameterBagInterface * * @api */ - function add(array $parameters); + public function add(array $parameters); /** * Gets the service container parameters. @@ -45,7 +45,7 @@ interface ParameterBagInterface * * @api */ - function all(); + public function all(); /** * Gets a service container parameter. @@ -58,7 +58,7 @@ interface ParameterBagInterface * * @api */ - function get($name); + public function get($name); /** * Sets a service container parameter. @@ -68,7 +68,7 @@ interface ParameterBagInterface * * @api */ - function set($name, $value); + public function set($name, $value); /** * Returns true if a parameter name is defined. @@ -79,12 +79,12 @@ interface ParameterBagInterface * * @api */ - function has($name); + public function has($name); /** * Replaces parameter placeholders (%name%) by their values for all parameters. */ - function resolve(); + public function resolve(); /** * Replaces parameter placeholders (%name%) by their values. @@ -93,7 +93,7 @@ interface ParameterBagInterface * * @throws ParameterNotFoundException if a placeholder references a parameter that does not exist */ - function resolveValue($value); + public function resolveValue($value); /** * Escape parameter placeholders % @@ -102,7 +102,7 @@ interface ParameterBagInterface * * @return mixed */ - function escapeValue($value); + public function escapeValue($value); /** * Unescape parameter placeholders % @@ -111,5 +111,5 @@ interface ParameterBagInterface * * @return mixed */ - function unescapeValue($value); + public function unescapeValue($value); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ScopeInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ScopeInterface.php index 44b8c5d..81ac67c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ScopeInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/ScopeInterface.php @@ -23,10 +23,10 @@ interface ScopeInterface /** * @api */ - function getName(); + public function getName(); /** * @api */ - function getParentName(); + public function getParentName(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/SimpleXMLElement.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/SimpleXMLElement.php index 457d54f..d154602 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/SimpleXMLElement.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/SimpleXMLElement.php @@ -99,7 +99,7 @@ class SimpleXMLElement extends \SimpleXMLElement * * @return mixed */ - static public function phpize($value) + public static function phpize($value) { $value = (string) $value; $lowercaseValue = strtolower($value); diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/TaggedContainerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/TaggedContainerInterface.php index 81adb20..3b48817 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/TaggedContainerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/TaggedContainerInterface.php @@ -29,5 +29,5 @@ interface TaggedContainerInterface extends ContainerInterface * * @api */ - function findTaggedServiceIds($name); + public function findTaggedServiceIds($name); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 4d650f9..c9e6b07 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -550,5 +550,4 @@ class ContainerBuilderTest extends \PHPUnit_Framework_TestCase } } - class FooClass {} diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php index 557c207..ec82cc1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/CrossCheckTest.php @@ -16,7 +16,7 @@ use Symfony\Component\Config\FileLocator; class CrossCheckTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ class CrossCheckTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/Fixtures/'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php index 69e775d..d3b93fd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper; class GraphvizDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ class GraphvizDumperTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = __DIR__.'/../Fixtures/'; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php index a072356..c1e2070 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php @@ -19,7 +19,7 @@ use Symfony\Component\DependencyInjection\Definition; class PhpDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -28,7 +28,7 @@ class PhpDumperTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php index 6618982..b2cddb5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/XmlDumperTest.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\Dumper\XmlDumper; class XmlDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ class XmlDumperTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php index 2dcb3b8..47cc4be 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Dumper/YamlDumperTest.php @@ -16,7 +16,7 @@ use Symfony\Component\DependencyInjection\Dumper\YamlDumper; class YamlDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -25,7 +25,7 @@ class YamlDumperTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php index 3c27376..514df23 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/classes.php @@ -16,17 +16,17 @@ class BazClass $instance->configure(); } - static public function getInstance() + public static function getInstance() { return new self(); } - static public function configureStatic($instance) + public static function configureStatic($instance) { $instance->configure(); } - static public function configureStatic1() + public static function configureStatic1() { } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php index 2c53122..180bb38 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Fixtures/includes/foo.php @@ -11,7 +11,7 @@ class FooClass $this->arguments = $arguments; } - static public function getInstance($arguments = array()) + public static function getInstance($arguments = array()) { $obj = new self($arguments); $obj->called = true; diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php index 448934c..bba9c8c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/IniFileLoaderTest.php @@ -17,12 +17,12 @@ use Symfony\Component\Config\FileLocator; class IniFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected $container; protected $loader; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 1a157e6..12109c2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -25,7 +25,7 @@ use Symfony\Component\Config\FileLocator; class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -34,7 +34,7 @@ class XmlFileLoaderTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); require_once self::$fixturesPath.'/includes/foo.php'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php index 35b5985..e655d3b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Tests/Loader/YamlFileLoaderTest.php @@ -23,7 +23,7 @@ use Symfony\Component\Config\FileLocator; class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; protected function setUp() { @@ -36,7 +36,7 @@ class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase } } - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); require_once self::$fixturesPath.'/includes/foo.php'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Crawler.php b/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Crawler.php index 03c1dc5..b408d7d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Crawler.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Crawler.php @@ -667,7 +667,7 @@ class Crawler extends \SplObjectStorage * @return string Converted string * */ - static public function xpathLiteral($s) + public static function xpathLiteral($s) { if (false === strpos($s, "'")) { return sprintf("'%s'", $s); diff --git a/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Form.php b/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Form.php index 9e60711..9106a23 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Form.php +++ b/vendor/symfony/symfony/src/Symfony/Component/DomCrawler/Form.php @@ -525,7 +525,7 @@ class FormFieldRegistry * * @return FormFieldRegistry */ - static private function create($base, array $values) + private static function create($base, array $values) { $registry = new static(); $registry->base = $base; diff --git a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php index 0a53876..a67a979 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Debug/TraceableEventDispatcherInterface.php @@ -21,12 +21,12 @@ interface TraceableEventDispatcherInterface * * @return array An array of called listeners */ - function getCalledListeners(); + public function getCalledListeners(); /** * Gets the not called listeners. * * @return array An array of not called listeners */ - function getNotCalledListeners(); + public function getNotCalledListeners(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php index e53d71d..7aead23 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventDispatcherInterface.php @@ -35,7 +35,7 @@ interface EventDispatcherInterface * * @api */ - function dispatch($eventName, Event $event = null); + public function dispatch($eventName, Event $event = null); /** * Adds an event listener that listens on the specified events. @@ -47,7 +47,7 @@ interface EventDispatcherInterface * * @api */ - function addListener($eventName, $listener, $priority = 0); + public function addListener($eventName, $listener, $priority = 0); /** * Adds an event subscriber. @@ -59,7 +59,7 @@ interface EventDispatcherInterface * * @api */ - function addSubscriber(EventSubscriberInterface $subscriber); + public function addSubscriber(EventSubscriberInterface $subscriber); /** * Removes an event listener from the specified events. @@ -67,14 +67,14 @@ interface EventDispatcherInterface * @param string|array $eventName The event(s) to remove a listener from * @param callable $listener The listener to remove */ - function removeListener($eventName, $listener); + public function removeListener($eventName, $listener); /** * Removes an event subscriber. * * @param EventSubscriberInterface $subscriber The subscriber */ - function removeSubscriber(EventSubscriberInterface $subscriber); + public function removeSubscriber(EventSubscriberInterface $subscriber); /** * Gets the listeners of a specific event or all listeners. @@ -83,7 +83,7 @@ interface EventDispatcherInterface * * @return array The event listeners for the specified event, or all event listeners by event name */ - function getListeners($eventName = null); + public function getListeners($eventName = null); /** * Checks whether an event has any registered listeners. @@ -92,5 +92,5 @@ interface EventDispatcherInterface * * @return Boolean true if the specified event has any listeners, false otherwise */ - function hasListeners($eventName = null); + public function hasListeners($eventName = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php index 1e85b98..080f892 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/EventSubscriberInterface.php @@ -46,5 +46,5 @@ interface EventSubscriberInterface * * @api */ - static function getSubscribedEvents(); + public static function getSubscribedEvents(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php index c62fc10..71f3ad0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Tests/ContainerAwareEventDispatcherTest.php @@ -235,14 +235,14 @@ class ContainerAwareEventDispatcherTest extends \PHPUnit_Framework_TestCase class Service { - function onEvent(Event $e) + public function onEvent(Event $e) { } } class SubscriberService implements EventSubscriberInterface { - static function getSubscribedEvents() + public static function getSubscribedEvents() { return array( 'onEvent' => 'onEvent', @@ -251,7 +251,7 @@ class SubscriberService implements EventSubscriberInterface ); } - function onEvent(Event $e) + public function onEvent(Event $e) { } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Tests/EventTest.php b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Tests/EventTest.php index cbc3910..52aa9ad 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Tests/EventTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Tests/EventTest.php @@ -29,7 +29,6 @@ class EventTest extends \PHPUnit_Framework_TestCase */ protected $dispatcher; - /** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php b/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php index 1b6721b..8bf81c9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Filesystem.php @@ -302,21 +302,28 @@ class Filesystem $startPath = strtr($startPath, '\\', '/'); } - // Find for which character the the common path stops - $offset = 0; - while (isset($startPath[$offset]) && isset($endPath[$offset]) && $startPath[$offset] === $endPath[$offset]) { - $offset++; + // Split the paths into arrays + $startPathArr = explode('/', trim($startPath, '/')); + $endPathArr = explode('/', trim($endPath, '/')); + + // Find for which directory the common path stops + $index = 0; + while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) { + $index++; } // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels) - $diffPath = trim(substr($startPath, $offset), '/'); - $depth = strlen($diffPath) > 0 ? substr_count($diffPath, '/') + 1 : 0; + $depth = count($startPathArr) - $index; // Repeated "../" for each level need to reach the common path $traverser = str_repeat('../', $depth); + $endPathRemainder = implode('/', array_slice($endPathArr, $index)); + // Construct $endPath from traversing to the common path, then to the remaining $endPath - return $traverser.substr($endPath, $offset); + $relativePath = $traverser . (strlen($endPathRemainder) > 0 ? $endPathRemainder . '/' : ''); + + return (strlen($relativePath) === 0) ? './' : $relativePath; } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php b/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php index a29155c..3a935e1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Filesystem/Tests/FilesystemTest.php @@ -733,6 +733,22 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase array('var/lib/symfony/', 'var/lib/symfony/src/Symfony/Component', '../../../'), array('/usr/lib/symfony/', '/var/lib/symfony/src/Symfony/Component', '../../../../../../usr/lib/symfony/'), array('/var/lib/symfony/src/Symfony/', '/var/lib/symfony/', 'src/Symfony/'), + array('/aa/bb', '/aa/bb', './'), + array('/aa/bb', '/aa/bb/', './'), + array('/aa/bb/', '/aa/bb', './'), + array('/aa/bb/', '/aa/bb/', './'), + array('/aa/bb/cc', '/aa/bb/cc/dd', '../'), + array('/aa/bb/cc', '/aa/bb/cc/dd/', '../'), + array('/aa/bb/cc/', '/aa/bb/cc/dd', '../'), + array('/aa/bb/cc/', '/aa/bb/cc/dd/', '../'), + array('/aa/bb/cc', '/aa', 'bb/cc/'), + array('/aa/bb/cc', '/aa/', 'bb/cc/'), + array('/aa/bb/cc/', '/aa', 'bb/cc/'), + array('/aa/bb/cc/', '/aa/', 'bb/cc/'), + array('/a/aab/bb', '/a/aa', '../aab/bb/'), + array('/a/aab/bb', '/a/aa/', '../aab/bb/'), + array('/a/aab/bb/', '/a/aa', '../aab/bb/'), + array('/a/aab/bb/', '/a/aa/', '../aab/bb/'), ); if (defined('PHP_WINDOWS_VERSION_MAJOR')) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php index f4b3c7d..30ca1be 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Finder.php @@ -47,7 +47,7 @@ class Finder implements \IteratorAggregate, \Countable private $contains = array(); private $notContains = array(); - static private $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'); + private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg'); /** * Constructor. @@ -64,7 +64,7 @@ class Finder implements \IteratorAggregate, \Countable * * @api */ - static public function create() + public static function create() { return new self(); } @@ -318,7 +318,7 @@ class Finder implements \IteratorAggregate, \Countable return $this; } - static public function addVCSPattern($pattern) + public static function addVCSPattern($pattern) { self::$vcsPatterns[] = $pattern; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Glob.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Glob.php index 5e31b75..dd26384 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Glob.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Glob.php @@ -44,7 +44,7 @@ class Glob * * @return string regex The regexp */ - static public function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true) + public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true) { $firstByte = true; $escaping = false; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php index e5d1135..42199ab 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Iterator/MultiplePcreFilterIterator.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Finder\Iterator; - /** * MultiplePcreFilterIterator filters files using patterns (regexps, globs or strings). * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/SplFileInfo.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/SplFileInfo.php index e9d4f7b..ee3d8ec 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/SplFileInfo.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/SplFileInfo.php @@ -62,14 +62,10 @@ class SplFileInfo extends \SplFileInfo */ public function getContents() { - $level = error_reporting(0); - $content = file_get_contents($this->getRealpath()); - error_reporting($level); - if (false === $content) { - $error = error_get_last(); - throw new \RuntimeException($error['message']); - } + $file = new \SplFileObject($this->getRealpath(), 'rb'); + ob_start(); + $file->fpassthru(); - return $content; + return ob_get_clean(); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/FinderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/FinderTest.php index fc06e1e..05ed82f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/FinderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/FinderTest.php @@ -15,9 +15,9 @@ use Symfony\Component\Finder\Finder; class FinderTest extends Iterator\RealIteratorTestCase { - static protected $tmpDir; + protected static $tmpDir; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { parent::setUpBeforeClass(); @@ -172,7 +172,6 @@ class FinderTest extends Iterator\RealIteratorTestCase $this->assertIterator($this->toAbsolute(array('foo', 'toto', 'foo/bar.tmp', 'test.php', 'test.py')), $finder->in(self::$tmpDir)->getIterator()); } - public function testSortByAccessedTime() { $finder = new Finder(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php index 1772d4b..b7b7b40 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Finder/Tests/Iterator/RealIteratorTestCase.php @@ -13,9 +13,9 @@ namespace Symfony\Component\Finder\Tests\Iterator; abstract class RealIteratorTestCase extends IteratorTestCase { - static protected $files; + protected static $files; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { $tmpDir = sys_get_temp_dir().'/symfony2_finder'; self::$files = array( @@ -51,7 +51,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase touch($tmpDir.'/test.php', strtotime('2005-10-15')); } - static public function tearDownAfterClass() + public static function tearDownAfterClass() { foreach (array_reverse(self::$files) as $file) { if ('/' === $file[strlen($file) - 1]) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/Form/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/AbstractType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/AbstractType.php index 281ee07..42b24e3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/AbstractType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/AbstractType.php @@ -20,8 +20,9 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface; abstract class AbstractType implements FormTypeInterface { /** - * The extensions for this type - * @var array An array of FormTypeExtensionInterface instances + * @var array + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ private $extensions = array(); @@ -46,14 +47,6 @@ abstract class AbstractType implements FormTypeInterface { } - /** - * {@inheritdoc} - */ - public function createBuilder($name, FormFactoryInterface $factory, array $options) - { - return null; - } - /** * {@inheritdoc} */ @@ -98,21 +91,26 @@ abstract class AbstractType implements FormTypeInterface } /** - * {@inheritdoc} + * Sets the extensions for this type. + * + * @param array $extensions An array of FormTypeExtensionInterface + * + * @throws Exception\UnexpectedTypeException if any extension does not implement FormTypeExtensionInterface + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ public function setExtensions(array $extensions) { - foreach ($extensions as $extension) { - if (!$extension instanceof FormTypeExtensionInterface) { - throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface'); - } - } - $this->extensions = $extensions; } /** - * {@inheritdoc} + * Returns the extensions associated with this type. + * + * @return array An array of FormTypeExtensionInterface + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use + * {@link ResolvedFormTypeInterface::getTypeExtensions()} instead. */ public function getExtensions() { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md index f468c38..03290fb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/CHANGELOG.md @@ -86,6 +86,7 @@ CHANGELOG * `hasAttribute` * `getClientData` * added FormBuilder methods + * `getTypes` * `addViewTransformer` * `getViewTransformers` * `resetViewTransformers` @@ -141,3 +142,34 @@ CHANGELOG * FormBuilder now implements \IteratorAggregate * [BC BREAK] compound forms now always need a data mapper * FormBuilder now maintains the order when explicitely adding form builders as children + * ChoiceType now doesn't add the empty value anymore if the choices already contain an empty element + * DateType, TimeType and DateTimeType now show empty values again if not required + * [BC BREAK] fixed rendering of errors for DateType, BirthdayType and similar ones + * [BC BREAK] fixed: form constraints are only validated if they belong to the validated group + * deprecated `bindRequest` in `Form` and replaced it by a listener to FormEvents::PRE_BIND + * fixed: the "data" option supersedes default values from the model + * changed DateType to refer to the "format" option for calculating the year and day choices instead + of padding them automatically + * [BC BREAK] DateType defaults to the format "yyyy-MM-dd" now if the widget is + "single_text", in order to support the HTML 5 date field out of the box + * added the option "format" to DateTimeType + * [BC BREAK] DateTimeType now outputs RFC 3339 dates by default, as generated and + consumed by HTML5 browsers, if the widget is "single_text" + * deprecated the options "data_timezone" and "user_timezone" in DateType, DateTimeType and TimeType + and renamed them to "model_timezone" and "view_timezone" + * fixed: TransformationFailedExceptions thrown in the model transformer are now caught by the form + * added FormRegistry and ResolvedFormTypeInterface + * deprecated FormFactory methods + * `addType` + * `hasType` + * `getType` + * [BC BREAK] FormFactory now expects a FormRegistryInterface as constructor argument + * [BC BREAK] The method `createBuilder` in FormTypeInterface is not supported anymore for performance reasons + * [BC BREAK] Removed `setTypes` from FormBuilder + * deprecated AbstractType methods + * `getExtensions` + * `setExtensions` + * ChoiceType now caches its created choice lists to improve performance + * [BC BREAK] Rows of a collection field cannot be themed individually anymore. All rows in the collection + field now have the same block names, which contains "entry" where it previously contained the row index. + * [BC BREAK] When registering a type through the DI extension, the tag alias has to match the actual type name. \ No newline at end of file diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/DataMapperInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/DataMapperInterface.php index 7584186..a574cbc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/DataMapperInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/DataMapperInterface.php @@ -24,7 +24,7 @@ interface DataMapperInterface * * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported. */ - function mapDataToForms($data, array $forms); + public function mapDataToForms($data, array $forms); /** * Maps the data of a list of forms into the properties of some data. @@ -34,5 +34,5 @@ interface DataMapperInterface * * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported. */ - function mapFormsToData(array $forms, &$data); + public function mapFormsToData(array $forms, &$data); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/DataTransformerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/DataTransformerInterface.php index 251ec17..07183d5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/DataTransformerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/DataTransformerInterface.php @@ -46,7 +46,7 @@ interface DataTransformerInterface * @throws UnexpectedTypeException when the argument is not a string * @throws TransformationFailedException when the transformation fails */ - function transform($value); + public function transform($value); /** * Transforms a value from the transformed representation to its original @@ -73,5 +73,5 @@ interface DataTransformerInterface * @throws UnexpectedTypeException when the argument is not of the expected type * @throws TransformationFailedException when the transformation fails */ - function reverseTransform($value); + public function reverseTransform($value); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Exception/CircularReferenceException.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Exception/CircularReferenceException.php deleted file mode 100644 index 6290449..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Exception/CircularReferenceException.php +++ /dev/null @@ -1,22 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Exception; - -use Symfony\Component\Form\FormTypeInterface; - -class CircularReferenceException extends FormException -{ - public function __construct(FormTypeInterface $type, $code = 0, $previous = null) - { - parent::__construct(sprintf('Circular reference detected in the "%s" type (defined in class "%s").', $type->getName(), get_class($type)), $code, $previous); - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php index 8c95f58..80abc73 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php @@ -335,7 +335,7 @@ class ChoiceList implements ChoiceListInterface { $index = $this->createIndex($choice); - if ('' === $index || null === $index || !FormConfig::isValidName((string)$index)) { + if ('' === $index || null === $index || !FormConfig::isValidName((string) $index)) { throw new InvalidConfigurationException('The index "' . $index . '" created by the choice list is invalid. It should be a valid, non-empty Form name.'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php index b4ce590..c81c560 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php @@ -33,14 +33,14 @@ interface ChoiceListInterface * * @return array The choices with their indices as keys. */ - function getChoices(); + public function getChoices(); /** * Returns the values for the choices * * @return array The values with the corresponding choice indices as keys. */ - function getValues(); + public function getValues(); /** * Returns the choice views of the preferred choices as nested array with @@ -64,7 +64,7 @@ interface ChoiceListInterface * choice indices as keys on the lowest levels and the choice * group names in the keys of the higher levels. */ - function getPreferredViews(); + public function getPreferredViews(); /** * Returns the choice views of the choices that are not preferred as nested @@ -90,7 +90,7 @@ interface ChoiceListInterface * * @see getPreferredValues */ - function getRemainingViews(); + public function getRemainingViews(); /** * Returns the choices corresponding to the given values. @@ -100,7 +100,7 @@ interface ChoiceListInterface * * @return array An array of choices with ascending, 0-based numeric keys */ - function getChoicesForValues(array $values); + public function getChoicesForValues(array $values); /** * Returns the values corresponding to the given choices. @@ -111,7 +111,7 @@ interface ChoiceListInterface * @return array An array of choice values with ascending, 0-based numeric * keys */ - function getValuesForChoices(array $choices); + public function getValuesForChoices(array $choices); /** * Returns the indices corresponding to the given choices. @@ -121,7 +121,7 @@ interface ChoiceListInterface * * @return array An array of indices with ascending, 0-based numeric keys */ - function getIndicesForChoices(array $choices); + public function getIndicesForChoices(array $choices); /** * Returns the indices corresponding to the given values. @@ -131,5 +131,5 @@ interface ChoiceListInterface * * @return array An array of indices with ascending, 0-based numeric keys */ - function getIndicesForValues(array $values); + public function getIndicesForValues(array $values); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php index 38d714d..f1af179 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Extension\Core\ChoiceList; - use Symfony\Component\Form\Exception\UnexpectedTypeException; /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php index 30beb13..940af59 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php @@ -159,6 +159,7 @@ class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer $intlDateFormatter = new \IntlDateFormatter(\Locale::getDefault(), $dateFormat, $timeFormat, $timezone, $calendar, $pattern); $intlDateFormatter->setLenient(false); + return $intlDateFormatter; } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php new file mode 100644 index 0000000..4062759 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php @@ -0,0 +1,80 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Exception\TransformationFailedException; + +/** + * @author Bernhard Schussek + */ +class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer +{ + /** + * {@inheritDoc} + */ + public function transform($dateTime) + { + if (null === $dateTime) { + return ''; + } + + if (!$dateTime instanceof \DateTime) { + throw new UnexpectedTypeException($dateTime, '\DateTime'); + } + + if ($this->inputTimezone !== $this->outputTimezone) { + $dateTime = clone $dateTime; + $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone)); + } + + return preg_replace('/\+00:00$/', 'Z', $dateTime->format('c')); + } + + /** + * {@inheritDoc} + */ + public function reverseTransform($rfc3339) + { + if (!is_string($rfc3339)) { + throw new UnexpectedTypeException($rfc3339, 'string'); + } + + if ('' === $rfc3339) { + return null; + } + + + $dateTime = new \DateTime($rfc3339); + + if ($this->outputTimezone !== $this->inputTimezone) { + try { + $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone)); + } catch (\Exception $e) { + throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e); + } + } + + if (preg_match('/(\d{4})-(\d{2})-(\d{2})/', $rfc3339, $matches)) { + if (!checkdate($matches[2], $matches[3], $matches[1])) { + throw new TransformationFailedException(sprintf( + 'The date "%s-%s-%s" is not a valid date.', + $matches[1], + $matches[2], + $matches[3] + )); + } + } + + return $dateTime; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToStringTransformer.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToStringTransformer.php deleted file mode 100644 index 084778e..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToStringTransformer.php +++ /dev/null @@ -1,67 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Extension\Core\DataTransformer; - -use Symfony\Component\Form\DataTransformerInterface; -use Symfony\Component\Form\Exception\UnexpectedTypeException; - -/** - * Transforms between a given value and a string. - * - * @author Joseph Bielawski - */ -class ValueToStringTransformer implements DataTransformerInterface -{ - /** - * Transforms a value into a string. - * - * @param mixed $value Mixed value. - * - * @return string String value. - * - * @throws UnexpectedTypeException if the given value is not a string or number - */ - public function transform($value) - { - if (null === $value) { - return ''; - } - - if (!is_string($value) && !is_numeric($value)) { - throw new UnexpectedTypeException($value, 'string or number'); - } - - return $value; - } - - /** - * Transforms a value into a string. - * - * @param string $value String value. - * - * @return string String value. - * - * @throws UnexpectedTypeException if the given value is not a string - */ - public function reverseTransform($value) - { - if (null === $value) { - return ''; - } - - if (!is_string($value)) { - throw new UnexpectedTypeException($value, 'string'); - } - - return $value; - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php new file mode 100644 index 0000000..868a5ae --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/BindRequestListener.php @@ -0,0 +1,85 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Extension\Core\EventListener; + +use Symfony\Component\Form\FormEvents; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\Form\Exception\FormException; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\Request; + +/** + * @author Bernhard Schussek + */ +class BindRequestListener implements EventSubscriberInterface +{ + public static function getSubscribedEvents() + { + // High priority in order to supersede other listeners + return array(FormEvents::PRE_BIND => array('preBind', 128)); + } + + public function preBind(FormEvent $event) + { + $form = $event->getForm(); + + /* @var Request $request */ + $request = $event->getData(); + + // Only proceed if we actually deal with a Request + if (!$request instanceof Request) { + return; + } + + $name = $form->getConfig()->getName(); + $default = $form->getConfig()->getCompound() ? array() : null; + + // Store the bound data in case of a post request + switch ($request->getMethod()) { + case 'POST': + case 'PUT': + case 'DELETE': + case 'PATCH': + if ('' === $name) { + // Form bound without name + $params = $request->request->all(); + $files = $request->files->all(); + } else { + $params = $request->request->get($name, $default); + $files = $request->files->get($name, $default); + } + + if (is_array($params) && is_array($files)) { + $data = array_replace_recursive($params, $files); + } else { + $data = $params ?: $files; + } + + break; + + case 'GET': + $data = '' === $name + ? $request->query->all() + : $request->query->get($name, $default); + + break; + + default: + throw new FormException(sprintf( + 'The request method "%s" is not supported', + $request->getMethod() + )); + } + + $event->setData($data); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php index 1cb89e5..083e23e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php @@ -44,7 +44,7 @@ class FixCheckboxInputListener implements EventSubscriberInterface $event->setData(count($indices) > 0 ? array_combine($indices, $values) : array()); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array(FormEvents::PRE_BIND => 'preBind'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php index 0bf24a2..c60bd26 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php @@ -44,7 +44,7 @@ class FixRadioInputListener implements EventSubscriberInterface $event->setData(false !== $index ? array($index => $value) : array()); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array(FormEvents::PRE_BIND => 'preBind'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php index 05a7253..1079903 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php @@ -38,7 +38,7 @@ class FixUrlProtocolListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array(FormEvents::BIND => 'onBind'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php index 5d76a78..ec88701 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php @@ -47,7 +47,7 @@ class MergeCollectionListener implements EventSubscriberInterface $this->allowDelete = $allowDelete; } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( FormEvents::BIND => 'onBind', diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php index 027ec7e..7c34a99 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php @@ -60,7 +60,7 @@ class ResizeFormListener implements EventSubscriberInterface $this->options = $options; } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( FormEvents::PRE_SET_DATA => 'preSetData', diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php index 0f93b8d..c5d6920 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php @@ -31,7 +31,7 @@ class TrimListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array(FormEvents::PRE_BIND => 'preBind'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php index d5a3ada..bcda8d2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php @@ -31,6 +31,12 @@ use Symfony\Component\OptionsResolver\OptionsResolverInterface; class ChoiceType extends AbstractType { + /** + * Caches created choice lists. + * @var array + */ + private $choiceListCache = array(); + /** * {@inheritdoc} */ @@ -81,9 +87,15 @@ class ChoiceType extends AbstractType 'preferred_choices' => $options['choice_list']->getPreferredViews(), 'choices' => $options['choice_list']->getRemainingViews(), 'separator' => '-------------------', - 'empty_value' => $options['empty_value'], + 'empty_value' => null, )); + // Check if the choices already contain the empty value + // Only add the empty value option if this is not the case + if (0 === count($options['choice_list']->getIndicesForValues(array('')))) { + $view->setVar('empty_value', $options['empty_value']); + } + if ($options['multiple'] && !$options['expanded']) { // Add "[]" to the name in case a select tag with multiple options is // displayed. Otherwise only one of the selected options is sent in the @@ -117,12 +129,20 @@ class ChoiceType extends AbstractType */ public function setDefaultOptions(OptionsResolverInterface $resolver) { - $choiceList = function (Options $options) { - return new SimpleChoiceList( - // Harden against NULL values (like in EntityType and ModelType) - null !== $options['choices'] ? $options['choices'] : array(), - $options['preferred_choices'] - ); + $choiceListCache =& $this->choiceListCache; + + $choiceList = function (Options $options) use (&$choiceListCache) { + // Harden against NULL values (like in EntityType and ModelType) + $choices = null !== $options['choices'] ? $options['choices'] : array(); + + // Reuse existing choice lists in order to increase performance + $hash = md5(json_encode(array($choices, $options['preferred_choices']))); + + if (!isset($choiceListCache[$hash])) { + $choiceListCache[$hash] = new SimpleChoiceList($choices, $options['preferred_choices']); + } + + return $choiceListCache[$hash]; }; $emptyData = function (Options $options) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php index 6b0d1ec..cc88d3a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php @@ -16,6 +16,7 @@ use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormViewInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener; +use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class CollectionType extends AbstractType @@ -73,6 +74,12 @@ class CollectionType extends AbstractType */ public function setDefaultOptions(OptionsResolverInterface $resolver) { + $optionsFilter = function (Options $options, $value) { + $value['block_name'] = 'entry'; + + return $value; + }; + $resolver->setDefaults(array( 'allow_add' => false, 'allow_delete' => false, @@ -81,6 +88,10 @@ class CollectionType extends AbstractType 'type' => 'text', 'options' => array(), )); + + $resolver->setFilters(array( + 'options' => $optionsFilter, + )); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php index 1711a50..fd35f57 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormViewInterface; @@ -19,31 +20,93 @@ use Symfony\Component\Form\ReversedTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer; +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer; use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class DateTimeType extends AbstractType { + const DEFAULT_DATE_FORMAT = \IntlDateFormatter::MEDIUM; + + const DEFAULT_TIME_FORMAT = \IntlDateFormatter::MEDIUM; + + /** + * This is not quite the HTML5 format yet, because ICU lacks the + * capability of parsing and generating RFC 3339 dates, which + * are like the below pattern but with a timezone suffix. The + * timezone suffix is + * + * * "Z" for UTC + * * "(-|+)HH:mm" for other timezones (note the colon!) + * + * http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax + * http://www.w3.org/TR/html-markup/input.datetime.html + * http://tools.ietf.org/html/rfc3339 + * + * An ICU ticket was created: + * http://icu-project.org/trac/ticket/9421 + * + * To temporarily circumvent this issue, DateTimeToRfc3339Transformer is used + * when the format matches this constant. + * + * ("ZZZZZZ" is not recognized by ICU and used here to differentiate this + * pattern from custom patterns). + */ + const HTML5_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZZZZZZ"; + + private static $acceptedFormats = array( + \IntlDateFormatter::FULL, + \IntlDateFormatter::LONG, + \IntlDateFormatter::MEDIUM, + \IntlDateFormatter::SHORT, + ); + /** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { $parts = array('year', 'month', 'day', 'hour', 'minute'); + $dateParts = array('year', 'month', 'day'); $timeParts = array('hour', 'minute'); - $format = 'Y-m-d H:i'; if ($options['with_seconds']) { - $format = 'Y-m-d H:i:s'; - $parts[] = 'second'; $timeParts[] = 'second'; } + $dateFormat = is_int($options['date_format']) ? $options['date_format'] : self::DEFAULT_DATE_FORMAT; + $timeFormat = self::DEFAULT_TIME_FORMAT; + $calendar = \IntlDateFormatter::GREGORIAN; + $pattern = is_string($options['format']) ? $options['format'] : null; + + if (!in_array($dateFormat, self::$acceptedFormats, true)) { + throw new InvalidOptionsException('The "date_format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.'); + } + + if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd') || false === strpos($pattern, 'H') || false === strpos($pattern, 'm'))) { + throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M", "d", "H" and "m". Its current value is "%s".', $pattern)); + } + if ('single_text' === $options['widget']) { - $builder->addViewTransformer(new DateTimeToStringTransformer($options['data_timezone'], $options['user_timezone'], $format)); + if (self::HTML5_FORMAT === $pattern) { + $builder->addViewTransformer(new DateTimeToRfc3339Transformer( + $options['model_timezone'], + $options['view_timezone'] + )); + } else { + $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer( + $options['model_timezone'], + $options['view_timezone'], + $dateFormat, + $timeFormat, + $calendar, + $pattern + )); + } } else { // Only pass a subset of the options to children $dateOptions = array_intersect_key($options, array_flip(array( @@ -54,6 +117,7 @@ class DateTimeType extends AbstractType 'required', 'translation_domain', ))); + $timeOptions = array_intersect_key($options, array_flip(array( 'hours', 'minutes', @@ -64,21 +128,15 @@ class DateTimeType extends AbstractType 'translation_domain', ))); - // If `widget` is set, overwrite widget options from `date` and `time` - if (isset($options['widget'])) { - $dateOptions['widget'] = $options['widget']; - $timeOptions['widget'] = $options['widget']; - } else { - if (isset($options['date_widget'])) { - $dateOptions['widget'] = $options['date_widget']; - } - - if (isset($options['time_widget'])) { - $timeOptions['widget'] = $options['time_widget']; - } + if (null !== $options['date_widget']) { + $dateOptions['widget'] = $options['date_widget']; } - if (isset($options['date_format'])) { + if (null !== $options['time_widget']) { + $timeOptions['widget'] = $options['time_widget']; + } + + if (null !== $options['date_format']) { $dateOptions['format'] = $options['date_format']; } @@ -87,9 +145,9 @@ class DateTimeType extends AbstractType $builder ->addViewTransformer(new DataTransformerChain(array( - new DateTimeToArrayTransformer($options['data_timezone'], $options['user_timezone'], $parts), + new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts), new ArrayToPartsTransformer(array( - 'date' => array('year', 'month', 'day'), + 'date' => $dateParts, 'time' => $timeParts, )), ))) @@ -100,15 +158,15 @@ class DateTimeType extends AbstractType if ('string' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToStringTransformer($options['data_timezone'], $options['data_timezone']) + new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone']) )); } elseif ('timestamp' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToTimestampTransformer($options['data_timezone'], $options['data_timezone']) + new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone']) )); } elseif ('array' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToArrayTransformer($options['data_timezone'], $options['data_timezone'], $parts) + new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts) )); } } @@ -120,7 +178,10 @@ class DateTimeType extends AbstractType { $view->setVar('widget', $options['widget']); - if ('single_text' === $options['widget']) { + // Change the input to a HTML5 date input if + // * the widget is set to "single_text" + // * the format matches the one expected by HTML5 + if ('single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { $view->setVar('type', 'datetime'); } } @@ -134,35 +195,60 @@ class DateTimeType extends AbstractType return $options['widget'] !== 'single_text'; }; + // Defaults to the value of "widget" + $dateWidget = function (Options $options) { + return $options['widget']; + }; + + // Defaults to the value of "widget" + $timeWidget = function (Options $options) { + return $options['widget']; + }; + + // BC until Symfony 2.3 + $modelTimezone = function (Options $options) { + return $options['data_timezone']; + }; + + // BC until Symfony 2.3 + $viewTimezone = function (Options $options) { + return $options['user_timezone']; + }; + $resolver->setDefaults(array( - 'input' => 'datetime', - 'data_timezone' => null, - 'user_timezone' => null, - 'date_widget' => null, - 'date_format' => null, - 'time_widget' => null, - /* Defaults for date field */ - 'years' => range(date('Y') - 5, date('Y') + 5), - 'months' => range(1, 12), - 'days' => range(1, 31), - /* Defaults for time field */ - 'hours' => range(0, 23), - 'minutes' => range(0, 59), - 'seconds' => range(0, 59), - 'with_seconds' => false, + 'input' => 'datetime', + 'model_timezone' => $modelTimezone, + 'view_timezone' => $viewTimezone, + // Deprecated timezone options + 'data_timezone' => null, + 'user_timezone' => null, + 'format' => self::HTML5_FORMAT, + 'date_format' => null, + 'widget' => null, + 'date_widget' => $dateWidget, + 'time_widget' => $timeWidget, + 'with_seconds' => false, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects - 'by_reference' => false, - // This will overwrite "widget" child options - 'widget' => null, - // This will overwrite "empty_value" child options - 'empty_value' => null, + 'by_reference' => false, // If initialized with a \DateTime object, FormType initializes // this option to "\DateTime". Since the internal, normalized // representation is not \DateTime, but an array, we need to unset // this option. - 'data_class' => null, - 'compound' => $compound, + 'data_class' => null, + 'compound' => $compound, + )); + + // Don't add some defaults in order to preserve the defaults + // set in DateType and TimeType + $resolver->setOptional(array( + 'empty_value', + 'years', + 'months', + 'days', + 'hours', + 'minutes', + 'seconds', )); $resolver->setAllowedValues(array( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateType.php index b6cb0a2..ea1b091 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/DateType.php @@ -23,88 +23,76 @@ use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTra use Symfony\Component\Form\ReversedTransformer; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolverInterface; +use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException; class DateType extends AbstractType { const DEFAULT_FORMAT = \IntlDateFormatter::MEDIUM; + const HTML5_FORMAT = 'yyyy-MM-dd'; + + private static $acceptedFormats = array( + \IntlDateFormatter::FULL, + \IntlDateFormatter::LONG, + \IntlDateFormatter::MEDIUM, + \IntlDateFormatter::SHORT, + ); + /** * {@inheritdoc} */ public function buildForm(FormBuilderInterface $builder, array $options) { - $format = $options['format']; - $pattern = null; + $dateFormat = is_int($options['format']) ? $options['format'] : self::DEFAULT_FORMAT; + $timeFormat = \IntlDateFormatter::NONE; + $calendar = \IntlDateFormatter::GREGORIAN; + $pattern = is_string($options['format']) ? $options['format'] : null; - $allowedFormats = array( - \IntlDateFormatter::FULL, - \IntlDateFormatter::LONG, - \IntlDateFormatter::MEDIUM, - \IntlDateFormatter::SHORT, - ); - - // If $format is not in the allowed options, it's considered as the pattern of the formatter if it is a string - if (!in_array($format, $allowedFormats, true)) { - if (is_string($format)) { - $format = self::DEFAULT_FORMAT; - $pattern = $options['format']; - } else { - throw new CreationException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom pattern'); - } + if (!in_array($dateFormat, self::$acceptedFormats, true)) { + throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.'); } - $formatter = new \IntlDateFormatter( - \Locale::getDefault(), - $format, - \IntlDateFormatter::NONE, - 'UTC', - \IntlDateFormatter::GREGORIAN, - $pattern - ); - $formatter->setLenient(false); + if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd'))) { + throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern)); + } if ('single_text' === $options['widget']) { - $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer($options['data_timezone'], $options['user_timezone'], $format, \IntlDateFormatter::NONE, \IntlDateFormatter::GREGORIAN, $pattern)); + $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer( + $options['model_timezone'], + $options['view_timezone'], + $dateFormat, + $timeFormat, + $calendar, + $pattern + )); } else { - $yearOptions = $monthOptions = $dayOptions = array(); + $yearOptions = $monthOptions = $dayOptions = array( + 'error_bubbling' => true, + ); + + $formatter = new \IntlDateFormatter( + \Locale::getDefault(), + $dateFormat, + $timeFormat, + 'UTC', + $calendar, + $pattern + ); + $formatter->setLenient(false); if ('choice' === $options['widget']) { - if (is_array($options['empty_value'])) { - $options['empty_value'] = array_merge(array('year' => null, 'month' => null, 'day' => null), $options['empty_value']); - } else { - $options['empty_value'] = array('year' => $options['empty_value'], 'month' => $options['empty_value'], 'day' => $options['empty_value']); - } - - $years = $months = $days = array(); - - foreach ($options['years'] as $year) { - $years[$year] = str_pad($year, 4, '0', STR_PAD_LEFT); - } - foreach ($options['months'] as $month) { - $months[$month] = str_pad($month, 2, '0', STR_PAD_LEFT); - } - foreach ($options['days'] as $day) { - $days[$day] = str_pad($day, 2, '0', STR_PAD_LEFT); - } - // Only pass a subset of the options to children - $yearOptions = array( - 'choices' => $years, - 'empty_value' => $options['empty_value']['year'], - ); - $monthOptions = array( - 'choices' => $this->formatMonths($formatter, $months), - 'empty_value' => $options['empty_value']['month'], - ); - $dayOptions = array( - 'choices' => $days, - 'empty_value' => $options['empty_value']['day'], - ); + $yearOptions['choices'] = $this->formatTimestamps($formatter, '/y+/', $this->listYears($options['years'])); + $yearOptions['empty_value'] = $options['empty_value']['year']; + $monthOptions['choices'] = $this->formatTimestamps($formatter, '/M+/', $this->listMonths($options['months'])); + $monthOptions['empty_value'] = $options['empty_value']['month']; + $dayOptions['choices'] = $this->formatTimestamps($formatter, '/d+/', $this->listDays($options['days'])); + $dayOptions['empty_value'] = $options['empty_value']['day']; + } - // Append generic carry-along options - foreach (array('required', 'translation_domain') as $passOpt) { - $yearOptions[$passOpt] = $monthOptions[$passOpt] = $dayOptions[$passOpt] = $options[$passOpt]; - } + // Append generic carry-along options + foreach (array('required', 'translation_domain') as $passOpt) { + $yearOptions[$passOpt] = $monthOptions[$passOpt] = $dayOptions[$passOpt] = $options[$passOpt]; } $builder @@ -112,26 +100,25 @@ class DateType extends AbstractType ->add('month', $options['widget'], $monthOptions) ->add('day', $options['widget'], $dayOptions) ->addViewTransformer(new DateTimeToArrayTransformer( - $options['data_timezone'], $options['user_timezone'], array('year', 'month', 'day') + $options['model_timezone'], $options['view_timezone'], array('year', 'month', 'day') )) + ->setAttribute('formatter', $formatter) ; } if ('string' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToStringTransformer($options['data_timezone'], $options['data_timezone'], 'Y-m-d') + new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], 'Y-m-d') )); } elseif ('timestamp' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToTimestampTransformer($options['data_timezone'], $options['data_timezone']) + new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone']) )); } elseif ('array' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToArrayTransformer($options['data_timezone'], $options['data_timezone'], array('year', 'month', 'day')) + new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], array('year', 'month', 'day')) )); } - - $builder->setAttribute('formatter', $formatter); } /** @@ -141,11 +128,14 @@ class DateType extends AbstractType { $view->setVar('widget', $options['widget']); - if ('single_text' === $options['widget']) { + // Change the input to a HTML5 date input if + // * the widget is set to "single_text" + // * the format matches the one expected by HTML5 + if ('single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) { $view->setVar('type', 'date'); } - if (count($view) > 0) { + if ($form->getConfig()->hasAttribute('formatter')) { $pattern = $form->getConfig()->getAttribute('formatter')->getPattern(); // set right order with respect to locale (e.g.: de_DE=dd.MM.yy; en_US=M/d/yy) @@ -170,16 +160,50 @@ class DateType extends AbstractType return $options['widget'] !== 'single_text'; }; + $emptyValue = $emptyValueDefault = function (Options $options) { + return $options['required'] ? null : ''; + }; + + $emptyValueFilter = function (Options $options, $emptyValue) use ($emptyValueDefault) { + if (is_array($emptyValue)) { + $default = $emptyValueDefault($options); + + return array_merge( + array('year' => $default, 'month' => $default, 'day' => $default), + $emptyValue + ); + } + + return array( + 'year' => $emptyValue, + 'month' => $emptyValue, + 'day' => $emptyValue + ); + }; + + // BC until Symfony 2.3 + $modelTimezone = function (Options $options) { + return $options['data_timezone']; + }; + + // BC until Symfony 2.3 + $viewTimezone = function (Options $options) { + return $options['user_timezone']; + }; + $resolver->setDefaults(array( 'years' => range(date('Y') - 5, date('Y') + 5), 'months' => range(1, 12), 'days' => range(1, 31), 'widget' => 'choice', 'input' => 'datetime', - 'format' => self::DEFAULT_FORMAT, + 'format' => self::HTML5_FORMAT, + 'model_timezone' => $modelTimezone, + 'view_timezone' => $viewTimezone, + // Deprecated timezone options 'data_timezone' => null, 'user_timezone' => null, - 'empty_value' => null, + 'empty_value' => $emptyValue, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, @@ -192,6 +216,10 @@ class DateType extends AbstractType 'compound' => $compound, )); + $resolver->setFilters(array( + 'empty_value' => $emptyValueFilter, + )); + $resolver->setAllowedValues(array( 'input' => array( 'datetime', @@ -205,6 +233,10 @@ class DateType extends AbstractType 'choice', ), )); + + $resolver->setAllowedTypes(array( + 'format' => array('int', 'string'), + )); } /** @@ -223,18 +255,18 @@ class DateType extends AbstractType return 'date'; } - private function formatMonths(\IntlDateFormatter $formatter, array $months) + private function formatTimestamps(\IntlDateFormatter $formatter, $regex, array $timestamps) { $pattern = $formatter->getPattern(); $timezone = $formatter->getTimezoneId(); $formatter->setTimezoneId(\DateTimeZone::UTC); - if (preg_match('/M+/', $pattern, $matches)) { + if (preg_match($regex, $pattern, $matches)) { $formatter->setPattern($matches[0]); - foreach ($months as $key => $value) { - $months[$key] = $formatter->format(gmmktime(0, 0, 0, $key, 15)); + foreach ($timestamps as $key => $timestamp) { + $timestamps[$key] = $formatter->format($timestamp); } // I'd like to clone the formatter above, but then we get a @@ -244,6 +276,39 @@ class DateType extends AbstractType $formatter->setTimezoneId($timezone); - return $months; + return $timestamps; + } + + private function listYears(array $years) + { + $result = array(); + + foreach ($years as $year) { + $result[$year] = gmmktime(0, 0, 0, 6, 15, $year); + } + + return $result; + } + + private function listMonths(array $months) + { + $result = array(); + + foreach ($months as $month) { + $result[$month] = gmmktime(0, 0, 0, $month, 15); + } + + return $result; + } + + private function listDays(array $days) + { + $result = array(); + + foreach ($days as $day) { + $result[$day] = gmmktime(0, 0, 0, 5, $day); + } + + return $result; } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php index 8d4c8c0..0f7f9a2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/FormType.php @@ -12,15 +12,14 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\Form\FormViewInterface; +use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener; use Symfony\Component\Form\Extension\Core\EventListener\TrimListener; use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper; -use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\Form\Exception\FormException; use Symfony\Component\OptionsResolver\Options; use Symfony\Component\OptionsResolver\OptionsResolverInterface; @@ -43,8 +42,10 @@ class FormType extends AbstractType ->setByReference($options['by_reference']) ->setVirtual($options['virtual']) ->setCompound($options['compound']) - ->setData($options['data']) + ->setData(isset($options['data']) ? $options['data'] : null) + ->setDataLocked(isset($options['data'])) ->setDataMapper($options['compound'] ? new PropertyPathMapper() : null) + ->addEventSubscriber(new BindRequestListener()) ; if ($options['trim']) { @@ -58,6 +59,7 @@ class FormType extends AbstractType public function buildView(FormViewInterface $view, FormInterface $form, array $options) { $name = $form->getName(); + $blockName = $options['block_name'] ?: $form->getName(); $readOnly = $options['read_only']; $translationDomain = $options['translation_domain']; @@ -66,23 +68,30 @@ class FormType extends AbstractType throw new FormException('Form node with empty name can be used only as root form node.'); } - if ('' !== ($parentFullName = $view->getParent()->getVar('full_name'))) { - $id = sprintf('%s_%s', $view->getParent()->getVar('id'), $name); + $parentView = $view->getParent(); + + if ('' !== ($parentFullName = $parentView->getVar('full_name'))) { + $id = sprintf('%s_%s', $parentView->getVar('id'), $name); $fullName = sprintf('%s[%s]', $parentFullName, $name); + $fullBlockName = sprintf('%s_%s', $parentView->getVar('full_block_name'), $blockName); } else { $id = $name; $fullName = $name; + $fullBlockName = '_' . $blockName; } - // Complex fields are read-only if themselves or their parent is. - $readOnly = $readOnly || $view->getParent()->getVar('read_only'); + // Complex fields are read-only if they themselves or their parents are. + if (!$readOnly) { + $readOnly = $parentView->getVar('read_only'); + } if (!$translationDomain) { - $translationDomain = $view->getParent()->getVar('translation_domain'); + $translationDomain = $parentView->getVar('translation_domain'); } } else { $id = $name; $fullName = $name; + $fullBlockName = '_' . $blockName; // Strip leading underscores and digits. These are allowed in // form names, but not in HTML4 ID attributes. @@ -91,8 +100,8 @@ class FormType extends AbstractType } $types = array(); - foreach ($form->getConfig()->getTypes() as $type) { - $types[] = $type->getName(); + for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) { + array_unshift($types, $type->getName()); } if (!$translationDomain) { @@ -104,6 +113,7 @@ class FormType extends AbstractType 'id' => $id, 'name' => $name, 'full_name' => $fullName, + 'full_block_name' => $fullBlockName, 'read_only' => $readOnly, 'errors' => $form->getErrors(), 'valid' => $form->isBound() ? $form->isValid() : true, @@ -147,7 +157,7 @@ class FormType extends AbstractType { // Derive "data_class" option from passed "data" object $dataClass = function (Options $options) { - return is_object($options['data']) ? get_class($options['data']) : null; + return isset($options['data']) && is_object($options['data']) ? get_class($options['data']) : null; }; // Derive "empty_data" closure from "data_class" option @@ -176,8 +186,14 @@ class FormType extends AbstractType return false !== $options['property_path']; }; + // If data is given, the form is locked to that data + // (independent of its value) + $resolver->setOptional(array( + 'data', + )); + $resolver->setDefaults(array( - 'data' => null, + 'block_name' => null, 'data_class' => $dataClass, 'empty_data' => $emptyData, 'trim' => true, @@ -204,14 +220,6 @@ class FormType extends AbstractType )); } - /** - * {@inheritdoc} - */ - public function createBuilder($name, FormFactoryInterface $factory, array $options) - { - return new FormBuilder($name, $options['data_class'], new EventDispatcher(), $factory, $options); - } - /** * {@inheritdoc} */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php index 8d4f414..4722b37 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php @@ -81,7 +81,7 @@ class MoneyType extends AbstractType * The pattern contains the placeholder "{{ widget }}" where the HTML tag should * be inserted */ - static private function getPattern($currency) + private static function getPattern($currency) { if (!$currency) { return '{{ widget }}'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php index cf3f3d8..ac6a3c9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormViewInterface; use Symfony\Component\OptionsResolver\OptionsResolverInterface; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TextType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TextType.php index 5b68169..ebfeaf6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TextType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TextType.php @@ -12,22 +12,10 @@ namespace Symfony\Component\Form\Extension\Core\Type; use Symfony\Component\Form\AbstractType; -use Symfony\Component\Form\FormBuilderInterface; -use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToStringTransformer; use Symfony\Component\OptionsResolver\OptionsResolverInterface; class TextType extends AbstractType { - /** - * {@inheritdoc} - */ - public function buildForm(FormBuilderInterface $builder, array $options) - { - $builder - ->addViewTransformer(new ValueToStringTransformer()) - ; - } - /** * {@inheritdoc} */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php index 0c4c65e..99617dd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php @@ -37,9 +37,11 @@ class TimeType extends AbstractType } if ('single_text' === $options['widget']) { - $builder->addViewTransformer(new DateTimeToStringTransformer($options['data_timezone'], $options['user_timezone'], $format)); + $builder->addViewTransformer(new DateTimeToStringTransformer($options['model_timezone'], $options['view_timezone'], $format)); } else { - $hourOptions = $minuteOptions = $secondOptions = array(); + $hourOptions = $minuteOptions = $secondOptions = array( + 'error_bubbling' => true, + ); if ('choice' === $options['widget']) { $hours = $minutes = array(); @@ -52,14 +54,10 @@ class TimeType extends AbstractType } // Only pass a subset of the options to children - $hourOptions = array( - 'choices' => $hours, - 'empty_value' => $options['empty_value']['hour'], - ); - $minuteOptions = array( - 'choices' => $minutes, - 'empty_value' => $options['empty_value']['minute'], - ); + $hourOptions['choices'] = $hours; + $hourOptions['empty_value'] = $options['empty_value']['hour']; + $minuteOptions['choices'] = $minutes; + $minuteOptions['empty_value'] = $options['empty_value']['minute']; if ($options['with_seconds']) { $seconds = array(); @@ -68,10 +66,8 @@ class TimeType extends AbstractType $seconds[$second] = str_pad($second, 2, '0', STR_PAD_LEFT); } - $secondOptions = array( - 'choices' => $seconds, - 'empty_value' => $options['empty_value']['second'], - ); + $secondOptions['choices'] = $seconds; + $secondOptions['empty_value'] = $options['empty_value']['second']; } // Append generic carry-along options @@ -92,20 +88,20 @@ class TimeType extends AbstractType $builder->add('second', $options['widget'], $secondOptions); } - $builder->addViewTransformer(new DateTimeToArrayTransformer($options['data_timezone'], $options['user_timezone'], $parts, 'text' === $options['widget'])); + $builder->addViewTransformer(new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts, 'text' === $options['widget'])); } if ('string' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToStringTransformer($options['data_timezone'], $options['data_timezone'], 'H:i:s') + new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], 'H:i:s') )); } elseif ('timestamp' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToTimestampTransformer($options['data_timezone'], $options['data_timezone']) + new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone']) )); } elseif ('array' === $options['input']) { $builder->addModelTransformer(new ReversedTransformer( - new DateTimeToArrayTransformer($options['data_timezone'], $options['data_timezone'], $parts) + new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts) )); } } @@ -134,10 +130,16 @@ class TimeType extends AbstractType return $options['widget'] !== 'single_text'; }; - $emptyValueFilter = function (Options $options, $emptyValue) { + $emptyValue = $emptyValueDefault = function (Options $options) { + return $options['required'] ? null : ''; + }; + + $emptyValueFilter = function (Options $options, $emptyValue) use ($emptyValueDefault) { if (is_array($emptyValue)) { + $default = $emptyValueDefault($options); + return array_merge( - array('hour' => null, 'minute' => null, 'second' => null), + array('hour' => $default, 'minute' => $default, 'second' => $default), $emptyValue ); } @@ -149,6 +151,16 @@ class TimeType extends AbstractType ); }; + // BC until Symfony 2.3 + $modelTimezone = function (Options $options) { + return $options['data_timezone']; + }; + + // BC until Symfony 2.3 + $viewTimezone = function (Options $options) { + return $options['user_timezone']; + }; + $resolver->setDefaults(array( 'hours' => range(0, 23), 'minutes' => range(0, 59), @@ -156,9 +168,12 @@ class TimeType extends AbstractType 'widget' => 'choice', 'input' => 'datetime', 'with_seconds' => false, + 'model_timezone' => $modelTimezone, + 'view_timezone' => $viewTimezone, + // Deprecated timezone options 'data_timezone' => null, 'user_timezone' => null, - 'empty_value' => null, + 'empty_value' => $emptyValue, // Don't modify \DateTime classes by reference, we treat // them like immutable value objects 'by_reference' => false, diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php index 178170f..cd4a2ad 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php @@ -20,7 +20,7 @@ class TimezoneType extends AbstractType * Stores the available timezone choices * @var array */ - static private $timezones; + private static $timezones; /** * {@inheritdoc} @@ -58,7 +58,7 @@ class TimezoneType extends AbstractType * * @return array The timezone choices */ - static public function getTimezones() + public static function getTimezones() { if (null === static::$timezones) { static::$timezones = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php index 340a74a..322a4f8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php @@ -35,7 +35,7 @@ interface CsrfProviderInterface * @param string $intention Some value that identifies the action intention * (i.e. "authenticate"). Doesn't have to be a secret value. */ - function generateCsrfToken($intention); + public function generateCsrfToken($intention); /** * Validates a CSRF token. @@ -45,5 +45,5 @@ interface CsrfProviderInterface * * @return Boolean Whether the token supplied by the browser is correct */ - function isCsrfTokenValid($intention, $token); + public function isCsrfTokenValid($intention, $token); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php index f852123..ea1fa58 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php @@ -50,6 +50,8 @@ class SessionCsrfProvider extends DefaultCsrfProvider */ protected function getSessionId() { + $this->session->start(); + return $this->session->getId(); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php index a440dcd..25a835f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php @@ -44,7 +44,7 @@ class CsrfValidationListener implements EventSubscriberInterface */ private $intention; - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( FormEvents::PRE_BIND => 'preBind', diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php index 2b2b1a3..efc5fdf 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php @@ -43,7 +43,13 @@ class DependencyInjectionExtension implements FormExtensionInterface throw new \InvalidArgumentException(sprintf('The field type "%s" is not registered with the service container.', $name)); } - return $this->container->get($this->typeServiceIds[$name]); + $type = $this->container->get($this->typeServiceIds[$name]); + + if ($type->getName() !== $name) { + throw new \InvalidArgumentException(sprintf('The type name specified for the service %s does not match the actual name', $this->typeServiceIds[$name])); + } + + return $type; } public function hasType($name) diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php index 88d2cfb..4befc03 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php @@ -71,7 +71,12 @@ class FormValidator extends ConstraintValidator $constraints = $config->getOption('constraints'); foreach ($constraints as $constraint) { foreach ($groups as $group) { - $graphWalker->walkConstraint($constraint, $form->getData(), $group, $path . 'data'); + if (in_array($group, $constraint->groups)) { + $graphWalker->walkConstraint($constraint, $form->getData(), $group, $path . 'data'); + + // Prevent duplicate validation + continue 2; + } } } } else { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php index f40ac21..dd2c51a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php @@ -30,7 +30,7 @@ class ValidationListener implements EventSubscriberInterface /** * {@inheritdoc} */ - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array(FormEvents::POST_BIND => 'validateForm'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php index eeb43f1..9b755e1 100755 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php @@ -158,25 +158,26 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface return new TypeGuess('text', array(), Guess::LOW_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\Size': - switch ($constraint->type) { - case 'string': - return new TypeGuess('text', array(), Guess::LOW_CONFIDENCE); - case 'collection': - return new TypeGuess('collection', array(), Guess::MEDIUM_CONFIDENCE); - } - break; - case 'Symfony\Component\Validator\Constraints\Min': - case 'Symfony\Component\Validator\Constraints\Range': case 'Symfony\Component\Validator\Constraints\Max': return new TypeGuess('number', array(), Guess::LOW_CONFIDENCE); + case 'Symfony\Component\Validator\Constraints\MinCount': + case 'Symfony\Component\Validator\Constraints\MaxCount': + return new TypeGuess('collection', array(), Guess::LOW_CONFIDENCE); + case 'Symfony\Component\Validator\Constraints\Time': return new TypeGuess('time', array('input'=>'string'), Guess::HIGH_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\Url': return new TypeGuess('url', array(), Guess::HIGH_CONFIDENCE); + + case 'Symfony\Component\Validator\Constraints\True': + case 'Symfony\Component\Validator\Constraints\False': + return new TypeGuess('checkbox', array(), Guess::MEDIUM_CONFIDENCE); } + + return null; } /** @@ -191,8 +192,11 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface switch (get_class($constraint)) { case 'Symfony\Component\Validator\Constraints\NotNull': case 'Symfony\Component\Validator\Constraints\NotBlank': + case 'Symfony\Component\Validator\Constraints\True': return new ValueGuess(true, Guess::HIGH_CONFIDENCE); } + + return null; } /** @@ -208,12 +212,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface case 'Symfony\Component\Validator\Constraints\MaxLength': return new ValueGuess($constraint->limit, Guess::HIGH_CONFIDENCE); - case 'Symfony\Component\Validator\Constraints\Size': - if ('string' === $constraint->type && null !== $constraint->max) { - return new ValueGuess($constraint->max, Guess::HIGH_CONFIDENCE); - } - break; - case 'Symfony\Component\Validator\Constraints\Type': if (in_array($constraint->type, array('double', 'float', 'numeric', 'real'))) { return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE); @@ -223,9 +221,11 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface case 'Symfony\Component\Validator\Constraints\Max': return new ValueGuess(strlen((string) $constraint->limit), Guess::LOW_CONFIDENCE); - case 'Symfony\Component\Validator\Constraints\Range': + case 'Symfony\Component\Validator\Constraints\Size': return new ValueGuess(strlen((string) $constraint->max), Guess::LOW_CONFIDENCE); } + + return null; } /** @@ -241,25 +241,6 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface case 'Symfony\Component\Validator\Constraints\MinLength': return new ValueGuess(sprintf('.{%s,}', (string) $constraint->limit), Guess::LOW_CONFIDENCE); - case 'Symfony\Component\Validator\Constraints\Size': - if ('string' !== $constraint->type) { - return; - } - - if ($constraint->min === $constraint->max) { - return new ValueGuess(sprintf('.{%s}', (string) $constraint->min), Guess::LOW_CONFIDENCE); - } - - if (null === $constraint->min) { - return new ValueGuess(sprintf('.{0,%s}', (string) $constraint->max), Guess::LOW_CONFIDENCE); - } - - if (null === $constraint->max) { - return new ValueGuess(sprintf('.{%s,}', (string) $constraint->min), Guess::LOW_CONFIDENCE); - } - - return new ValueGuess(sprintf('.{%s,%s}', (string) $constraint->min, (string) $constraint->max), Guess::LOW_CONFIDENCE); - case 'Symfony\Component\Validator\Constraints\Regex': $htmlPattern = $constraint->getHtmlPattern(); @@ -271,7 +252,7 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface case 'Symfony\Component\Validator\Constraints\Min': return new ValueGuess(sprintf('.{%s,}', strlen((string) $constraint->limit)), Guess::LOW_CONFIDENCE); - case 'Symfony\Component\Validator\Constraints\Range': + case 'Symfony\Component\Validator\Constraints\Size': return new ValueGuess(sprintf('.{%s,%s}', strlen((string) $constraint->min), strlen((string) $constraint->max)), Guess::LOW_CONFIDENCE); case 'Symfony\Component\Validator\Constraints\Type': @@ -280,6 +261,8 @@ class ValidatorTypeGuesser implements FormTypeGuesserInterface } break; } + + return null; } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php index eef8b0e..7b96efb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; use Symfony\Component\Form\FormInterface; -use Symfony\Component\Form\Util\PropertyPathInterface; use Symfony\Component\Form\Exception\ErrorMappingException; /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php index 49b7c61..eb8907f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php @@ -29,5 +29,5 @@ interface ViolationMapperInterface * @param Boolean $allowNonSynchronized Whether to allow * mapping to non-synchronized forms. */ - function mapViolation(ConstraintViolation $violation, FormInterface $form, $allowNonSynchronized = false); + public function mapViolation(ConstraintViolation $violation, FormInterface $form, $allowNonSynchronized = false); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php index 79a13fa..f5517f2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; use Symfony\Component\Form\Util\PropertyPath; -use Symfony\Component\Form\Util\PropertyPathIterator; use Symfony\Component\Form\Util\PropertyPathInterface; /** @@ -232,7 +231,6 @@ class ViolationPath implements \IteratorAggregate, PropertyPathInterface return $this->mapsForm[$index]; } - /** * Returns a new iterator for this path * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPathIterator.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPathIterator.php index c4970b9..531da86 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPathIterator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPathIterator.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Form\Extension\Validator\ViolationMapper; use Symfony\Component\Form\Util\PropertyPathIterator; -use Symfony\Component\Form\Util\PropertyPath; /** * @author Bernhard Schussek diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php index 58135fe..e191cc9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Form.php @@ -18,7 +18,6 @@ use Symfony\Component\Form\Exception\TransformationFailedException; use Symfony\Component\Form\Util\FormUtil; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; /** * Form represents a form. @@ -196,11 +195,17 @@ class Form implements \IteratorAggregate, FormInterface * @return array An array of FormTypeInterface * * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use - * {@link getConfig()} and {@link FormConfigInterface::getTypes()} instead. + * {@link getConfig()} and {@link FormConfigInterface::getType()} instead. */ public function getTypes() { - return $this->config->getTypes(); + $types = array(); + + for ($type = $this->config->getType(); null !== $type; $type = $type->getParent()) { + array_unshift($types, $type->getInnerType()); + } + + return $types; } /** @@ -332,6 +337,11 @@ class Form implements \IteratorAggregate, FormInterface throw new AlreadyBoundException('You cannot change the data of a bound form'); } + // Don't allow modifications of the configured data if the data is locked + if ($this->config->getDataLocked() && $modelData !== $this->config->getData()) { + return $this; + } + if (is_object($modelData) && !$this->config->getByReference()) { $modelData = clone $modelData; } @@ -540,11 +550,7 @@ class Form implements \IteratorAggregate, FormInterface try { // Normalize data to unified representation $normData = $this->viewToNorm($viewData); - $synchronized = true; - } catch (TransformationFailedException $e) { - } - if ($synchronized) { // Hook to change content of the data into the normalized // representation $event = new FormEvent($this, $normData); @@ -556,6 +562,9 @@ class Form implements \IteratorAggregate, FormInterface // Synchronize representations - must not change the content! $modelData = $this->normToModel($normData); $viewData = $this->normToView($normData); + + $synchronized = true; + } catch (TransformationFailedException $e) { } $this->bound = true; @@ -586,44 +595,13 @@ class Form implements \IteratorAggregate, FormInterface * @return Form This form * * @throws FormException if the method of the request is not one of GET, POST or PUT + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use + * {@link FormConfigInterface::bind()} instead. */ public function bindRequest(Request $request) { - $name = $this->config->getName(); - - // Store the bound data in case of a post request - switch ($request->getMethod()) { - case 'POST': - case 'PUT': - case 'DELETE': - case 'PATCH': - if ('' === $name) { - // Form bound without name - $params = $request->request->all(); - $files = $request->files->all(); - } elseif ($this->config->getCompound()) { - // Form bound with name and children - $params = $request->request->get($name, array()); - $files = $request->files->get($name, array()); - } else { - // Form bound with name, but without children - $params = $request->request->get($name, null); - $files = $request->files->get($name, null); - } - if (is_array($params) && is_array($files)) { - $data = array_replace_recursive($params, $files); - } else { - $data = $params ?: $files; - } - break; - case 'GET': - $data = '' === $name ? $request->query->all() : $request->query->get($name, array()); - break; - default: - throw new FormException(sprintf('The request method "%s" is not supported', $request->getMethod())); - } - - return $this->bind($data); + return $this->bind($request); } /** @@ -976,34 +954,7 @@ class Form implements \IteratorAggregate, FormInterface $parent = $this->parent->createView(); } - $view = new FormView($this->config->getName()); - - $view->setParent($parent); - - $types = (array) $this->config->getTypes(); - $options = $this->config->getOptions(); - - foreach ($types as $type) { - $type->buildView($view, $this, $options); - - foreach ($type->getExtensions() as $typeExtension) { - $typeExtension->buildView($view, $this, $options); - } - } - - foreach ($this->children as $child) { - $view->add($child->createView($view)); - } - - foreach ($types as $type) { - $type->finishView($view, $this, $options); - - foreach ($type->getExtensions() as $typeExtension) { - $typeExtension->finishView($view, $this, $options); - } - } - - return $view; + return $this->config->getType()->createView($this, $parent); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php index cc759f6..4abec18 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilder.php @@ -13,9 +13,7 @@ namespace Symfony\Component\Form; use Symfony\Component\Form\Exception\FormException; use Symfony\Component\Form\Exception\UnexpectedTypeException; -use Symfony\Component\Form\Exception\CircularReferenceException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * A builder for creating {@link Form} instances. @@ -45,8 +43,6 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI */ private $unresolvedChildren = array(); - private $currentLoadingType; - /** * The parent of this builder * @var FormBuilder @@ -99,10 +95,6 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface'); } - if ($this->currentLoadingType && ($type instanceof FormTypeInterface ? $type->getName() : $type) == $this->currentLoadingType) { - throw new CircularReferenceException(is_string($type) ? $this->getFormFactory()->getType($type) : $type); - } - // Add to "children" to maintain order $this->children[$child] = null; $this->unresolvedChildren[$child] = array( @@ -123,10 +115,10 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI } if (null !== $type) { - return $this->getFormFactory()->createNamedBuilder($name, $type, null, $options, $this); + return $this->factory->createNamedBuilder($name, $type, null, $options, $this); } - return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options, $this); + return $this->factory->createBuilderForProperty($this->getDataClass(), $name, null, $options, $this); } /** @@ -152,7 +144,7 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI { unset($this->unresolvedChildren[$name]); - if (isset($this->children[$name])) { + if (array_key_exists($name, $this->children)) { if ($this->children[$name] instanceof self) { $this->children[$name]->setParent(null); } @@ -212,11 +204,6 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI return $form; } - public function setCurrentLoadingType($type) - { - $this->currentLoadingType = $type; - } - /** * {@inheritdoc} */ @@ -279,4 +266,23 @@ class FormBuilder extends FormConfig implements \IteratorAggregate, FormBuilderI { return new \ArrayIterator($this->children); } + + /** + * Returns the types used by this builder. + * + * @return array An array of FormTypeInterface + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use + * {@link FormConfigInterface::getType()} instead. + */ + public function getTypes() + { + $types = array(); + + for ($type = $this->getType(); null !== $type; $type = $type->getParent()) { + array_unshift($types, $type->getInnerType()); + } + + return $types; + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilderInterface.php index f9e9135..bc8eee1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormBuilderInterface.php @@ -29,7 +29,7 @@ interface FormBuilderInterface extends FormConfigEditorInterface, \Traversable, * * @return FormBuilderInterface The builder object. */ - function add($child, $type = null, array $options = array()); + public function add($child, $type = null, array $options = array()); /** * Creates a form builder. @@ -40,7 +40,7 @@ interface FormBuilderInterface extends FormConfigEditorInterface, \Traversable, * * @return FormBuilderInterface The created builder. */ - function create($name, $type = null, array $options = array()); + public function create($name, $type = null, array $options = array()); /** * Returns a child by name. @@ -51,7 +51,7 @@ interface FormBuilderInterface extends FormConfigEditorInterface, \Traversable, * * @throws Exception\FormException if the given child does not exist */ - function get($name); + public function get($name); /** * Removes the field with the given name. * @@ -59,7 +59,7 @@ interface FormBuilderInterface extends FormConfigEditorInterface, \Traversable, * * @return FormBuilderInterface The builder object. */ - function remove($name); + public function remove($name); /** * Returns whether a field with the given name exists. @@ -68,28 +68,28 @@ interface FormBuilderInterface extends FormConfigEditorInterface, \Traversable, * * @return Boolean */ - function has($name); + public function has($name); /** * Returns the children. * * @return array */ - function all(); + public function all(); /** * Returns the associated form factory. * * @return FormFactoryInterface The factory */ - function getFormFactory(); + public function getFormFactory(); /** * Creates the form. * * @return Form The form */ - function getForm(); + public function getForm(); /** * Sets the parent builder. @@ -98,19 +98,19 @@ interface FormBuilderInterface extends FormConfigEditorInterface, \Traversable, * * @return FormBuilderInterface The builder object. */ - function setParent(FormBuilderInterface $parent = null); + public function setParent(FormBuilderInterface $parent = null); /** * Returns the parent builder. * * @return FormBuilderInterface The parent builder */ - function getParent(); + public function getParent(); /** * Returns whether the builder has a parent. * * @return Boolean */ - function hasParent(); + public function hasParent(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php index 6b30bfe..af68a13 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfig.php @@ -59,9 +59,9 @@ class FormConfig implements FormConfigEditorInterface private $compound = false; /** - * @var array + * @var ResolvedFormTypeInterface */ - private $types = array(); + private $type; /** * @var array @@ -118,6 +118,11 @@ class FormConfig implements FormConfigEditorInterface */ private $dataClass; + /** + * @var Boolean + */ + private $dataLocked; + /** * @var array */ @@ -372,9 +377,9 @@ class FormConfig implements FormConfigEditorInterface /** * {@inheritdoc} */ - public function getTypes() + public function getType() { - return $this->types; + return $this->type; } /** @@ -507,6 +512,14 @@ class FormConfig implements FormConfigEditorInterface return $this->dataClass; } + /** + * {@inheritdoc} + */ + public function getDataLocked() + { + return $this->dataLocked; + } + /** * {@inheritdoc} */ @@ -658,9 +671,9 @@ class FormConfig implements FormConfigEditorInterface /** * {@inheritdoc} */ - public function setTypes(array $types) + public function setType(ResolvedFormTypeInterface $type) { - $this->types = $types; + $this->type = $type; return $this; } @@ -675,6 +688,16 @@ class FormConfig implements FormConfigEditorInterface return $this; } + /** + * {@inheritdoc} + */ + public function setDataLocked($locked) + { + $this->dataLocked = $locked; + + return $this; + } + /** * Validates whether the given variable is a valid form name. * @@ -683,7 +706,7 @@ class FormConfig implements FormConfigEditorInterface * @throws UnexpectedTypeException If the name is not a string. * @throws \InvalidArgumentException If the name contains invalid characters. */ - static public function validateName($name) + public static function validateName($name) { if (!is_string($name)) { throw new UnexpectedTypeException($name, 'string'); @@ -711,7 +734,7 @@ class FormConfig implements FormConfigEditorInterface * * @return Boolean Whether the name is valid. */ - static public function isValidName($name) + public static function isValidName($name) { return '' === $name || preg_match('/^[a-zA-Z0-9_][a-zA-Z0-9_\-:]*$/D', $name); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php index 10c1e04..b84dbb0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigEditorInterface.php @@ -29,7 +29,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function addEventListener($eventName, $listener, $priority = 0); + public function addEventListener($eventName, $listener, $priority = 0); /** * Adds an event subscriber for events on this form. @@ -38,7 +38,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function addEventSubscriber(EventSubscriberInterface $subscriber); + public function addEventSubscriber(EventSubscriberInterface $subscriber); /** * Adds a validator to the form. @@ -49,7 +49,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ - function addValidator(FormValidatorInterface $validator); + public function addValidator(FormValidatorInterface $validator); /** * Appends / prepends a transformer to the view transformer chain. @@ -64,14 +64,14 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false); + public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false); /** * Clears the view transformers. * * @return self The configuration object. */ - function resetViewTransformers(); + public function resetViewTransformers(); /** * Prepends / appends a transformer to the normalization transformer chain. @@ -86,14 +86,14 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false); + public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false); /** * Clears the normalization transformers. * * @return self The configuration object. */ - function resetModelTransformers(); + public function resetModelTransformers(); /** * Sets the value for an attribute. @@ -103,7 +103,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setAttribute($name, $value); + public function setAttribute($name, $value); /** * Sets the attributes. @@ -112,7 +112,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setAttributes(array $attributes); + public function setAttributes(array $attributes); /** * Sets the data mapper used by the form. @@ -121,7 +121,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setDataMapper(DataMapperInterface $dataMapper = null); + public function setDataMapper(DataMapperInterface $dataMapper = null); /** * Set whether the form is disabled. @@ -130,7 +130,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setDisabled($disabled); + public function setDisabled($disabled); /** * Sets the data used for the client data when no value is bound. @@ -139,7 +139,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setEmptyData($emptyData); + public function setEmptyData($emptyData); /** * Sets whether errors bubble up to the parent. @@ -148,7 +148,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setErrorBubbling($errorBubbling); + public function setErrorBubbling($errorBubbling); /** * Sets whether this field is required to be filled out when bound. @@ -157,7 +157,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setRequired($required); + public function setRequired($required); /** * Sets the property path that the form should be mapped to. @@ -168,7 +168,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setPropertyPath($propertyPath); + public function setPropertyPath($propertyPath); /** * Sets whether the form should be mapped to an element of its @@ -178,7 +178,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setMapped($mapped); + public function setMapped($mapped); /** * Sets whether the form's data should be modified by reference. @@ -188,7 +188,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setByReference($byReference); + public function setByReference($byReference); /** * Sets whether the form should be virtual. @@ -197,7 +197,7 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setVirtual($virtual); + public function setVirtual($virtual); /** * Sets whether the form should be compound. @@ -208,16 +208,16 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @see FormConfigInterface::getCompound() */ - function setCompound($compound); + public function setCompound($compound); /** * Set the types. * - * @param array $types An array FormTypeInterface + * @param ResolvedFormTypeInterface $type The type of the form. * * @return self The configuration object. */ - function setTypes(array $types); + public function setType(ResolvedFormTypeInterface $type); /** * Sets the initial data of the form. @@ -226,5 +226,18 @@ interface FormConfigEditorInterface extends FormConfigInterface * * @return self The configuration object. */ - function setData($data); + public function setData($data); + + /** + * Locks the form's data to the data passed in the configuration. + * + * A form with locked data is restricted to the data passed in + * this configuration. The data can only be modified then by + * binding the form. + * + * @param Boolean $locked Whether to lock the default data. + * + * @return self The configuration object. + */ + public function setDataLocked($locked); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigInterface.php index 22354d8..1274e4c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormConfigInterface.php @@ -23,21 +23,21 @@ interface FormConfigInterface * * @return \Symfony\Component\EventDispatcher\EventDispatcherInterface The dispatcher. */ - function getEventDispatcher(); + public function getEventDispatcher(); /** * Returns the name of the form used as HTTP parameter. * * @return string The form name. */ - function getName(); + public function getName(); /** * Returns the property path that the form should be mapped to. * * @return Util\PropertyPath The property path. */ - function getPropertyPath(); + public function getPropertyPath(); /** * Returns whether the form should be mapped to an element of its @@ -45,14 +45,14 @@ interface FormConfigInterface * * @return Boolean Whether the form is mapped. */ - function getMapped(); + public function getMapped(); /** * Returns whether the form's data should be modified by reference. * * @return Boolean Whether to modify the form's data by reference. */ - function getByReference(); + public function getByReference(); /** * Returns whether the form should be virtual. @@ -63,7 +63,7 @@ interface FormConfigInterface * * @return Boolean Whether the form is virtual. */ - function getVirtual(); + public function getVirtual(); /** * Returns whether the form is compound. @@ -74,35 +74,35 @@ interface FormConfigInterface * * @return Boolean Whether the form is compound. */ - function getCompound(); + public function getCompound(); /** * Returns the form types used to construct the form. * - * @return array An array of {@link FormTypeInterface} instances. + * @return ResolvedFormTypeInterface The form's type. */ - function getTypes(); + public function getType(); /** * Returns the view transformers of the form. * * @return array An array of {@link DataTransformerInterface} instances. */ - function getViewTransformers(); + public function getViewTransformers(); /** * Returns the model transformers of the form. * * @return array An array of {@link DataTransformerInterface} instances. */ - function getModelTransformers(); + public function getModelTransformers(); /** * Returns the data mapper of the form. * * @return DataMapperInterface The data mapper. */ - function getDataMapper(); + public function getDataMapper(); /** * Returns the validators of the form. @@ -111,42 +111,42 @@ interface FormConfigInterface * * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ - function getValidators(); + public function getValidators(); /** * Returns whether the form is required. * * @return Boolean Whether the form is required. */ - function getRequired(); + public function getRequired(); /** * Returns whether the form is disabled. * * @return Boolean Whether the form is disabled. */ - function getDisabled(); + public function getDisabled(); /** * Returns whether errors attached to the form will bubble to its parent. * * @return Boolean Whether errors will bubble up. */ - function getErrorBubbling(); + public function getErrorBubbling(); /** * Returns the data that should be returned when the form is empty. * * @return mixed The data returned if the form is empty. */ - function getEmptyData(); + public function getEmptyData(); /** * Returns additional attributes of the form. * * @return array An array of key-value combinations. */ - function getAttributes(); + public function getAttributes(); /** * Returns whether the attribute with the given name exists. @@ -155,7 +155,7 @@ interface FormConfigInterface * * @return Boolean Whether the attribute exists. */ - function hasAttribute($name); + public function hasAttribute($name); /** * Returns the value of the given attribute. @@ -165,28 +165,39 @@ interface FormConfigInterface * * @return mixed The attribute value. */ - function getAttribute($name, $default = null); + public function getAttribute($name, $default = null); /** * Returns the initial data of the form. * * @return mixed The initial form data. */ - function getData(); + public function getData(); /** * Returns the class of the form data or null if the data is scalar or an array. * * @return string The data class or null. */ - function getDataClass(); + public function getDataClass(); + + /** + * Returns whether the form's data is locked. + * + * A form with locked data is restricted to the data passed in + * this configuration. The data can only be modified then by + * binding the form. + * + * @return Boolean Whether the data is locked. + */ + public function getDataLocked(); /** * Returns all options passed during the construction of the form. * * @return array The passed options. */ - function getOptions(); + public function getOptions(); /** * Returns whether a specific option exists. @@ -195,7 +206,7 @@ interface FormConfigInterface * * @return Boolean Whether the option exists. */ - function hasOption($name); + public function hasOption($name); /** * Returns the value of a specific option. @@ -205,5 +216,5 @@ interface FormConfigInterface * * @return mixed The option value. */ - function getOption($name, $default = null); + public function getOption($name, $default = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormExtensionInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormExtensionInterface.php index e3c2b78..5347c45 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormExtensionInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormExtensionInterface.php @@ -25,7 +25,7 @@ interface FormExtensionInterface * * @throws Exception\FormException if the given type is not supported by this extension */ - function getType($name); + public function getType($name); /** * Returns whether the given type is supported. @@ -34,7 +34,7 @@ interface FormExtensionInterface * * @return Boolean Whether the type is supported by this extension */ - function hasType($name); + public function hasType($name); /** * Returns the extensions for the given type. @@ -43,7 +43,7 @@ interface FormExtensionInterface * * @return array An array of extensions as FormTypeExtensionInterface instances */ - function getTypeExtensions($name); + public function getTypeExtensions($name); /** * Returns whether this extension provides type extensions for the given type. @@ -52,12 +52,12 @@ interface FormExtensionInterface * * @return Boolean Whether the given type has extensions */ - function hasTypeExtensions($name); + public function hasTypeExtensions($name); /** * Returns the type guesser provided by this extension. * * @return FormTypeGuesserInterface|null The type guesser */ - function getTypeGuesser(); + public function getTypeGuesser(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php index 5537b32..a925b1a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactory.php @@ -18,92 +18,14 @@ use Symfony\Component\OptionsResolver\OptionsResolver; class FormFactory implements FormFactoryInterface { - private static $requiredOptions = array( - 'data', - 'required', - 'max_length', - ); - /** - * Extensions - * @var array An array of FormExtensionInterface + * @var FormRegistryInterface */ - private $extensions = array(); + private $registry; - /** - * All known types (cache) - * @var array An array of FormTypeInterface - */ - private $types = array(); - - /** - * The guesser chain - * @var FormTypeGuesserChain - */ - private $guesser; - - /** - * Constructor. - * - * @param array $extensions An array of FormExtensionInterface - * - * @throws UnexpectedTypeException if any extension does not implement FormExtensionInterface - */ - public function __construct(array $extensions) + public function __construct(FormRegistryInterface $registry) { - foreach ($extensions as $extension) { - if (!$extension instanceof FormExtensionInterface) { - throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormExtensionInterface'); - } - } - - $this->extensions = $extensions; - } - - /** - * {@inheritdoc} - */ - public function hasType($name) - { - if (isset($this->types[$name])) { - return true; - } - - try { - $this->loadType($name); - } catch (FormException $e) { - return false; - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function addType(FormTypeInterface $type) - { - $this->loadTypeExtensions($type); - - $this->validateFormTypeName($type); - - $this->types[$type->getName()] = $type; - } - - /** - * {@inheritdoc} - */ - public function getType($name) - { - if (!is_string($name)) { - throw new UnexpectedTypeException($name, 'string'); - } - - if (!isset($this->types[$name])) { - $this->loadType($name); - } - - return $this->types[$name]; + $this->registry = $registry; } /** @@ -135,7 +57,9 @@ class FormFactory implements FormFactoryInterface */ public function createBuilder($type, $data = null, array $options = array(), FormBuilderInterface $parent = null) { - $name = is_object($type) ? $type->getName() : $type; + $name = $type instanceof FormTypeInterface || $type instanceof ResolvedFormTypeInterface + ? $type->getName() + : $type; return $this->createNamedBuilder($name, $type, $data, $options, $parent); } @@ -145,91 +69,22 @@ class FormFactory implements FormFactoryInterface */ public function createNamedBuilder($name, $type, $data = null, array $options = array(), FormBuilderInterface $parent = null) { - if (!array_key_exists('data', $options)) { + if (null !== $data && !array_key_exists('data', $options)) { $options['data'] = $data; } - $builder = null; - $types = array(); - $optionsResolver = new OptionsResolver(); - - // Bottom-up determination of the type hierarchy - // Start with the actual type and look for the parent type - // The complete hierarchy is saved in $types, the first entry being - // the root and the last entry being the leaf (the concrete type) - while (null !== $type) { - if ($type instanceof FormTypeInterface) { - if ($type->getName() == $type->getParent($options)) { - throw new FormException(sprintf('The form type name "%s" for class "%s" cannot be the same as the parent type.', $type->getName(), get_class($type))); - } - - $this->addType($type); - } elseif (is_string($type)) { - $type = $this->getType($type); - } else { - throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface'); - } - - array_unshift($types, $type); - - $type = $type->getParent(); + if ($type instanceof ResolvedFormTypeInterface) { + $this->registry->addType($type); + } elseif ($type instanceof FormTypeInterface) { + $type = $this->registry->resolveType($type); + $this->registry->addType($type); + } elseif (is_string($type)) { + $type = $this->registry->getType($type); + } else { + throw new UnexpectedTypeException($type, 'string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface'); } - // Top-down determination of the default options - foreach ($types as $type) { - // Merge the default options of all types to an array of default - // options. Default options of children override default options - // of parents. - /* @var FormTypeInterface $type */ - $type->setDefaultOptions($optionsResolver); - - foreach ($type->getExtensions() as $typeExtension) { - /* @var FormTypeExtensionInterface $typeExtension */ - $typeExtension->setDefaultOptions($optionsResolver); - } - } - - // Resolve concrete type - $type = end($types); - - // Validate options required by the factory - $diff = array(); - - foreach (self::$requiredOptions as $requiredOption) { - if (!$optionsResolver->isKnown($requiredOption)) { - $diff[] = $requiredOption; - } - } - - if (count($diff) > 0) { - throw new TypeDefinitionException(sprintf('Type "%s" should support the option(s) "%s"', $type->getName(), implode('", "', $diff))); - } - - // Resolve options - $options = $optionsResolver->resolve($options); - - for ($i = 0, $l = count($types); $i < $l && !$builder; ++$i) { - $builder = $types[$i]->createBuilder($name, $this, $options); - } - - if (!$builder) { - throw new TypeDefinitionException(sprintf('Type "%s" or any of its parents should return a FormBuilderInterface instance from createBuilder()', $type->getName())); - } - - $builder->setTypes($types); - $builder->setCurrentLoadingType($type->getName()); - $builder->setParent($parent); - - foreach ($types as $type) { - $type->buildForm($builder, $options); - - foreach ($type->getExtensions() as $typeExtension) { - $typeExtension->buildForm($builder, $options); - } - } - $builder->setCurrentLoadingType(null); - - return $builder; + return $type->createBuilder($this, $name, $options, $parent); } /** @@ -237,16 +92,13 @@ class FormFactory implements FormFactoryInterface */ public function createBuilderForProperty($class, $property, $data = null, array $options = array(), FormBuilderInterface $parent = null) { - if (!$this->guesser) { - $this->loadGuesser(); - } - - $typeGuess = $this->guesser->guessType($class, $property); - $maxLengthGuess = $this->guesser->guessMaxLength($class, $property); + $guesser = $this->registry->getTypeGuesser(); + $typeGuess = $guesser->guessType($class, $property); + $maxLengthGuess = $guesser->guessMaxLength($class, $property); // Keep $minLengthGuess for BC until Symfony 2.3 - $minLengthGuess = $this->guesser->guessMinLength($class, $property); - $requiredGuess = $this->guesser->guessRequired($class, $property); - $patternGuess = $this->guesser->guessPattern($class, $property); + $minLengthGuess = $guesser->guessMinLength($class, $property); + $requiredGuess = $guesser->guessRequired($class, $property); + $patternGuess = $guesser->guessPattern($class, $property); $type = $typeGuess ? $typeGuess->getType() : 'text'; @@ -280,75 +132,50 @@ class FormFactory implements FormFactoryInterface } /** - * Initializes the guesser chain. + * Returns whether the given type is supported. + * + * @param string $name The name of the type + * + * @return Boolean Whether the type is supported + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use + * {@link FormRegistryInterface::hasType()} instead. */ - private function loadGuesser() + public function hasType($name) { - $guessers = array(); - - foreach ($this->extensions as $extension) { - $guesser = $extension->getTypeGuesser(); - - if ($guesser) { - $guessers[] = $guesser; - } - } - - $this->guesser = new FormTypeGuesserChain($guessers); + return $this->registry->hasType($name); } /** - * Loads a type. - * - * @param string $name The type name - * - * @throws FormException if the type is not provided by any registered extension - */ - private function loadType($name) - { - $type = null; - - foreach ($this->extensions as $extension) { - if ($extension->hasType($name)) { - $type = $extension->getType($name); - break; - } - } - - if (!$type) { - throw new FormException(sprintf('Could not load type "%s"', $name)); - } - - $this->loadTypeExtensions($type); - - $this->validateFormTypeName($type); - - $this->types[$name] = $type; - } - - /** - * Loads the extensions for a given type. + * Adds a type. * * @param FormTypeInterface $type The type + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use + * {@link FormRegistryInterface::resolveType()} and + * {@link FormRegistryInterface::addType()} instead. */ - private function loadTypeExtensions(FormTypeInterface $type) + public function addType(FormTypeInterface $type) { - $typeExtensions = array(); - - foreach ($this->extensions as $extension) { - $typeExtensions = array_merge( - $typeExtensions, - $extension->getTypeExtensions($type->getName()) - ); - } - - $type->setExtensions($typeExtensions); + $this->registry->addType($this->registry->resolveType($type)); } - private function validateFormTypeName(FormTypeInterface $type) + /** + * Returns a type by name. + * + * This methods registers the type extensions from the form extensions. + * + * @param string $name The name of the type + * + * @return FormTypeInterface The type + * + * @throws Exception\FormException if the type can not be retrieved from any extension + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. Use + * {@link FormRegistryInterface::getType()} instead. + */ + public function getType($name) { - if (!preg_match('/^[a-z0-9_]*$/i', $type->getName())) { - throw new FormException(sprintf('The "%s" form type name ("%s") is not valid. Names must only contain letters, numbers, and "_".', get_class($type), $type->getName())); - } + return $this->registry->getType($name)->getInnerType(); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactoryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactoryInterface.php index 6b242b3..73f31aa 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactoryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormFactoryInterface.php @@ -30,7 +30,7 @@ interface FormFactoryInterface * * @throws Exception\FormException if any given option is not applicable to the given type */ - function create($type, $data = null, array $options = array(), FormBuilderInterface $parent = null); + public function create($type, $data = null, array $options = array(), FormBuilderInterface $parent = null); /** * Returns a form. @@ -47,7 +47,7 @@ interface FormFactoryInterface * * @throws Exception\FormException if any given option is not applicable to the given type */ - function createNamed($name, $type, $data = null, array $options = array(), FormBuilderInterface $parent = null); + public function createNamed($name, $type, $data = null, array $options = array(), FormBuilderInterface $parent = null); /** * Returns a form for a property of a class. @@ -64,7 +64,7 @@ interface FormFactoryInterface * * @throws Exception\FormException if any given option is not applicable to the form type */ - function createForProperty($class, $property, $data = null, array $options = array(), FormBuilderInterface $parent = null); + public function createForProperty($class, $property, $data = null, array $options = array(), FormBuilderInterface $parent = null); /** * Returns a form builder. @@ -78,7 +78,7 @@ interface FormFactoryInterface * * @throws Exception\FormException if any given option is not applicable to the given type */ - function createBuilder($type, $data = null, array $options = array(), FormBuilderInterface $parent = null); + public function createBuilder($type, $data = null, array $options = array(), FormBuilderInterface $parent = null); /** * Returns a form builder. @@ -93,7 +93,7 @@ interface FormFactoryInterface * * @throws Exception\FormException if any given option is not applicable to the given type */ - function createNamedBuilder($name, $type, $data = null, array $options = array(), FormBuilderInterface $parent = null); + public function createNamedBuilder($name, $type, $data = null, array $options = array(), FormBuilderInterface $parent = null); /** * Returns a form builder for a property of a class. @@ -111,34 +111,5 @@ interface FormFactoryInterface * * @throws Exception\FormException if any given option is not applicable to the form type */ - function createBuilderForProperty($class, $property, $data = null, array $options = array(), FormBuilderInterface $parent = null); - - /** - * Returns a type by name. - * - * This methods registers the type extensions from the form extensions. - * - * @param string $name The name of the type - * - * @return FormTypeInterface The type - * - * @throws Exception\FormException if the type can not be retrieved from any extension - */ - function getType($name); - - /** - * Returns whether the given type is supported. - * - * @param string $name The name of the type - * - * @return Boolean Whether the type is supported - */ - function hasType($name); - - /** - * Adds a type. - * - * @param FormTypeInterface $type The type - */ - function addType(FormTypeInterface $type); + public function createBuilderForProperty($class, $property, $data = null, array $options = array(), FormBuilderInterface $parent = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormInterface.php index e74dcbf..b6dd1c1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormInterface.php @@ -25,21 +25,21 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormInterface The form instance */ - function setParent(FormInterface $parent = null); + public function setParent(FormInterface $parent = null); /** * Returns the parent form. * * @return FormInterface The parent form */ - function getParent(); + public function getParent(); /** * Returns whether the form has a parent. * * @return Boolean */ - function hasParent(); + public function hasParent(); /** * Adds a child to the form. @@ -48,7 +48,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormInterface The form instance */ - function add(FormInterface $child); + public function add(FormInterface $child); /** * Returns the child with the given name. @@ -57,7 +57,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormInterface The child form */ - function get($name); + public function get($name); /** * Returns whether a child with the given name exists. @@ -66,7 +66,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return Boolean */ - function has($name); + public function has($name); /** * Removes a child from the form. @@ -75,21 +75,21 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormInterface The form instance */ - function remove($name); + public function remove($name); /** * Returns all children in this group. * * @return array An array of FormInterface instances */ - function all(); + public function all(); /** * Returns all errors. * * @return array An array of FormError instances that occurred during binding */ - function getErrors(); + public function getErrors(); /** * Updates the field with default data. @@ -98,14 +98,14 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormInterface The form instance */ - function setData($modelData); + public function setData($modelData); /** * Returns the data in the format needed for the underlying object. * * @return mixed */ - function getData(); + public function getData(); /** * Returns the normalized data of the field. @@ -114,49 +114,49 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * When the field is bound, the normalized bound data is * returned if the field is valid, null otherwise. */ - function getNormData(); + public function getNormData(); /** * Returns the data transformed by the value transformer. * * @return string */ - function getViewData(); + public function getViewData(); /** * Returns the extra data. * * @return array The bound data which do not belong to a child */ - function getExtraData(); + public function getExtraData(); /** * Returns the form's configuration. * * @return FormConfigInterface The configuration. */ - function getConfig(); + public function getConfig(); /** * Returns whether the field is bound. * * @return Boolean true if the form is bound to input values, false otherwise */ - function isBound(); + public function isBound(); /** * Returns the name by which the form is identified in forms. * * @return string The name of the form. */ - function getName(); + public function getName(); /** * Returns the property path that the form is mapped to. * * @return Util\PropertyPath The property path. */ - function getPropertyPath(); + public function getPropertyPath(); /** * Adds an error to this form. @@ -165,14 +165,14 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormInterface The form instance */ - function addError(FormError $error); + public function addError(FormError $error); /** * Returns whether the form is valid. * * @return Boolean */ - function isValid(); + public function isValid(); /** * Returns whether the form is required to be filled out. @@ -183,7 +183,7 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return Boolean */ - function isRequired(); + public function isRequired(); /** * Returns whether this form is disabled. @@ -196,21 +196,21 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return Boolean */ - function isDisabled(); + public function isDisabled(); /** * Returns whether the form is empty. * * @return Boolean */ - function isEmpty(); + public function isEmpty(); /** * Returns whether the data in the different formats is synchronized. * * @return Boolean */ - function isSynchronized(); + public function isSynchronized(); /** * Writes data into the form. @@ -219,21 +219,21 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormInterface The form instance */ - function bind($data); + public function bind($data); /** * Returns the root of the form tree. * * @return FormInterface The root of the tree */ - function getRoot(); + public function getRoot(); /** * Returns whether the field is the root of the form tree. * * @return Boolean */ - function isRoot(); + public function isRoot(); /** * Creates a view. @@ -242,5 +242,5 @@ interface FormInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormViewInterface The view */ - function createView(FormViewInterface $parent = null); + public function createView(FormViewInterface $parent = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php new file mode 100644 index 0000000..12c6101 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistry.php @@ -0,0 +1,164 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Exception\FormException; + +/** + * The central registry of the Form component. + * + * @author Bernhard Schussek + */ +class FormRegistry implements FormRegistryInterface +{ + /** + * Extensions + * @var array An array of FormExtensionInterface + */ + private $extensions = array(); + + /** + * @var array + */ + private $types = array(); + + /** + * @var FormTypeGuesserInterface + */ + private $guesser; + + /** + * Constructor. + * + * @param array $extensions An array of FormExtensionInterface + * + * @throws UnexpectedTypeException if any extension does not implement FormExtensionInterface + */ + public function __construct(array $extensions) + { + foreach ($extensions as $extension) { + if (!$extension instanceof FormExtensionInterface) { + throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormExtensionInterface'); + } + } + + $this->extensions = $extensions; + } + + /** + * {@inheritdoc} + */ + public function resolveType(FormTypeInterface $type) + { + $typeExtensions = array(); + + foreach ($this->extensions as $extension) { + /* @var FormExtensionInterface $extension */ + $typeExtensions = array_merge( + $typeExtensions, + $extension->getTypeExtensions($type->getName()) + ); + } + + $parent = $type->getParent() ? $this->getType($type->getParent()) : null; + + return new ResolvedFormType($type, $typeExtensions, $parent); + } + + /** + * {@inheritdoc} + */ + public function addType(ResolvedFormTypeInterface $type) + { + $this->types[$type->getName()] = $type; + } + + /** + * {@inheritdoc} + */ + public function getType($name) + { + if (!is_string($name)) { + throw new UnexpectedTypeException($name, 'string'); + } + + if (!isset($this->types[$name])) { + $type = null; + + foreach ($this->extensions as $extension) { + /* @var FormExtensionInterface $extension */ + if ($extension->hasType($name)) { + $type = $extension->getType($name); + break; + } + } + + if (!$type) { + throw new FormException(sprintf('Could not load type "%s"', $name)); + } + + $this->addType($this->resolveType($type)); + } + + return $this->types[$name]; + } + + /** + * {@inheritdoc} + */ + public function hasType($name) + { + if (isset($this->types[$name])) { + return true; + } + + try { + $this->getType($name); + } catch (FormException $e) { + return false; + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function getTypeGuesser() + { + if (null === $this->guesser) { + $guessers = array(); + + foreach ($this->extensions as $extension) { + /* @var FormExtensionInterface $extension */ + $guesser = $extension->getTypeGuesser(); + + if ($guesser) { + $guessers[] = $guesser; + } + } + + $this->guesser = new FormTypeGuesserChain($guessers); + } + + return $this->guesser; + } + + /** + * {@inheritdoc} + */ + public function getExtensions() + { + return $this->extensions; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistryInterface.php new file mode 100644 index 0000000..55773d4 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormRegistryInterface.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * The central registry of the Form component. + * + * @author Bernhard Schussek + */ +interface FormRegistryInterface +{ + /** + * Adds a form type. + * + * @param ResolvedFormTypeInterface $type The type + */ + public function addType(ResolvedFormTypeInterface $type); + + /** + * Returns a form type by name. + * + * This methods registers the type extensions from the form extensions. + * + * @param string $name The name of the type + * + * @return ResolvedFormTypeInterface The type + * + * @throws Exception\UnexpectedTypeException if the passed name is not a string + * @throws Exception\FormException if the type can not be retrieved from any extension + */ + public function getType($name); + + /** + * Returns whether the given form type is supported. + * + * @param string $name The name of the type + * + * @return Boolean Whether the type is supported + */ + public function hasType($name); + + /** + * Resolves a form type. + * + * @param FormTypeInterface $type + * + * @return ResolvedFormTypeInterface + * + * @throws Exception\UnexpectedTypeException if the types parent {@link FormTypeInterface::getParent()} is not a string + * @throws Exception\FormException if the types parent can not be retrieved from any extension + */ + public function resolveType(FormTypeInterface $type); + + /** + * Returns the guesser responsible for guessing types. + * + * @return FormTypeGuesserInterface + */ + public function getTypeGuesser(); + + /** + * Returns the extensions loaded by the framework. + * + * @return array + */ + public function getExtensions(); +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeExtensionInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeExtensionInterface.php index b83cf02..2cbfc28 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeExtensionInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeExtensionInterface.php @@ -29,7 +29,7 @@ interface FormTypeExtensionInterface * @param FormBuilderInterface $builder The form builder * @param array $options The options */ - function buildForm(FormBuilderInterface $builder, array $options); + public function buildForm(FormBuilderInterface $builder, array $options); /** * Builds the view. @@ -43,7 +43,7 @@ interface FormTypeExtensionInterface * @param FormInterface $form The form * @param array $options The options */ - function buildView(FormViewInterface $view, FormInterface $form, array $options); + public function buildView(FormViewInterface $view, FormInterface $form, array $options); /** * Finishes the view. @@ -57,19 +57,19 @@ interface FormTypeExtensionInterface * @param FormInterface $form The form * @param array $options The options */ - function finishView(FormViewInterface $view, FormInterface $form, array $options); + public function finishView(FormViewInterface $view, FormInterface $form, array $options); /** * Overrides the default options from the extended type. * * @param OptionsResolverInterface $resolver The resolver for the options. */ - function setDefaultOptions(OptionsResolverInterface $resolver); + public function setDefaultOptions(OptionsResolverInterface $resolver); /** * Returns the name of the type being extended. * * @return string The name of the type being extended */ - function getExtendedType(); + public function getExtendedType(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeGuesserInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeGuesserInterface.php index 5750336..d5b570f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeGuesserInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeGuesserInterface.php @@ -24,7 +24,7 @@ interface FormTypeGuesserInterface * * @return Guess\TypeGuess A guess for the field's type and options */ - function guessType($class, $property); + public function guessType($class, $property); /** * Returns a guess whether a property of a class is required @@ -34,7 +34,7 @@ interface FormTypeGuesserInterface * * @return Guess\Guess A guess for the field's required setting */ - function guessRequired($class, $property); + public function guessRequired($class, $property); /** * Returns a guess about the field's maximum length @@ -44,7 +44,7 @@ interface FormTypeGuesserInterface * * @return Guess\Guess A guess for the field's maximum length */ - function guessMaxLength($class, $property); + public function guessMaxLength($class, $property); /** * Returns a guess about the field's minimum length @@ -56,7 +56,7 @@ interface FormTypeGuesserInterface * * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ - function guessMinLength($class, $property); + public function guessMinLength($class, $property); /** * Returns a guess about the field's pattern @@ -72,5 +72,5 @@ interface FormTypeGuesserInterface * * @return Guess\Guess A guess for the field's required pattern */ - function guessPattern($class, $property); + public function guessPattern($class, $property); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeInterface.php index 22f874c..00e96dd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormTypeInterface.php @@ -29,7 +29,7 @@ interface FormTypeInterface * @param FormBuilderInterface $builder The form builder * @param array $options The options */ - function buildForm(FormBuilderInterface $builder, array $options); + public function buildForm(FormBuilderInterface $builder, array $options); /** * Builds the form view. @@ -47,7 +47,7 @@ interface FormTypeInterface * @param FormInterface $form The form * @param array $options The options */ - function buildView(FormViewInterface $view, FormInterface $form, array $options); + public function buildView(FormViewInterface $view, FormInterface $form, array $options); /** * Finishes the form view. @@ -66,56 +66,26 @@ interface FormTypeInterface * @param FormInterface $form The form * @param array $options The options */ - function finishView(FormViewInterface $view, FormInterface $form, array $options); - - /** - * Returns a builder for the current type. - * - * The builder is retrieved by going up in the type hierarchy when a type does - * not provide one. - * - * @param string $name The name of the builder - * @param FormFactoryInterface $factory The form factory - * @param array $options The options - * - * @return FormBuilderInterface|null A form builder or null when the type does not have a builder - */ - function createBuilder($name, FormFactoryInterface $factory, array $options); + public function finishView(FormViewInterface $view, FormInterface $form, array $options); /** * Sets the default options for this type. * * @param OptionsResolverInterface $resolver The resolver for the options. */ - function setDefaultOptions(OptionsResolverInterface $resolver); + public function setDefaultOptions(OptionsResolverInterface $resolver); /** * Returns the name of the parent type. * * @return string|null The name of the parent type if any, null otherwise. */ - function getParent(); + public function getParent(); /** * Returns the name of this type. * * @return string The name of this type */ - function getName(); - - /** - * Sets the extensions for this type. - * - * @param array $extensions An array of FormTypeExtensionInterface - * - * @throws Exception\UnexpectedTypeException if any extension does not implement FormTypeExtensionInterface - */ - function setExtensions(array $extensions); - - /** - * Returns the extensions associated with this type. - * - * @return array An array of FormTypeExtensionInterface - */ - function getExtensions(); + public function getName(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormValidatorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormValidatorInterface.php index 6fa541b..2fdd51f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormValidatorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormValidatorInterface.php @@ -24,5 +24,5 @@ interface FormValidatorInterface /** * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ - function validate(FormInterface $form); + public function validate(FormInterface $form); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/FormViewInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/FormViewInterface.php index 1e71aba..bee156f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/FormViewInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/FormViewInterface.php @@ -21,21 +21,21 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return string The form name. */ - function getName(); + public function getName(); /** * Returns whether the view was already rendered. * * @return Boolean Whether this view's widget is rendered. */ - function isRendered(); + public function isRendered(); /** * Marks the view as rendered. * * @return FormViewInterface The view object. */ - function setRendered(); + public function setRendered(); /** * Sets the parent view. @@ -44,21 +44,21 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormViewInterface The view object. */ - function setParent(FormViewInterface $parent = null); + public function setParent(FormViewInterface $parent = null); /** * Returns the parent view. * * @return FormViewInterface The parent view. */ - function getParent(); + public function getParent(); /** * Returns whether this view has a parent. * * @return Boolean Whether this view has a parent */ - function hasParent(); + public function hasParent(); /** * Adds a child view. @@ -67,7 +67,7 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormViewInterface The view object. */ - function add(FormViewInterface $child); + public function add(FormViewInterface $child); /** * Removes a child view. @@ -76,14 +76,14 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormViewInterface The view object. */ - function remove($name); + public function remove($name); /** * Returns the children. * * @return array The children as instances of FormView */ - function all(); + public function all(); /** * Returns a given child. @@ -92,7 +92,7 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormViewInterface The child view */ - function get($name); + public function get($name); /** * Returns whether this view has a given child. @@ -101,7 +101,7 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return Boolean Whether the child with the given name exists */ - function has($name); + public function has($name); /** * Sets a view variable. @@ -111,7 +111,7 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormViewInterface The view object. */ - function setVar($name, $value); + public function setVar($name, $value); /** * Adds a list of view variables. @@ -120,7 +120,7 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return FormViewInterface The view object. */ - function addVars(array $values); + public function addVars(array $values); /** * Returns whether a view variable exists. @@ -129,7 +129,7 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return Boolean Whether the variable exists. */ - function hasVar($name); + public function hasVar($name); /** * Returns the value of a view variable. @@ -139,12 +139,12 @@ interface FormViewInterface extends \ArrayAccess, \Traversable, \Countable * * @return mixed The variable value. */ - function getVar($name, $default = null); + public function getVar($name, $default = null); /** * Returns the values of all view variables. * * @return array The values of all variables. */ - function getVars(); + public function getVars(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Guess/Guess.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Guess/Guess.php index 800617a..c964ec2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Guess/Guess.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Guess/Guess.php @@ -77,7 +77,7 @@ abstract class Guess * * @return Guess The guess with the highest confidence */ - static public function getBestGuess(array $guesses) + public static function getBestGuess(array $guesses) { usort($guesses, function ($a, $b) { return $b->getConfidence() - $a->getConfidence(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php new file mode 100644 index 0000000..3a85679 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormType.php @@ -0,0 +1,213 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Exception\FormException; +use Symfony\Component\Form\Exception\UnexpectedTypeException; +use Symfony\Component\Form\Exception\TypeDefinitionException; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\OptionsResolver\OptionsResolver; + +/** + * A wrapper for a form type and its extensions. + * + * @author Bernhard Schussek + */ +class ResolvedFormType implements ResolvedFormTypeInterface +{ + /** + * @var FormTypeInterface + */ + private $innerType; + + /** + * @var array + */ + private $typeExtensions; + + /** + * @var ResolvedFormType + */ + private $parent; + + /** + * @var OptionsResolver + */ + private $optionsResolver; + + public function __construct(FormTypeInterface $innerType, array $typeExtensions = array(), ResolvedFormType $parent = null) + { + if (!preg_match('/^[a-z0-9_]*$/i', $innerType->getName())) { + throw new FormException(sprintf( + 'The "%s" form type name ("%s") is not valid. Names must only contain letters, numbers, and "_".', + get_class($innerType), + $innerType->getName() + )); + } + + foreach ($typeExtensions as $extension) { + if (!$extension instanceof FormTypeExtensionInterface) { + throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface'); + } + } + + // BC + if ($innerType instanceof AbstractType) { + /* @var AbstractType $innerType */ + $innerType->setExtensions($typeExtensions); + } + + $this->innerType = $innerType; + $this->typeExtensions = $typeExtensions; + $this->parent = $parent; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return $this->innerType->getName(); + } + + /** + * {@inheritdoc} + */ + public function getParent() + { + return $this->parent; + } + + /** + * {@inheritdoc} + */ + public function getInnerType() + { + return $this->innerType; + } + + /** + * {@inheritdoc} + */ + public function getTypeExtensions() + { + // BC + if ($this->innerType instanceof AbstractType) { + return $this->innerType->getExtensions(); + } + + return $this->typeExtensions; + } + + /** + * {@inheritdoc} + */ + public function createBuilder(FormFactoryInterface $factory, $name, array $options = array(), FormBuilderInterface $parent = null) + { + $options = $this->getOptionsResolver()->resolve($options); + + // Should be decoupled from the specific option at some point + $dataClass = isset($options['data_class']) ? $options['data_class'] : null; + + $builder = new FormBuilder($name, $dataClass, new EventDispatcher(), $factory, $options); + $builder->setType($this); + $builder->setParent($parent); + + $this->buildForm($builder, $options); + + return $builder; + } + + /** + * {@inheritdoc} + */ + public function createView(FormInterface $form, FormViewInterface $parent = null) + { + $options = $form->getConfig()->getOptions(); + + $view = new FormView($form->getConfig()->getName()); + $view->setParent($parent); + + $this->buildView($view, $form, $options); + + foreach ($form as $child) { + /* @var FormInterface $child */ + $view->add($child->createView($view)); + } + + $this->finishView($view, $form, $options); + + return $view; + } + + private function buildForm(FormBuilderInterface $builder, array $options) + { + if (null !== $this->parent) { + $this->parent->buildForm($builder, $options); + } + + $this->innerType->buildForm($builder, $options); + + foreach ($this->typeExtensions as $extension) { + /* @var FormTypeExtensionInterface $extension */ + $extension->buildForm($builder, $options); + } + } + + private function buildView(FormViewInterface $view, FormInterface $form, array $options) + { + if (null !== $this->parent) { + $this->parent->buildView($view, $form, $options); + } + + $this->innerType->buildView($view, $form, $options); + + foreach ($this->typeExtensions as $extension) { + /* @var FormTypeExtensionInterface $extension */ + $extension->buildView($view, $form, $options); + } + } + + private function finishView(FormViewInterface $view, FormInterface $form, array $options) + { + if (null !== $this->parent) { + $this->parent->finishView($view, $form, $options); + } + + $this->innerType->finishView($view, $form, $options); + + foreach ($this->typeExtensions as $extension) { + /* @var FormTypeExtensionInterface $extension */ + $extension->finishView($view, $form, $options); + } + } + + private function getOptionsResolver() + { + if (null === $this->optionsResolver) { + if (null !== $this->parent) { + $this->optionsResolver = clone $this->parent->getOptionsResolver(); + } else { + $this->optionsResolver = new OptionsResolver(); + } + + $this->innerType->setDefaultOptions($this->optionsResolver); + + foreach ($this->typeExtensions as $extension) { + /* @var FormTypeExtensionInterface $extension */ + $extension->setDefaultOptions($this->optionsResolver); + } + } + + return $this->optionsResolver; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeInterface.php new file mode 100644 index 0000000..0620981 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/ResolvedFormTypeInterface.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +/** + * A wrapper for a form type and its extensions. + * + * @author Bernhard Schussek + */ +interface ResolvedFormTypeInterface +{ + /** + * Returns the name of the type. + * + * @return string The type name. + */ + public function getName(); + + /** + * Returns the parent type. + * + * @return ResolvedFormTypeInterface The parent type or null. + */ + public function getParent(); + + /** + * Returns the wrapped form type. + * + * @return FormTypeInterface The wrapped form type. + */ + public function getInnerType(); + + /** + * Returns the extensions of the wrapped form type. + * + * @return array An array of {@link FormTypeExtensionInterface} instances. + */ + public function getTypeExtensions(); + + /** + * Creates a new form builder for this type. + * + * @param FormFactoryInterface $factory The form factory. + * @param string $name The name for the builder. + * @param array $options The builder options. + * @param FormBuilderInterface $parent The parent builder object or null. + * + * @return FormBuilderInterface The created form builder. + */ + public function createBuilder(FormFactoryInterface $factory, $name, array $options = array(), FormBuilderInterface $parent = null); + + /** + * Creates a new form view for a form of this type. + * + * @param FormInterface $form The form to create a view for. + * @param FormViewInterface $parent The parent view or null. + * + * @return FormViewInterface The created form view. + */ + public function createView(FormInterface $form, FormViewInterface $parent = null); +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf b/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf index 7cd90ff..ff7f550 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf @@ -11,8 +11,8 @@ Отпремљена датотека је била превелика. Молим покушајте отпремање мање датотеке. - The CSRF token is invalid. - CSRF вредност је невалидна. + The CSRF token is invalid. Please try to resubmit the form. + CSRF вредност је невалидна. Покушајте поново. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf b/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf index 42d6d50..6c4be35 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf @@ -11,8 +11,8 @@ Otpremljena datoteka je bila prevelika. Molim pokušajte otpremanje manje datoteke. - The CSRF token is invalid. - CSRF vrednost je nevalidna. + The CSRF token is invalid. Please try to resubmit the form. + CSRF vrednost je nevalidna. Pokušajte ponovo. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php index 0841f62..01c8d96 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php @@ -57,11 +57,13 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest $view = $form->createView(); $html = $this->renderRow($view); + // The errors of the form are not rendered by intention! + // In practice, repeated fields cannot have errors as all errors + // on them are mapped to the first child. + // (see RepeatedTypeValidatorExtension) + $this->assertMatchesXpath($html, -'/ul - [./li[.="[trans]Error![/trans]"]] - [count(./li)=1] -/following-sibling::div +'/div [ ./label[@for="name_first"] /following-sibling::input[@id="name_first"] @@ -373,7 +375,8 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest $this->assertWidgetMatchesXpath($form->createView(), array(), '/div [ - ./div/div[@id="name_child"][./ul/li[.="[trans]Error![/trans]"]] + ./div/label + /following-sibling::ul[./li[.="[trans]Error![/trans]"]] ] [count(.//li[.="[trans]Error![/trans]"])=1] ' @@ -554,6 +557,27 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest ] /following-sibling::input[@type="hidden"] ] +' + ); + } + + /** + * The block "_name_child_label" should be overridden in the theme of the + * implemented driver. + */ + public function testCollectionRowWithCustomBlock() + { + $collection = array('one', 'two', 'three'); + $form = $this->factory->createNamedBuilder('name', 'collection', $collection) + ->getForm(); + + $this->assertWidgetMatchesXpath($form->createView(), array(), +'/div + [ + ./div[./label[.="Custom label: [trans]0[/trans]"]] + /following-sibling::div[./label[.="Custom label: [trans]1[/trans]"]] + /following-sibling::div[./label[.="Custom label: [trans]2[/trans]"]] + ] ' ); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractFormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractFormTest.php index 6b2ca65..8393d61 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractFormTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractFormTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Form\Tests; -use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormBuilder; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase @@ -38,7 +38,9 @@ abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('The "EventDispatcher" component is not available'); } - $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + // We need an actual dispatcher to bind the deprecated + // bindRequest() method + $this->dispatcher = new EventDispatcher();; $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface'); $this->form = $this->createForm(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php index 874e885..40195c2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php @@ -17,7 +17,7 @@ use Symfony\Component\Form\FormFactory; use Symfony\Component\Form\Extension\Core\CoreExtension; use Symfony\Component\Form\Extension\Csrf\CsrfExtension; -abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase +abstract class AbstractLayoutTest extends FormIntegrationTestCase { protected $csrfProvider; @@ -33,10 +33,15 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase $this->csrfProvider = $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface'); - $this->factory = new FormFactory(array( + parent::setUp(); + } + + protected function getExtensions() + { + return array( new CoreExtension(), new CsrfExtension($this->csrfProvider), - )); + ); } protected function tearDown() @@ -377,7 +382,6 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase ); } - public function testSingleChoiceWithPreferredAndNoSeparator() { $form = $this->factory->createNamed('name', 'choice', '&a', array( @@ -787,14 +791,14 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase [@id="name_date"] [ ./select + [@id="name_date_year"] + [./option[@value="2011"][@selected="selected"]] + /following-sibling::select [@id="name_date_month"] [./option[@value="2"][@selected="selected"]] /following-sibling::select [@id="name_date_day"] [./option[@value="3"][@selected="selected"]] - /following-sibling::select - [@id="name_date_year"] - [./option[@value="2011"][@selected="selected"]] ] /following-sibling::div [@id="name_time"] @@ -827,14 +831,14 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase [@id="name_date"] [ ./select + [@id="name_date_year"] + [./option[@value=""][.="[trans]Change&Me[/trans]"]] + /following-sibling::select [@id="name_date_month"] [./option[@value=""][.="[trans]Change&Me[/trans]"]] /following-sibling::select [@id="name_date_day"] [./option[@value=""][.="[trans]Change&Me[/trans]"]] - /following-sibling::select - [@id="name_date_year"] - [./option[@value=""][.="[trans]Change&Me[/trans]"]] ] /following-sibling::div [@id="name_time"] @@ -867,14 +871,14 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase [@id="name_date"] [ ./select + [@id="name_date_year"] + [./option[@value="2011"][@selected="selected"]] + /following-sibling::select [@id="name_date_month"] [./option[@value="2"][@selected="selected"]] /following-sibling::select [@id="name_date_day"] [./option[@value="3"][@selected="selected"]] - /following-sibling::select - [@id="name_date_year"] - [./option[@value="2011"][@selected="selected"]] ] /following-sibling::div [@id="name_time"] @@ -906,14 +910,14 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase [@id="name_date"] [ ./select + [@id="name_date_year"] + [./option[@value="2011"][@selected="selected"]] + /following-sibling::select [@id="name_date_month"] [./option[@value="2"][@selected="selected"]] /following-sibling::select [@id="name_date_day"] [./option[@value="3"][@selected="selected"]] - /following-sibling::select - [@id="name_date_year"] - [./option[@value="2011"][@selected="selected"]] ] /following-sibling::div [@id="name_time"] @@ -949,7 +953,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase [@type="date"] [@id="name_date"] [@name="name[date]"] - [@value="Feb 3, 2011"] + [@value="2011-02-03"] /following-sibling::input [@type="time"] [@id="name_time"] @@ -965,13 +969,15 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array( 'input' => 'string', 'widget' => 'single_text', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', )); $this->assertWidgetMatchesXpath($form->createView(), array(), '/input [@type="datetime"] [@name="name"] - [@value="2011-02-03 04:05"] + [@value="2011-02-03T04:05:06Z"] ' ); } @@ -983,13 +989,15 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase 'date_widget' => 'choice', 'time_widget' => 'choice', 'widget' => 'single_text', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', )); $this->assertWidgetMatchesXpath($form->createView(), array(), '/input [@type="datetime"] [@name="name"] - [@value="2011-02-03 04:05"] + [@value="2011-02-03T04:05:06Z"] ' ); } @@ -1005,14 +1013,14 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase '/div [ ./select + [@id="name_year"] + [./option[@value="2011"][@selected="selected"]] + /following-sibling::select [@id="name_month"] [./option[@value="2"][@selected="selected"]] /following-sibling::select [@id="name_day"] [./option[@value="3"][@selected="selected"]] - /following-sibling::select - [@id="name_year"] - [./option[@value="2011"][@selected="selected"]] ] [count(./select)=3] ' @@ -1032,14 +1040,14 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase '/div [ ./select + [@id="name_year"] + [./option[@value=""][.="[trans]Change&Me[/trans]"]] + /following-sibling::select [@id="name_month"] [./option[@value=""][.="[trans]Change&Me[/trans]"]] /following-sibling::select [@id="name_day"] [./option[@value=""][.="[trans]Change&Me[/trans]"]] - /following-sibling::select - [@id="name_year"] - [./option[@value=""][.="[trans]Change&Me[/trans]"]] ] [count(./select)=3] ' @@ -1059,14 +1067,14 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase '/div [ ./select + [@id="name_year"] + [./option[@value=""][.="[trans]Change&Me[/trans]"]] + /following-sibling::select [@id="name_month"] [./option[@value="1"]] /following-sibling::select [@id="name_day"] [./option[@value="1"]] - /following-sibling::select - [@id="name_year"] - [./option[@value=""][.="[trans]Change&Me[/trans]"]] ] [count(./select)=3] ' @@ -1084,6 +1092,10 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase '/div [ ./input + [@id="name_year"] + [@type="text"] + [@value="2011"] + /following-sibling::input [@id="name_month"] [@type="text"] [@value="2"] @@ -1091,10 +1103,6 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase [@id="name_day"] [@type="text"] [@value="3"] - /following-sibling::input - [@id="name_year"] - [@type="text"] - [@value="2011"] ] [count(./input)=3] ' @@ -1112,7 +1120,7 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase '/input [@type="date"] [@name="name"] - [@value="Feb 3, 2011"] + [@value="2011-02-03"] ' ); } @@ -1138,14 +1146,14 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase '/div [ ./select + [@id="name_year"] + [./option[@value="2000"][@selected="selected"]] + /following-sibling::select [@id="name_month"] [./option[@value="2"][@selected="selected"]] /following-sibling::select [@id="name_day"] [./option[@value="3"][@selected="selected"]] - /following-sibling::select - [@id="name_year"] - [./option[@value="2000"][@selected="selected"]] ] [count(./select)=3] ' @@ -1164,6 +1172,10 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase '/div [ ./select + [@id="name_year"] + [./option[@value=""][.="[trans][/trans]"]] + [./option[@value="1950"][@selected="selected"]] + /following-sibling::select [@id="name_month"] [./option[@value=""][.="[trans][/trans]"]] [./option[@value="1"][@selected="selected"]] @@ -1171,10 +1183,6 @@ abstract class AbstractLayoutTest extends \PHPUnit_Framework_TestCase [@id="name_day"] [./option[@value=""][.="[trans][/trans]"]] [./option[@value="1"][@selected="selected"]] - /following-sibling::select - [@id="name_year"] - [./option[@value=""][.="[trans][/trans]"]] - [./option[@value="1950"][@selected="selected"]] ] [count(./select)=3] ' diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php index 62ac603..1436d83 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php @@ -59,12 +59,12 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest /following-sibling::td [./input[@id="name_second"]] ] - [count(../tr)=3] /following-sibling::tr[@style="display: none"] [./td[@colspan="2"]/input [@type="hidden"] [@id="name__token"] ] + [count(../tr)=3] ' ); } @@ -76,12 +76,13 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest $view = $form->createView(); $html = $this->renderRow($view); + // The errors of the form are not rendered by intention! + // In practice, repeated fields cannot have errors as all errors + // on them are mapped to the first child. + // (see RepeatedTypeValidatorExtension) + $this->assertMatchesXpath($html, '/tr - [./td[@colspan="2"]/ul - [./li[.="[trans]Error![/trans]"]] - ] -/following-sibling::tr [ ./td [./label[@for="name_first"]] @@ -95,12 +96,12 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest /following-sibling::td [./input[@id="name_second"]] ] - [count(../tr)=4] /following-sibling::tr[@style="display: none"] [./td[@colspan="2"]/input [@type="hidden"] [@id="name__token"] ] + [count(../tr)=3] ' ); } @@ -235,9 +236,8 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest $this->assertWidgetMatchesXpath($form->createView(), array(), '/table [ - ./tr/td/table - [@id="name_child"] - [./tr/td/ul/li[.="[trans]Error![/trans]"]] + ./tr/td/ul[./li[.="[trans]Error![/trans]"]] + /following-sibling::table[@id="name_child"] ] [count(.//li[.="[trans]Error![/trans]"])=1] ' @@ -338,6 +338,27 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest ] ] [count(.//input)=3] +' + ); + } + + /** + * The block "_name_child_label" should be overridden in the theme of the + * implemented driver. + */ + public function testCollectionRowWithCustomBlock() + { + $collection = array('one', 'two', 'three'); + $form = $this->factory->createNamedBuilder('name', 'collection', $collection) + ->getForm(); + + $this->assertWidgetMatchesXpath($form->createView(), array(), +'/table + [ + ./tr[./td/label[.="Custom label: [trans]0[/trans]"]] + /following-sibling::tr[./td/label[.="Custom label: [trans]1[/trans]"]] + /following-sibling::tr[./td/label[.="Custom label: [trans]2[/trans]"]] + ] ' ); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php new file mode 100644 index 0000000..b0191c5 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +/** + * @author Bernhard Schussek + */ +class CompoundFormPerformanceTest extends FormPerformanceTestCase +{ + /** + * Create a compound form multiple times, as happens in a collection form + * + * @group benchmark + */ + public function testArrayBasedForm() + { + $this->setMaxRunningTime(1); + + for ($i = 0; $i < 40; ++$i) { + $form = $this->factory->createBuilder('form') + ->add('firstName', 'text') + ->add('lastName', 'text') + ->add('gender', 'choice', array( + 'choices' => array('male' => 'Male', 'female' => 'Female'), + 'required' => false, + )) + ->add('age', 'number') + ->add('birthDate', 'birthday') + ->add('city', 'choice', array( + // simulate 300 different cities + 'choices' => range(1, 300), + )) + ->getForm(); + + // load the form into a view + $form->createView(); + } + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php index a5f4261..1fecee9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/CompoundFormTest.php @@ -12,18 +12,13 @@ namespace Symfony\Component\Form\Tests; use Symfony\Component\Form\Form; -use Symfony\Component\Form\Util\PropertyPath; -use Symfony\Component\Form\FormConfig; use Symfony\Component\Form\FormView; -use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormError; -use Symfony\Component\Form\Exception\TransformationFailedException; +use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer; -use Symfony\Component\Form\Tests\Fixtures\FixedFilterListener; class FormTest extends AbstractFormTest { @@ -366,6 +361,7 @@ class FormTest extends AbstractFormTest $form = $this->getBuilder('author') ->setCompound(true) ->setDataMapper($this->getDataMapper()) + ->addEventSubscriber(new BindRequestListener()) ->getForm(); $form->add($this->getBuilder('name')->getForm()); $form->add($this->getBuilder('image')->getForm()); @@ -414,6 +410,7 @@ class FormTest extends AbstractFormTest $form = $this->getBuilder('') ->setCompound(true) ->setDataMapper($this->getDataMapper()) + ->addEventSubscriber(new BindRequestListener()) ->getForm(); $form->add($this->getBuilder('name')->getForm()); $form->add($this->getBuilder('image')->getForm()); @@ -455,7 +452,9 @@ class FormTest extends AbstractFormTest 'REQUEST_METHOD' => $method, )); - $form = $this->getBuilder('image')->getForm(); + $form = $this->getBuilder('image') + ->addEventSubscriber(new BindRequestListener()) + ->getForm(); $form->bindRequest($request); @@ -486,7 +485,9 @@ class FormTest extends AbstractFormTest 'REQUEST_METHOD' => $method, )); - $form = $this->getBuilder('name')->getForm(); + $form = $this->getBuilder('name') + ->addEventSubscriber(new BindRequestListener()) + ->getForm(); $form->bindRequest($request); @@ -515,6 +516,7 @@ class FormTest extends AbstractFormTest $form = $this->getBuilder('author') ->setCompound(true) ->setDataMapper($this->getDataMapper()) + ->addEventSubscriber(new BindRequestListener()) ->getForm(); $form->add($this->getBuilder('firstName')->getForm()); $form->add($this->getBuilder('lastName')->getForm()); @@ -544,6 +546,7 @@ class FormTest extends AbstractFormTest $form = $this->getBuilder('') ->setCompound(true) ->setDataMapper($this->getDataMapper()) + ->addEventSubscriber(new BindRequestListener()) ->getForm(); $form->add($this->getBuilder('firstName')->getForm()); $form->add($this->getBuilder('lastName')->getForm()); @@ -555,103 +558,6 @@ class FormTest extends AbstractFormTest $this->assertEquals(array('extra' => 'data'), $form->getExtraData()); } - public function testCreateView() - { - $test = $this; - $type1 = $this->getMock('Symfony\Component\Form\FormTypeInterface'); - $type1Extension = $this->getMock('Symfony\Component\Form\FormTypeExtensionInterface'); - $type1->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array($type1Extension))); - $type2 = $this->getMock('Symfony\Component\Form\FormTypeInterface'); - $type2Extension = $this->getMock('Symfony\Component\Form\FormTypeExtensionInterface'); - $type2->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array($type2Extension))); - $calls = array(); - - $type1->expects($this->once()) - ->method('buildView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type1::buildView'; - $test->assertTrue($view->hasParent()); - $test->assertEquals(0, count($view)); - })); - - $type1Extension->expects($this->once()) - ->method('buildView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type1ext::buildView'; - $test->assertTrue($view->hasParent()); - $test->assertEquals(0, count($view)); - })); - - $type2->expects($this->once()) - ->method('buildView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type2::buildView'; - $test->assertTrue($view->hasParent()); - $test->assertEquals(0, count($view)); - })); - - $type2Extension->expects($this->once()) - ->method('buildView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type2ext::buildView'; - $test->assertTrue($view->hasParent()); - $test->assertEquals(0, count($view)); - })); - - $type1->expects($this->once()) - ->method('finishView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type1::finishView'; - $test->assertGreaterThan(0, count($view)); - })); - - $type1Extension->expects($this->once()) - ->method('finishView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type1ext::finishView'; - $test->assertGreaterThan(0, count($view)); - })); - - $type2->expects($this->once()) - ->method('finishView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type2::finishView'; - $test->assertGreaterThan(0, count($view)); - })); - - $type2Extension->expects($this->once()) - ->method('finishView') - ->will($this->returnCallback(function (FormView $view, Form $form) use ($test, &$calls) { - $calls[] = 'type2ext::finishView'; - $test->assertGreaterThan(0, count($view)); - })); - - $form = $this->getBuilder() - ->setCompound(true) - ->setDataMapper($this->getDataMapper()) - ->setTypes(array($type1, $type2)) - ->getForm(); - $form->setParent($this->getBuilder()->getForm()); - $form->add($this->getBuilder()->getForm()); - - $form->createView(); - - $this->assertEquals(array( - 0 => 'type1::buildView', - 1 => 'type1ext::buildView', - 2 => 'type2::buildView', - 3 => 'type2ext::buildView', - 4 => 'type1::finishView', - 5 => 'type1ext::finishView', - 6 => 'type2::finishView', - 7 => 'type2ext::finishView', - ), $calls); - } - public function testGetErrorsAsStringDeep() { $parent = $this->getBuilder() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php index 822cbcf..0a4c8b8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\DataMapper; -use Symfony\Component\Form\Tests\FormInterface; use Symfony\Component\Form\Form; use Symfony\Component\Form\FormConfig; use Symfony\Component\Form\FormConfigInterface; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php index d744e1b..82234d2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php @@ -105,12 +105,12 @@ class DateTimeToArrayTransformerTest extends DateTimeTestCase $dateTime = new \DateTime('2010-02-03 04:05:06 America/New_York'); $dateTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong')); $output = array( - 'year' => (string)(int)$dateTime->format('Y'), - 'month' => (string)(int)$dateTime->format('m'), - 'day' => (string)(int)$dateTime->format('d'), - 'hour' => (string)(int)$dateTime->format('H'), - 'minute' => (string)(int)$dateTime->format('i'), - 'second' => (string)(int)$dateTime->format('s'), + 'year' => (string) (int) $dateTime->format('Y'), + 'month' => (string) (int) $dateTime->format('m'), + 'day' => (string) (int) $dateTime->format('d'), + 'hour' => (string) (int) $dateTime->format('H'), + 'minute' => (string) (int) $dateTime->format('i'), + 'second' => (string) (int) $dateTime->format('s'), ); $this->assertSame($output, $transformer->transform($input)); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php new file mode 100644 index 0000000..40195cb --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php @@ -0,0 +1,122 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; + +use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer; + +class DateTimeToRfc3339TransformerTest extends DateTimeTestCase +{ + protected $dateTime; + protected $dateTimeWithoutSeconds; + + protected function setUp() + { + parent::setUp(); + + $this->dateTime = new \DateTime('2010-02-03 04:05:06 UTC'); + $this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC'); + } + + protected function tearDown() + { + $this->dateTime = null; + $this->dateTimeWithoutSeconds = null; + } + + public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE) + { + if ($expected instanceof \DateTime && $actual instanceof \DateTime) { + $expected = $expected->format('c'); + $actual = $actual->format('c'); + } + + parent::assertEquals($expected, $actual, $message, $delta, $maxDepth, $canonicalize, $ignoreCase); + } + + public function allProvider() + { + return array( + array('UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06Z'), + array('UTC', 'UTC', null, ''), + array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:06 America/New_York', '2010-02-03T17:05:06+08:00'), + array('America/New_York', 'Asia/Hong_Kong', null, ''), + array('UTC', 'Asia/Hong_Kong', '2010-02-03 04:05:06 UTC', '2010-02-03T12:05:06+08:00'), + array('America/New_York', 'UTC', '2010-02-03 04:05:06 America/New_York', '2010-02-03T09:05:06Z'), + ); + } + + public function transformProvider() + { + return $this->allProvider(); + } + + public function reverseTransformProvider() + { + return array_merge($this->allProvider(), array( + // format without seconds, as appears in some browsers + array('UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05Z'), + array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05+08:00'), + )); + } + + /** + * @dataProvider transformProvider + */ + public function testTransform($fromTz, $toTz, $from, $to) + { + $transformer = new DateTimeToRfc3339Transformer($fromTz, $toTz); + + $this->assertSame($to, $transformer->transform(null !== $from ? new \DateTime($from) : null)); + } + + /** + * @expectedException Symfony\Component\Form\Exception\UnexpectedTypeException + */ + public function testTransformRequiresValidDateTime() + { + $transformer = new DateTimeToRfc3339Transformer(); + $transformer->transform('2010-01-01'); + } + + /** + * @dataProvider reverseTransformProvider + */ + public function testReverseTransform($toTz, $fromTz, $to, $from) + { + $transformer = new DateTimeToRfc3339Transformer($toTz, $fromTz); + + if (null !== $to) { + $this->assertDateTimeEquals(new \DateTime($to), $transformer->reverseTransform($from)); + } else { + $this->assertSame($to, $transformer->reverseTransform($from)); + } + } + + /** + * @expectedException Symfony\Component\Form\Exception\UnexpectedTypeException + */ + public function testReverseTransformRequiresString() + { + $transformer = new DateTimeToRfc3339Transformer(); + $transformer->reverseTransform(12345); + } + + /** + * @expectedException Symfony\Component\Form\Exception\TransformationFailedException + */ + public function testReverseTransformWithNonExistingDate() + { + $transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC'); + + var_dump($transformer->reverseTransform('2010-04-31T04:05Z')); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php index 478c9a5..be7b3d4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer; - class MoneyToLocalizedStringTransformerTest extends LocalizedTestCase { protected function setUp() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToStringTransformerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToStringTransformerTest.php deleted file mode 100644 index 0abe70a..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToStringTransformerTest.php +++ /dev/null @@ -1,90 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer; - -use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToStringTransformer; - -class ValueToStringTransformerTest extends \PHPUnit_Framework_TestCase -{ - protected $transformer; - - protected function setUp() - { - $this->transformer = new ValueToStringTransformer(); - } - - protected function tearDown() - { - $this->transformer = null; - } - - /** - * @dataProvider validDataProvider - */ - public function testTransform($value, $transformed) - { - $this->assertEquals($transformed, $this->transformer->transform($value)); - } - - /** - * @dataProvider validDataProvider - */ - public function testReverseTransform($value, $transformed) - { - $this->assertEquals($transformed, $this->transformer->reverseTransform($transformed)); - } - - public function validDataProvider() - { - return array( - array('test', 'test'), - array('', null), - array(null, null), - - array(0, '0'), - array('0', '0'), - array(1, '1'), - array('123', '123'), - array(1.23, '1.23'), - ); - } - - /** - * @dataProvider invalidDataProvider - */ - public function testTransformExpectsStringOrNumber($value) - { - $this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException'); - - $this->transformer->transform($value); - } - - /** - * @dataProvider invalidDataProvider - */ - public function testReverseTransformExpectsString($value) - { - $this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException'); - - $this->transformer->reverseTransform($value); - } - - public function invalidDataProvider() - { - return array( - array(true), - array(false), - array(new \stdClass), - array(array()), - ); - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php new file mode 100644 index 0000000..a3d235f --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/BindRequestListenerTest.php @@ -0,0 +1,285 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; + +use Symfony\Component\Form\Extension\Core\EventListener\BindRequestListener; +use Symfony\Component\Form\Form; +use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\FormEvent; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\File\UploadedFile; + +/** + * @author Bernhard Schussek + */ +class BindRequestListenerTest extends \PHPUnit_Framework_TestCase +{ + private $values; + + private $filesPlain; + + private $filesNested; + + /** + * @var UploadedFile + */ + private $uploadedFile; + + protected function setUp() + { + $path = tempnam(sys_get_temp_dir(), 'sf2'); + touch($path); + + $this->values = array( + 'name' => 'Bernhard', + 'image' => array('filename' => 'foobar.png'), + ); + + $this->filesPlain = array( + 'image' => array( + 'error' => UPLOAD_ERR_OK, + 'name' => 'upload.png', + 'size' => 123, + 'tmp_name' => $path, + 'type' => 'image/png' + ), + ); + + $this->filesNested = array( + 'error' => array('image' => UPLOAD_ERR_OK), + 'name' => array('image' => 'upload.png'), + 'size' => array('image' => 123), + 'tmp_name' => array('image' => $path), + 'type' => array('image' => 'image/png'), + ); + + $this->uploadedFile = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK); + } + + protected function tearDown() + { + unlink($this->uploadedFile->getRealPath()); + } + + public function requestMethodProvider() + { + return array( + array('POST'), + array('PUT'), + array('DELETE'), + array('PATCH'), + ); + } + + /** + * @dataProvider requestMethodProvider + */ + public function testBindRequest($method) + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $values = array('author' => $this->values); + $files = array('author' => $this->filesNested); + $request = new Request(array(), $values, array(), array(), $files, array( + 'REQUEST_METHOD' => $method, + )); + + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $config = new FormConfig('author', null, $dispatcher); + $form = new Form($config); + $event = new FormEvent($form, $request); + + $listener = new BindRequestListener(); + $listener->preBind($event); + + $this->assertEquals(array( + 'name' => 'Bernhard', + 'image' => $this->uploadedFile, + ), $event->getData()); + } + + /** + * @dataProvider requestMethodProvider + */ + public function testBindRequestWithEmptyName($method) + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $request = new Request(array(), $this->values, array(), array(), $this->filesPlain, array( + 'REQUEST_METHOD' => $method, + )); + + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $config = new FormConfig('', null, $dispatcher); + $form = new Form($config); + $event = new FormEvent($form, $request); + + $listener = new BindRequestListener(); + $listener->preBind($event); + + $this->assertEquals(array( + 'name' => 'Bernhard', + 'image' => $this->uploadedFile, + ), $event->getData()); + } + + /** + * @dataProvider requestMethodProvider + */ + public function testBindEmptyRequestToCompoundForm($method) + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $request = new Request(array(), array(), array(), array(), array(), array( + 'REQUEST_METHOD' => $method, + )); + + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $config = new FormConfig('author', null, $dispatcher); + $config->setCompound(true); + $config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface')); + $form = new Form($config); + $event = new FormEvent($form, $request); + + $listener = new BindRequestListener(); + $listener->preBind($event); + + // Default to empty array + $this->assertEquals(array(), $event->getData()); + } + + /** + * @dataProvider requestMethodProvider + */ + public function testBindEmptyRequestToSimpleForm($method) + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $request = new Request(array(), array(), array(), array(), array(), array( + 'REQUEST_METHOD' => $method, + )); + + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $config = new FormConfig('author', null, $dispatcher); + $config->setCompound(false); + $form = new Form($config); + $event = new FormEvent($form, $request); + + $listener = new BindRequestListener(); + $listener->preBind($event); + + // Default to null + $this->assertNull($event->getData()); + } + + public function testBindGetRequest() + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $values = array('author' => $this->values); + $request = new Request($values, array(), array(), array(), array(), array( + 'REQUEST_METHOD' => 'GET', + )); + + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $config = new FormConfig('author', null, $dispatcher); + $form = new Form($config); + $event = new FormEvent($form, $request); + + $listener = new BindRequestListener(); + $listener->preBind($event); + + $this->assertEquals(array( + 'name' => 'Bernhard', + 'image' => array('filename' => 'foobar.png'), + ), $event->getData()); + } + + public function testBindGetRequestWithEmptyName() + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $request = new Request($this->values, array(), array(), array(), array(), array( + 'REQUEST_METHOD' => 'GET', + )); + + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $config = new FormConfig('', null, $dispatcher); + $form = new Form($config); + $event = new FormEvent($form, $request); + + $listener = new BindRequestListener(); + $listener->preBind($event); + + $this->assertEquals(array( + 'name' => 'Bernhard', + 'image' => array('filename' => 'foobar.png'), + ), $event->getData()); + } + + public function testBindEmptyGetRequestToCompoundForm() + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $request = new Request(array(), array(), array(), array(), array(), array( + 'REQUEST_METHOD' => 'GET', + )); + + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $config = new FormConfig('author', null, $dispatcher); + $config->setCompound(true); + $config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface')); + $form = new Form($config); + $event = new FormEvent($form, $request); + + $listener = new BindRequestListener(); + $listener->preBind($event); + + $this->assertEquals(array(), $event->getData()); + } + + public function testBindEmptyGetRequestToSimpleForm() + { + if (!class_exists('Symfony\Component\HttpFoundation\Request')) { + $this->markTestSkipped('The "HttpFoundation" component is not available'); + } + + $request = new Request(array(), array(), array(), array(), array(), array( + 'REQUEST_METHOD' => 'GET', + )); + + $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $config = new FormConfig('author', null, $dispatcher); + $config->setCompound(false); + $form = new Form($config); + $event = new FormEvent($form, $request); + + $listener = new BindRequestListener(); + $listener->preBind($event); + + $this->assertNull($event->getData()); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php index c156b9e..78a0c01 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php @@ -13,7 +13,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\EventListener; use Symfony\Component\Form\FormEvent; use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener; -use Symfony\Component\Form\FormBuilder; abstract class MergeCollectionListenerTest extends \PHPUnit_Framework_TestCase { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php new file mode 100644 index 0000000..dbb3e0f --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests\Extension\Core\Type; + +use Symfony\Component\Form\Tests\FormPerformanceTestCase; + +/** + * @author Bernhard Schussek + */ +class ChoiceTypePerformanceTest extends FormPerformanceTestCase +{ + /** + * This test case is realistic in collection forms where each + * row contains the same choice field. + * + * @group benchmark + */ + public function testSameChoiceFieldCreatedMultipleTimes() + { + $this->setMaxRunningTime(1); + $choices = range(1, 300); + + for ($i = 0; $i < 100; ++$i) { + $this->factory->create('choice', rand(1, 400), array( + 'choices' => $choices, + )); + } + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php index 9fe6878..74f17b6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php @@ -61,7 +61,6 @@ class ChoiceTypeTest extends TypeTestCase ); } - protected function tearDown() { parent::tearDown(); @@ -614,6 +613,23 @@ class ChoiceTypeTest extends TypeTestCase $this->assertEquals($viewValue, $view->getVar('empty_value')); } + /** + * @dataProvider getOptionsWithEmptyValue + */ + public function testDontPassEmptyValueIfContainedInChoices($multiple, $expanded, $required, $emptyValue, $viewValue) + { + $form = $this->factory->create('choice', null, array( + 'multiple' => $multiple, + 'expanded' => $expanded, + 'required' => $required, + 'empty_value' => $emptyValue, + 'choices' => array('a' => 'A', '' => 'Empty'), + )); + $view = $form->createView(); + + $this->assertNull($view->getVar('empty_value')); + } + public function getOptionsWithEmptyValue() { return array( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php index 9c7cbe6..3ed8b5b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php @@ -11,15 +11,13 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; -use Symfony\Component\Form\FormError; - class DateTimeTypeTest extends LocalizedTestCase { public function testSubmit_dateTime() { $form = $this->factory->create('datetime', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'date_widget' => 'choice', 'time_widget' => 'choice', 'input' => 'datetime', @@ -45,8 +43,8 @@ class DateTimeTypeTest extends LocalizedTestCase public function testSubmit_string() { $form = $this->factory->create('datetime', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'string', 'date_widget' => 'choice', 'time_widget' => 'choice', @@ -70,8 +68,8 @@ class DateTimeTypeTest extends LocalizedTestCase public function testSubmit_timestamp() { $form = $this->factory->create('datetime', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'timestamp', 'date_widget' => 'choice', 'time_widget' => 'choice', @@ -97,8 +95,8 @@ class DateTimeTypeTest extends LocalizedTestCase public function testSubmit_withSeconds() { $form = $this->factory->create('datetime', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'date_widget' => 'choice', 'time_widget' => 'choice', 'input' => 'datetime', @@ -128,8 +126,8 @@ class DateTimeTypeTest extends LocalizedTestCase public function testSubmit_differentTimezones() { $form = $this->factory->create('datetime', null, array( - 'data_timezone' => 'America/New_York', - 'user_timezone' => 'Pacific/Tahiti', + 'model_timezone' => 'America/New_York', + 'view_timezone' => 'Pacific/Tahiti', 'date_widget' => 'choice', 'time_widget' => 'choice', 'input' => 'string', @@ -140,14 +138,14 @@ class DateTimeTypeTest extends LocalizedTestCase $form->bind(array( 'date' => array( - 'day' => (int)$dateTime->format('d'), - 'month' => (int)$dateTime->format('m'), - 'year' => (int)$dateTime->format('Y'), + 'day' => (int) $dateTime->format('d'), + 'month' => (int) $dateTime->format('m'), + 'year' => (int) $dateTime->format('Y'), ), 'time' => array( - 'hour' => (int)$dateTime->format('H'), - 'minute' => (int)$dateTime->format('i'), - 'second' => (int)$dateTime->format('s'), + 'hour' => (int) $dateTime->format('H'), + 'minute' => (int) $dateTime->format('i'), + 'second' => (int) $dateTime->format('s'), ), )); @@ -159,52 +157,51 @@ class DateTimeTypeTest extends LocalizedTestCase public function testSubmit_differentTimezonesDateTime() { $form = $this->factory->create('datetime', null, array( - 'data_timezone' => 'America/New_York', - 'user_timezone' => 'Pacific/Tahiti', + 'model_timezone' => 'America/New_York', + 'view_timezone' => 'Pacific/Tahiti', 'widget' => 'single_text', 'input' => 'datetime', )); - $dateTime = new \DateTime('2010-06-02 03:04:05 America/New_York'); - - $form->bind('2010-06-02 03:04:05'); - $outputTime = new \DateTime('2010-06-02 03:04:00 Pacific/Tahiti'); + + $form->bind('2010-06-02T03:04:00-10:00'); + $outputTime->setTimezone(new \DateTimeZone('America/New_York')); $this->assertDateTimeEquals($outputTime, $form->getData()); - $this->assertEquals('2010-06-02 03:04', $form->getViewData()); + $this->assertEquals('2010-06-02T03:04:00-10:00', $form->getViewData()); } public function testSubmit_stringSingleText() { $form = $this->factory->create('datetime', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'string', 'widget' => 'single_text', )); - $form->bind('2010-06-02 03:04:05'); + $form->bind('2010-06-02T03:04:00Z'); $this->assertEquals('2010-06-02 03:04:00', $form->getData()); - $this->assertEquals('2010-06-02 03:04', $form->getViewData()); + $this->assertEquals('2010-06-02T03:04:00Z', $form->getViewData()); } public function testSubmit_stringSingleText_withSeconds() { $form = $this->factory->create('datetime', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'string', 'widget' => 'single_text', 'with_seconds' => true, )); - $form->bind('2010-06-02 03:04:05'); + $form->bind('2010-06-02T03:04:05Z'); $this->assertEquals('2010-06-02 03:04:05', $form->getData()); - $this->assertEquals('2010-06-02 03:04:05', $form->getViewData()); + $this->assertEquals('2010-06-02T03:04:05Z', $form->getViewData()); } public function testSubmit_differentPattern() @@ -243,4 +240,150 @@ class DateTimeTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals('datetime', $view->getVar('type')); } + + public function testPassDefaultEmptyValueToViewIfNotRequired() + { + $form = $this->factory->create('datetime', null, array( + 'required' => false, + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('', $view->get('date')->get('year')->getVar('empty_value')); + $this->assertSame('', $view->get('date')->get('month')->getVar('empty_value')); + $this->assertSame('', $view->get('date')->get('day')->getVar('empty_value')); + $this->assertSame('', $view->get('time')->get('hour')->getVar('empty_value')); + $this->assertSame('', $view->get('time')->get('minute')->getVar('empty_value')); + $this->assertSame('', $view->get('time')->get('second')->getVar('empty_value')); + } + + public function testPassNoEmptyValueToViewIfRequired() + { + $form = $this->factory->create('datetime', null, array( + 'required' => true, + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertNull($view->get('date')->get('year')->getVar('empty_value')); + $this->assertNull($view->get('date')->get('month')->getVar('empty_value')); + $this->assertNull($view->get('date')->get('day')->getVar('empty_value')); + $this->assertNull($view->get('time')->get('hour')->getVar('empty_value')); + $this->assertNull($view->get('time')->get('minute')->getVar('empty_value')); + $this->assertNull($view->get('time')->get('second')->getVar('empty_value')); + } + + public function testPassEmptyValueAsString() + { + $form = $this->factory->create('datetime', null, array( + 'empty_value' => 'Empty', + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('Empty', $view->get('date')->get('year')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('date')->get('month')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('date')->get('day')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('time')->get('hour')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('time')->get('minute')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('time')->get('second')->getVar('empty_value')); + } + + public function testPassEmptyValueAsArray() + { + $form = $this->factory->create('datetime', null, array( + 'empty_value' => array( + 'year' => 'Empty year', + 'month' => 'Empty month', + 'day' => 'Empty day', + 'hour' => 'Empty hour', + 'minute' => 'Empty minute', + 'second' => 'Empty second', + ), + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('Empty year', $view->get('date')->get('year')->getVar('empty_value')); + $this->assertSame('Empty month', $view->get('date')->get('month')->getVar('empty_value')); + $this->assertSame('Empty day', $view->get('date')->get('day')->getVar('empty_value')); + $this->assertSame('Empty hour', $view->get('time')->get('hour')->getVar('empty_value')); + $this->assertSame('Empty minute', $view->get('time')->get('minute')->getVar('empty_value')); + $this->assertSame('Empty second', $view->get('time')->get('second')->getVar('empty_value')); + } + + public function testPassEmptyValueAsPartialArray_addEmptyIfNotRequired() + { + $form = $this->factory->create('datetime', null, array( + 'required' => false, + 'empty_value' => array( + 'year' => 'Empty year', + 'day' => 'Empty day', + 'hour' => 'Empty hour', + 'second' => 'Empty second', + ), + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('Empty year', $view->get('date')->get('year')->getVar('empty_value')); + $this->assertSame('', $view->get('date')->get('month')->getVar('empty_value')); + $this->assertSame('Empty day', $view->get('date')->get('day')->getVar('empty_value')); + $this->assertSame('Empty hour', $view->get('time')->get('hour')->getVar('empty_value')); + $this->assertSame('', $view->get('time')->get('minute')->getVar('empty_value')); + $this->assertSame('Empty second', $view->get('time')->get('second')->getVar('empty_value')); + } + + public function testPassEmptyValueAsPartialArray_addNullIfRequired() + { + $form = $this->factory->create('datetime', null, array( + 'required' => true, + 'empty_value' => array( + 'year' => 'Empty year', + 'day' => 'Empty day', + 'hour' => 'Empty hour', + 'second' => 'Empty second', + ), + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('Empty year', $view->get('date')->get('year')->getVar('empty_value')); + $this->assertNull($view->get('date')->get('month')->getVar('empty_value')); + $this->assertSame('Empty day', $view->get('date')->get('day')->getVar('empty_value')); + $this->assertSame('Empty hour', $view->get('time')->get('hour')->getVar('empty_value')); + $this->assertNull($view->get('time')->get('minute')->getVar('empty_value')); + $this->assertSame('Empty second', $view->get('time')->get('second')->getVar('empty_value')); + } + + public function testPassHtml5TypeIfSingleTextAndHtml5Format() + { + $form = $this->factory->create('datetime', null, array( + 'widget' => 'single_text', + )); + + $view = $form->createView(); + $this->assertSame('datetime', $view->getVar('type')); + } + + public function testDontPassHtml5TypeIfNotHtml5Format() + { + $form = $this->factory->create('datetime', null, array( + 'widget' => 'single_text', + 'format' => 'yyyy-MM-dd HH:mm', + )); + + $view = $form->createView(); + $this->assertNull($view->getVar('datetime')); + } + + public function testDontPassHtml5TypeIfNotSingleText() + { + $form = $this->factory->create('datetime', null, array( + 'widget' => 'text', + )); + + $view = $form->createView(); + $this->assertNull($view->getVar('type')); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php index 2dd30ec..cd99217 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php @@ -43,11 +43,27 @@ class DateTypeTest extends LocalizedTestCase )); } + public function testSubmitFromSingleTextDateTimeWithDefaultFormat() + { + $form = $this->factory->create('date', null, array( + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', + 'widget' => 'single_text', + 'input' => 'datetime', + )); + + $form->bind('2010-06-02'); + + $this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData()); + $this->assertEquals('2010-06-02', $form->getViewData()); + } + public function testSubmitFromSingleTextDateTime() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'format' => \IntlDateFormatter::MEDIUM, + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'single_text', 'input' => 'datetime', )); @@ -61,8 +77,9 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromSingleTextString() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'format' => \IntlDateFormatter::MEDIUM, + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'single_text', 'input' => 'string', )); @@ -76,8 +93,9 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromSingleTextTimestamp() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'format' => \IntlDateFormatter::MEDIUM, + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'single_text', 'input' => 'timestamp', )); @@ -93,8 +111,9 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromSingleTextRaw() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'format' => \IntlDateFormatter::MEDIUM, + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'single_text', 'input' => 'array', )); @@ -114,8 +133,8 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromText() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'text', )); @@ -136,8 +155,8 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromChoice() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'choice', )); @@ -158,8 +177,8 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromChoiceEmpty() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'choice', 'required' => false, )); @@ -179,8 +198,8 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromInputDateTimeDifferentPattern() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'format' => 'MM*yyyy*dd', 'widget' => 'single_text', 'input' => 'datetime', @@ -195,8 +214,8 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromInputStringDifferentPattern() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'format' => 'MM*yyyy*dd', 'widget' => 'single_text', 'input' => 'string', @@ -211,8 +230,8 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromInputTimestampDifferentPattern() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'format' => 'MM*yyyy*dd', 'widget' => 'single_text', 'input' => 'timestamp', @@ -229,8 +248,8 @@ class DateTypeTest extends LocalizedTestCase public function testSubmitFromInputRawDifferentPattern() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'format' => 'MM*yyyy*dd', 'widget' => 'single_text', 'input' => 'array', @@ -251,37 +270,45 @@ class DateTypeTest extends LocalizedTestCase /** * This test is to check that the strings '0', '1', '2', '3' are no accepted * as valid IntlDateFormatter constants for FULL, LONG, MEDIUM or SHORT respectively. + * + * @expectedException Symfony\Component\OptionsResolver\Exception\InvalidOptionsException */ - public function testFormatOptionCustomPatternCollapsingIntlDateFormatterConstant() + public function testThrowExceptionIfFormatIsNoPattern() { - $form = $this->factory->create('date', null, array( + $this->factory->create('date', null, array( 'format' => '0', 'widget' => 'single_text', 'input' => 'string', )); - - $form->setData('2010-06-02'); - - // This would be what would be outputed if '0' was mistaken for \IntlDateFormatter::FULL - $this->assertNotEquals('Mittwoch, 02. Juni 2010', $form->getViewData()); } /** - * @expectedException Symfony\Component\Form\Exception\CreationException + * @expectedException Symfony\Component\OptionsResolver\Exception\InvalidOptionsException */ - public function testValidateFormatOptionGivenWrongConstants() + public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay() { - $form = $this->factory->create('date', null, array( + $this->factory->create('date', null, array( + 'months' => array(6, 7), + 'format' => 'yy', + )); + } + + /** + * @expectedException Symfony\Component\OptionsResolver\Exception\InvalidOptionsException + */ + public function testThrowExceptionIfFormatIsNoConstant() + { + $this->factory->create('date', null, array( 'format' => 105, )); } /** - * @expectedException Symfony\Component\Form\Exception\CreationException + * @expectedException Symfony\Component\OptionsResolver\Exception\InvalidOptionsException */ - public function testValidateFormatOptionGivenArrayValue() + public function testThrowExceptionIfFormatIsInvalid() { - $form = $this->factory->create('date', null, array( + $this->factory->create('date', null, array( 'format' => array(), )); } @@ -289,8 +316,9 @@ class DateTypeTest extends LocalizedTestCase public function testSetData_differentTimezones() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'America/New_York', - 'user_timezone' => 'Pacific/Tahiti', + 'format' => \IntlDateFormatter::MEDIUM, + 'model_timezone' => 'America/New_York', + 'view_timezone' => 'Pacific/Tahiti', 'input' => 'string', 'widget' => 'single_text', )); @@ -303,8 +331,9 @@ class DateTypeTest extends LocalizedTestCase public function testSetData_differentTimezonesDateTime() { $form = $this->factory->create('date', null, array( - 'data_timezone' => 'America/New_York', - 'user_timezone' => 'Pacific/Tahiti', + 'format' => \IntlDateFormatter::MEDIUM, + 'model_timezone' => 'America/New_York', + 'view_timezone' => 'Pacific/Tahiti', 'input' => 'datetime', 'widget' => 'single_text', )); @@ -345,21 +374,6 @@ class DateTypeTest extends LocalizedTestCase ), $view->get('month')->getVar('choices')); } - public function testMonthsOptionNumericIfFormatContainsNoMonth() - { - $form = $this->factory->create('date', null, array( - 'months' => array(6, 7), - 'format' => 'yy', - )); - - $view = $form->createView(); - - $this->assertEquals(array( - new ChoiceView('6', '06'), - new ChoiceView('7', '07'), - ), $view->get('month')->getVar('choices')); - } - public function testMonthsOptionShortFormat() { $form = $this->factory->create('date', null, array( @@ -424,8 +438,8 @@ class DateTypeTest extends LocalizedTestCase $this->markTestIncomplete('Needs to be reimplemented using validators'); $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'single_text', )); @@ -439,8 +453,8 @@ class DateTypeTest extends LocalizedTestCase $this->markTestIncomplete('Needs to be reimplemented using validators'); $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'choice', )); @@ -458,8 +472,8 @@ class DateTypeTest extends LocalizedTestCase $this->markTestIncomplete('Needs to be reimplemented using validators'); $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'choice', )); @@ -477,8 +491,8 @@ class DateTypeTest extends LocalizedTestCase $this->markTestIncomplete('Needs to be reimplemented using validators'); $form = $this->factory->create('date', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'widget' => 'choice', )); @@ -496,6 +510,17 @@ class DateTypeTest extends LocalizedTestCase $form = $this->factory->create('date'); $view = $form->createView(); + $this->assertSame('{{ year }}-{{ month }}-{{ day }}', $view->getVar('date_pattern')); + } + + public function testPassDatePatternToViewDifferentFormat() + { + $form = $this->factory->create('date', null, array( + 'format' => \IntlDateFormatter::MEDIUM, + )); + + $view = $form->createView(); + $this->assertSame('{{ day }}.{{ month }}.{{ year }}', $view->getVar('date_pattern')); } @@ -547,4 +572,172 @@ class DateTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals('date', $view->getVar('type')); } + + public function testPassDefaultEmptyValueToViewIfNotRequired() + { + $form = $this->factory->create('date', null, array( + 'required' => false, + )); + + $view = $form->createView(); + $this->assertSame('', $view->get('year')->getVar('empty_value')); + $this->assertSame('', $view->get('month')->getVar('empty_value')); + $this->assertSame('', $view->get('day')->getVar('empty_value')); + } + + public function testPassNoEmptyValueToViewIfRequired() + { + $form = $this->factory->create('date', null, array( + 'required' => true, + )); + + $view = $form->createView(); + $this->assertNull($view->get('year')->getVar('empty_value')); + $this->assertNull($view->get('month')->getVar('empty_value')); + $this->assertNull($view->get('day')->getVar('empty_value')); + } + + public function testPassEmptyValueAsString() + { + $form = $this->factory->create('date', null, array( + 'empty_value' => 'Empty', + )); + + $view = $form->createView(); + $this->assertSame('Empty', $view->get('year')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('month')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('day')->getVar('empty_value')); + } + + public function testPassEmptyValueAsArray() + { + $form = $this->factory->create('date', null, array( + 'empty_value' => array( + 'year' => 'Empty year', + 'month' => 'Empty month', + 'day' => 'Empty day', + ), + )); + + $view = $form->createView(); + $this->assertSame('Empty year', $view->get('year')->getVar('empty_value')); + $this->assertSame('Empty month', $view->get('month')->getVar('empty_value')); + $this->assertSame('Empty day', $view->get('day')->getVar('empty_value')); + } + + public function testPassEmptyValueAsPartialArray_addEmptyIfNotRequired() + { + $form = $this->factory->create('date', null, array( + 'required' => false, + 'empty_value' => array( + 'year' => 'Empty year', + 'day' => 'Empty day', + ), + )); + + $view = $form->createView(); + $this->assertSame('Empty year', $view->get('year')->getVar('empty_value')); + $this->assertSame('', $view->get('month')->getVar('empty_value')); + $this->assertSame('Empty day', $view->get('day')->getVar('empty_value')); + } + + public function testPassEmptyValueAsPartialArray_addNullIfRequired() + { + $form = $this->factory->create('date', null, array( + 'required' => true, + 'empty_value' => array( + 'year' => 'Empty year', + 'day' => 'Empty day', + ), + )); + + $view = $form->createView(); + $this->assertSame('Empty year', $view->get('year')->getVar('empty_value')); + $this->assertNull($view->get('month')->getVar('empty_value')); + $this->assertSame('Empty day', $view->get('day')->getVar('empty_value')); + } + + public function testPassHtml5TypeIfSingleTextAndHtml5Format() + { + $form = $this->factory->create('date', null, array( + 'widget' => 'single_text', + )); + + $view = $form->createView(); + $this->assertSame('date', $view->getVar('type')); + } + + public function testDontPassHtml5TypeIfNotHtml5Format() + { + $form = $this->factory->create('date', null, array( + 'widget' => 'single_text', + 'format' => \IntlDateFormatter::MEDIUM, + )); + + $view = $form->createView(); + $this->assertNull($view->getVar('type')); + } + + public function testDontPassHtml5TypeIfNotSingleText() + { + $form = $this->factory->create('date', null, array( + 'widget' => 'text', + )); + + $view = $form->createView(); + $this->assertNull($view->getVar('type')); + } + + public function provideCompoundWidgets() + { + return array( + array('text'), + array('choice'), + ); + } + + /** + * @dataProvider provideCompoundWidgets + */ + public function testYearErrorsBubbleUp($widget) + { + $error = new FormError('Invalid!'); + $form = $this->factory->create('date', null, array( + 'widget' => $widget, + )); + $form->get('year')->addError($error); + + $this->assertSame(array(), $form->get('year')->getErrors()); + $this->assertSame(array($error), $form->getErrors()); + } + + /** + * @dataProvider provideCompoundWidgets + */ + public function testMonthErrorsBubbleUp($widget) + { + $error = new FormError('Invalid!'); + $form = $this->factory->create('date', null, array( + 'widget' => $widget, + )); + $form->get('month')->addError($error); + + $this->assertSame(array(), $form->get('month')->getErrors()); + $this->assertSame(array($error), $form->getErrors()); + } + + /** + * @dataProvider provideCompoundWidgets + */ + public function testDayErrorsBubbleUp($widget) + { + $error = new FormError('Invalid!'); + $form = $this->factory->create('date', null, array( + 'widget' => $widget, + )); + $form->get('day')->addError($error); + + $this->assertSame(array(), $form->get('day')->getErrors()); + $this->assertSame(array($error), $form->getErrors()); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php index d9d8866..81e96c6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php @@ -633,4 +633,16 @@ class FormTypeTest extends TypeTestCase $view = $form->createView(); $this->assertFalse($view->getVar('valid')); } + + public function testDataOptionSupersedesSetDataCalls() + { + $form = $this->factory->create('form', null, array( + 'data' => 'default', + 'compound' => false, + )); + + $form->setData('foobar'); + + $this->assertSame('default', $form->getData()); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php index 7abe8f7..7db1e84 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; - class PasswordTypeTest extends TypeTestCase { public function testEmptyIfNotBound() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php index d993132..1c0cf3c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; - class RepeatedTypeTest extends TypeTestCase { protected $form; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php index 1342535..8e61181 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php @@ -12,14 +12,15 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\Extension\Core\View\ChoiceView; +use Symfony\Component\Form\FormError; class TimeTypeTest extends LocalizedTestCase { public function testSubmit_dateTime() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'datetime', )); @@ -39,8 +40,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSubmit_string() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'string', )); @@ -58,8 +59,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSubmit_timestamp() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'timestamp', )); @@ -79,8 +80,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSubmit_array() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'array', )); @@ -98,8 +99,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSubmit_datetimeSingleText() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'datetime', 'widget' => 'single_text', )); @@ -113,8 +114,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSubmit_arraySingleText() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'array', 'widget' => 'single_text', )); @@ -133,8 +134,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSubmit_arraySingleTextWithSeconds() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'array', 'widget' => 'single_text', 'with_seconds' => true, @@ -155,8 +156,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSubmit_stringSingleText() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'string', 'widget' => 'single_text', )); @@ -170,8 +171,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSetData_withSeconds() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'UTC', - 'user_timezone' => 'UTC', + 'model_timezone' => 'UTC', + 'view_timezone' => 'UTC', 'input' => 'datetime', 'with_seconds' => true, )); @@ -184,8 +185,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSetData_differentTimezones() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'America/New_York', - 'user_timezone' => 'Asia/Hong_Kong', + 'model_timezone' => 'America/New_York', + 'view_timezone' => 'Asia/Hong_Kong', 'input' => 'string', 'with_seconds' => true, )); @@ -199,9 +200,9 @@ class TimeTypeTest extends LocalizedTestCase $outputTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong')); $displayedData = array( - 'hour' => (int)$outputTime->format('H'), - 'minute' => (int)$outputTime->format('i'), - 'second' => (int)$outputTime->format('s') + 'hour' => (int) $outputTime->format('H'), + 'minute' => (int) $outputTime->format('i'), + 'second' => (int) $outputTime->format('s') ); $this->assertEquals($displayedData, $form->getViewData()); @@ -210,8 +211,8 @@ class TimeTypeTest extends LocalizedTestCase public function testSetData_differentTimezonesDateTime() { $form = $this->factory->create('time', null, array( - 'data_timezone' => 'America/New_York', - 'user_timezone' => 'Asia/Hong_Kong', + 'model_timezone' => 'America/New_York', + 'view_timezone' => 'Asia/Hong_Kong', 'input' => 'datetime', 'with_seconds' => true, )); @@ -225,9 +226,9 @@ class TimeTypeTest extends LocalizedTestCase $outputTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong')); $displayedData = array( - 'hour' => (int)$outputTime->format('H'), - 'minute' => (int)$outputTime->format('i'), - 'second' => (int)$outputTime->format('s') + 'hour' => (int) $outputTime->format('H'), + 'minute' => (int) $outputTime->format('i'), + 'second' => (int) $outputTime->format('s') ); $this->assertDateTimeEquals($dateTime, $form->getData()); @@ -416,4 +417,148 @@ class TimeTypeTest extends LocalizedTestCase $view = $form->createView(); $this->assertEquals('time', $view->getVar('type')); } + + public function testPassDefaultEmptyValueToViewIfNotRequired() + { + $form = $this->factory->create('time', null, array( + 'required' => false, + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('', $view->get('hour')->getVar('empty_value')); + $this->assertSame('', $view->get('minute')->getVar('empty_value')); + $this->assertSame('', $view->get('second')->getVar('empty_value')); + } + + public function testPassNoEmptyValueToViewIfRequired() + { + $form = $this->factory->create('time', null, array( + 'required' => true, + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertNull($view->get('hour')->getVar('empty_value')); + $this->assertNull($view->get('minute')->getVar('empty_value')); + $this->assertNull($view->get('second')->getVar('empty_value')); + } + + public function testPassEmptyValueAsString() + { + $form = $this->factory->create('time', null, array( + 'empty_value' => 'Empty', + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('Empty', $view->get('hour')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('minute')->getVar('empty_value')); + $this->assertSame('Empty', $view->get('second')->getVar('empty_value')); + } + + public function testPassEmptyValueAsArray() + { + $form = $this->factory->create('time', null, array( + 'empty_value' => array( + 'hour' => 'Empty hour', + 'minute' => 'Empty minute', + 'second' => 'Empty second', + ), + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('Empty hour', $view->get('hour')->getVar('empty_value')); + $this->assertSame('Empty minute', $view->get('minute')->getVar('empty_value')); + $this->assertSame('Empty second', $view->get('second')->getVar('empty_value')); + } + + public function testPassEmptyValueAsPartialArray_addEmptyIfNotRequired() + { + $form = $this->factory->create('time', null, array( + 'required' => false, + 'empty_value' => array( + 'hour' => 'Empty hour', + 'second' => 'Empty second', + ), + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('Empty hour', $view->get('hour')->getVar('empty_value')); + $this->assertSame('', $view->get('minute')->getVar('empty_value')); + $this->assertSame('Empty second', $view->get('second')->getVar('empty_value')); + } + + public function testPassEmptyValueAsPartialArray_addNullIfRequired() + { + $form = $this->factory->create('time', null, array( + 'required' => true, + 'empty_value' => array( + 'hour' => 'Empty hour', + 'second' => 'Empty second', + ), + 'with_seconds' => true, + )); + + $view = $form->createView(); + $this->assertSame('Empty hour', $view->get('hour')->getVar('empty_value')); + $this->assertNull($view->get('minute')->getVar('empty_value')); + $this->assertSame('Empty second', $view->get('second')->getVar('empty_value')); + } + + public function provideCompoundWidgets() + { + return array( + array('text'), + array('choice'), + ); + } + + /** + * @dataProvider provideCompoundWidgets + */ + public function testHourErrorsBubbleUp($widget) + { + $error = new FormError('Invalid!'); + $form = $this->factory->create('time', null, array( + 'widget' => $widget, + )); + $form->get('hour')->addError($error); + + $this->assertSame(array(), $form->get('hour')->getErrors()); + $this->assertSame(array($error), $form->getErrors()); + } + + /** + * @dataProvider provideCompoundWidgets + */ + public function testMinuteErrorsBubbleUp($widget) + { + $error = new FormError('Invalid!'); + $form = $this->factory->create('time', null, array( + 'widget' => $widget, + )); + $form->get('minute')->addError($error); + + $this->assertSame(array(), $form->get('minute')->getErrors()); + $this->assertSame(array($error), $form->getErrors()); + } + + /** + * @dataProvider provideCompoundWidgets + */ + public function testSecondErrorsBubbleUp($widget) + { + $error = new FormError('Invalid!'); + $form = $this->factory->create('time', null, array( + 'widget' => $widget, + 'with_seconds' => true, + )); + $form->get('second')->addError($error); + + $this->assertSame(array(), $form->get('second')->getErrors()); + $this->assertSame(array($error), $form->getErrors()); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php index 6acda43..9101e45 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php @@ -12,17 +12,11 @@ namespace Symfony\Component\Form\Tests\Extension\Core\Type; use Symfony\Component\Form\FormBuilder; -use Symfony\Component\Form\FormFactory; -use Symfony\Component\Form\Extension\Core\CoreExtension; +use Symfony\Component\Form\Tests\FormIntegrationTestCase; use Symfony\Component\EventDispatcher\EventDispatcher; -abstract class TypeTestCase extends \PHPUnit_Framework_TestCase +abstract class TypeTestCase extends FormIntegrationTestCase { - /** - * @var FormFactory - */ - protected $factory; - /** * @var FormBuilder */ @@ -35,29 +29,12 @@ abstract class TypeTestCase extends \PHPUnit_Framework_TestCase protected function setUp() { - if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) { - $this->markTestSkipped('The "EventDispatcher" component is not available'); - } + parent::setUp(); $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); - $this->factory = new FormFactory($this->getExtensions()); $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory); } - protected function tearDown() - { - $this->builder = null; - $this->dispatcher = null; - $this->factory = null; - } - - protected function getExtensions() - { - return array( - new CoreExtension(), - ); - } - public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual) { self::assertEquals($expected->format('c'), $actual->format('c')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php index a2b107f..d1fa6da 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php @@ -43,7 +43,7 @@ class UrlTypeTest extends LocalizedTestCase $form->bind(''); - $this->assertSame('', $form->getData()); + $this->assertNull($form->getData()); $this->assertSame('', $form->getViewData()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php index 7388588..0194a54 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php @@ -19,6 +19,8 @@ use Symfony\Component\Form\Extension\Validator\Constraints\Form; use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\NotNull; +use Symfony\Component\Validator\Constraints\NotBlank; use Symfony\Component\Validator\GlobalExecutionContext; use Symfony\Component\Validator\ExecutionContext; @@ -88,8 +90,8 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase $context = $this->getExecutionContext(); $graphWalker = $context->getGraphWalker(); $object = $this->getMock('\stdClass'); - $constraint1 = $this->getMock('Symfony\Component\Validator\Constraint'); - $constraint2 = $this->getMock('Symfony\Component\Validator\Constraint'); + $constraint1 = new NotNull(array('groups' => array('group1', 'group2'))); + $constraint2 = new NotBlank(array('groups' => 'group2')); $options = array( 'validation_groups' => array('group1', 'group2'), @@ -112,12 +114,6 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase ->method('walkConstraint') ->with($constraint1, $object, 'group1', 'data'); $graphWalker->expects($this->at(3)) - ->method('walkConstraint') - ->with($constraint1, $object, 'group2', 'data'); - $graphWalker->expects($this->at(4)) - ->method('walkConstraint') - ->with($constraint2, $object, 'group1', 'data'); - $graphWalker->expects($this->at(5)) ->method('walkConstraint') ->with($constraint2, $object, 'group2', 'data'); @@ -153,8 +149,8 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase $context = $this->getExecutionContext(); $graphWalker = $context->getGraphWalker(); $object = $this->getMock('\stdClass'); - $constraint1 = $this->getMock('Symfony\Component\Validator\Constraint'); - $constraint2 = $this->getMock('Symfony\Component\Validator\Constraint'); + $constraint1 = new NotNull(array('groups' => array('group1', 'group2'))); + $constraint2 = new NotBlank(array('groups' => 'group2')); $parent = $this->getBuilder('parent', null, array('cascade_validation' => false)) ->setCompound(true) @@ -173,12 +169,6 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase ->method('walkConstraint') ->with($constraint1, $object, 'group1', 'data'); $graphWalker->expects($this->at(1)) - ->method('walkConstraint') - ->with($constraint1, $object, 'group2', 'data'); - $graphWalker->expects($this->at(2)) - ->method('walkConstraint') - ->with($constraint2, $object, 'group1', 'data'); - $graphWalker->expects($this->at(3)) ->method('walkConstraint') ->with($constraint2, $object, 'group2', 'data'); @@ -428,7 +418,6 @@ class FormValidatorTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Extra!', $context->getViolations()->get(0)->getMessage()); } - /** * @dataProvider getPostMaxSizeFixtures */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php index e9212f5..69dd6fa 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php @@ -18,10 +18,7 @@ use Symfony\Component\Form\FormError; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\Form\Extension\Validator\Constraints\Form; use Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener; -use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintViolation; -use Symfony\Component\Validator\GlobalExecutionContext; -use Symfony\Component\Validator\ExecutionContext; class ValidationListenerTest extends \PHPUnit_Framework_TestCase { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php index 11703b3..03872b2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php @@ -18,7 +18,6 @@ use Symfony\Component\Form\Form; use Symfony\Component\Form\FormConfig; use Symfony\Component\Form\FormError; use Symfony\Component\Form\Util\PropertyPath; -use Symfony\Component\Form\FormBuilder; use Symfony\Component\Validator\ConstraintViolation; /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php index db64e9c..02df8f4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php @@ -243,4 +243,3 @@ class ViolationPathTest extends \PHPUnit_Framework_TestCase $path->mapsForm(-1); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php new file mode 100644 index 0000000..4f7ba6d --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests\Fixtures; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormBuilderInterface; +use Symfony\Component\Form\FormFactoryInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\OptionsResolver\OptionsResolverInterface; + +class FooSubType extends AbstractType +{ + public function getName() + { + return 'foo_sub_type'; + } + + public function getParent() + { + return 'foo'; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/FooType.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/FooType.php index feae689..d26d3f7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/FooType.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Fixtures/FooType.php @@ -16,42 +16,15 @@ use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormFactoryInterface; use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\OptionsResolver\OptionsResolverInterface; class FooType extends AbstractType { - public function buildForm(FormBuilderInterface $builder, array $options) - { - $builder->setAttribute('foo', 'x'); - $builder->setAttribute('data_option', $options['data']); - } - public function getName() { return 'foo'; } - public function createBuilder($name, FormFactoryInterface $factory, array $options) - { - return new FormBuilder($name, null, new EventDispatcher(), $factory); - } - - public function getDefaultOptions() - { - return array( - 'data' => null, - 'required' => false, - 'max_length' => null, - 'a_or_b' => 'a', - ); - } - - public function getAllowedOptionValues() - { - return array( - 'a_or_b' => array('a', 'b'), - ); - } - public function getParent() { return null; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderTest.php index 52dcebc..42d4317 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormBuilderTest.php @@ -134,6 +134,15 @@ class FormBuilderTest extends \PHPUnit_Framework_TestCase $this->assertFalse($this->builder->has('foo')); } + // https://github.com/symfony/symfony/pull/4826 + public function testRemoveAndGetForm() + { + $this->builder->add('foo', 'text'); + $this->builder->remove('foo'); + $form = $this->builder->getForm(); + $this->assertInstanceOf('Symfony\Component\Form\Form', $form); + } + public function testCreateNoTypeNo() { $this->factory->expects($this->once()) diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php index 189cdee..6165fb9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormFactoryTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests; use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormTypeGuesserChain; use Symfony\Component\Form\FormFactory; use Symfony\Component\Form\Guess\Guess; use Symfony\Component\Form\Guess\ValueGuess; @@ -23,16 +24,29 @@ use Symfony\Component\Form\Tests\Fixtures\FooType; use Symfony\Component\Form\Tests\Fixtures\FooTypeBarExtension; use Symfony\Component\Form\Tests\Fixtures\FooTypeBazExtension; +/** + * @author Bernhard Schussek + */ class FormFactoryTest extends \PHPUnit_Framework_TestCase { - private $extension1; - - private $extension2; - + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ private $guesser1; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ private $guesser2; + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $registry; + + /** + * @var FormFactory + */ private $factory; protected function setUp() @@ -43,270 +57,252 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase $this->guesser1 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); $this->guesser2 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); - $this->extension1 = new TestExtension($this->guesser1); - $this->extension2 = new TestExtension($this->guesser2); - $this->factory = new FormFactory(array($this->extension1, $this->extension2)); - } + $this->registry = $this->getMock('Symfony\Component\Form\FormRegistryInterface'); + $this->factory = new FormFactory($this->registry); - protected function tearDown() - { - $this->extension1 = null; - $this->extension2 = null; - $this->guesser1 = null; - $this->guesser2 = null; - $this->factory = null; + $this->registry->expects($this->any()) + ->method('getTypeGuesser') + ->will($this->returnValue(new FormTypeGuesserChain(array( + $this->guesser1, + $this->guesser2, + )))); } public function testAddType() { - $this->assertFalse($this->factory->hasType('foo')); - $type = new FooType(); - $this->factory->addType($type); + $resolvedType = $this->getMockResolvedType(); - $this->assertTrue($this->factory->hasType('foo')); - $this->assertSame($type, $this->factory->getType('foo')); - } + $this->registry->expects($this->once()) + ->method('resolveType') + ->with($type) + ->will($this->returnValue($resolvedType)); - public function testAddTypeAddsExtensions() - { - $type = new FooType(); - $ext1 = new FooTypeBarExtension(); - $ext2 = new FooTypeBazExtension(); - - $this->extension1->addTypeExtension($ext1); - $this->extension2->addTypeExtension($ext2); + $this->registry->expects($this->once()) + ->method('addType') + ->with($resolvedType); $this->factory->addType($type); - - $this->assertEquals(array($ext1, $ext2), $type->getExtensions()); } - public function testGetTypeFromExtension() + public function testHasType() + { + $this->registry->expects($this->once()) + ->method('hasType') + ->with('name') + ->will($this->returnValue('RESULT')); + + $this->assertSame('RESULT', $this->factory->hasType('name')); + } + + public function testGetType() { $type = new FooType(); - $this->extension2->addType($type); + $resolvedType = $this->getMockResolvedType(); - $this->assertSame($type, $this->factory->getType('foo')); + $resolvedType->expects($this->once()) + ->method('getInnerType') + ->will($this->returnValue($type)); + + $this->registry->expects($this->once()) + ->method('getType') + ->with('name') + ->will($this->returnValue($resolvedType)); + + $this->assertEquals($type, $this->factory->getType('name')); } - public function testGetTypeAddsExtensions() + public function testCreateNamedBuilderWithTypeName() { - $type = new FooType(); - $ext1 = new FooTypeBarExtension(); - $ext2 = new FooTypeBazExtension(); + $options = array('a' => '1', 'b' => '2'); + $resolvedType = $this->getMockResolvedType(); - $this->extension1->addTypeExtension($ext1); - $this->extension2->addTypeExtension($ext2); - $this->extension2->addType($type); + $this->registry->expects($this->once()) + ->method('getType') + ->with('type') + ->will($this->returnValue($resolvedType)); - $type = $this->factory->getType('foo'); + $resolvedType->expects($this->once()) + ->method('createBuilder') + ->with($this->factory, 'name', $options) + ->will($this->returnValue('BUILDER')); - $this->assertEquals(array($ext1, $ext2), $type->getExtensions()); + $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', 'type', null, $options)); } - /** - * @expectedException Symfony\Component\Form\Exception\FormException - */ - public function testGetTypeExpectsExistingType() + public function testCreateNamedBuilderWithTypeInstance() { - $this->factory->getType('bar'); + $options = array('a' => '1', 'b' => '2'); + $type = $this->getMockType(); + $resolvedType = $this->getMockResolvedType(); + + $this->registry->expects($this->once()) + ->method('resolveType') + ->with($type) + ->will($this->returnValue($resolvedType)); + + // The type is also implicitely added to the registry + $this->registry->expects($this->once()) + ->method('addType') + ->with($resolvedType); + + $resolvedType->expects($this->once()) + ->method('createBuilder') + ->with($this->factory, 'name', $options) + ->will($this->returnValue('BUILDER')); + + $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', $type, null, $options)); } - public function testCreateNamedBuilder() + public function testCreateNamedBuilderWithResolvedTypeInstance() { - $type = new FooType(); - $this->extension1->addType($type); + $options = array('a' => '1', 'b' => '2'); + $resolvedType = $this->getMockResolvedType(); - $builder = $this->factory->createNamedBuilder('bar', 'foo'); + // The type is also implicitely added to the registry + $this->registry->expects($this->once()) + ->method('addType') + ->with($resolvedType); - $this->assertTrue($builder instanceof FormBuilder); - $this->assertEquals('bar', $builder->getName()); - $this->assertNull($builder->getParent()); + $resolvedType->expects($this->once()) + ->method('createBuilder') + ->with($this->factory, 'name', $options) + ->will($this->returnValue('BUILDER')); + + $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', $resolvedType, null, $options)); } - public function testCreateNamedBuilderCallsBuildFormMethods() + public function testCreateNamedBuilderWithParentBuilder() { - $type = new FooType(); - $ext1 = new FooTypeBarExtension(); - $ext2 = new FooTypeBazExtension(); + $options = array('a' => '1', 'b' => '2'); + $parentBuilder = $this->getMockFormBuilder(); + $resolvedType = $this->getMockResolvedType(); - $this->extension1->addTypeExtension($ext1); - $this->extension2->addTypeExtension($ext2); - $this->extension2->addType($type); + $this->registry->expects($this->once()) + ->method('getType') + ->with('type') + ->will($this->returnValue($resolvedType)); - $builder = $this->factory->createNamedBuilder('bar', 'foo'); + $resolvedType->expects($this->once()) + ->method('createBuilder') + ->with($this->factory, 'name', $options, $parentBuilder) + ->will($this->returnValue('BUILDER')); - $this->assertTrue($builder->hasAttribute('foo')); - $this->assertTrue($builder->hasAttribute('bar')); - $this->assertTrue($builder->hasAttribute('baz')); + $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', 'type', null, $options, $parentBuilder)); } public function testCreateNamedBuilderFillsDataOption() { - $type = new FooType(); - $this->extension1->addType($type); + $givenOptions = array('a' => '1', 'b' => '2'); + $expectedOptions = array_merge($givenOptions, array('data' => 'DATA')); + $resolvedType = $this->getMockResolvedType(); - $builder = $this->factory->createNamedBuilder('bar', 'foo', 'xyz'); + $this->registry->expects($this->once()) + ->method('getType') + ->with('type') + ->will($this->returnValue($resolvedType)); - // see FooType::buildForm() - $this->assertEquals('xyz', $builder->getAttribute('data_option')); + $resolvedType->expects($this->once()) + ->method('createBuilder') + ->with($this->factory, 'name', $expectedOptions) + ->will($this->returnValue('BUILDER')); + + $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', 'type', 'DATA', $givenOptions)); } public function testCreateNamedBuilderDoesNotOverrideExistingDataOption() { - $type = new FooType(); - $this->extension1->addType($type); + $options = array('a' => '1', 'b' => '2', 'data' => 'CUSTOM'); + $resolvedType = $this->getMockResolvedType(); - $builder = $this->factory->createNamedBuilder('bar', 'foo', 'xyz', array( - 'data' => 'abc', - )); + $this->registry->expects($this->once()) + ->method('getType') + ->with('type') + ->will($this->returnValue($resolvedType)); - // see FooType::buildForm() - $this->assertEquals('abc', $builder->getAttribute('data_option')); - } - - /** - * @expectedException Symfony\Component\Form\Exception\TypeDefinitionException - */ - public function testCreateNamedBuilderExpectsDataOptionToBeSupported() - { - $type = $this->getMock('Symfony\Component\Form\FormTypeInterface'); - $type->expects($this->any()) - ->method('getName') - ->will($this->returnValue('foo')); - $type->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array())); - - $this->extension1->addType($type); - - $this->factory->createNamedBuilder('bar', 'foo'); - } - - /** - * @expectedException Symfony\Component\Form\Exception\TypeDefinitionException - */ - public function testCreateNamedBuilderExpectsRequiredOptionToBeSupported() - { - $type = $this->getMock('Symfony\Component\Form\FormTypeInterface'); - $type->expects($this->any()) - ->method('getName') - ->will($this->returnValue('foo')); - $type->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array())); - - $this->extension1->addType($type); - - $this->factory->createNamedBuilder('bar', 'foo'); - } - - /** - * @expectedException Symfony\Component\Form\Exception\TypeDefinitionException - */ - public function testCreateNamedBuilderExpectsMaxLengthOptionToBeSupported() - { - $type = $this->getMock('Symfony\Component\Form\FormTypeInterface'); - $type->expects($this->any()) - ->method('getName') - ->will($this->returnValue('foo')); - $type->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array())); - - $this->extension1->addType($type); - - $this->factory->createNamedBuilder('bar', 'foo'); - } - - /** - * @expectedException Symfony\Component\Form\Exception\TypeDefinitionException - */ - public function testCreateNamedBuilderExpectsBuilderToBeReturned() - { - $type = $this->getMock('Symfony\Component\Form\FormTypeInterface'); - $type->expects($this->any()) - ->method('getName') - ->will($this->returnValue('foo')); - $type->expects($this->any()) - ->method('getExtensions') - ->will($this->returnValue(array())); - $type->expects($this->any()) + $resolvedType->expects($this->once()) ->method('createBuilder') - ->will($this->returnValue(null)); + ->with($this->factory, 'name', $options) + ->will($this->returnValue('BUILDER')); - $this->extension1->addType($type); - - $this->factory->createNamedBuilder('bar', 'foo'); - } - - /** - * @expectedException Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ - public function testCreateNamedBuilderExpectsOptionsToExist() - { - $type = new FooType(); - $this->extension1->addType($type); - - $this->factory->createNamedBuilder('bar', 'foo', null, array( - 'invalid' => 'xyz', - )); - } - - /** - * @expectedException Symfony\Component\OptionsResolver\Exception\InvalidOptionsException - */ - public function testCreateNamedBuilderExpectsOptionsToBeInValidRange() - { - $type = new FooType(); - $this->extension1->addType($type); - - $this->factory->createNamedBuilder('bar', 'foo', null, array( - 'a_or_b' => 'c', - )); - } - - public function testCreateNamedBuilderAllowsExtensionsToExtendAllowedOptionValues() - { - $type = new FooType(); - $this->extension1->addType($type); - $this->extension1->addTypeExtension(new FooTypeBarExtension()); - - // no exception this time - $this->factory->createNamedBuilder('bar', 'foo', null, array( - 'a_or_b' => 'c', - )); - } - - public function testCreateNamedBuilderAddsTypeInstances() - { - $type = new FooType(); - $this->assertFalse($this->factory->hasType('foo')); - - $builder = $this->factory->createNamedBuilder('bar', $type); - - $this->assertTrue($builder instanceof FormBuilder); - $this->assertTrue($this->factory->hasType('foo')); + $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', 'type', 'DATA', $options)); } /** * @expectedException Symfony\Component\Form\Exception\UnexpectedTypeException - * @expectedExceptionMessage Expected argument of type "string or Symfony\Component\Form\FormTypeInterface", "stdClass" given + * @expectedExceptionMessage Expected argument of type "string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface", "stdClass" given */ public function testCreateNamedBuilderThrowsUnderstandableException() { $this->factory->createNamedBuilder('name', new \stdClass()); } - public function testCreateUsesTypeNameAsName() + public function testCreateUsesTypeNameIfTypeGivenAsString() { - $type = new FooType(); - $this->extension1->addType($type); + $options = array('a' => '1', 'b' => '2'); + $resolvedType = $this->getMockResolvedType(); + $builder = $this->getMockFormBuilder(); - $builder = $this->factory->createBuilder('foo'); + $this->registry->expects($this->once()) + ->method('getType') + ->with('TYPE') + ->will($this->returnValue($resolvedType)); - $this->assertEquals('foo', $builder->getName()); + $resolvedType->expects($this->once()) + ->method('createBuilder') + ->with($this->factory, 'TYPE', $options) + ->will($this->returnValue($builder)); + + $builder->expects($this->once()) + ->method('getForm') + ->will($this->returnValue('FORM')); + + $this->assertSame('FORM', $this->factory->create('TYPE', null, $options)); + } + + public function testCreateUsesTypeNameIfTypeGivenAsObject() + { + $options = array('a' => '1', 'b' => '2'); + $resolvedType = $this->getMockResolvedType(); + $builder = $this->getMockFormBuilder(); + + $resolvedType->expects($this->once()) + ->method('getName') + ->will($this->returnValue('TYPE')); + + $resolvedType->expects($this->once()) + ->method('createBuilder') + ->with($this->factory, 'TYPE', $options) + ->will($this->returnValue($builder)); + + $builder->expects($this->once()) + ->method('getForm') + ->will($this->returnValue('FORM')); + + $this->assertSame('FORM', $this->factory->create($resolvedType, null, $options)); + } + + public function testCreateNamed() + { + $options = array('a' => '1', 'b' => '2'); + $resolvedType = $this->getMockResolvedType(); + $builder = $this->getMockFormBuilder(); + + $this->registry->expects($this->once()) + ->method('getType') + ->with('type') + ->will($this->returnValue($resolvedType)); + + $resolvedType->expects($this->once()) + ->method('createBuilder') + ->with($this->factory, 'name', $options) + ->will($this->returnValue($builder)); + + $builder->expects($this->once()) + ->method('getForm') + ->will($this->returnValue('FORM')); + + $this->assertSame('FORM', $this->factory->createNamed('name', 'type', null, $options)); } public function testCreateBuilderForPropertyCreatesFormWithHighestConfidence() @@ -329,7 +325,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase Guess::HIGH_CONFIDENCE ))); - $factory = $this->createMockFactory(array('createNamedBuilder')); + $factory = $this->getMockFactory(array('createNamedBuilder')); $factory->expects($this->once()) ->method('createNamedBuilder') @@ -348,7 +344,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase ->with('Application\Author', 'firstName') ->will($this->returnValue(null)); - $factory = $this->createMockFactory(array('createNamedBuilder')); + $factory = $this->getMockFactory(array('createNamedBuilder')); $factory->expects($this->once()) ->method('createNamedBuilder') @@ -371,7 +367,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase Guess::MEDIUM_CONFIDENCE ))); - $factory = $this->createMockFactory(array('createNamedBuilder')); + $factory = $this->getMockFactory(array('createNamedBuilder')); $factory->expects($this->once()) ->method('createNamedBuilder') @@ -406,7 +402,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase Guess::HIGH_CONFIDENCE ))); - $factory = $this->createMockFactory(array('createNamedBuilder')); + $factory = $this->getMockFactory(array('createNamedBuilder')); $factory->expects($this->once()) ->method('createNamedBuilder') @@ -439,7 +435,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase Guess::HIGH_CONFIDENCE ))); - $factory = $this->createMockFactory(array('createNamedBuilder')); + $factory = $this->getMockFactory(array('createNamedBuilder')); $factory->expects($this->once()) ->method('createNamedBuilder') @@ -474,7 +470,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase Guess::LOW_CONFIDENCE ))); - $factory = $this->createMockFactory(array('createNamedBuilder')); + $factory = $this->getMockFactory(array('createNamedBuilder')); $factory->expects($this->once()) ->method('createNamedBuilder') @@ -507,7 +503,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase Guess::HIGH_CONFIDENCE ))); - $factory = $this->createMockFactory(array('createNamedBuilder')); + $factory = $this->getMockFactory(array('createNamedBuilder')); $factory->expects($this->once()) ->method('createNamedBuilder') @@ -540,7 +536,7 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase Guess::HIGH_CONFIDENCE ))); - $factory = $this->createMockFactory(array('createNamedBuilder')); + $factory = $this->getMockFactory(array('createNamedBuilder')); $factory->expects($this->once()) ->method('createNamedBuilder') @@ -555,41 +551,26 @@ class FormFactoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals('builderInstance', $builder); } - public function testCreateNamedBuilderFromParentBuilder() - { - $type = new FooType(); - $this->extension1->addType($type); - - $parentBuilder = $this->getMockBuilder('Symfony\Component\Form\FormBuilder') - ->setConstructorArgs(array('name', null, $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'), $this->factory)) - ->getMock() - ; - - $builder = $this->factory->createNamedBuilder('bar', 'foo', null, array(), $parentBuilder); - - $this->assertNotEquals($builder, $builder->getParent()); - $this->assertEquals($parentBuilder, $builder->getParent()); - } - - public function testFormTypeCreatesDefaultValueForEmptyDataOption() - { - $factory = new FormFactory(array(new \Symfony\Component\Form\Extension\Core\CoreExtension())); - - $form = $factory->createNamedBuilder('author', new AuthorType())->getForm(); - $form->bind(array('firstName' => 'John', 'lastName' => 'Smith')); - - $author = new Author(); - $author->firstName = 'John'; - $author->setLastName('Smith'); - - $this->assertEquals($author, $form->getData()); - } - - private function createMockFactory(array $methods = array()) + private function getMockFactory(array $methods = array()) { return $this->getMockBuilder('Symfony\Component\Form\FormFactory') ->setMethods($methods) - ->setConstructorArgs(array(array($this->extension1, $this->extension2))) + ->setConstructorArgs(array($this->registry)) ->getMock(); } + + private function getMockResolvedType() + { + return $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); + } + + private function getMockType() + { + return $this->getMock('Symfony\Component\Form\FormTypeInterface'); + } + + private function getMockFormBuilder() + { + return $this->getMock('Symfony\Component\Form\Tests\FormBuilderInterface'); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php new file mode 100644 index 0000000..fa03a40 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormIntegrationTestCase.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\FormFactory; +use Symfony\Component\Form\FormRegistry; +use Symfony\Component\Form\Extension\Core\CoreExtension; + +/** + * @author Bernhard Schussek + */ +class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase +{ + /** + * @var FormRegistry + */ + protected $registry; + + /** + * @var FormFactory + */ + protected $factory; + + protected function setUp() + { + if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) { + $this->markTestSkipped('The "EventDispatcher" component is not available'); + } + + $this->registry = new FormRegistry($this->getExtensions()); + $this->factory = new FormFactory($this->registry); + } + + protected function getExtensions() + { + return array( + new CoreExtension(), + ); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormPerformanceTestCase.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormPerformanceTestCase.php new file mode 100644 index 0000000..d68d67a --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormPerformanceTestCase.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +/** + * Base class for performance tests. + * + * Copied from Doctrine 2's OrmPerformanceTestCase. + * + * @author robo + * @author Bernhard Schussek + */ +class FormPerformanceTestCase extends FormIntegrationTestCase +{ + /** + * @var integer + */ + protected $maxRunningTime = 0; + + /** + */ + protected function runTest() + { + $s = microtime(true); + parent::runTest(); + $time = microtime(true) - $s; + + if ($this->maxRunningTime != 0 && $time > $this->maxRunningTime) { + $this->fail( + sprintf( + 'expected running time: <= %s but was: %s', + + $this->maxRunningTime, + $time + ) + ); + } + } + + /** + * @param integer $maxRunningTime + * @throws InvalidArgumentException + */ + public function setMaxRunningTime($maxRunningTime) + { + if (is_integer($maxRunningTime) && $maxRunningTime >= 0) { + $this->maxRunningTime = $maxRunningTime; + } else { + throw new \InvalidArgumentException; + } + } + + /** + * @return integer + * @since Method available since Release 2.3.0 + */ + public function getMaxRunningTime() + { + return $this->maxRunningTime; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormRegistryTest.php new file mode 100644 index 0000000..ae0946f --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormRegistryTest.php @@ -0,0 +1,177 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form; + +use Symfony\Component\Form\Tests\Fixtures\TestExtension; +use Symfony\Component\Form\Tests\Fixtures\FooSubType; +use Symfony\Component\Form\Tests\Fixtures\FooTypeBazExtension; +use Symfony\Component\Form\Tests\Fixtures\FooTypeBarExtension; +use Symfony\Component\Form\Tests\Fixtures\FooType; + +/** + * @author Bernhard Schussek + */ +class FormRegistryTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var FormRegistry + */ + private $registry; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $guesser1; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $guesser2; + + /** + * @var TestExtension + */ + private $extension1; + + /** + * @var TestExtension + */ + private $extension2; + + protected function setUp() + { + $this->guesser1 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); + $this->guesser2 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface'); + $this->extension1 = new TestExtension($this->guesser1); + $this->extension2 = new TestExtension($this->guesser2); + $this->registry = new FormRegistry(array( + $this->extension1, + $this->extension2, + )); + } + + public function testResolveType() + { + $type = new FooType(); + $ext1 = new FooTypeBarExtension(); + $ext2 = new FooTypeBazExtension(); + + $this->extension1->addTypeExtension($ext1); + $this->extension2->addTypeExtension($ext2); + + $resolvedType = $this->registry->resolveType($type); + + $this->assertEquals($type, $resolvedType->getInnerType()); + $this->assertEquals(array($ext1, $ext2), $resolvedType->getTypeExtensions()); + } + + public function testResolveTypeConnectsParent() + { + $parentType = new FooType(); + $type = new FooSubType(); + + $resolvedParentType = $this->registry->resolveType($parentType); + + $this->registry->addType($resolvedParentType); + + $resolvedType = $this->registry->resolveType($type); + + $this->assertSame($resolvedParentType, $resolvedType->getParent()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\FormException + */ + public function testResolveTypeThrowsExceptionIfParentNotFound() + { + $type = new FooSubType(); + + $this->registry->resolveType($type); + } + + public function testGetTypeReturnsAddedType() + { + $type = new FooType(); + + $resolvedType = $this->registry->resolveType($type); + + $this->registry->addType($resolvedType); + + $this->assertSame($resolvedType, $this->registry->getType('foo')); + } + + public function testGetTypeFromExtension() + { + $type = new FooType(); + + $this->extension2->addType($type); + + $resolvedType = $this->registry->getType('foo'); + + $this->assertInstanceOf('Symfony\Component\Form\ResolvedFormTypeInterface', $resolvedType); + $this->assertSame($type, $resolvedType->getInnerType()); + } + + /** + * @expectedException Symfony\Component\Form\Exception\FormException + */ + public function testGetTypeThrowsExceptionIfTypeNotFound() + { + $this->registry->getType('bar'); + } + + /** + * @expectedException Symfony\Component\Form\Exception\UnexpectedTypeException + */ + public function testGetTypeThrowsExceptionIfNoString() + { + $this->registry->getType(array()); + } + + public function testHasTypeAfterAdding() + { + $type = new FooType(); + + $resolvedType = $this->registry->resolveType($type); + + $this->assertFalse($this->registry->hasType('foo')); + + $this->registry->addType($resolvedType); + + $this->assertTrue($this->registry->hasType('foo')); + } + + public function testHasTypeAfterLoadingFromExtension() + { + $type = new FooType(); + + $this->assertFalse($this->registry->hasType('foo')); + + $this->extension2->addType($type); + + $this->assertTrue($this->registry->hasType('foo')); + } + + public function testGetTypeGuesser() + { + $expectedGuesser = new FormTypeGuesserChain(array($this->guesser1, $this->guesser2)); + + $this->assertEquals($expectedGuesser, $this->registry->getTypeGuesser()); + } + + public function testGetExtensions() + { + $expectedExtensions = array($this->extension1, $this->extension2); + + $this->assertEquals($expectedExtensions, $this->registry->getExtensions()); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormViewInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormViewInterface.php new file mode 100644 index 0000000..431dd3a --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/FormViewInterface.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +interface FormViewInterface extends \Iterator, \Symfony\Component\Form\FormViewInterface +{ +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php new file mode 100644 index 0000000..e89e650 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php @@ -0,0 +1,285 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Form\Tests; + +use Symfony\Component\Form\ResolvedFormType; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\FormViewInterface; +use Symfony\Component\Form\FormBuilder; +use Symfony\Component\Form\FormConfig; +use Symfony\Component\Form\Form; +use Symfony\Component\OptionsResolver\OptionsResolverInterface; + +/** + * @author Bernhard Schussek + */ +class ResolvedFormTypeTest extends \PHPUnit_Framework_TestCase +{ + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $dispatcher; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $factory; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $dataMapper; + + protected function setUp() + { + if (!class_exists('Symfony\Component\OptionsResolver\OptionsResolver')) { + $this->markTestSkipped('The "OptionsResolver" component is not available'); + } + + if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) { + $this->markTestSkipped('The "EventDispatcher" component is not available'); + } + + $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface'); + $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface'); + $this->dataMapper = $this->getMock('Symfony\Component\Form\DataMapperInterface'); + } + + public function testCreateBuilder() + { + $parentType = $this->getMockFormType(); + $type = $this->getMockFormType(); + $extension1 = $this->getMockFormTypeExtension(); + $extension2 = $this->getMockFormTypeExtension(); + + $parentResolvedType = new ResolvedFormType($parentType); + $resolvedType = new ResolvedFormType($type, array($extension1, $extension2), $parentResolvedType); + + $test = $this; + $i = 0; + + $assertIndex = function ($index) use (&$i, $test) { + return function () use (&$i, $test, $index) { + /* @var \PHPUnit_Framework_TestCase $test */ + $test->assertEquals($index, $i, 'Executed at index ' . $index); + + ++$i; + }; + }; + + $assertIndexAndAddOption = function ($index, $option, $default) use ($assertIndex) { + $assertIndex = $assertIndex($index); + + return function (OptionsResolverInterface $resolver) use ($assertIndex, $index, $option, $default) { + $assertIndex(); + + $resolver->setDefaults(array($option => $default)); + }; + }; + + // First the default options are generated for the super type + $parentType->expects($this->once()) + ->method('setDefaultOptions') + ->will($this->returnCallback($assertIndexAndAddOption(0, 'a', 'a_default'))); + + // The form type itself + $type->expects($this->once()) + ->method('setDefaultOptions') + ->will($this->returnCallback($assertIndexAndAddOption(1, 'b', 'b_default'))); + + // And its extensions + $extension1->expects($this->once()) + ->method('setDefaultOptions') + ->will($this->returnCallback($assertIndexAndAddOption(2, 'c', 'c_default'))); + + $extension2->expects($this->once()) + ->method('setDefaultOptions') + ->will($this->returnCallback($assertIndexAndAddOption(3, 'd', 'd_default'))); + + // Can only be uncommented when the following PHPUnit "bug" is fixed: + // https://github.com/sebastianbergmann/phpunit-mock-objects/issues/47 + // $givenOptions = array('a' => 'a_custom', 'c' => 'c_custom'); + // $resolvedOptions = array('a' => 'a_custom', 'b' => 'b_default', 'c' => 'c_custom', 'd' => 'd_default'); + + $givenOptions = array(); + $resolvedOptions = array(); + + // Then the form is built for the super type + $parentType->expects($this->once()) + ->method('buildForm') + ->with($this->anything(), $resolvedOptions) + ->will($this->returnCallback($assertIndex(4))); + + // Then the type itself + $type->expects($this->once()) + ->method('buildForm') + ->with($this->anything(), $resolvedOptions) + ->will($this->returnCallback($assertIndex(5))); + + // Then its extensions + $extension1->expects($this->once()) + ->method('buildForm') + ->with($this->anything(), $resolvedOptions) + ->will($this->returnCallback($assertIndex(6))); + + $extension2->expects($this->once()) + ->method('buildForm') + ->with($this->anything(), $resolvedOptions) + ->will($this->returnCallback($assertIndex(7))); + + $factory = $this->getMockFormFactory(); + $parentBuilder = $this->getBuilder('parent'); + $builder = $resolvedType->createBuilder($factory, 'name', $givenOptions, $parentBuilder); + + $this->assertSame($parentBuilder, $builder->getParent()); + $this->assertSame($resolvedType, $builder->getType()); + } + + public function testCreateView() + { + $parentType = $this->getMockFormType(); + $type = $this->getMockFormType(); + $field1Type = $this->getMockFormType(); + $field2Type = $this->getMockFormType(); + $extension1 = $this->getMockFormTypeExtension(); + $extension2 = $this->getMockFormTypeExtension(); + + $parentResolvedType = new ResolvedFormType($parentType); + $resolvedType = new ResolvedFormType($type, array($extension1, $extension2), $parentResolvedType); + $field1ResolvedType = new ResolvedFormType($field1Type); + $field2ResolvedType = new ResolvedFormType($field2Type); + + $options = array('a' => '1', 'b' => '2'); + $form = $this->getBuilder('name', $options) + ->setCompound(true) + ->setDataMapper($this->dataMapper) + ->setType($resolvedType) + ->add($this->getBuilder('foo')->setType($field1ResolvedType)) + ->add($this->getBuilder('bar')->setType($field2ResolvedType)) + ->getForm(); + + $test = $this; + $i = 0; + + $assertIndexAndNbOfChildViews = function ($index, $nbOfChildViews) use (&$i, $test) { + return function (FormViewInterface $view) use (&$i, $test, $index, $nbOfChildViews) { + /* @var \PHPUnit_Framework_TestCase $test */ + $test->assertEquals($index, $i, 'Executed at index ' . $index); + $test->assertCount($nbOfChildViews, $view); + + ++$i; + }; + }; + + // First the super type + $parentType->expects($this->once()) + ->method('buildView') + ->with($this->anything(), $form, $options) + ->will($this->returnCallback($assertIndexAndNbOfChildViews(0, 0))); + + // Then the type itself + $type->expects($this->once()) + ->method('buildView') + ->with($this->anything(), $form, $options) + ->will($this->returnCallback($assertIndexAndNbOfChildViews(1, 0))); + + // Then its extensions + $extension1->expects($this->once()) + ->method('buildView') + ->with($this->anything(), $form, $options) + ->will($this->returnCallback($assertIndexAndNbOfChildViews(2, 0))); + + $extension2->expects($this->once()) + ->method('buildView') + ->with($this->anything(), $form, $options) + ->will($this->returnCallback($assertIndexAndNbOfChildViews(3, 0))); + + // Now the first child form + $field1Type->expects($this->once()) + ->method('buildView') + ->will($this->returnCallback($assertIndexAndNbOfChildViews(4, 0))); + $field1Type->expects($this->once()) + ->method('finishView') + ->will($this->returnCallback($assertIndexAndNbOfChildViews(5, 0))); + + // And the second child form + $field2Type->expects($this->once()) + ->method('buildView') + ->will($this->returnCallback($assertIndexAndNbOfChildViews(6, 0))); + $field2Type->expects($this->once()) + ->method('finishView') + ->will($this->returnCallback($assertIndexAndNbOfChildViews(7, 0))); + + // Again first the parent + $parentType->expects($this->once()) + ->method('finishView') + ->with($this->anything(), $form, $options) + ->will($this->returnCallback($assertIndexAndNbOfChildViews(8, 2))); + + // Then the type itself + $type->expects($this->once()) + ->method('finishView') + ->with($this->anything(), $form, $options) + ->will($this->returnCallback($assertIndexAndNbOfChildViews(9, 2))); + + // Then its extensions + $extension1->expects($this->once()) + ->method('finishView') + ->with($this->anything(), $form, $options) + ->will($this->returnCallback($assertIndexAndNbOfChildViews(10, 2))); + + $extension2->expects($this->once()) + ->method('finishView') + ->with($this->anything(), $form, $options) + ->will($this->returnCallback($assertIndexAndNbOfChildViews(11, 2))); + + $parentView = new FormView('parent'); + $view = $resolvedType->createView($form, $parentView); + + $this->assertSame($parentView, $view->getParent()); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getMockFormType() + { + return $this->getMock('Symfony\Component\Form\FormTypeInterface'); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getMockFormTypeExtension() + { + return $this->getMock('Symfony\Component\Form\FormTypeExtensionInterface'); + } + + /** + * @return \PHPUnit_Framework_MockObject_MockObject + */ + private function getMockFormFactory() + { + return $this->getMock('Symfony\Component\Form\FormFactoryInterface'); + } + + /** + * @param string $name + * @param array $options + * + * @return FormBuilder + */ + protected function getBuilder($name = 'name', array $options = array()) + { + return new FormBuilder($name, null, $this->dispatcher, $this->factory, $options); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php index 36810dc..cf6e478 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -15,22 +15,18 @@ use Symfony\Component\Form\Form; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\Form\FormConfig; use Symfony\Component\Form\FormView; -use Symfony\Component\Form\FormBuilder; use Symfony\Component\Form\FormError; use Symfony\Component\Form\Exception\TransformationFailedException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer; use Symfony\Component\Form\Tests\Fixtures\FixedFilterListener; class SimpleFormTest extends AbstractFormTest { - public function testDataIsInitializedEmpty() + public function testDataIsInitializedToConfiguredValue() { $model = new FixedDataTransformer(array( - '' => 'foo', + 'default' => 'foo', )); $view = new FixedDataTransformer(array( 'foo' => 'bar', @@ -39,9 +35,10 @@ class SimpleFormTest extends AbstractFormTest $config = new FormConfig('name', null, $this->dispatcher); $config->addViewTransformer($view); $config->addModelTransformer($model); + $config->setData('default'); $form = new Form($config); - $this->assertNull($form->getData()); + $this->assertSame('default', $form->getData()); $this->assertSame('foo', $form->getNormData()); $this->assertSame('bar', $form->getViewData()); } @@ -380,6 +377,18 @@ class SimpleFormTest extends AbstractFormTest $this->assertSame('', $form->getViewData()); } + public function testSetDataIsIgnoredIfDataIsLocked() + { + $form = $this->getBuilder() + ->setData('default') + ->setDataLocked(true) + ->getForm(); + + $form->setData('foobar'); + + $this->assertSame('default', $form->getData()); + } + public function testBindConvertsEmptyToNullIfNoTransformer() { $form = $this->getBuilder()->getForm(); @@ -416,7 +425,7 @@ class SimpleFormTest extends AbstractFormTest ))) ->getForm(); - $form->setData('app'); + $form->bind('client'); $this->assertEquals('app', $form->getData()); $this->assertEquals('filterednorm', $form->getNormData()); @@ -471,7 +480,7 @@ class SimpleFormTest extends AbstractFormTest $this->assertTrue($this->form->isSynchronized()); } - public function testNotSynchronizedIfTransformationFailed() + public function testNotSynchronizedIfViewReverseTransformationFailed() { $transformer = $this->getDataTransformer(); $transformer->expects($this->once()) @@ -487,6 +496,22 @@ class SimpleFormTest extends AbstractFormTest $this->assertFalse($form->isSynchronized()); } + public function testNotSynchronizedIfModelReverseTransformationFailed() + { + $transformer = $this->getDataTransformer(); + $transformer->expects($this->once()) + ->method('reverseTransform') + ->will($this->throwException(new TransformationFailedException())); + + $form = $this->getBuilder() + ->addModelTransformer($transformer) + ->getForm(); + + $form->bind('foobar'); + + $this->assertFalse($form->isSynchronized()); + } + public function testEmptyDataCreatedBeforeTransforming() { $form = $this->getBuilder() @@ -552,13 +577,54 @@ class SimpleFormTest extends AbstractFormTest $this->assertSame(array(), $this->form->getErrors()); } - public function testCreateViewAcceptsParent() + public function testCreateView() { - $parent = new FormView('form'); + $type = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); + $view = $this->getMock('Symfony\Component\Form\Tests\FormViewInterface'); + $form = $this->getBuilder()->setType($type)->getForm(); - $view = $this->form->createView($parent); + $type->expects($this->once()) + ->method('createView') + ->with($form) + ->will($this->returnValue($view)); - $this->assertSame($parent, $view->getParent()); + $this->assertSame($view, $form->createView()); + } + + public function testCreateViewWithParent() + { + $type = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); + $view = $this->getMock('Symfony\Component\Form\Tests\FormViewInterface'); + $parentForm = $this->getMock('Symfony\Component\Form\Tests\FormInterface'); + $parentView = $this->getMock('Symfony\Component\Form\Tests\FormViewInterface'); + $form = $this->getBuilder()->setType($type)->getForm(); + $form->setParent($parentForm); + + $parentForm->expects($this->once()) + ->method('createView') + ->will($this->returnValue($parentView)); + + $type->expects($this->once()) + ->method('createView') + ->with($form, $parentView) + ->will($this->returnValue($view)); + + $this->assertSame($view, $form->createView()); + } + + public function testCreateViewWithExplicitParent() + { + $type = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface'); + $view = $this->getMock('Symfony\Component\Form\Tests\FormViewInterface'); + $parentView = $this->getMock('Symfony\Component\Form\Tests\FormViewInterface'); + $form = $this->getBuilder()->setType($type)->getForm(); + + $type->expects($this->once()) + ->method('createView') + ->with($form, $parentView) + ->will($this->returnValue($view)); + + $this->assertSame($view, $form->createView($parentView)); } public function testGetErrorsAsString() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Util/PropertyPathCollectionTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Util/PropertyPathCollectionTest.php index ff8b88f..ae8b18d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Util/PropertyPathCollectionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Util/PropertyPathCollectionTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Form\Tests\Util; use Symfony\Component\Form\Util\PropertyPath; +use Symfony\Component\Form\Util\FormUtil; class PropertyPathCollectionTest_Car { @@ -72,9 +73,23 @@ class PropertyPathCollectionTest_CarOnlyRemover public function getAxes() {} } +class PropertyPathCollectionTest_CarNoAdderAndRemover +{ + public function getAxes() {} +} + +class PropertyPathCollectionTest_CarNoAdderAndRemoverWithProperty +{ + protected $axes = array(); + + public function getAxes() {} +} + class PropertyPathCollectionTest_CompositeCar { public function getStructure() {} + + public function setStructure($structure) {} } class PropertyPathCollectionTest_CarStructure @@ -90,6 +105,64 @@ abstract class PropertyPathCollectionTest extends \PHPUnit_Framework_TestCase { abstract protected function getCollection(array $array); + public function testGetValueReadsArrayAccess() + { + $object = $this->getCollection(array('firstName' => 'Bernhard')); + + $path = new PropertyPath('[firstName]'); + + $this->assertEquals('Bernhard', $path->getValue($object)); + } + + public function testGetValueReadsNestedArrayAccess() + { + $object = $this->getCollection(array('person' => array('firstName' => 'Bernhard'))); + + $path = new PropertyPath('[person][firstName]'); + + $this->assertEquals('Bernhard', $path->getValue($object)); + } + + /** + * @expectedException Symfony\Component\Form\Exception\InvalidPropertyException + */ + public function testGetValueThrowsExceptionIfArrayAccessExpected() + { + $path = new PropertyPath('[firstName]'); + + $path->getValue(new \stdClass()); + } + + public function testSetValueUpdatesArrayAccess() + { + $object = $this->getCollection(array()); + + $path = new PropertyPath('[firstName]'); + $path->setValue($object, 'Bernhard'); + + $this->assertEquals('Bernhard', $object['firstName']); + } + + public function testSetValueUpdatesNestedArrayAccess() + { + $object = $this->getCollection(array()); + + $path = new PropertyPath('[person][firstName]'); + $path->setValue($object, 'Bernhard'); + + $this->assertEquals('Bernhard', $object['person']['firstName']); + } + + /** + * @expectedException Symfony\Component\Form\Exception\InvalidPropertyException + */ + public function testSetValueThrowsExceptionIfArrayAccessExpected() + { + $path = new PropertyPath('[firstName]'); + + $path->setValue(new \stdClass(), 'Bernhard'); + } + public function testSetValueCallsAdderAndRemoverForCollections() { $axesBefore = $this->getCollection(array(1 => 'second', 3 => 'fourth', 4 => 'fifth')); @@ -195,4 +268,61 @@ abstract class PropertyPathCollectionTest extends \PHPUnit_Framework_TestCase $path->setValue($car, $axesAfter); } + + /** + * @dataProvider noAdderRemoverData + */ + public function testNoAdderAndRemoverThrowsSensibleError($car, $path, $message) + { + $axes = $this->getCollection(array(0 => 'first', 1 => 'second', 2 => 'third')); + + try { + $path->setValue($car, $axes); + $this->fail('An expected exception was not thrown!'); + } catch (\Symfony\Component\Form\Exception\FormException $e) { + $this->assertEquals($message, $e->getMessage()); + } + } + + public function noAdderRemoverData() + { + $data = array(); + + $car = $this->getMock(__CLASS__ . '_CarNoAdderAndRemover'); + $propertyPath = new PropertyPath('axes'); + $expectedMessage = sprintf( + 'Neither element "axes" nor method "setAxes()" exists in class ' + .'"%s", nor could adders and removers be found based on the ' + .'guessed singulars: %s (provide a singular by suffixing the ' + .'property path with "|{singular}" to override the guesser)', + get_class($car), + implode(', ', (array) $singulars = FormUtil::singularify('Axes')) + ); + $data[] = array($car, $propertyPath, $expectedMessage); + + $propertyPath = new PropertyPath('axes|boo'); + $expectedMessage = sprintf( + 'Neither element "axes" nor method "setAxes()" exists in class ' + .'"%s", nor could adders and removers be found based on the ' + .'passed singular: %s', + get_class($car), + 'boo' + ); + $data[] = array($car, $propertyPath, $expectedMessage); + + $car = $this->getMock(__CLASS__ . '_CarNoAdderAndRemoverWithProperty'); + $propertyPath = new PropertyPath('axes'); + $expectedMessage = sprintf( + 'Property "axes" is not public in class "%s", nor could adders and ' + .'removers be found based on the guessed singulars: %s ' + .'(provide a singular by suffixing the property path with ' + .'"|{singular}" to override the guesser). Maybe you should ' + .'create the method "setAxes()"?', + get_class($car), + implode(', ', (array) $singulars = FormUtil::singularify('Axes')) + ); + $data[] = array($car, $propertyPath, $expectedMessage); + + return $data; + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Util/PropertyPathTest.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Util/PropertyPathTest.php index f231c24..c2ffb4d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Util/PropertyPathTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Tests/Util/PropertyPathTest.php @@ -123,26 +123,6 @@ class PropertyPathTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Bernhard', $path->getValue($object)); } - public function testGetValueReadsArrayAccess() - { - $object = new \ArrayObject(); - $object['firstName'] = 'Bernhard'; - - $path = new PropertyPath('[firstName]'); - - $this->assertEquals('Bernhard', $path->getValue($object)); - } - - /** - * @expectedException Symfony\Component\Form\Exception\InvalidPropertyException - */ - public function testGetValueThrowsExceptionIfArrayAccessExpected() - { - $path = new PropertyPath('[firstName]'); - - $path->getValue(new Author()); - } - /** * @expectedException Symfony\Component\Form\Exception\PropertyAccessDeniedException */ @@ -213,6 +193,18 @@ class PropertyPathTest extends \PHPUnit_Framework_TestCase $this->assertSame('foobar', $path->getValue($object)); } + /* + * https://github.com/symfony/symfony/pull/4450 + */ + public function testGetValueReadsMagicGetThatReturnsConstant() + { + $path = new PropertyPath('magicProperty'); + + $object = new Magician(); + + $this->assertNull($path->getValue($object)); + } + /** * @expectedException Symfony\Component\Form\Exception\PropertyAccessDeniedException */ @@ -316,16 +308,6 @@ class PropertyPathTest extends \PHPUnit_Framework_TestCase $this->assertEquals('Bernhard', $object->child['index']->firstName); } - public function testSetValueUpdatesArrayAccess() - { - $object = new \ArrayObject(); - - $path = new PropertyPath('[firstName]'); - $path->setValue($object, 'Bernhard'); - - $this->assertEquals('Bernhard', $object['firstName']); - } - public function testSetValueUpdateMagicSet() { $object = new Magician(); @@ -336,16 +318,6 @@ class PropertyPathTest extends \PHPUnit_Framework_TestCase $this->assertEquals('foobar', $object->__get('magicProperty')); } - /** - * @expectedException Symfony\Component\Form\Exception\InvalidPropertyException - */ - public function testSetValueThrowsExceptionIfArrayAccessExpected() - { - $path = new PropertyPath('[firstName]'); - - $path->setValue(new Author(), 'Bernhard'); - } - public function testSetValueUpdatesSetters() { $object = new Author(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/UnmodifiableFormConfig.php b/vendor/symfony/symfony/src/Symfony/Component/Form/UnmodifiableFormConfig.php index 76af017..cb586a8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/UnmodifiableFormConfig.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/UnmodifiableFormConfig.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Form; -use Symfony\Component\Form\Exception\UnexpectedTypeException; use Symfony\Component\Form\Util\PropertyPath; use Symfony\Component\EventDispatcher\UnmodifiableEventDispatcher; @@ -58,9 +57,9 @@ class UnmodifiableFormConfig implements FormConfigInterface private $compound; /** - * @var array + * @var ResolvedFormTypeInterface */ - private $types; + private $type; /** * @var array @@ -117,6 +116,11 @@ class UnmodifiableFormConfig implements FormConfigInterface */ private $dataClass; + /** + * @var Boolean + */ + private $dataLocked; + /** * @var array */ @@ -130,7 +134,7 @@ class UnmodifiableFormConfig implements FormConfigInterface public function __construct(FormConfigInterface $config) { $dispatcher = $config->getEventDispatcher(); - if (!$dispatcher instanceof UnmodifiableEventDispatcher) { + if (!$dispatcher instanceof UnmodifiableEventDispatcher) { $dispatcher = new UnmodifiableEventDispatcher($dispatcher); } @@ -141,7 +145,7 @@ class UnmodifiableFormConfig implements FormConfigInterface $this->byReference = $config->getByReference(); $this->virtual = $config->getVirtual(); $this->compound = $config->getCompound(); - $this->types = $config->getTypes(); + $this->type = $config->getType(); $this->viewTransformers = $config->getViewTransformers(); $this->modelTransformers = $config->getModelTransformers(); $this->dataMapper = $config->getDataMapper(); @@ -153,6 +157,7 @@ class UnmodifiableFormConfig implements FormConfigInterface $this->attributes = $config->getAttributes(); $this->data = $config->getData(); $this->dataClass = $config->getDataClass(); + $this->dataLocked = $config->getDataLocked(); $this->options = $config->getOptions(); } @@ -215,9 +220,9 @@ class UnmodifiableFormConfig implements FormConfigInterface /** * {@inheritdoc} */ - public function getTypes() + public function getType() { - return $this->types; + return $this->type; } /** @@ -326,6 +331,14 @@ class UnmodifiableFormConfig implements FormConfigInterface return $this->dataClass; } + /** + * {@inheritdoc} + */ + public function getDataLocked() + { + return $this->dataLocked; + } + /** * {@inheritdoc} */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/FormUtil.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/FormUtil.php index 868dab9..cf7d4d7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/FormUtil.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/FormUtil.php @@ -34,7 +34,7 @@ abstract class FormUtil * @see http://english-zone.com/spelling/plurals.html * @see http://www.scribd.com/doc/3271143/List-of-100-Irregular-Plural-Nouns-in-English */ - static private $pluralMap = array( + private static $pluralMap = array( // First entry: plural suffix, reversed // Second entry: length of plural suffix // Third entry: Whether the suffix may succeed a vocal @@ -117,7 +117,7 @@ abstract class FormUtil * @return string|array The singular form or an array of possible singular * forms */ - static public function singularify($plural) + public static function singularify($plural) { $pluralRev = strrev($plural); $lowerPluralRev = strtolower($pluralRev); @@ -198,7 +198,7 @@ abstract class FormUtil * * @return Boolean Whether the choice is a group */ - static public function isChoiceGroup($choice) + public static function isChoiceGroup($choice) { return is_array($choice) || $choice instanceof \Traversable; } @@ -211,7 +211,7 @@ abstract class FormUtil * * @return Boolean Whether the choice is selected */ - static public function isChoiceSelected($choice, $value) + public static function isChoiceSelected($choice, $value) { if (is_array($value)) { return false !== array_search($choice, $value, true); @@ -231,7 +231,7 @@ abstract class FormUtil * * @return Boolean */ - static public function isEmpty($data) + public static function isEmpty($data) { // Should not do a check for array() === $data!!! // This method is used in occurrences where arrays are diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php index 873d541..7536b40 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPath.php @@ -31,6 +31,9 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface */ const SINGULAR_SEPARATOR = '|'; + const VALUE = 0; + const IS_REF = 1; + /** * The elements of the property path * @var array @@ -272,7 +275,9 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface */ public function getValue($objectOrArray) { - return $this->readPropertyAt($objectOrArray, $this->length - 1); + $propertyValues =& $this->readPropertiesUntil($objectOrArray, $this->length - 1); + + return $propertyValues[count($propertyValues) - 1][self::VALUE]; } /** @@ -306,48 +311,70 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface */ public function setValue(&$objectOrArray, $value) { - $objectOrArray =& $this->readPropertyAt($objectOrArray, $this->length - 2); + $propertyValues =& $this->readPropertiesUntil($objectOrArray, $this->length - 2); + $overwrite = true; - if (!is_object($objectOrArray) && !is_array($objectOrArray)) { - throw new UnexpectedTypeException($objectOrArray, 'object or array'); + // Add the root object to the list + array_unshift($propertyValues, array( + self::VALUE => &$objectOrArray, + self::IS_REF => true, + )); + + for ($i = count($propertyValues) - 1; $i >= 0; --$i) { + $objectOrArray =& $propertyValues[$i][self::VALUE]; + + if ($overwrite) { + if (!is_object($objectOrArray) && !is_array($objectOrArray)) { + throw new UnexpectedTypeException($objectOrArray, 'object or array'); + } + + $property = $this->elements[$i]; + $singular = $this->singulars[$i]; + $isIndex = $this->isIndex[$i]; + + $this->writeProperty($objectOrArray, $property, $singular, $isIndex, $value); + } + + $value =& $objectOrArray; + $overwrite = !$propertyValues[$i][self::IS_REF]; } - - $property = $this->elements[$this->length - 1]; - $singular = $this->singulars[$this->length - 1]; - $isIndex = $this->isIndex[$this->length - 1]; - - $this->writeProperty($objectOrArray, $property, $singular, $isIndex, $value); } /** * Reads the path from an object up to a given path index. * * @param object|array $objectOrArray The object or array to read from. - * @param integer $index The integer up to which should be read. + * @param integer $lastIndex The integer up to which should be read. * - * @return mixed The value read at the end of the path. + * @return array The values read in the path. * * @throws UnexpectedTypeException If a value within the path is neither object nor array. */ - protected function &readPropertyAt(&$objectOrArray, $index) + private function &readPropertiesUntil(&$objectOrArray, $lastIndex) { - for ($i = 0; $i <= $index; ++$i) { + $propertyValues = array(); + + for ($i = 0; $i <= $lastIndex; ++$i) { if (!is_object($objectOrArray) && !is_array($objectOrArray)) { throw new UnexpectedTypeException($objectOrArray, 'object or array'); } - // Create missing nested arrays on demand - if (is_array($objectOrArray) && !array_key_exists($this->elements[$i], $objectOrArray)) { - $objectOrArray[$this->elements[$i]] = $i + 1 < $this->length ? array() : null; - } - $property = $this->elements[$i]; $isIndex = $this->isIndex[$i]; + $isArrayAccess = is_array($objectOrArray) || $objectOrArray instanceof \ArrayAccess; - $objectOrArray =& $this->readProperty($objectOrArray, $property, $isIndex); + // Create missing nested arrays on demand + if ($isIndex && $isArrayAccess && !isset($objectOrArray[$property])) { + $objectOrArray[$property] = $i + 1 < $this->length ? array() : null; + } + + $propertyValue =& $this->readProperty($objectOrArray, $property, $isIndex); + $objectOrArray =& $propertyValue[self::VALUE]; + + $propertyValues[] =& $propertyValue; } - return $objectOrArray; + return $propertyValues; } /** @@ -363,9 +390,14 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface * @throws PropertyAccessDeniedException If the property cannot be accessed due to * access restrictions (private or protected). */ - protected function &readProperty(&$objectOrArray, $property, $isIndex) + private function &readProperty(&$objectOrArray, $property, $isIndex) { - $result = null; + // Use an array instead of an object since performance is + // very crucial here + $result = array( + self::VALUE => null, + self::IS_REF => false + ); if ($isIndex) { if (!$objectOrArray instanceof \ArrayAccess && !is_array($objectOrArray)) { @@ -373,7 +405,12 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface } if (isset($objectOrArray[$property])) { - $result =& $objectOrArray[$property]; + if (is_array($objectOrArray)) { + $result[self::VALUE] =& $objectOrArray[$property]; + $result[self::IS_REF] = true; + } else { + $result[self::VALUE] = $objectOrArray[$property]; + } } } elseif (is_object($objectOrArray)) { $camelProp = $this->camelize($property); @@ -387,31 +424,33 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $getter, $reflClass->name)); } - $result = $objectOrArray->$getter(); + $result[self::VALUE] = $objectOrArray->$getter(); } elseif ($reflClass->hasMethod($isser)) { if (!$reflClass->getMethod($isser)->isPublic()) { throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $isser, $reflClass->name)); } - $result = $objectOrArray->$isser(); + $result[self::VALUE] = $objectOrArray->$isser(); } elseif ($reflClass->hasMethod($hasser)) { if (!$reflClass->getMethod($hasser)->isPublic()) { throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $hasser, $reflClass->name)); } - $result = $objectOrArray->$hasser(); + $result[self::VALUE] = $objectOrArray->$hasser(); } elseif ($reflClass->hasMethod('__get')) { // needed to support magic method __get - $result =& $objectOrArray->$property; + $result[self::VALUE] = $objectOrArray->$property; } elseif ($reflClass->hasProperty($property)) { if (!$reflClass->getProperty($property)->isPublic()) { throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()" or "%s()"?', $property, $reflClass->name, $getter, $isser)); } - $result =& $objectOrArray->$property; + $result[self::VALUE] =& $objectOrArray->$property; + $result[self::IS_REF] = true; } elseif (property_exists($objectOrArray, $property)) { // needed to support \stdClass instances - $result =& $objectOrArray->$property; + $result[self::VALUE] =& $objectOrArray->$property; + $result[self::IS_REF] = true; } else { throw new InvalidPropertyException(sprintf('Neither property "%s" nor method "%s()" nor method "%s()" exists in class "%s"', $property, $getter, $isser, $reflClass->name)); } @@ -419,6 +458,11 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface throw new InvalidPropertyException(sprintf('Cannot read property "%s" from an array. Maybe you should write the property path as "[%s]" instead?', $property, $property)); } + // Objects are always passed around by reference + if (is_object($result[self::VALUE])) { + $result[self::IS_REF] = true; + } + return $result; } @@ -435,8 +479,10 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface * @throws PropertyAccessDeniedException If the property cannot be accessed due to * access restrictions (private or protected). */ - protected function writeProperty(&$objectOrArray, $property, $singular, $isIndex, $value) + private function writeProperty(&$objectOrArray, $property, $singular, $isIndex, $value) { + $adderRemoverError = null; + if ($isIndex) { if (!$objectOrArray instanceof \ArrayAccess && !is_array($objectOrArray)) { throw new InvalidPropertyException(sprintf('Index "%s" cannot be modified in object of type "%s" because it doesn\'t implement \ArrayAccess', $property, get_class($objectOrArray))); @@ -446,13 +492,20 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface } elseif (is_object($objectOrArray)) { $reflClass = new ReflectionClass($objectOrArray); + // The plural form is the last element of the property path + $plural = $this->camelize($this->elements[$this->length - 1]); + + // Any of the two methods is required, but not yet known + $singulars = null !== $singular ? array($singular) : (array) FormUtil::singularify($plural); + if (is_array($value) || $value instanceof Traversable) { - $methods = $this->findAdderAndRemover($reflClass, $singular); + $methods = $this->findAdderAndRemover($reflClass, $singulars); if (null !== $methods) { // At this point the add and remove methods have been found $itemsToAdd = is_object($value) ? clone $value : $value; $itemToRemove = array(); - $previousValue = $this->readProperty($objectOrArray, $property, $isIndex); + $propertyValue = $this->readProperty($objectOrArray, $property, $isIndex); + $previousValue = $propertyValue[self::VALUE]; if (is_array($previousValue) || $previousValue instanceof Traversable) { foreach ($previousValue as $previousItem) { @@ -480,6 +533,13 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface } return; + } else { + $adderRemoverError = ', nor could adders and removers be found based on the '; + if (null === $singular) { + $adderRemoverError .= 'guessed singulars: '.implode(', ', $singulars).' (provide a singular by suffixing the property path with "|{singular}" to override the guesser)'; + } else { + $adderRemoverError .= 'passed singular: '.$singular; + } } } @@ -495,7 +555,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface $objectOrArray->$property = $value; } elseif ($reflClass->hasProperty($property)) { if (!$reflClass->getProperty($property)->isPublic()) { - throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()"?', $property, $reflClass->name, $setter)); + throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s"%s. Maybe you should create the method "%s()"?', $property, $reflClass->name, $adderRemoverError, $setter)); } $objectOrArray->$property = $value; @@ -503,7 +563,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface // needed to support \stdClass instances $objectOrArray->$property = $value; } else { - throw new InvalidPropertyException(sprintf('Neither element "%s" nor method "%s()" exists in class "%s"', $property, $setter, $reflClass->name)); + throw new InvalidPropertyException(sprintf('Neither element "%s" nor method "%s()" exists in class "%s"%s', $property, $setter, $reflClass->name, $adderRemoverError)); } } else { throw new InvalidPropertyException(sprintf('Cannot write property "%s" in an array. Maybe you should write the property path as "[%s]" instead?', $property, $property)); @@ -517,7 +577,7 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface * * @return string The camelized version of the string. */ - protected function camelize($string) + private function camelize($string) { return preg_replace_callback('/(^|_|\.)+(.)/', function ($match) { return ('.' === $match[1] ? '_' : '').strtoupper($match[2]); }, $string); } @@ -532,37 +592,8 @@ class PropertyPath implements \IteratorAggregate, PropertyPathInterface * * @throws InvalidPropertyException If the property does not exist. */ - private function findAdderAndRemover(\ReflectionClass $reflClass, $singular) + private function findAdderAndRemover(\ReflectionClass $reflClass, array $singulars) { - if (null !== $singular) { - $addMethod = 'add' . $this->camelize($singular); - $removeMethod = 'remove' . $this->camelize($singular); - - if (!$this->isAccessible($reflClass, $addMethod, 1)) { - throw new InvalidPropertyException(sprintf( - 'The public method "%s" with exactly one required parameter was not found on class %s', - $addMethod, - $reflClass->name - )); - } - - if (!$this->isAccessible($reflClass, $removeMethod, 1)) { - throw new InvalidPropertyException(sprintf( - 'The public method "%s" with exactly one required parameter was not found on class %s', - $removeMethod, - $reflClass->name - )); - } - - return array($addMethod, $removeMethod); - } - - // The plural form is the last element of the property path - $plural = $this->camelize($this->elements[$this->length - 1]); - - // Any of the two methods is required, but not yet known - $singulars = (array) FormUtil::singularify($plural); - foreach ($singulars as $singular) { $addMethod = 'add' . $singular; $removeMethod = 'remove' . $singular; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPathInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPathInterface.php index 8231ce7..ee0923c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPathInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPathInterface.php @@ -21,7 +21,7 @@ interface PropertyPathInterface extends \Traversable * * @return string The path as string. */ - function __toString(); + public function __toString(); /** * Returns the positions at which the elements of the path @@ -29,14 +29,14 @@ interface PropertyPathInterface extends \Traversable * * @return array The string offsets of the elements. */ - function getPositions(); + public function getPositions(); /** * Returns the length of the property path. * * @return integer The path length. */ - function getLength(); + public function getLength(); /** * Returns the parent property path. @@ -48,14 +48,14 @@ interface PropertyPathInterface extends \Traversable * * @return PropertyPath The parent path or null. */ - function getParent(); + public function getParent(); /** * Returns the elements of the property path as array * * @return array An array of property/index names */ - function getElements(); + public function getElements(); /** * Returns the element at the given index in the property path @@ -66,7 +66,7 @@ interface PropertyPathInterface extends \Traversable * * @throws \OutOfBoundsException If the offset is invalid. */ - function getElement($index); + public function getElement($index); /** * Returns whether the element at the given index is a property @@ -77,7 +77,7 @@ interface PropertyPathInterface extends \Traversable * * @throws \OutOfBoundsException If the offset is invalid. */ - function isProperty($index); + public function isProperty($index); /** * Returns whether the element at the given index is an array index @@ -88,5 +88,5 @@ interface PropertyPathInterface extends \Traversable * * @throws \OutOfBoundsException If the offset is invalid. */ - function isIndex($index); + public function isIndex($index); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPathIteratorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPathIteratorInterface.php index 639164a..35fb11a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPathIteratorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Form/Util/PropertyPathIteratorInterface.php @@ -22,7 +22,7 @@ interface PropertyPathIteratorInterface extends \Iterator, \SeekableIterator * * @return Boolean */ - function isIndex(); + public function isIndex(); /** * Returns whether the current element in the property path is a property @@ -30,5 +30,5 @@ interface PropertyPathIteratorInterface extends \Iterator, \SeekableIterator * * @return Boolean */ - function isProperty(); + public function isProperty(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/CHANGELOG.md index 5525f2b..4a00207 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/CHANGELOG.md @@ -22,7 +22,8 @@ CHANGELOG * [BC BREAK] Moved all session related classes and interfaces into own namespace, as `Symfony\Component\HttpFoundation\Session` and renamed classes accordingly. Session handlers are located in the subnamespace `Symfony\Component\HttpFoundation\Session\Handler`. - * SessionHandlers must implement `\SessionHandlerInterface`. + * SessionHandlers must implement `\SessionHandlerInterface` or extend from the + `Symfony\Component\HttpFoundation\Storage\Handler\NativeSessionHandler` base class. * Added internal storage driver proxy mechanism for forward compatibility with PHP 5.4 `\SessionHandler` class. * Added session handlers for custom Memcache, Memcached and Null session save handlers. @@ -53,8 +54,8 @@ CHANGELOG * Added `FlashBag`. Flashes expire when retrieved by `get()` or `all()`. This implementation is ESI compatible. * Added `AutoExpireFlashBag` (default) to replicate Symfony 2.0.x auto expire - behaviour of messages auto expiring. - after one page page load. Messages must be retrieved by `get()` or `all()`. + behaviour of messages auto expiring after one page page load. Messages must + be retrieved by `get()` or `all()`. * Added `Symfony\Component\HttpFoundation\Attribute\AttributeBag` to replicate attributes storage behaviour from 2.0.x (default). * Added `Symfony\Component\HttpFoundation\Attribute\NamespacedAttributeBag` for diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php index 2eb3924..d5715f6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesser.php @@ -33,7 +33,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * * @var ExtensionGuesser */ - static private $instance = null; + private static $instance = null; /** * All registered ExtensionGuesserInterface instances @@ -47,7 +47,7 @@ class ExtensionGuesser implements ExtensionGuesserInterface * * @return ExtensionGuesser */ - static public function getInstance() + public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php index 7d892c0..8373696 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/ExtensionGuesserInterface.php @@ -22,5 +22,5 @@ interface ExtensionGuesserInterface * @param string $mimeType The mime type * @return string The guessed extension or NULL, if none could be guessed */ - function guess($mimeType); + public function guess($mimeType); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php index 96895e8..3da63dd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -43,7 +43,7 @@ class FileBinaryMimeTypeGuesser implements MimeTypeGuesserInterface * * @return Boolean */ - static public function isSupported() + public static function isSupported() { return !defined('PHP_WINDOWS_VERSION_BUILD'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php index 8efb3a2..09a0d7e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -26,7 +26,7 @@ class FileinfoMimeTypeGuesser implements MimeTypeGuesserInterface * * @return Boolean */ - static public function isSupported() + public static function isSupported() { return function_exists('finfo_open'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php index d8d9d36..13fe4a2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeExtensionGuesser.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -namespace Symfony\Component\HttpFoundation\File\Mimetype; +namespace Symfony\Component\HttpFoundation\File\MimeType; /** * Provides a best-guess mapping of mime type to file extension. @@ -542,6 +542,7 @@ class MimeTypeExtensionGuesser implements ExtensionGuesserInterface 'application/x-pkcs7-certificates' => 'p7b', 'application/x-pkcs7-certreqresp' => 'p7r', 'application/x-rar-compressed' => 'rar', + 'application/x-rar' => 'rar', 'application/x-sh' => 'sh', 'application/x-shar' => 'shar', 'application/x-shockwave-flash' => 'swf', diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php index a3c2617..a8247ab 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php @@ -38,7 +38,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * * @var MimeTypeGuesser */ - static private $instance = null; + private static $instance = null; /** * All registered MimeTypeGuesserInterface instances @@ -52,7 +52,7 @@ class MimeTypeGuesser implements MimeTypeGuesserInterface * * @return MimeTypeGuesser */ - static public function getInstance() + public static function getInstance() { if (null === self::$instance) { self::$instance = new self(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php index 2cd9902..87ea20f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesserInterface.php @@ -31,5 +31,5 @@ interface MimeTypeGuesserInterface * @throws FileNotFoundException If the file does not exist * @throws AccessDeniedException If the file could not be read */ - function guess($path); + public function guess($path); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php index 077c0df..6d6dda1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/File/UploadedFile.php @@ -201,7 +201,7 @@ class UploadedFile extends File * * @return int The maximum size of an uploaded file in bytes */ - static public function getMaxFilesize() + public static function getMaxFilesize() { $max = trim(ini_get('upload_max_filesize')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/FileBag.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/FileBag.php index 799a8ed..b2775ef 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/FileBag.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/FileBag.php @@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; */ class FileBag extends ParameterBag { - static private $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); + private static $fileKeys = array('error', 'name', 'size', 'tmp_name', 'type'); /** * Constructor. diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/JsonResponse.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/JsonResponse.php index 734628f..43ade8f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/JsonResponse.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/JsonResponse.php @@ -38,7 +38,7 @@ class JsonResponse extends Response /** * {@inheritDoc} */ - static public function create($data = array(), $status = 200, $headers = array()) + public static function create($data = array(), $status = 200, $headers = array()) { return new static($data, $status, $headers); } @@ -52,7 +52,7 @@ class JsonResponse extends Response */ public function setCallback($callback = null) { - if ($callback) { + if (null !== $callback) { // taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/ $pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u'; $parts = explode('.', $callback); @@ -95,7 +95,7 @@ class JsonResponse extends Response */ protected function update() { - if ($this->callback) { + if (null !== $this->callback) { // Not using application/javascript for compatibility reasons with older browsers. $this->headers->set('Content-Type', 'text/javascript', true); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RedirectResponse.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RedirectResponse.php index 27676ec..f2e854e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RedirectResponse.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RedirectResponse.php @@ -66,7 +66,7 @@ class RedirectResponse extends Response /** * {@inheritDoc} */ - static public function create($url = '', $status = 302, $headers = array()) + public static function create($url = '', $status = 302, $headers = array()) { return new static($url, $status, $headers); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php index 1cf8e0f..8d681a9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Request.php @@ -30,7 +30,7 @@ use Symfony\Component\HttpFoundation\Session\SessionInterface; */ class Request { - static protected $trustProxy = false; + protected static $trustProxy = false; /** * @var \Symfony\Component\HttpFoundation\ParameterBag @@ -149,7 +149,7 @@ class Request /** * @var array */ - static protected $formats; + protected static $formats; /** * Constructor. @@ -213,7 +213,7 @@ class Request * * @api */ - static public function createFromGlobals() + public static function createFromGlobals() { $request = new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER); @@ -242,7 +242,7 @@ class Request * * @api */ - static public function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) + public static function create($uri, $method = 'GET', $parameters = array(), $cookies = array(), $files = array(), $server = array(), $content = null) { $defaults = array( 'SERVER_NAME' => 'localhost', @@ -444,7 +444,7 @@ class Request * * @api */ - static public function trustProxyData() + public static function trustProxyData() { self::$trustProxy = true; } @@ -455,7 +455,7 @@ class Request * * @return boolean */ - static public function isProxyTrusted() + public static function isProxyTrusted() { return self::$trustProxy; } @@ -470,7 +470,7 @@ class Request * * @return string A normalized query string for the Request */ - static public function normalizeQueryString($qs) + public static function normalizeQueryString($qs) { if ('' == $qs) { return ''; @@ -848,6 +848,7 @@ class Request public function getQueryString() { $qs = static::normalizeQueryString($this->server->get('QUERY_STRING')); + return '' === $qs ? null : $qs; } @@ -924,7 +925,7 @@ class Request if (null === $this->method) { $this->method = strtoupper($this->server->get('REQUEST_METHOD', 'GET')); if ('POST' === $this->method) { - $this->method = strtoupper($this->headers->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', 'POST'))); + $this->method = strtoupper($this->headers->get('X-HTTP-METHOD-OVERRIDE', $this->request->get('_method', $this->query->get('_method', 'POST')))); } } @@ -1454,7 +1455,7 @@ class Request /** * Initializes HTTP request formats. */ - static protected function initializeFormats() + protected static function initializeFormats() { static::$formats = array( 'html' => array('text/html', 'application/xhtml+xml'), diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php index 0ee161c..695fd21 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/RequestMatcherInterface.php @@ -29,5 +29,5 @@ interface RequestMatcherInterface * * @api */ - function matches(Request $request); + public function matches(Request $request); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php index 11fcf3b..1d2106e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Resources/stubs/SessionHandlerInterface.php @@ -36,7 +36,7 @@ interface SessionHandlerInterface * * @return boolean */ - function open($savePath, $sessionName); + public function open($savePath, $sessionName); /** * Close session. @@ -45,7 +45,7 @@ interface SessionHandlerInterface * * @return boolean */ - function close(); + public function close(); /** * Read session. @@ -56,7 +56,7 @@ interface SessionHandlerInterface * * @return string String as stored in persistent storage or empty string in all other cases. */ - function read($sessionId); + public function read($sessionId); /** * Commit session to storage. @@ -68,7 +68,7 @@ interface SessionHandlerInterface * * @return boolean */ - function write($sessionId, $data); + public function write($sessionId, $data); /** * Destroys this session. @@ -81,7 +81,7 @@ interface SessionHandlerInterface * * @return boolean */ - function destroy($sessionId); + public function destroy($sessionId); /** * Garbage collection for storage. @@ -94,5 +94,5 @@ interface SessionHandlerInterface * * @return boolean */ - function gc($lifetime); + public function gc($lifetime); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php index f6b41e2..ae6a389 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php @@ -61,7 +61,7 @@ class Response * * @var array */ - static public $statusTexts = array( + public static $statusTexts = array( 100 => 'Continue', 101 => 'Switching Protocols', 102 => 'Processing', // RFC2518 @@ -158,7 +158,7 @@ class Response * * @return Response */ - static public function create($content = '', $status = 200, $headers = array()) + public static function create($content = '', $status = 200, $headers = array()) { return new static($content, $status, $headers); } @@ -299,6 +299,15 @@ class Response if (function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); + } elseif ('cli' !== PHP_SAPI) { + // ob_get_level() never returns 0 on some Windows configurations, so if + // the level is the same two times in a row, the loop should be stopped. + $previous = null; + while (($level = ob_get_level()) > 0 && $level !== $previous) { + $previous = $level; + ob_end_flush(); + } + flush(); } return $this; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php index ec6d93c..5f1f37b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Attribute/AttributeBagInterface.php @@ -27,7 +27,7 @@ interface AttributeBagInterface extends SessionBagInterface * * @return Boolean true if the attribute is defined, false otherwise */ - function has($name); + public function has($name); /** * Returns an attribute. @@ -37,7 +37,7 @@ interface AttributeBagInterface extends SessionBagInterface * * @return mixed */ - function get($name, $default = null); + public function get($name, $default = null); /** * Sets an attribute. @@ -45,21 +45,21 @@ interface AttributeBagInterface extends SessionBagInterface * @param string $name * @param mixed $value */ - function set($name, $value); + public function set($name, $value); /** * Returns attributes. * * @return array Attributes */ - function all(); + public function all(); /** * Sets attributes. * * @param array $attributes Attributes */ - function replace(array $attributes); + public function replace(array $attributes); /** * Removes an attribute. @@ -68,5 +68,5 @@ interface AttributeBagInterface extends SessionBagInterface * * @return mixed The removed value */ - function remove($name); + public function remove($name); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php index b47962f..c6e41de 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Flash/AutoExpireFlashBag.php @@ -93,7 +93,7 @@ class AutoExpireFlashBag implements FlashBagInterface */ public function peekAll() { - return array_key_exists('display', $this->flashes) ? (array)$this->flashes['display'] : array(); + return array_key_exists('display', $this->flashes) ? (array) $this->flashes['display'] : array(); } /** @@ -139,7 +139,7 @@ class AutoExpireFlashBag implements FlashBagInterface */ public function set($type, $messages) { - $this->flashes['new'][$type] = (array)$messages; + $this->flashes['new'][$type] = (array) $messages; } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php index 2fab8bd..9ae5a3d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Flash/FlashBagInterface.php @@ -26,7 +26,7 @@ interface FlashBagInterface extends SessionBagInterface * @param string $type * @param string $message */ - function add($type, $message); + public function add($type, $message); /** * Registers a message for a given type. @@ -34,7 +34,7 @@ interface FlashBagInterface extends SessionBagInterface * @param string $type * @param string $message */ - function set($type, $message); + public function set($type, $message); /** * Gets flash message for a given type. @@ -44,14 +44,14 @@ interface FlashBagInterface extends SessionBagInterface * * @return string */ - function peek($type, array $default = array()); + public function peek($type, array $default = array()); /** * Gets all flash messages. * * @return array */ - function peekAll(); + public function peekAll(); /** * Gets and clears flash from the stack. @@ -61,19 +61,19 @@ interface FlashBagInterface extends SessionBagInterface * * @return string */ - function get($type, array $default = array()); + public function get($type, array $default = array()); /** * Gets and clears flashes from the stack. * * @return array */ - function all(); + public function all(); /** * Sets all flash messages. */ - function setAll(array $messages); + public function setAll(array $messages); /** * Has flash messages for a given type? @@ -82,12 +82,12 @@ interface FlashBagInterface extends SessionBagInterface * * @return boolean */ - function has($type); + public function has($type); /** * Returns a list of all defined types. * * @return array */ - function keys(); + public function keys(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php index 50c2d4b..f8d3d32 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionBagInterface.php @@ -23,26 +23,26 @@ interface SessionBagInterface * * @return string */ - function getName(); + public function getName(); /** * Initializes the Bag * * @param array $array */ - function initialize(array &$array); + public function initialize(array &$array); /** * Gets the storage key for this bag. * * @return string */ - function getStorageKey(); + public function getStorageKey(); /** * Clears out data from bag. * * @return mixed Whatever data was contained. */ - function clear(); + public function clear(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php index a4d5dcc..a94fad0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/SessionInterface.php @@ -29,7 +29,7 @@ interface SessionInterface * * @api */ - function start(); + public function start(); /** * Returns the session ID. @@ -38,7 +38,7 @@ interface SessionInterface * * @api */ - function getId(); + public function getId(); /** * Sets the session ID @@ -47,7 +47,7 @@ interface SessionInterface * * @api */ - function setId($id); + public function setId($id); /** * Returns the session name. @@ -56,7 +56,7 @@ interface SessionInterface * * @api */ - function getName(); + public function getName(); /** * Sets the session name. @@ -65,7 +65,7 @@ interface SessionInterface * * @api */ - function setName($name); + public function setName($name); /** * Invalidates the current session. @@ -82,7 +82,7 @@ interface SessionInterface * * @api */ - function invalidate($lifetime = null); + public function invalidate($lifetime = null); /** * Migrates the current session to a new session id while maintaining all @@ -98,7 +98,7 @@ interface SessionInterface * * @api */ - function migrate($destroy = false, $lifetime = null); + public function migrate($destroy = false, $lifetime = null); /** * Force the session to be saved and closed. @@ -107,7 +107,7 @@ interface SessionInterface * the session will be automatically saved at the end of * code execution. */ - function save(); + public function save(); /** * Checks if an attribute is defined. @@ -118,7 +118,7 @@ interface SessionInterface * * @api */ - function has($name); + public function has($name); /** * Returns an attribute. @@ -130,7 +130,7 @@ interface SessionInterface * * @api */ - function get($name, $default = null); + public function get($name, $default = null); /** * Sets an attribute. @@ -140,7 +140,7 @@ interface SessionInterface * * @api */ - function set($name, $value); + public function set($name, $value); /** * Returns attributes. @@ -149,14 +149,14 @@ interface SessionInterface * * @api */ - function all(); + public function all(); /** * Sets attributes. * * @param array $attributes Attributes */ - function replace(array $attributes); + public function replace(array $attributes); /** * Removes an attribute. @@ -167,28 +167,28 @@ interface SessionInterface * * @api */ - function remove($name); + public function remove($name); /** * Clears all attributes. * * @api */ - function clear(); + public function clear(); /** * Checks if the session was started. * * @return Boolean */ - function isStarted(); + public function isStarted(); /** * Registers a SessionBagInterface with the session. * * @param SessionBagInterface $bag */ - function registerBag(SessionBagInterface $bag); + public function registerBag(SessionBagInterface $bag); /** * Gets a bag instance by name. @@ -197,12 +197,12 @@ interface SessionInterface * * @return SessionBagInterface */ - function getBag($name); + public function getBag($name); /** * Gets session meta. * * @return MetadataBag */ - function getMetadataBag(); + public function getMetadataBag(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php deleted file mode 100644 index 4c62125..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/FileSessionHandler.php +++ /dev/null @@ -1,116 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; - -/** - * FileSessionHandler. - * - * @author Drak - */ -class FileSessionHandler implements \SessionHandlerInterface -{ - /** - * @var string - */ - private $savePath; - - /** - * @var string - */ - private $prefix; - - /** - * Constructor. - * - * @param string $savePath Path of directory to save session files. - * @param string $prefix - */ - public function __construct($savePath = null, $prefix = 'sess_') - { - if (null === $savePath) { - $savePath = sys_get_temp_dir(); - } - - $this->savePath = $savePath; - if (false === is_dir($this->savePath)) { - mkdir($this->savePath, 0777, true); - } - - $this->prefix = $prefix; - } - - /** - * {@inheritdoc} - */ - public function open($savePath, $sessionName) - { - return true; - } - - /** - * {@inheritdoc} - */ - public function close() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function read($id) - { - $file = $this->getPath().$id; - - return is_readable($file) ? file_get_contents($file) : ''; - } - - /** - * {@inheritdoc} - */ - public function write($id, $data) - { - return false === file_put_contents($this->getPath().$id, $data) ? false : true; - } - - /** - * {@inheritdoc} - */ - public function destroy($id) - { - $file = $this->getPath().$id; - if (is_file($file)) { - unlink($file); - } - - return true; - } - - /** - * {@inheritdoc} - */ - public function gc($maxlifetime) - { - foreach (glob($this->getPath().'*') as $file) { - if ((filemtime($file) + $maxlifetime) < time()) { - unlink($file); - } - } - - return true; - } - - private function getPath() - { - return $this->savePath.'/'.$this->prefix; - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php new file mode 100644 index 0000000..422e3a7 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeFileSessionHandler.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * NativeFileSessionHandler. + * + * Native session handler using PHP's built in file storage. + * + * @author Drak + */ +class NativeFileSessionHandler extends NativeSessionHandler +{ + /** + * Constructor. + * + * @param string $savePath Path of directory to save session files. Default null will leave setting as defined by PHP. + */ + public function __construct($savePath = null) + { + if (null === $savePath) { + $savePath = ini_get('session.save_path'); + } + + if ($savePath && !is_dir($savePath)) { + mkdir($savePath, 0777, true); + } + + ini_set('session.save_handler', 'files'); + ini_set('session.save_path', $savePath); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php new file mode 100644 index 0000000..1260ad0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/NativeSessionHandler.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; + +/** + * Adds SessionHandler functionality if available. + * + * @see http://php.net/sessionhandler + */ + +if (version_compare(phpversion(), '5.4.0', '>=')) { + class NativeSessionHandler extends \SessionHandler {} +} else { + class NativeSessionHandler {} +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php index 23b86b3..80aa44b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/MockFileSessionStorage.php @@ -11,9 +11,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage; -use Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler; -use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; - /** * MockFileSessionStorage is used to mock sessions for * functional testing when done in a single PHP process. @@ -28,27 +25,35 @@ use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag; class MockFileSessionStorage extends MockArraySessionStorage { /** - * @var FileSessionHandler + * @var string */ - private $handler; + private $savePath; + + /** + * @var array + */ + private $sessionData; /** * Constructor. * - * @param string $savePath Path of directory to save session files. - * @param string $name Session name. - * @param FileSessionHandler $handler Save handler - * @param MetadataBag $metaData Metadatabag + * @param string $savePath Path of directory to save session files. + * @param string $name Session name. + * @param MetadataBag $metaBag MetadataBag instance. */ - public function __construct($savePath = null, $name = 'MOCKSESSID', FileSessionHandler $handler = null, MetadataBag $metaData = null) + public function __construct($savePath = null, $name = 'MOCKSESSID', MetadataBag $metaBag = null) { - if (null == $handler) { - $handler = new FileSessionHandler($savePath, 'mocksess_'); + if (null === $savePath) { + $savePath = sys_get_temp_dir(); } - $this->handler = $handler; + if (!is_dir($savePath)) { + mkdir($savePath, 0777, true); + } - parent::__construct($name, $metaData); + $this->savePath = $savePath; + + parent::__construct($name, $metaBag); } /** @@ -92,7 +97,7 @@ class MockFileSessionStorage extends MockArraySessionStorage */ public function save() { - $this->handler->write($this->id, serialize($this->data)); + file_put_contents($this->getFilePath(), serialize($this->data)); // this is needed for Silex, where the session object is re-used across requests // in functional tests. In Symfony, the container is rebooted, so we don't have @@ -106,7 +111,19 @@ class MockFileSessionStorage extends MockArraySessionStorage */ private function destroy() { - $this->handler->destroy($this->id); + if (is_file($this->getFilePath())) { + unlink($this->getFilePath()); + } + } + + /** + * Calculate path to file. + * + * @return string File path + */ + private function getFilePath() + { + return $this->savePath.'/'.$this->id.'.mocksess'; } /** @@ -114,8 +131,8 @@ class MockFileSessionStorage extends MockArraySessionStorage */ private function read() { - $data = $this->handler->read($this->id); - $this->data = $data ? unserialize($data) : array(); + $filePath = $this->getFilePath(); + $this->data = is_readable($filePath) && is_file($filePath) ? unserialize(file_get_contents($filePath)) : array(); $this->loadSession(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php index e925d62..e1f4fff 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -42,7 +42,7 @@ class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterf */ public function open($savePath, $sessionName) { - $return = (bool)$this->handler->open($savePath, $sessionName); + $return = (bool) $this->handler->open($savePath, $sessionName); if (true === $return) { $this->active = true; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php index 0673d97..26a7418 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/SessionStorageInterface.php @@ -33,14 +33,14 @@ interface SessionStorageInterface * * @api */ - function start(); + public function start(); /** * Checks if the session is started. * * @return boolean True if started, false otherwise. */ - function isStarted(); + public function isStarted(); /** * Returns the session ID @@ -49,7 +49,7 @@ interface SessionStorageInterface * * @api */ - function getId(); + public function getId(); /** * Sets the session ID @@ -58,7 +58,7 @@ interface SessionStorageInterface * * @api */ - function setId($id); + public function setId($id); /** * Returns the session name @@ -67,7 +67,7 @@ interface SessionStorageInterface * * @api */ - function getName(); + public function getName(); /** * Sets the session name @@ -76,7 +76,7 @@ interface SessionStorageInterface * * @api */ - function setName($name); + public function setName($name); /** * Regenerates id that represents this storage. @@ -101,7 +101,7 @@ interface SessionStorageInterface * * @api */ - function regenerate($destroy = false, $lifetime = null); + public function regenerate($destroy = false, $lifetime = null); /** * Force the session to be saved and closed. @@ -111,12 +111,12 @@ interface SessionStorageInterface * a real PHP session would interfere with testing, in which case it * it should actually persist the session data if required. */ - function save(); + public function save(); /** * Clear all session data in memory. */ - function clear(); + public function clear(); /** * Gets a SessionBagInterface by name. @@ -127,17 +127,17 @@ interface SessionStorageInterface * * @throws \InvalidArgumentException If the bag does not exist */ - function getBag($name); + public function getBag($name); /** * Registers a SessionBagInterface for use. * * @param SessionBagInterface $bag */ - function registerBag(SessionBagInterface $bag); + public function registerBag(SessionBagInterface $bag); /** * @return MetadataBag */ - function getMetadataBag(); + public function getMetadataBag(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php index f79096f..b42a3fc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/File/UploadedFileTest.php @@ -132,7 +132,6 @@ class UploadedFileTest extends \PHPUnit_Framework_TestCase @unlink($targetPath); } - public function testGetClientOriginalNameSanitizeFilename() { $file = new UploadedFile( @@ -207,7 +206,6 @@ class UploadedFileTest extends \PHPUnit_Framework_TestCase $this->assertFalse($file->isValid()); } - public function uploadedFileErrorProvider() { return array( diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php index d96e00b..c3c0b16 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/ParameterBagTest.php @@ -200,7 +200,6 @@ class ParameterBagTest extends \PHPUnit_Framework_TestCase $this->assertEquals(array('bang'), $bag->filter('array', '', false), '->filter() gets a value of parameter as an array'); - } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php index 069d8b4..e165987 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestMatcherTest.php @@ -11,8 +11,6 @@ namespace Symfony\Component\HttpFoundation\Tests; - - use Symfony\Component\HttpFoundation\RequestMatcher; use Symfony\Component\HttpFoundation\Request; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php index 14e01aa..1e447c5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpFoundation\Tests; - use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Request; @@ -621,6 +620,11 @@ class RequestTest extends \PHPUnit_Framework_TestCase $request->request->set('_method', 'purge'); $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); + $request->setMethod('POST'); + $request->request->remove('_method'); + $request->query->set('_method', 'purge'); + $this->assertEquals('PURGE', $request->getMethod(), '->getMethod() returns the method from _method if defined and POST'); + $request->setMethod('POST'); $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete'); $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override even though _method is set if defined and POST'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php deleted file mode 100644 index d935b34..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/FileSessionHandlerTest.php +++ /dev/null @@ -1,106 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; - -use Symfony\Component\HttpFoundation\Session\Storage\Handler\FileSessionHandler; - -/** - * Test class for FileSessionHandler. - * - * @author Drak - */ -class FileSessionStorageTest extends \PHPUnit_Framework_TestCase -{ - /** - * @var FileSessionHandler - */ - private $handler; - - /** - * @var string - */ - private $path; - - public function setUp() - { - $this->path = sys_get_temp_dir().'/filesessionhandler'; - $this->handler = new FileSessionHandler($this->path, 'mocksess_'); - - parent::setUp(); - } - - public function tearDown() - { - foreach (glob($this->path.'/*') as $file) { - unlink($file); - } - - rmdir($this->path); - - $this->handler = null; - } - - public function test__construct() - { - $this->assertTrue(is_dir($this->path)); - } - - public function testOpen() - { - $this->assertTrue($this->handler->open('a', 'b')); - } - - public function testClose() - { - $this->assertTrue($this->handler->close()); - } - - public function testReadWrite() - { - $this->assertEmpty($this->handler->read('123')); - $this->assertTrue($this->handler->write('123', 'data')); - $this->assertEquals('data', $this->handler->read('123')); - } - - public function testDestroy() - { - $this->handler->write('456', 'data'); - $this->handler->destroy('123'); - $this->assertEquals('data', $this->handler->read('456')); - $this->handler->destroy('456'); - $this->assertEmpty($this->handler->read('456')); - } - - public function testGc() - { - $prefix = $this->path.'/mocksess_'; - $this->handler->write('1', 'data'); - touch($prefix.'1', time()-86400); - - $this->handler->write('2', 'data'); - touch($prefix.'2', time()-3600); - - $this->handler->write('3', 'data'); - touch($prefix.'3', time()-300); - - $this->handler->write('4', 'data'); - - $this->handler->gc(90000); - $this->assertEquals(4, count(glob($this->path.'/*'))); - - $this->handler->gc(4000); - $this->assertEquals(3, count(glob($this->path.'/*'))); - - $this->handler->gc(200); - $this->assertEquals(1, count(glob($this->path.'/*'))); - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php new file mode 100644 index 0000000..7bdf3a1 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeFileSessionHandlerTest.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; +use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; + +/** + * Test class for NativeFileSessionHandler. + * + * @author Drak + * + * @runTestsInSeparateProcesses + */ +class NativeFileSessionHandlerTest extends \PHPUnit_Framework_TestCase +{ + public function testConstruct() + { + $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler(sys_get_temp_dir())); + + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); + $this->assertEquals('files', ini_get('session.save_handler')); + } else { + $this->assertEquals('files', $storage->getSaveHandler()->getSaveHandlerName()); + $this->assertEquals('user', ini_get('session.save_handler')); + } + + $this->assertEquals(sys_get_temp_dir(), ini_get('session.save_path')); + $this->assertEquals('TESTING', ini_get('session.name')); + } + + public function testConstructDefault() + { + $path = ini_get('session.save_path'); + $storage = new NativeSessionStorage(array('name' => 'TESTING'), new NativeFileSessionHandler()); + + $this->assertEquals($path, ini_get('session.save_path')); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php new file mode 100644 index 0000000..7880615 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NativeSessionHandlerTest.php @@ -0,0 +1,39 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; + +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeSessionHandler; + +/** + * Test class for NativeSessionHandler. + * + * @author Drak + * + * @runTestsInSeparateProcesses + */ +class NativeSessionHandlerTest extends \PHPUnit_Framework_TestCase +{ + public function testConstruct() + { + $handler = new NativeSessionHandler(); + + // note for PHPUnit optimisers - the use of assertTrue/False + // here is deliberate since the tests do not require the classes to exist - drak + if (version_compare(phpversion(), '5.4.0', '<')) { + $this->assertFalse($handler instanceof \SessionHandler); + $this->assertTrue($handler instanceof NativeSessionHandler); + } else { + $this->assertTrue($handler instanceof \SessionHandler); + $this->assertTrue($handler instanceof NativeSessionHandler); + } + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php index 3bd702e..45a47ce 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php @@ -55,4 +55,3 @@ class NullSessionStorageTest extends \PHPUnit_Framework_TestCase return new NativeSessionStorage(array(), new NullSessionHandler()); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index d0938e0..ff1565a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -61,4 +61,3 @@ class PdoSessionHandlerTest extends \PHPUnit_Framework_TestCase $this->assertEquals(0, count($this->pdo->query('SELECT * FROM sessions')->fetchAll())); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php index 7bfe6a7..f18089d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -28,7 +28,7 @@ class MockFileSessionStorageTest extends \PHPUnit_Framework_TestCase private $sessionDir; /** - * @var MockFileSessionStorage + * @var FileMockSessionStorage */ protected $storage; @@ -40,14 +40,12 @@ class MockFileSessionStorageTest extends \PHPUnit_Framework_TestCase protected function tearDown() { - foreach (glob($this->sessionDir.'/mocksess_*') as $file) { - unlink($file); - } - - rmdir($this->sessionDir); - $this->sessionDir = null; $this->storage = null; + array_map('unlink', glob($this->sessionDir.'/*.session')); + if (is_dir($this->sessionDir)) { + rmdir($this->sessionDir); + } } public function testStart() diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php index 528a1d7..4b88a23 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; +use Symfony\Component\HttpFoundation\Session\Storage\Handler\NativeFileSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; @@ -136,8 +137,8 @@ class NativeSessionStorageTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('Test skipped, for PHP 5.3 only.'); } - ini_set('session.save_handler', 'files'); $storage = $this->getStorage(); + $storage->setSaveHandler(new NativeFileSessionHandler()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\Session\Storage\Proxy\NativeProxy', $storage->getSaveHandler()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php index 980b890..3203d84 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Bundle/BundleInterface.php @@ -29,14 +29,14 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function boot(); + public function boot(); /** * Shutdowns the Bundle. * * @api */ - function shutdown(); + public function shutdown(); /** * Builds the bundle. @@ -47,7 +47,7 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function build(ContainerBuilder $container); + public function build(ContainerBuilder $container); /** * Returns the container extension that should be implicitly loaded. @@ -56,16 +56,20 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function getContainerExtension(); + public function getContainerExtension(); /** - * Returns the bundle parent name. + * Returns the bundle name that this bundle overrides. * - * @return string The Bundle parent name it overrides or null if no parent + * Despite its name, this method does not imply any parent/child relationship + * between the bundles, just a way to extend and override an existing + * bundle. + * + * @return string The Bundle name it overrides or null if no parent * * @api */ - function getParent(); + public function getParent(); /** * Returns the bundle name (the class short name). @@ -74,7 +78,7 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function getName(); + public function getName(); /** * Gets the Bundle namespace. @@ -83,7 +87,7 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function getNamespace(); + public function getNamespace(); /** * Gets the Bundle directory path. @@ -94,5 +98,5 @@ interface BundleInterface extends ContainerAwareInterface * * @api */ - function getPath(); + public function getPath(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php index 1588b67..d4a2db3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheClearer/CacheClearerInterface.php @@ -23,5 +23,5 @@ interface CacheClearerInterface * * @param string $cacheDir The cache directory. */ - function clear($cacheDir); + public function clear($cacheDir); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php index 478cdc9..ed76ce3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerInterface.php @@ -28,5 +28,5 @@ interface CacheWarmerInterface extends WarmableInterface * * @return Boolean true if the warmer is optional, false otherwise */ - function isOptional(); + public function isOptional(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php index 0476161..25d8ee8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/WarmableInterface.php @@ -23,5 +23,5 @@ interface WarmableInterface * * @param string $cacheDir The cache directory */ - function warmUp($cacheDir); + public function warmUp($cacheDir); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php index 986a13d..f58f50d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Controller/ControllerResolverInterface.php @@ -45,7 +45,7 @@ interface ControllerResolverInterface * * @api */ - function getController(Request $request); + public function getController(Request $request); /** * Returns the arguments to pass to the controller. @@ -59,5 +59,5 @@ interface ControllerResolverInterface * * @api */ - function getArguments(Request $request, $controller); + public function getArguments(Request $request, $controller); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index 37e93b0..81ede39 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -31,7 +31,7 @@ class ConfigDataCollector extends DataCollector * * @param KernelInterface $kernel A KernelInterface instance */ - public function __construct(KernelInterface $kernel) + public function setKernel(KernelInterface $kernel) { $this->kernel = $kernel; } @@ -44,9 +44,9 @@ class ConfigDataCollector extends DataCollector $this->data = array( 'token' => $response->headers->get('X-Debug-Token'), 'symfony_version' => Kernel::VERSION, - 'name' => $this->kernel->getName(), - 'env' => $this->kernel->getEnvironment(), - 'debug' => $this->kernel->isDebug(), + 'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a', + 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', + 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, 'xdebug_enabled' => extension_loaded('xdebug'), 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), @@ -55,8 +55,10 @@ class ConfigDataCollector extends DataCollector 'bundles' => array(), ); - foreach ($this->kernel->getBundles() as $name => $bundle) { - $this->data['bundles'][$name] = $bundle->getPath(); + if (isset($this->kernel)) { + foreach ($this->kernel->getBundles() as $name => $bundle) { + $this->data['bundles'][$name] = $bundle->getPath(); + } } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php index 7da36b6..98eabdb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\DataCollector; - /** * DataCollector. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php index 7cfbbd1..cf4cdfd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php @@ -32,7 +32,7 @@ interface DataCollectorInterface * * @api */ - function collect(Request $request, Response $response, \Exception $exception = null); + public function collect(Request $request, Response $response, \Exception $exception = null); /** * Returns the name of the collector. @@ -41,5 +41,5 @@ interface DataCollectorInterface * * @api */ - function getName(); + public function getName(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php index d6808ce..20ff597 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/ExceptionDataCollector.php @@ -29,13 +29,8 @@ class ExceptionDataCollector extends DataCollector public function collect(Request $request, Response $response, \Exception $exception = null) { if (null !== $exception) { - $flattenException = FlattenException::create($exception); - if ($exception instanceof HttpExceptionInterface) { - $flattenException->setStatusCode($exception->getStatusCode()); - } - $this->data = array( - 'exception' => $flattenException, + 'exception' => FlattenException::create($exception), ); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php index f7cf88e..7ca2327 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php @@ -60,11 +60,17 @@ class RequestDataCollector extends DataCollector } $sessionMetadata = array(); - + $sessionAttributes = array(); + $flashes = array(); if ($request->hasSession()) { - $sessionMetadata['Created'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getCreated()); - $sessionMetadata['Last used'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getLastUsed()); - $sessionMetadata['Lifetime'] = $request->getSession()->getMetadataBag()->getLifetime(); + $session = $request->getSession(); + if ($session->isStarted()) { + $sessionMetadata['Created'] = date(DATE_RFC822, $session->getMetadataBag()->getCreated()); + $sessionMetadata['Last used'] = date(DATE_RFC822, $session->getMetadataBag()->getLastUsed()); + $sessionMetadata['Lifetime'] = $session->getMetadataBag()->getLifetime(); + $sessionAttributes = $session->all(); + $flashes = $session->getFlashBag()->peekAll(); + } } $this->data = array( @@ -80,8 +86,8 @@ class RequestDataCollector extends DataCollector 'request_attributes' => $attributes, 'response_headers' => $responseHeaders, 'session_metadata' => $sessionMetadata, - 'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(), - 'flashes' => $request->hasSession() ? $request->getSession()->getFlashBag()->peekAll() : array(), + 'session_attributes' => $sessionAttributes, + 'flashes' => $flashes, 'path_info' => $request->getPathInfo(), ); } @@ -161,6 +167,37 @@ class RequestDataCollector extends DataCollector return $this->data['format']; } + + /** + * Gets the route. + * + * @return string The route + */ + public function getRoute() + { + return 'n/a'; + } + + /** + * Returns the route parameters. + * + * @return array The parameters + */ + public function getRouteParams() + { + return 'n/a'; + } + + /** + * Gets the controller. + * + * @return string The controller as a string + */ + public function getController() + { + return 'n/a'; + } + /** * {@inheritdoc} */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php new file mode 100644 index 0000000..07b2780 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DataCollector/RouterDataCollector.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\DataCollector; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpKernel\DataCollector\DataCollector; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; + +/** + * RouterDataCollector. + * + * @author Fabien Potencier + */ +class RouterDataCollector extends DataCollector +{ + protected $controllers; + + public function __construct() + { + $this->controllers = new \SplObjectStorage(); + + $this->data = array( + 'redirect' => false, + 'url' => null, + 'route' => null, + ); + } + + /** + * {@inheritdoc} + */ + public function collect(Request $request, Response $response, \Exception $exception = null) + { + if ($response instanceof RedirectResponse) { + $this->data['redirect'] = true; + $this->data['url'] = $response->getTargetUrl(); + + if ($this->controllers->contains($request)) { + $this->data['route'] = $this->guessRoute($request, $this->controllers[$request]); + } + } + } + + protected function guessRoute(Request $request, $controller) + { + return 'n/a'; + } + + /** + * Remembers the controller associated to each request. + * + * @param FilterControllerEvent The filter controller event + */ + public function onKernelController(FilterControllerEvent $event) + { + $this->controllers[$event->getRequest()] = $event->getController(); + } + + /** + * @return Boolean Whether this request will result in a redirect + */ + public function getRedirect() + { + return $this->data['redirect']; + } + + /** + * @return string|null The target URL + */ + public function getTargetUrl() + { + return $this->data['url']; + } + + /** + * @return string|null The target route + */ + public function getTargetRoute() + { + return $this->data['route']; + } + + /** + * {@inheritdoc} + */ + public function getName() + { + return 'router'; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php index 5ab784d..605c086 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php @@ -39,7 +39,7 @@ class ErrorHandler * * @return The registered error handler */ - static public function register($level = null) + public static function register($level = null) { $handler = new static(); $handler->setLevel($level); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php index a9da249..848f3cc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Debug/ExceptionHandler.php @@ -45,7 +45,7 @@ class ExceptionHandler * * @return The registered exception handler */ - static public function register($debug = true) + public static function register($debug = true) { $handler = new static($debug); @@ -100,7 +100,7 @@ class ExceptionHandler } } - return new Response($this->decorate($content, $title), $exception->getStatusCode()); + return new Response($this->decorate($content, $title), $exception->getStatusCode(), $exception->getHeaders()); } private function getContent($exception) diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php index 8388ccf..7e036fd 100755 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/ConfigurableExtension.php @@ -30,7 +30,7 @@ abstract class ConfigurableExtension extends Extension /** * {@inheritDoc} */ - public final function load(array $configs, ContainerBuilder $container) + final public function load(array $configs, ContainerBuilder $container) { $this->loadInternal($this->processConfiguration($this->getConfiguration(array(), $container), $configs), $container); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php index dacd60a..5c8d5e6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/DependencyInjection/Extension.php @@ -96,7 +96,7 @@ abstract class Extension implements ExtensionInterface, ConfigurationExtensionIn return Container::underscore($classBaseName); } - protected final function processConfiguration(ConfigurationInterface $configuration, array $configs) + final protected function processConfiguration(ConfigurationInterface $configuration, array $configs) { $processor = new Processor(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/EsiListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/EsiListener.php index ba67dc1..1176a73 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/EsiListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/EsiListener.php @@ -51,7 +51,7 @@ class EsiListener implements EventSubscriberInterface $this->esi->addSurrogateControl($event->getResponse()); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => 'onKernelResponse', diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php index c7a90e4..99c9fff 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ExceptionListener.php @@ -62,15 +62,9 @@ class ExceptionListener implements EventSubscriberInterface $logger = $this->logger instanceof DebugLoggerInterface ? $this->logger : null; - $flattenException = FlattenException::create($exception); - if ($exception instanceof HttpExceptionInterface) { - $flattenException->setStatusCode($exception->getStatusCode()); - $flattenException->setHeaders($exception->getHeaders()); - } - $attributes = array( '_controller' => $this->controller, - 'exception' => $flattenException, + 'exception' => FlattenException::create($exception), 'logger' => $logger, 'format' => $request->getRequestFormat(), ); @@ -96,7 +90,7 @@ class ExceptionListener implements EventSubscriberInterface $handling = false; // re-throw the exception as this is a catch-all - throw $exception; + return; } $event->setResponse($response); @@ -104,7 +98,7 @@ class ExceptionListener implements EventSubscriberInterface $handling = false; } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::EXCEPTION => array('onKernelException', -128), diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php index 38143ca..529314b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/LocaleListener.php @@ -47,7 +47,7 @@ class LocaleListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( // must be registered after the Router to have access to the _locale diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php index 83ee82a..0175d20 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php @@ -134,7 +134,7 @@ class ProfilerListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( // kernel.request must be registered as early as possible to not break diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php index d047b1f..669980c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ResponseListener.php @@ -50,7 +50,7 @@ class ResponseListener implements EventSubscriberInterface $response->prepare($event->getRequest()); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => 'onKernelResponse', diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php index 06adebf..6cccd37 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php @@ -12,7 +12,6 @@ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\HttpKernel\Log\LoggerInterface; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; @@ -108,7 +107,7 @@ class RouterListener implements EventSubscriberInterface return implode(', ', $pieces); } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array(array('onKernelRequest', 32)), diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php index 588c5fe..88505fa 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/StreamedResponseListener.php @@ -43,7 +43,7 @@ class StreamedResponseListener implements EventSubscriberInterface } } - static public function getSubscribedEvents() + public static function getSubscribedEvents() { return array( KernelEvents::RESPONSE => array('onKernelResponse', -1024), diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Exception/FlattenException.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Exception/FlattenException.php index 16f1453..b2ffb9f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Exception/FlattenException.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Exception/FlattenException.php @@ -30,14 +30,19 @@ class FlattenException private $file; private $line; - static public function create(\Exception $exception, $statusCode = null, array $headers = array()) + public static function create(\Exception $exception, $statusCode = null, array $headers = array()) { $e = new static(); $e->setMessage($exception->getMessage()); $e->setCode($exception->getCode()); + if ($exception instanceof HttpExceptionInterface) { + $statusCode = $exception->getStatusCode(); + $headers = array_merge($headers, $exception->getHeaders()); + } + if (null === $statusCode) { - $statusCode = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : 500; + $statusCode = 500; } $e->setStatusCode($statusCode); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php index 11102bd..dd4a9dc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Exception/HttpExceptionInterface.php @@ -23,12 +23,12 @@ interface HttpExceptionInterface * * @return integer An HTTP response status code */ - function getStatusCode(); + public function getStatusCode(); /** * Returns response headers. * * @return array Response headers */ - function getHeaders(); + public function getHeaders(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php index 7b1d387..0fb8a12 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/EsiResponseCacheStrategyInterface.php @@ -30,12 +30,12 @@ interface EsiResponseCacheStrategyInterface * * @param Response $response */ - function add(Response $response); + public function add(Response $response); /** * Updates the Response HTTP headers based on the embedded Responses. * * @param Response $response */ - function update(Response $response); + public function update(Response $response); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php index 58f8a8c..dd8c886 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpCache/StoreInterface.php @@ -31,7 +31,7 @@ interface StoreInterface * * @return Response|null A Response instance, or null if no cache entry was found */ - function lookup(Request $request); + public function lookup(Request $request); /** * Writes a cache entry to the store for the given Request and Response. @@ -44,14 +44,14 @@ interface StoreInterface * * @return string The key under which the response is stored */ - function write(Request $request, Response $response); + public function write(Request $request, Response $response); /** * Invalidates all cache entries that match the request. * * @param Request $request A Request instance */ - function invalidate(Request $request); + public function invalidate(Request $request); /** * Locks the cache for a given Request. @@ -60,14 +60,14 @@ interface StoreInterface * * @return Boolean|string true if the lock is acquired, the path to the current lock otherwise */ - function lock(Request $request); + public function lock(Request $request); /** * Releases the lock for the given Request. * * @param Request $request A Request instance */ - function unlock(Request $request); + public function unlock(Request $request); /** * Purges data for the given URL. @@ -76,10 +76,10 @@ interface StoreInterface * * @return Boolean true if the URL exists and has been purged, false otherwise */ - function purge($url); + public function purge($url); /** * Cleanups storage. */ - function cleanup(); + public function cleanup(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php index eea71e8..12ebed3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php @@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; @@ -184,14 +185,30 @@ class HttpKernel implements HttpKernelInterface, TerminableInterface $event = new GetResponseForExceptionEvent($this, $request, $type, $e); $this->dispatcher->dispatch(KernelEvents::EXCEPTION, $event); + // a listener might have replaced the exception + $e = $event->getException(); + if (!$event->hasResponse()) { throw $e; } + $response = $event->getResponse(); + + // ensure that we actually have an error response + if (!$response->isClientError() && !$response->isServerError() && !$response->isRedirect()) { + if ($e instanceof HttpExceptionInterface) { + // keep the HTTP status code and headers + $response->setStatusCode($e->getStatusCode()); + $response->headers->add($e->getHeaders()); + } else { + $response->setStatusCode(500); + } + } + try { - return $this->filterResponse($event->getResponse(), $request, $type); + return $this->filterResponse($response, $request, $type); } catch (\Exception $e) { - return $event->getResponse(); + return $response; } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernelInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernelInterface.php index efcf39d..f49d37c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernelInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernelInterface.php @@ -43,5 +43,5 @@ interface HttpKernelInterface * * @api */ - function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php index d1ab151..ced3fa1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php @@ -58,12 +58,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface protected $classes; protected $errorReportingLevel; - const VERSION = '2.1.0-BETA2'; + const VERSION = '2.1.0-DEV'; const VERSION_ID = '20100'; const MAJOR_VERSION = '2'; const MINOR_VERSION = '1'; const RELEASE_VERSION = '0'; - const EXTRA_VERSION = 'BETA'; + const EXTRA_VERSION = 'DEV'; /** * Constructor. @@ -79,7 +79,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface $this->debug = (Boolean) $debug; $this->booted = false; $this->rootDir = $this->getRootDir(); - $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); + $this->name = $this->getName(); $this->classes = array(); if ($this->debug) { @@ -354,6 +354,10 @@ abstract class Kernel implements KernelInterface, TerminableInterface */ public function getName() { + if (null === $this->name) { + $this->name = preg_replace('/[^a-zA-Z0-9_]+/', '', basename($this->rootDir)); + } + return $this->name; } @@ -748,7 +752,7 @@ abstract class Kernel implements KernelInterface, TerminableInterface * * @return string The PHP string with the comments removed */ - static public function stripComments($source) + public static function stripComments($source) { if (!function_exists('token_get_all')) { return $source; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelInterface.php index 3379ee6..4010a30 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/KernelInterface.php @@ -34,7 +34,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function registerBundles(); + public function registerBundles(); /** * Loads the container configuration @@ -43,14 +43,14 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function registerContainerConfiguration(LoaderInterface $loader); + public function registerContainerConfiguration(LoaderInterface $loader); /** * Boots the current kernel. * * @api */ - function boot(); + public function boot(); /** * Shutdowns the kernel. @@ -59,7 +59,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function shutdown(); + public function shutdown(); /** * Gets the registered bundle instances. @@ -68,7 +68,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getBundles(); + public function getBundles(); /** * Checks if a given class name belongs to an active bundle. @@ -79,7 +79,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function isClassInActiveBundle($class); + public function isClassInActiveBundle($class); /** * Returns a bundle and optionally its descendants by its name. @@ -93,7 +93,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getBundle($name, $first = true); + public function getBundle($name, $first = true); /** * Returns the file path for a given resource. @@ -123,7 +123,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function locateResource($name, $dir = null, $first = true); + public function locateResource($name, $dir = null, $first = true); /** * Gets the name of the kernel @@ -132,7 +132,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getName(); + public function getName(); /** * Gets the environment. @@ -141,7 +141,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getEnvironment(); + public function getEnvironment(); /** * Checks if debug mode is enabled. @@ -150,7 +150,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function isDebug(); + public function isDebug(); /** * Gets the application root dir. @@ -159,7 +159,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getRootDir(); + public function getRootDir(); /** * Gets the current container. @@ -168,7 +168,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getContainer(); + public function getContainer(); /** * Gets the request start time (not available if debug is disabled). @@ -177,7 +177,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getStartTime(); + public function getStartTime(); /** * Gets the cache directory. @@ -186,7 +186,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getCacheDir(); + public function getCacheDir(); /** * Gets the log directory. @@ -195,7 +195,7 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getLogDir(); + public function getLogDir(); /** * Gets the charset of the application. @@ -204,5 +204,5 @@ interface KernelInterface extends HttpKernelInterface, \Serializable * * @api */ - function getCharset(); + public function getCharset(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php index 65bb25a..4442c63 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Log/DebugLoggerInterface.php @@ -27,12 +27,12 @@ interface DebugLoggerInterface * * @return array An array of logs */ - function getLogs(); + public function getLogs(); /** * Returns the number of errors. * * @return integer The number of errors */ - function countErrors(); + public function countErrors(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Log/LoggerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Log/LoggerInterface.php index 97fe65b..34847c8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Log/LoggerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Log/LoggerInterface.php @@ -23,40 +23,40 @@ interface LoggerInterface /** * @api */ - function emerg($message, array $context = array()); + public function emerg($message, array $context = array()); /** * @api */ - function alert($message, array $context = array()); + public function alert($message, array $context = array()); /** * @api */ - function crit($message, array $context = array()); + public function crit($message, array $context = array()); /** * @api */ - function err($message, array $context = array()); + public function err($message, array $context = array()); /** * @api */ - function warn($message, array $context = array()); + public function warn($message, array $context = array()); /** * @api */ - function notice($message, array $context = array()); + public function notice($message, array $context = array()); /** * @api */ - function info($message, array $context = array()); + public function info($message, array $context = array()); /** * @api */ - function debug($message, array $context = array()); + public function debug($message, array $context = array()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php index 4091232..b7bc617 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php @@ -235,7 +235,7 @@ abstract class PdoProfilerStorage implements ProfilerStorageInterface return $profiles; } - + /** * Returns whether data for the given token already exists in storage. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php index db608ea..f92d90d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/ProfilerStorageInterface.php @@ -28,7 +28,7 @@ interface ProfilerStorageInterface * * @return array An array of tokens */ - function find($ip, $url, $limit, $method); + public function find($ip, $url, $limit, $method); /** * Reads data associated with the given token. @@ -39,7 +39,7 @@ interface ProfilerStorageInterface * * @return Profile The profile associated with token */ - function read($token); + public function read($token); /** * Saves a Profile. @@ -48,10 +48,10 @@ interface ProfilerStorageInterface * * @return Boolean Write operation successful */ - function write(Profile $profile); + public function write(Profile $profile); /** * Purges all data from the database. */ - function purge(); + public function purge(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php index 70e9c50..f59bbc9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php @@ -11,7 +11,6 @@ namespace Symfony\Component\HttpKernel\Profiler; - /** * SqliteProfilerStorage stores profiling information in a SQLite database. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/TerminableInterface.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/TerminableInterface.php index 78a362f..fc0e580 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/TerminableInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/TerminableInterface.php @@ -35,5 +35,5 @@ interface TerminableInterface * * @api */ - function terminate(Request $request, Response $response); + public function terminate(Request $request, Response $response); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php index eaff42a..8affb5f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Bundle/BundleTest.php @@ -25,7 +25,7 @@ class BundleTest extends \PHPUnit_Framework_TestCase $this->markTestSkipped('The "Console" component is not available'); } - if (!class_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface')) { + if (!interface_exists('Symfony\Component\DependencyInjection\ContainerAwareInterface')) { $this->markTestSkipped('The "DependencyInjection" component is not available'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php index e1ede85..594af32 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Controller/ControllerResolverTest.php @@ -162,7 +162,7 @@ class ControllerResolverTest extends \PHPUnit_Framework_TestCase { } - static protected function controllerMethod4() + protected static function controllerMethod4() { } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index 407f18f..f517c12 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -28,8 +28,9 @@ class ConfigDataCollectorTest extends \PHPUnit_Framework_TestCase public function testCollect() { - $kernel = new KernelForTest('test',true); - $c = new ConfigDataCollector($kernel); + $kernel = new KernelForTest('test', true); + $c = new ConfigDataCollector(); + $c->setKernel($kernel); $c->collect(new Request(), new Response()); $this->assertSame('test',$c->getEnv()); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php index b126848..40c54e5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ContainerAwareTraceableEventDispatcherTest.php @@ -71,9 +71,9 @@ class ContainerAwareTraceableEventDispatcherTest extends \PHPUnit_Framework_Test class StaticClassFixture { - static public $called = false; + public static $called = false; - static public function staticListener($event) + public static function staticListener($event) { self::$called = true; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php index 8c61f5a..c13e559 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/ExceptionHandlerTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel\Tests\Debug; use Symfony\Component\HttpKernel\Debug\ExceptionHandler; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase { @@ -51,6 +52,15 @@ class ExceptionHandlerTest extends \PHPUnit_Framework_TestCase $this->assertContains('Sorry, the page you are looking for could not be found.', $response->getContent()); } + public function testHeaders() + { + $handler = new ExceptionHandler(false); + + $response = $handler->createResponse(new MethodNotAllowedHttpException(array('POST'))); + $this->assertEquals('405', $response->getStatusCode()); + $this->assertEquals('POST', $response->headers->get('Allow')); + } + public function testNestedExceptions() { $handler = new ExceptionHandler(true); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php index 76ae556..210acb5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Debug/StopwatchTest.php @@ -85,7 +85,6 @@ class StopwatchTest extends \PHPUnit_Framework_TestCase $stopwatch->stop('foobar'); $stopwatch->stopSection('0'); - // the section is an event by itself $this->assertCount(3, $stopwatch->getSectionEvents('1')); $this->assertCount(2, $stopwatch->getSectionEvents('2')); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php index a1ddda7..65975aa 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Exception/FlattenExceptionTest.php @@ -13,6 +13,7 @@ namespace Symfony\Component\HttpKernel\Tests\Exception; use Symfony\Component\HttpKernel\Exception\FlattenException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; class FlattenExceptionTest extends \PHPUnit_Framework_TestCase { @@ -28,6 +29,12 @@ class FlattenExceptionTest extends \PHPUnit_Framework_TestCase $this->assertEquals('404', $flattened->getStatusCode()); } + public function testHeadersForHttpException() + { + $flattened = FlattenException::create(new MethodNotAllowedHttpException(array('POST'))); + $this->assertEquals(array('Allow' => 'POST'), $flattened->getHeaders()); + } + /** * @dataProvider flattenDataProvider */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php new file mode 100644 index 0000000..32c05f4 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/KernelForOverrideName.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\Fixtures; + +use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\Config\Loader\LoaderInterface; + +class KernelForOverrideName extends Kernel +{ + protected $name = 'overridden'; + + public function registerBundles() + { + + } + + public function registerContainerConfiguration(LoaderInterface $loader) + { + + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php index f277378..da7ef5b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Fixtures/TestEventDispatcher.php @@ -16,12 +16,12 @@ use Symfony\Component\EventDispatcher\EventDispatcher; class TestEventDispatcher extends EventDispatcher implements TraceableEventDispatcherInterface { - function getCalledListeners() + public function getCalledListeners() { return array('foo'); } - function getNotCalledListeners() + public function getNotCalledListeners() { return array('bar'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php index 3d78c7c..4377f61 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/HttpCache/HttpCacheTestCase.php @@ -154,7 +154,7 @@ class HttpCacheTestCase extends \PHPUnit_Framework_TestCase $this->catch = $catch; } - static public function clearDirectory($directory) + public static function clearDirectory($directory) { if (!is_dir($directory)) { return; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php index bdbc4e8..e1e1701 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/HttpKernelTest.php @@ -14,8 +14,11 @@ namespace Symfony\Component\HttpKernel\Tests; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\EventDispatcher\EventDispatcher; class HttpKernelTest extends \PHPUnit_Framework_TestCase @@ -59,8 +62,38 @@ class HttpKernelTest extends \PHPUnit_Framework_TestCase }); $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new \RuntimeException('foo'); })); + $response = $kernel->handle(new Request()); - $this->assertEquals('foo', $kernel->handle(new Request())->getContent()); + $this->assertEquals('500', $response->getStatusCode()); + $this->assertEquals('foo', $response->getContent()); + } + + public function testHandleExceptionWithARedirectionResponse() + { + $dispatcher = new EventDispatcher(); + $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { + $event->setResponse(new RedirectResponse('/login', 301)); + }); + + $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new AccessDeniedHttpException(); })); + $response = $kernel->handle(new Request()); + + $this->assertEquals('301', $response->getStatusCode()); + $this->assertEquals('/login', $response->headers->get('Location')); + } + + public function testHandleHttpException() + { + $dispatcher = new EventDispatcher(); + $dispatcher->addListener(KernelEvents::EXCEPTION, function ($event) { + $event->setResponse(new Response($event->getException()->getMessage())); + }); + + $kernel = new HttpKernel($dispatcher, $this->getResolver(function () { throw new MethodNotAllowedHttpException(array('POST')); })); + $response = $kernel->handle(new Request()); + + $this->assertEquals('405', $response->getStatusCode()); + $this->assertEquals('POST', $response->headers->get('Allow')); } public function testHandleWhenAListenerReturnsAResponse() @@ -225,7 +258,7 @@ class Controller return new Response('foo'); } - static public function staticController() + public static function staticController() { return new Response('foo'); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php index 86cec9f..0def224 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/KernelTest.php @@ -17,6 +17,7 @@ use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; +use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; use Symfony\Component\HttpKernel\Tests\Fixtures\FooBarBundle; class KernelTest extends \PHPUnit_Framework_TestCase @@ -310,6 +311,13 @@ EOF; $this->assertEquals('Fixtures', $kernel->getName()); } + public function testOverrideGetName() + { + $kernel = new KernelForOverrideName('test', true); + + $this->assertEquals('overridden', $kernel->getName()); + } + public function testSerialize() { $env = 'test_env'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php index b7e2513..ad22512 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/FileProfilerStorageTest.php @@ -62,7 +62,7 @@ class FileProfilerStorageTest extends AbstractProfilerStorageTest public function testMultiRowIndexFile() { $iteration = 3; - for($i = 0; $i < $iteration; $i++) { + for ($i = 0; $i < $iteration; $i++) { $profile = new Profile('token' . $i); $profile->setIp('127.0.0.' . $i); $profile->setUrl('http://foo.bar/' . $i); @@ -74,7 +74,7 @@ class FileProfilerStorageTest extends AbstractProfilerStorageTest } $handle = fopen(self::$tmpDir . '/index.csv', 'r'); - for($i = 0; $i < $iteration; $i++) { + for ($i = 0; $i < $iteration; $i++) { $row = fgetcsv($handle); $this->assertEquals('token' . $i, $row[0]); $this->assertEquals('127.0.0.' . $i, $row[1]); diff --git a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php index 4679a0e..bff52e7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php @@ -26,7 +26,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest { protected static $storage; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { if (extension_loaded('mongo')) { self::$storage = new DummyMongoDbProfilerStorage('mongodb://localhost/symfony_tests/profiler_data', '', '', 86400); @@ -38,7 +38,7 @@ class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest } } - static public function tearDownAfterClass() + public static function tearDownAfterClass() { if (self::$storage) { self::$storage->purge(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php index 0340213..74f04ec 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Locale.php @@ -40,7 +40,7 @@ class Locale extends \Locale * * @throws RuntimeException When the resource bundles cannot be loaded */ - static public function getDisplayCountries($locale) + public static function getDisplayCountries($locale) { if (!isset(self::$countries[$locale])) { $bundle = \ResourceBundle::create($locale, __DIR__.'/Resources/data/region'); @@ -81,7 +81,7 @@ class Locale extends \Locale * @return array The country codes * @throws RuntimeException When the resource bundles cannot be loaded */ - static public function getCountries() + public static function getCountries() { return array_keys(self::getDisplayCountries(self::getDefault())); } @@ -95,7 +95,7 @@ class Locale extends \Locale * * @throws RuntimeException When the resource bundles cannot be loaded */ - static public function getDisplayLanguages($locale) + public static function getDisplayLanguages($locale) { if (!isset(self::$languages[$locale])) { $bundle = \ResourceBundle::create($locale, __DIR__.'/Resources/data/lang'); @@ -134,7 +134,7 @@ class Locale extends \Locale * @return array The language codes * @throws RuntimeException When the resource bundles cannot be loaded */ - static public function getLanguages() + public static function getLanguages() { return array_keys(self::getDisplayLanguages(self::getDefault())); } @@ -146,7 +146,7 @@ class Locale extends \Locale * @return array The locale names with their codes as keys * @throws RuntimeException When the resource bundles cannot be loaded */ - static public function getDisplayLocales($locale) + public static function getDisplayLocales($locale) { if (!isset(self::$locales[$locale])) { $bundle = \ResourceBundle::create($locale, __DIR__.'/Resources/data/names'); @@ -182,7 +182,7 @@ class Locale extends \Locale * @return array The locale codes * @throws RuntimeException When the resource bundles cannot be loaded */ - static public function getLocales() + public static function getLocales() { return array_keys(self::getDisplayLocales(self::getDefault())); } @@ -192,7 +192,7 @@ class Locale extends \Locale * * @return string|null The ICU version */ - static public function getIcuVersion() + public static function getIcuVersion() { if (defined('INTL_ICU_VERSION')) { return INTL_ICU_VERSION; @@ -217,7 +217,7 @@ class Locale extends \Locale * * @return string|null The ICU Data version */ - static public function getIcuDataVersion() + public static function getIcuDataVersion() { if (defined('INTL_ICU_DATA_VERSION')) { return INTL_ICU_DATA_VERSION; @@ -243,7 +243,7 @@ class Locale extends \Locale * @param $locale The locale to find the fallback for * @return string|null The fallback locale, or null if no parent exists */ - static protected function getFallbackLocale($locale) + protected static function getFallbackLocale($locale) { if ($locale === self::getDefault()) { return null; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/data/update-data.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/data/update-data.php index 69f511a..f65eb99 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/data/update-data.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/data/update-data.php @@ -398,7 +398,6 @@ genrb($namesGeneratedDir, $namesDir); clear_directory($namesGeneratedDir); rmdir($namesGeneratedDir); - // Generate the data to the stubbed intl classes We only extract data for the 'en' locale // The extracted data is used only by the stub classes $defaultLocale = 'en'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/FullTransformer.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/FullTransformer.php index 7d64464..6c883c9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/FullTransformer.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/FullTransformer.php @@ -151,6 +151,9 @@ class FullTransformer } } + // reset error code and message + StubIntl::setError(StubIntl::U_ZERO_ERROR); + return $this->calculateUnixTimestamp($dateTime, $options); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/MonthTransformer.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/MonthTransformer.php index 3538664..458fa8c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/MonthTransformer.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/MonthTransformer.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Locale\Stub\DateFormat; - /** * Parser and formatter for month format * @@ -22,7 +21,7 @@ class MonthTransformer extends Transformer /** * @var array */ - static protected $months = array( + protected static $months = array( 'January', 'February', 'March', @@ -41,19 +40,19 @@ class MonthTransformer extends Transformer * Short months names (first 3 letters) * @var array */ - static protected $shortMonths = array(); + protected static $shortMonths = array(); /** * Flipped $months array, $name => $index * @var array */ - static protected $flippedMonths = array(); + protected static $flippedMonths = array(); /** * Flipped $shortMonths array, $name => $index * @var array */ - static protected $flippedShortMonths = array(); + protected static $flippedShortMonths = array(); /** * Constructor diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/TimeZoneTransformer.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/TimeZoneTransformer.php index ce37e34..e9cf0eb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/TimeZoneTransformer.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/DateFormat/TimeZoneTransformer.php @@ -74,7 +74,7 @@ class TimeZoneTransformer extends Transformer * @throws NotImplementedException When the GMT time zone have minutes offset different than zero * @throws InvalidArgumentException When the value can not be matched with pattern */ - static public function getEtcTimeZoneId($formattedTimeZone) + public static function getEtcTimeZoneId($formattedTimeZone) { if (preg_match('/GMT(?P[+-])(?P\d{2}):?(?P\d{2})/', $formattedTimeZone, $matches)) { $hours = (int) $matches['hours']; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubCollator.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubCollator.php index 13f187d..7f46288 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubCollator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubCollator.php @@ -76,7 +76,7 @@ class StubCollator * * @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed */ - static public function create($locale) + public static function create($locale) { return new self($locale); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntl.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntl.php index a550954..b89e52f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntl.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntl.php @@ -71,7 +71,7 @@ abstract class StubIntl * * @return Boolean */ - static public function isFailure($errorCode) + public static function isFailure($errorCode) { return isset(self::$errorCodes[$errorCode]) && $errorCode > self::U_ZERO_ERROR; @@ -84,7 +84,7 @@ abstract class StubIntl * * @return integer */ - static public function getErrorCode() + public static function getErrorCode() { return self::$errorCode; } @@ -96,7 +96,7 @@ abstract class StubIntl * * @return string */ - static public function getErrorMessage() + public static function getErrorMessage() { return self::$errorMessage; } @@ -106,7 +106,7 @@ abstract class StubIntl * * @return string */ - static public function getErrorName($code) + public static function getErrorName($code) { if (isset(self::$errorCodes[$code])) { return self::$errorCodes[$code]; @@ -123,7 +123,7 @@ abstract class StubIntl * * @throws \InvalidArgumentException If the code is not one of the error constants in this class */ - static public function setError($code, $message = '') + public static function setError($code, $message = '') { if (!isset(self::$errorCodes[$code])) { throw new \InvalidArgumentException(sprintf('No such error code: "%s"', $code)); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php index d16bd66..7c9cc71 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubIntlDateFormatter.php @@ -155,7 +155,7 @@ class StubIntlDateFormatter * * @throws MethodArgumentValueNotImplementedException When $locale different than 'en' is passed */ - static public function create($locale, $datetype, $timetype, $timezone = null, $calendar = self::GREGORIAN, $pattern = null) + public static function create($locale, $datetype, $timetype, $timezone = null, $calendar = self::GREGORIAN, $pattern = null) { return new self($locale, $datetype, $timetype, $timezone, $calendar, $pattern); } @@ -378,10 +378,8 @@ class StubIntlDateFormatter $timestamp = $transformer->parse($dateTime, $value); // behave like the intl extension. FullTransformer::parse() set the proper error - if (false === $timestamp) { - $this->errorCode = StubIntl::getErrorCode(); - $this->errorMessage = StubIntl::getErrorMessage(); - } + $this->errorCode = StubIntl::getErrorCode(); + $this->errorMessage = StubIntl::getErrorMessage(); return $timestamp; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php index 5563d13..bf8d293 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubLocale.php @@ -80,7 +80,7 @@ class StubLocale * * @throws InvalidArgumentException When the locale is different than 'en' */ - static public function getDisplayCountries($locale) + public static function getDisplayCountries($locale) { return self::getStubData($locale, 'countries', 'region'); } @@ -90,7 +90,7 @@ class StubLocale * * @return array The country codes */ - static public function getCountries() + public static function getCountries() { return array_keys(self::getDisplayCountries(self::getDefault())); } @@ -104,7 +104,7 @@ class StubLocale * * @throws InvalidArgumentException When the locale is different than 'en' */ - static public function getDisplayLanguages($locale) + public static function getDisplayLanguages($locale) { return self::getStubData($locale, 'languages', 'lang'); } @@ -114,7 +114,7 @@ class StubLocale * * @return array The language codes */ - static public function getLanguages() + public static function getLanguages() { return array_keys(self::getDisplayLanguages(self::getDefault())); } @@ -128,7 +128,7 @@ class StubLocale * * @throws InvalidArgumentException When the locale is different than 'en' */ - static public function getDisplayLocales($locale) + public static function getDisplayLocales($locale) { return self::getStubData($locale, 'locales', 'names'); } @@ -138,7 +138,7 @@ class StubLocale * * @return array The locale codes */ - static public function getLocales() + public static function getLocales() { return array_keys(self::getDisplayLocales(self::getDefault())); } @@ -150,7 +150,7 @@ class StubLocale * * @return array The currencies data */ - static public function getCurrenciesData($locale) + public static function getCurrenciesData($locale) { return self::getStubData($locale, 'currencies', 'curr'); } @@ -164,7 +164,7 @@ class StubLocale * * @throws InvalidArgumentException When the locale is different than 'en' */ - static public function getDisplayCurrencies($locale) + public static function getDisplayCurrencies($locale) { $currencies = self::getCurrenciesData($locale); @@ -184,7 +184,7 @@ class StubLocale * * @return array The currencies codes */ - static public function getCurrencies() + public static function getCurrencies() { return array_keys(self::getCurrenciesData(self::getDefault())); } @@ -200,7 +200,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function acceptFromHttp($header) + public static function acceptFromHttp($header) { throw new MethodNotImplementedException(__METHOD__); } @@ -216,7 +216,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function composeLocale(array $subtags) + public static function composeLocale(array $subtags) { throw new MethodNotImplementedException(__METHOD__); } @@ -234,7 +234,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function filterMatches($langtag, $locale, $canonicalize = false) + public static function filterMatches($langtag, $locale, $canonicalize = false) { throw new MethodNotImplementedException(__METHOD__); } @@ -250,7 +250,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getAllVariants($locale) + public static function getAllVariants($locale) { throw new MethodNotImplementedException(__METHOD__); } @@ -264,7 +264,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getDefault() + public static function getDefault() { return 'en'; } @@ -281,7 +281,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getDisplayLanguage($locale, $inLocale = null) + public static function getDisplayLanguage($locale, $inLocale = null) { throw new MethodNotImplementedException(__METHOD__); } @@ -298,7 +298,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getDisplayName($locale, $inLocale = null) + public static function getDisplayName($locale, $inLocale = null) { throw new MethodNotImplementedException(__METHOD__); } @@ -315,7 +315,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getDisplayRegion($locale, $inLocale = null) + public static function getDisplayRegion($locale, $inLocale = null) { throw new MethodNotImplementedException(__METHOD__); } @@ -332,7 +332,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getDisplayScript($locale, $inLocale = null) + public static function getDisplayScript($locale, $inLocale = null) { throw new MethodNotImplementedException(__METHOD__); } @@ -349,7 +349,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getDisplayVariant($locale, $inLocale = null) + public static function getDisplayVariant($locale, $inLocale = null) { throw new MethodNotImplementedException(__METHOD__); } @@ -365,7 +365,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getKeywords($locale) + public static function getKeywords($locale) { throw new MethodNotImplementedException(__METHOD__); } @@ -381,7 +381,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getPrimaryLanguage($locale) + public static function getPrimaryLanguage($locale) { throw new MethodNotImplementedException(__METHOD__); } @@ -397,7 +397,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getRegion($locale) + public static function getRegion($locale) { throw new MethodNotImplementedException(__METHOD__); } @@ -413,7 +413,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function getScript($locale) + public static function getScript($locale) { throw new MethodNotImplementedException(__METHOD__); } @@ -430,7 +430,7 @@ class StubLocale * * @throws RuntimeException When the intl extension is not loaded */ - static public function lookup(array $langtag, $locale, $canonicalize = false, $default = null) + public static function lookup(array $langtag, $locale, $canonicalize = false, $default = null) { throw new MethodNotImplementedException(__METHOD__); } @@ -446,7 +446,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function parseLocale($locale) + public static function parseLocale($locale) { throw new MethodNotImplementedException(__METHOD__); } @@ -462,7 +462,7 @@ class StubLocale * * @throws MethodNotImplementedException */ - static public function setDefault($locale) + public static function setDefault($locale) { throw new MethodNotImplementedException(__METHOD__); } @@ -478,7 +478,7 @@ class StubLocale * * @throws InvalidArgumentException When the locale is different than 'en' */ - static private function getStubData($locale, $cacheVariable, $stubDataDir) + private static function getStubData($locale, $cacheVariable, $stubDataDir) { if ('en' !== $locale) { throw new \InvalidArgumentException(sprintf('Only the \'en\' locale is supported. %s', NotImplementedException::INTL_INSTALL_MESSAGE)); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubNumberFormatter.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubNumberFormatter.php index 2524892..4cf8605 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubNumberFormatter.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Stub/StubNumberFormatter.php @@ -158,7 +158,7 @@ class StubNumberFormatter * * @var array */ - static private $supportedStyles = array( + private static $supportedStyles = array( 'CURRENCY' => self::CURRENCY, 'DECIMAL' => self::DECIMAL ); @@ -168,7 +168,7 @@ class StubNumberFormatter * * @var array */ - static private $supportedAttributes = array( + private static $supportedAttributes = array( 'FRACTION_DIGITS' => self::FRACTION_DIGITS, 'GROUPING_USED' => self::GROUPING_USED, 'ROUNDING_MODE' => self::ROUNDING_MODE @@ -181,7 +181,7 @@ class StubNumberFormatter * * @var array */ - static private $roundingModes = array( + private static $roundingModes = array( 'ROUND_HALFEVEN' => self::ROUND_HALFEVEN, 'ROUND_HALFDOWN' => self::ROUND_HALFDOWN, 'ROUND_HALFUP' => self::ROUND_HALFUP @@ -195,7 +195,7 @@ class StubNumberFormatter * * @var array */ - static private $phpRoundingMap = array( + private static $phpRoundingMap = array( self::ROUND_HALFDOWN => \PHP_ROUND_HALF_DOWN, self::ROUND_HALFEVEN => \PHP_ROUND_HALF_EVEN, self::ROUND_HALFUP => \PHP_ROUND_HALF_UP @@ -206,7 +206,7 @@ class StubNumberFormatter * * @var array */ - static private $int32Range = array( + private static $int32Range = array( 'positive' => 2147483647, 'negative' => -2147483648 ); @@ -216,7 +216,7 @@ class StubNumberFormatter * * @var array */ - static private $int64Range = array( + private static $int64Range = array( 'positive' => 9223372036854775807, 'negative' => -9223372036854775808 ); @@ -274,7 +274,7 @@ class StubNumberFormatter * @throws MethodArgumentValueNotImplementedException When the $style is not supported * @throws MethodArgumentNotImplementedException When the pattern value is different than null */ - static public function create($locale = 'en', $style = null, $pattern = null) + public static function create($locale = 'en', $style = null, $pattern = null) { return new self($locale, $style, $pattern); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php index 994f03f..2b3dd83 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubIntlDateFormatterTest.php @@ -859,6 +859,24 @@ class StubIntlDateFormatterTest extends LocaleTestCase ); } + /* + * https://github.com/symfony/symfony/issues/4242 + */ + public function testParseAfterErrorIntl() + { + $this->testParseErrorIntl('y-MMMMM-d', '1970-J-1'); + $this->testParseIntl('y-M-d', '1970-1-1', 0); + } + + /* + * https://github.com/symfony/symfony/issues/4242 + */ + public function testParseAfterErrorStub() + { + $this->testParseErrorStub('y-MMMMM-d', '1970-J-1'); + $this->testParseStub('y-M-d', '1970-1-1', 0); + } + /** * Just to document the differences between the stub and the intl implementations. The intl can parse * any of the tested formats alone. The stub does not implement them as it would be needed to add more diff --git a/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php b/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php index db22e47..af3967f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Locale/Tests/Stub/StubNumberFormatterTest.php @@ -246,7 +246,6 @@ class StubNumberFormatterTest extends LocaleTestCase $this->assertEquals(sprintf($expected, $symbol), $formatter->formatCurrency($value, $currency)); } - public function formatCurrencyWithCurrencyStyleSwissRoundingProvider() { // The currency symbol was updated from 4.2 to the 4.4 version. The ICU CLDR data was updated in 2010-03-03, diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Options.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Options.php index 51540b0..88fa375 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Options.php +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Options.php @@ -414,7 +414,7 @@ class Options implements \ArrayAccess, \Iterator, \Countable * * @return Boolean Whether it is a lazy option closure. */ - static private function isEvaluatedLazily($value) + private static function isEvaluatedLazily($value) { if (!$value instanceof \Closure) { return false; diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php index 1ead9c2..6542e9a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolver.php @@ -67,6 +67,14 @@ class OptionsResolver implements OptionsResolverInterface $this->defaultOptions = new Options(); } + /** + * Clones the resolver. + */ + public function __clone() + { + $this->defaultOptions = clone $this->defaultOptions; + } + /** * {@inheritdoc} */ @@ -210,7 +218,7 @@ class OptionsResolver implements OptionsResolverInterface /** * {@inheritdoc} */ - public function resolve(array $options) + public function resolve(array $options = array()) { $this->validateOptionsExistence($options); $this->validateOptionsCompleteness($options); diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php index a8344ed..734a14d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/OptionsResolverInterface.php @@ -39,7 +39,7 @@ interface OptionsResolverInterface * * @return OptionsResolverInterface The resolver instance. */ - function setDefaults(array $defaultValues); + public function setDefaults(array $defaultValues); /** * Replaces default option values. @@ -54,7 +54,7 @@ interface OptionsResolverInterface * * @return OptionsResolverInterface The resolver instance. */ - function replaceDefaults(array $defaultValues); + public function replaceDefaults(array $defaultValues); /** * Sets optional options. @@ -71,7 +71,7 @@ interface OptionsResolverInterface * * @throws Exception\OptionDefinitionException When trying to pass default values. */ - function setOptional(array $optionNames); + public function setOptional(array $optionNames); /** * Sets required options. @@ -85,7 +85,7 @@ interface OptionsResolverInterface * * @throws Exception\OptionDefinitionException When trying to pass default values. */ - function setRequired(array $optionNames); + public function setRequired(array $optionNames); /** * Sets allowed values for a list of options. @@ -100,7 +100,7 @@ interface OptionsResolverInterface * (see {@link isKnown()}) for which * an allowed value is set. */ - function setAllowedValues(array $allowedValues); + public function setAllowedValues(array $allowedValues); /** * Adds allowed values for a list of options. @@ -117,7 +117,7 @@ interface OptionsResolverInterface * (see {@link isKnown()}) for which * an allowed value is set. */ - function addAllowedValues(array $allowedValues); + public function addAllowedValues(array $allowedValues); /** * Sets allowed types for a list of options. @@ -130,7 +130,7 @@ interface OptionsResolverInterface * @throws Exception\InvalidOptionsException If an option has not been defined for * which an allowed type is set. */ - function setAllowedTypes(array $allowedTypes); + public function setAllowedTypes(array $allowedTypes); /** * Adds allowed types for a list of options. @@ -145,7 +145,7 @@ interface OptionsResolverInterface * @throws Exception\InvalidOptionsException If an option has not been defined for * which an allowed type is set. */ - function addAllowedTypes(array $allowedTypes); + public function addAllowedTypes(array $allowedTypes); /** * Sets filters that are applied on resolved options. @@ -165,7 +165,7 @@ interface OptionsResolverInterface * * @return OptionsResolverInterface The resolver instance. */ - function setFilters(array $filters); + public function setFilters(array $filters); /** * Returns whether an option is known. @@ -177,7 +177,7 @@ interface OptionsResolverInterface * * @return Boolean Whether the option is known. */ - function isKnown($option); + public function isKnown($option); /** * Returns whether an option is required. @@ -190,7 +190,7 @@ interface OptionsResolverInterface * * @return Boolean Whether the option is required. */ - function isRequired($option); + public function isRequired($option); /** * Returns the combination of the default and the passed options. @@ -206,5 +206,5 @@ interface OptionsResolverInterface * @throws Exception\OptionDefinitionException If a cyclic dependency is detected * between two lazy options. */ - function resolve(array $options); + public function resolve(array $options = array()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php index d112dd3..d755b6b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsResolverTest.php @@ -612,4 +612,25 @@ class OptionsResolverTest extends \PHPUnit_Framework_TestCase $this->assertEquals($options, $this->resolver->resolve($options)); } + + public function testClone() + { + $this->resolver->setDefaults(array('one' => '1')); + + $clone = clone $this->resolver; + + // Changes after cloning don't affect each other + $this->resolver->setDefaults(array('two' => '2')); + $clone->setDefaults(array('three' => '3')); + + $this->assertEquals(array( + 'one' => '1', + 'two' => '2', + ), $this->resolver->resolve()); + + $this->assertEquals(array( + 'one' => '1', + 'three' => '3', + ), $clone->resolve()); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php index 70d4a19..ca0872f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/OptionsResolver/Tests/OptionsTest.php @@ -38,7 +38,6 @@ class OptionsTest extends \PHPUnit_Framework_TestCase unset($this->options['bar']); - $this->assertTrue(isset($this->options['foo'])); $this->assertFalse(isset($this->options['bar'])); $this->assertEquals(0, $this->options['foo']); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php b/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php index bea1855..60f2650 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php @@ -57,7 +57,7 @@ class Process * * @var array */ - static public $exitCodes = array( + public static $exitCodes = array( 0 => 'OK', 1 => 'General error', 2 => 'Misuse of shell builtins', @@ -131,7 +131,7 @@ class Process $this->env = null; } $this->stdin = $stdin; - $this->timeout = $timeout; + $this->setTimeout($timeout); $this->enhanceWindowsCompatibility = true; $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options); } @@ -585,8 +585,27 @@ class Process return $this->timeout; } + /** + * Sets the process timeout. + * + * To disable the timeout, set this value to null. + * + * @param integer|null + */ public function setTimeout($timeout) { + if (null === $timeout) { + $this->timeout = null; + + return; + } + + $timeout = (integer) $timeout; + + if ($timeout < 0) { + throw new \InvalidArgumentException('The timeout value must be a valid positive integer.'); + } + $this->timeout = $timeout; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessBuilder.php b/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessBuilder.php index a1008e2..2ffb3af 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessBuilder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessBuilder.php @@ -81,8 +81,27 @@ class ProcessBuilder return $this; } + /** + * Sets the process timeout. + * + * To disable the timeout, set this value to null. + * + * @param integer|null + */ public function setTimeout($timeout) { + if (null === $timeout) { + $this->timeout = null; + + return $this; + } + + $timeout = (integer) $timeout; + + if ($timeout < 0) { + throw new \InvalidArgumentException('The timeout value must be a valid positive integer.'); + } + $this->timeout = $timeout; return $this; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php index 4e9c2e8..9ca45a8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessBuilderTest.php @@ -83,4 +83,26 @@ class ProcessBuilderTest extends \PHPUnit_Framework_TestCase $_ENV = $snapshot; } + + /** + * @expectedException \InvalidArgumentException + */ + public function testNegativeTimeoutFromSetter() + { + $pb = new ProcessBuilder(); + $pb->setTimeout(-1); + } + + public function testNullTimeout() + { + $pb = new ProcessBuilder(); + $pb->setTimeout(10); + $pb->setTimeout(null); + + $r = new \ReflectionObject($pb); + $p = $r->getProperty('timeout'); + $p->setAccessible(true); + + $this->assertNull($p->getValue($pb)); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessTest.php b/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessTest.php index c30d1bb..81f8171 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Process/Tests/ProcessTest.php @@ -19,20 +19,29 @@ use Symfony\Component\Process\Process; class ProcessTest extends \PHPUnit_Framework_TestCase { /** - * tests getter/setter - * - * @dataProvider methodProvider + * @expectedException \InvalidArgumentException */ - public function testDefaultGetterSetter($fn) + public function testNegativeTimeoutFromConstructor() { - $p = new Process('php'); + new Process('', null, null, null, -1); + } - $setter = 'set'.$fn; - $getter = 'get'.$fn; + /** + * @expectedException \InvalidArgumentException + */ + public function testNegativeTimeoutFromSetter() + { + $p = new Process(''); + $p->setTimeout(-1); + } - $this->assertNull($p->$setter(array('foo'))); + public function testNullTimeout() + { + $p = new Process(''); + $p->setTimeout(10); + $p->setTimeout(null); - $this->assertSame(array('foo'), $p->$getter(array('foo'))); + $this->assertNull($p->getTimeout()); } /** diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/Routing/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php index 0f2f684..deb0c0a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/Dumper/GeneratorDumperInterface.php @@ -30,12 +30,12 @@ interface GeneratorDumperInterface * * @return string Executable code */ - function dump(array $options = array()); + public function dump(array $options = array()); /** * Gets the routes to dump. * * @return RouteCollection A RouteCollection instance */ - function getRoutes(); + public function getRoutes(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php index 220334f..e28c79d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Generator/UrlGeneratorInterface.php @@ -39,5 +39,5 @@ interface UrlGeneratorInterface extends RequestContextAwareInterface * * @api */ - function generate($name, $parameters = array(), $absolute = false); + public function generate($name, $parameters = array(), $absolute = false); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php index 6e5e2db..3003dfd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/ApacheUrlMatcher.php @@ -34,6 +34,7 @@ class ApacheUrlMatcher extends UrlMatcher public function match($pathinfo) { $parameters = array(); + $defaults = array(); $allow = array(); $match = false; @@ -44,26 +45,28 @@ class ApacheUrlMatcher extends UrlMatcher $name = substr($name, 9); } - if (0 === strpos($name, '_ROUTING_')) { + if (0 === strpos($name, '_ROUTING_DEFAULTS_')) { + $name = substr($name, 18); + $defaults[$name] = $value; + } elseif (0 === strpos($name, '_ROUTING_')) { $name = substr($name, 9); + if ('_route' == $name) { + $match = true; + $parameters[$name] = $value; + } elseif (0 === strpos($name, '_allow_')) { + $allow[] = substr($name, 7); + } else { + $parameters[$name] = $value; + } } else { continue; } - if ('_route' == $name) { - $match = true; - $parameters[$name] = $value; - } elseif (0 === strpos($name, '_allow_')) { - $allow[] = substr($name, 7); - } else { - $parameters[$name] = $value; - } - unset($_SERVER[$key]); } if ($match) { - return $parameters; + return $this->mergeDefaults($parameters, $defaults); } elseif (0 < count($allow)) { throw new MethodNotAllowedException($allow); } else { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php index 6e0561d..102488c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/ApacheMatcherDumper.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Routing\Matcher\Dumper; - /** * Dumps a set of Apache mod_rewrite rules. * @@ -75,7 +74,7 @@ class ApacheMatcherDumper extends MatcherDumper $variables[] = 'E=_ROUTING_'.$variable.':%'.($i + 1); } foreach ($route->getDefaults() as $key => $value) { - $variables[] = 'E=_ROUTING_'.$key.':'.strtr($value, array( + $variables[] = 'E=_ROUTING_DEFAULTS_'.$key.':'.strtr($value, array( ':' => '\\:', '=' => '\\=', '\\' => '\\\\', @@ -140,7 +139,7 @@ class ApacheMatcherDumper extends MatcherDumper * * @return string The escaped string */ - static private function escape($string, $char, $with) + private static function escape($string, $char, $with) { $escaped = false; $output = ''; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php index 08d03f5..f85e4ce 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/Dumper/MatcherDumperInterface.php @@ -26,12 +26,12 @@ interface MatcherDumperInterface * * @return string Executable code */ - function dump(array $options = array()); + public function dump(array $options = array()); /** * Gets the routes to dump. * * @return RouteCollection A RouteCollection instance */ - function getRoutes(); + public function getRoutes(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php index 7225c81..929ae9c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RedirectableUrlMatcherInterface.php @@ -31,5 +31,5 @@ interface RedirectableUrlMatcherInterface * * @api */ - function redirect($path, $route, $scheme = null); + public function redirect($path, $route, $scheme = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php index d636cd0..b5def3d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/RequestMatcherInterface.php @@ -35,5 +35,5 @@ interface RequestMatcherInterface * @throws ResourceNotFoundException If no matching resource could be found * @throws MethodNotAllowedException If a matching resource was found but the request method is not allowed */ - function matchRequest(Request $request); + public function matchRequest(Request $request); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php index ce372e8..b517907 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcher.php @@ -166,10 +166,10 @@ class UrlMatcher implements UrlMatcherInterface /** * Get merged default parameters. - * + * * @param array $params The parameters * @param array $defaults The defaults - * + * * @return array Merged default parameters */ protected function mergeDefaults($params, $defaults) diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php index 1242c2e..dd718b1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Matcher/UrlMatcherInterface.php @@ -39,5 +39,5 @@ interface UrlMatcherInterface extends RequestContextAwareInterface * * @api */ - function match($pathinfo); + public function match($pathinfo); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/RequestContextAwareInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/RequestContextAwareInterface.php index 8357b52..daf5254 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/RequestContextAwareInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/RequestContextAwareInterface.php @@ -23,7 +23,7 @@ interface RequestContextAwareInterface * * @api */ - function setContext(RequestContext $context); + public function setContext(RequestContext $context); /** * Gets the request context. @@ -32,5 +32,5 @@ interface RequestContextAwareInterface * * @api */ - function getContext(); + public function getContext(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Route.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Route.php index f18b0ed..16f34ec 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Route.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Route.php @@ -18,7 +18,7 @@ namespace Symfony\Component\Routing; * * @api */ -class Route +class Route implements \Serializable { private $pattern; private $defaults; @@ -26,7 +26,7 @@ class Route private $options; private $compiled; - static private $compilers = array(); + private static $compilers = array(); /** * Constructor. @@ -55,6 +55,25 @@ class Route $this->compiled = null; } + public function serialize() + { + return serialize(array( + 'pattern' => $this->pattern, + 'default' => $this->default, + 'requirements' => $this->requirements, + 'options' => $this->options, + )); + } + + public function unserialize($data) + { + $data = unserialize($data); + $this->pattern = $data['pattern']; + $this->default = $data['default']; + $this->requirements = $data['requirements']; + $this->options = $data['options']; + } + /** * Returns the pattern. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCompilerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCompilerInterface.php index 5193665..f72e9e5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCompilerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/RouteCompilerInterface.php @@ -25,5 +25,5 @@ interface RouteCompilerInterface * * @return CompiledRoute A CompiledRoute instance */ - function compile(Route $route); + public function compile(Route $route); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/RouterInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/RouterInterface.php index 529a85f..a10ae34 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/RouterInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/RouterInterface.php @@ -28,5 +28,5 @@ interface RouterInterface extends UrlMatcherInterface, UrlGeneratorInterface * * @return RouteCollection A RouteCollection instance */ - function getRouteCollection(); + public function getRouteCollection(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php index dc080db..ff3c20c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Annotation/RouteTest.php @@ -43,4 +43,3 @@ class RouteTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache index 25f6060..ea17bca 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/dumper/url_matcher1.apache @@ -4,7 +4,11 @@ RewriteRule .* - [QSA,L] # foo RewriteCond %{REQUEST_URI} ^/foo/(baz|symfony)$ -RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foo,E=_ROUTING_bar:%1,E=_ROUTING_def:test] +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foo,E=_ROUTING_bar:%1,E=_ROUTING_DEFAULTS_def:test] + +# foobar +RewriteCond %{REQUEST_URI} ^/foo(?:/([^/]+))?$ +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:foobar,E=_ROUTING_bar:%1,E=_ROUTING_DEFAULTS_bar:toto] # bar RewriteCond %{REQUEST_URI} ^/bar/([^/]+)$ @@ -58,7 +62,7 @@ RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz5unsafe,E=_ROUTING_foo:%1] # baz6 RewriteCond %{REQUEST_URI} ^/test/baz$ -RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz6,E=_ROUTING_foo:bar\ baz] +RewriteRule .* app.php [QSA,L,E=_ROUTING__route:baz6,E=_ROUTING_DEFAULTS_foo:bar\ baz] # baz7 RewriteCond %{REQUEST_URI} ^/te\ st/baz$ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml index e645d9b..d5136cb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Fixtures/validpattern.yml @@ -3,4 +3,3 @@ blog_show: defaults: { _controller: MyBlogBundle:Blog:show } options: compiler_class: RouteCompiler - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php index a30555b..c927ae4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Loader/AbstractAnnotationLoaderTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Routing\Tests\Loader; - abstract class AbstractAnnotationLoaderTest extends \PHPUnit_Framework_TestCase { protected function setUp() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php index f4b30e3..74c3873 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Loader/PhpFileLoaderTest.php @@ -50,4 +50,3 @@ class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase $this->assertEquals('RouteCompiler', $route->getOption('compiler_class')); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php index e68b618..e4e107c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/ApacheUrlMatcherTest.php @@ -49,6 +49,35 @@ class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase 'name' => 'world', ), ), + array( + 'Route with params and defaults', + '/hello/hugo', + array( + '_ROUTING__route' => 'hello', + '_ROUTING__controller' => 'AcmeBundle:Default:index', + '_ROUTING_name' => 'hugo', + '_ROUTING_DEFAULTS_name' => 'world', + ), + array( + 'name' => 'hugo', + '_route' => 'hello', + '_controller' => 'AcmeBundle:Default:index', + ), + ), + array( + 'Route with defaults only', + '/hello', + array( + '_ROUTING__route' => 'hello', + '_ROUTING__controller' => 'AcmeBundle:Default:index', + '_ROUTING_DEFAULTS_name' => 'world', + ), + array( + 'name' => 'world', + '_route' => 'hello', + '_controller' => 'AcmeBundle:Default:index', + ), + ), array( 'REDIRECT_ envs', '/hello/world', @@ -66,4 +95,3 @@ class ApacheUrlMatcherTest extends \PHPUnit_Framework_TestCase ); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php index 65cb454..2847564 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/ApacheMatcherDumperTest.php @@ -17,9 +17,9 @@ use Symfony\Component\Routing\Matcher\Dumper\ApacheMatcherDumper; class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../../Fixtures/'); } @@ -70,6 +70,11 @@ class ApacheMatcherDumperTest extends \PHPUnit_Framework_TestCase array('def' => 'test'), array('bar' => 'baz|symfony') )); + // defaults parameters in pattern + $collection->add('foobar', new Route( + '/foo/{bar}', + array('bar' => 'toto') + )); // method requirement $collection->add('bar', new Route( '/bar/{foo}', diff --git a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index 3677c7e..69b3c07 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -14,7 +14,6 @@ namespace Symfony\Component\Routing\Tests\Matcher\Dumper; use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; class PhpMatcherDumperTest extends \PHPUnit_Framework_TestCase { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/Security/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php index 8413843..ada4f22 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Dbal/AclProvider.php @@ -339,7 +339,7 @@ QUERY; * @param ObjectIdentityInterface $oid * @return integer */ - protected final function retrieveObjectIdentityPrimaryKey(ObjectIdentityInterface $oid) + final protected function retrieveObjectIdentityPrimaryKey(ObjectIdentityInterface $oid) { return $this->connection->executeQuery($this->getSelectObjectIdentityIdSql($oid))->fetchColumn(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/Acl.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/Acl.php index 6d53131..4665c0e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/Acl.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/Acl.php @@ -19,7 +19,6 @@ use Symfony\Component\Security\Acl\Model\ObjectIdentityInterface; use Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface; use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface; - /** * An ACL implementation. * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php index e37e82b..da98f5e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/ObjectIdentity.php @@ -52,7 +52,7 @@ final class ObjectIdentity implements ObjectIdentityInterface * @throws \InvalidArgumentException * @return ObjectIdentity */ - static public function fromDomainObject($domainObject) + public static function fromDomainObject($domainObject) { if (!is_object($domainObject)) { throw new InvalidDomainObjectException('$domainObject must be an object.'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php index 040e43b..ebb0056 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php @@ -51,7 +51,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface * @param UserInterface $user * @return UserSecurityIdentity */ - static public function fromAccount(UserInterface $user) + public static function fromAccount(UserInterface $user) { return new self($user->getUsername(), ClassUtils::getRealClass($user)); } @@ -62,7 +62,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface * @param TokenInterface $token * @return UserSecurityIdentity */ - static public function fromToken(TokenInterface $token) + public static function fromToken(TokenInterface $token) { $user = $token->getUser(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclCacheInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclCacheInterface.php index dd515ce..ea9604e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclCacheInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclCacheInterface.php @@ -23,7 +23,7 @@ interface AclCacheInterface * * @param string $primaryKey a serialized primary key */ - function evictFromCacheById($primaryKey); + public function evictFromCacheById($primaryKey); /** * Removes an ACL from the cache @@ -32,7 +32,7 @@ interface AclCacheInterface * * @param ObjectIdentityInterface $oid */ - function evictFromCacheByIdentity(ObjectIdentityInterface $oid); + public function evictFromCacheByIdentity(ObjectIdentityInterface $oid); /** * Retrieves an ACL for the given object identity primary key from the cache @@ -40,7 +40,7 @@ interface AclCacheInterface * @param integer $primaryKey * @return AclInterface */ - function getFromCacheById($primaryKey); + public function getFromCacheById($primaryKey); /** * Retrieves an ACL for the given object identity from the cache @@ -48,17 +48,17 @@ interface AclCacheInterface * @param ObjectIdentityInterface $oid * @return AclInterface */ - function getFromCacheByIdentity(ObjectIdentityInterface $oid); + public function getFromCacheByIdentity(ObjectIdentityInterface $oid); /** * Stores a new ACL in the cache * * @param AclInterface $acl */ - function putInCache(AclInterface $acl); + public function putInCache(AclInterface $acl); /** * Removes all ACLs from the cache */ - function clearCache(); + public function clearCache(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclInterface.php index 9094560..fffe591 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclInterface.php @@ -28,7 +28,7 @@ interface AclInterface extends \Serializable * * @return array */ - function getClassAces(); + public function getClassAces(); /** * Returns all class-field-based ACEs associated with this ACL @@ -36,14 +36,14 @@ interface AclInterface extends \Serializable * @param string $field * @return array */ - function getClassFieldAces($field); + public function getClassFieldAces($field); /** * Returns all object-based ACEs associated with this ACL * * @return array */ - function getObjectAces(); + public function getObjectAces(); /** * Returns all object-field-based ACEs associated with this ACL @@ -51,28 +51,28 @@ interface AclInterface extends \Serializable * @param string $field * @return array */ - function getObjectFieldAces($field); + public function getObjectFieldAces($field); /** * Returns the object identity associated with this ACL * * @return ObjectIdentityInterface */ - function getObjectIdentity(); + public function getObjectIdentity(); /** * Returns the parent ACL, or null if there is none. * * @return AclInterface|null */ - function getParentAcl(); + public function getParentAcl(); /** * Whether this ACL is inheriting ACEs from a parent ACL. * * @return Boolean */ - function isEntriesInheriting(); + public function isEntriesInheriting(); /** * Determines whether field access is granted @@ -83,7 +83,7 @@ interface AclInterface extends \Serializable * @param Boolean $administrativeMode * @return Boolean */ - function isFieldGranted($field, array $masks, array $securityIdentities, $administrativeMode = false); + public function isFieldGranted($field, array $masks, array $securityIdentities, $administrativeMode = false); /** * Determines whether access is granted @@ -94,7 +94,7 @@ interface AclInterface extends \Serializable * @param Boolean $administrativeMode * @return Boolean */ - function isGranted(array $masks, array $securityIdentities, $administrativeMode = false); + public function isGranted(array $masks, array $securityIdentities, $administrativeMode = false); /** * Whether the ACL has loaded ACEs for all of the passed security identities @@ -102,5 +102,5 @@ interface AclInterface extends \Serializable * @param mixed $securityIdentities an implementation of SecurityIdentityInterface, or an array thereof * @return Boolean */ - function isSidLoaded($securityIdentities); + public function isSidLoaded($securityIdentities); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclProviderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclProviderInterface.php index 2f878e1..bdb40b7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclProviderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AclProviderInterface.php @@ -25,7 +25,7 @@ interface AclProviderInterface * @param Boolean $directChildrenOnly * @return array returns an array of child 'ObjectIdentity's */ - function findChildren(ObjectIdentityInterface $parentOid, $directChildrenOnly = false); + public function findChildren(ObjectIdentityInterface $parentOid, $directChildrenOnly = false); /** * Returns the ACL that belongs to the given object identity @@ -35,7 +35,7 @@ interface AclProviderInterface * @param array $sids * @return AclInterface */ - function findAcl(ObjectIdentityInterface $oid, array $sids = array()); + public function findAcl(ObjectIdentityInterface $oid, array $sids = array()); /** * Returns the ACLs that belong to the given object identities @@ -45,5 +45,5 @@ interface AclProviderInterface * @param array $sids an array of SecurityIdentityInterface implementations * @return \SplObjectStorage mapping the passed object identities to ACLs */ - function findAcls(array $oids, array $sids = array()); + public function findAcls(array $oids, array $sids = array()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditLoggerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditLoggerInterface.php index 7cab6f1..09bcbb8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditLoggerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditLoggerInterface.php @@ -25,5 +25,5 @@ interface AuditLoggerInterface * @param Boolean $granted * @param EntryInterface $ace */ - function logIfNeeded($granted, EntryInterface $ace); + public function logIfNeeded($granted, EntryInterface $ace); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditableAclInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditableAclInterface.php index 5da593e..14b4c04 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditableAclInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditableAclInterface.php @@ -25,7 +25,7 @@ interface AuditableAclInterface extends MutableAclInterface * @param Boolean $auditSuccess * @param Boolean $auditFailure */ - function updateClassAuditing($index, $auditSuccess, $auditFailure); + public function updateClassAuditing($index, $auditSuccess, $auditFailure); /** * Updates auditing for class-field-based ACE @@ -35,7 +35,7 @@ interface AuditableAclInterface extends MutableAclInterface * @param Boolean $auditSuccess * @param Boolean $auditFailure */ - function updateClassFieldAuditing($index, $field, $auditSuccess, $auditFailure); + public function updateClassFieldAuditing($index, $field, $auditSuccess, $auditFailure); /** * Updates auditing for object-based ACE @@ -44,7 +44,7 @@ interface AuditableAclInterface extends MutableAclInterface * @param Boolean $auditSuccess * @param Boolean $auditFailure */ - function updateObjectAuditing($index, $auditSuccess, $auditFailure); + public function updateObjectAuditing($index, $auditSuccess, $auditFailure); /** * Updates auditing for object-field-based ACE @@ -54,5 +54,5 @@ interface AuditableAclInterface extends MutableAclInterface * @param Boolean $auditSuccess * @param Boolean $auditFailure */ - function updateObjectFieldAuditing($index, $field, $auditSuccess, $auditFailure); + public function updateObjectFieldAuditing($index, $field, $auditSuccess, $auditFailure); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditableEntryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditableEntryInterface.php index 40c4484..e957965 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditableEntryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/AuditableEntryInterface.php @@ -23,12 +23,12 @@ interface AuditableEntryInterface extends EntryInterface * * @return Boolean */ - function isAuditFailure(); + public function isAuditFailure(); /** * Whether auditing for successful denies is turned on * * @return Boolean */ - function isAuditSuccess(); + public function isAuditSuccess(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/DomainObjectInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/DomainObjectInterface.php index 50bc4c3..195cb4e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/DomainObjectInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/DomainObjectInterface.php @@ -25,5 +25,5 @@ interface DomainObjectInterface * * @return string */ - function getObjectIdentifier(); + public function getObjectIdentifier(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/EntryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/EntryInterface.php index 6fe0dc8..98b754c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/EntryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/EntryInterface.php @@ -26,40 +26,40 @@ interface EntryInterface extends \Serializable * * @return AclInterface */ - function getAcl(); + public function getAcl(); /** * The primary key of this ACE * * @return integer */ - function getId(); + public function getId(); /** * The permission mask of this ACE * * @return integer */ - function getMask(); + public function getMask(); /** * The security identity associated with this ACE * * @return SecurityIdentityInterface */ - function getSecurityIdentity(); + public function getSecurityIdentity(); /** * The strategy for comparing masks * * @return string */ - function getStrategy(); + public function getStrategy(); /** * Returns whether this ACE is granting, or denying * * @return Boolean */ - function isGranting(); + public function isGranting(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/FieldEntryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/FieldEntryInterface.php index a35ddb4..8382ae1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/FieldEntryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/FieldEntryInterface.php @@ -23,5 +23,5 @@ interface FieldEntryInterface extends EntryInterface * * @return string */ - function getField(); + public function getField(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php index f84e817..9028aa9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/MutableAclInterface.php @@ -26,7 +26,7 @@ interface MutableAclInterface extends AclInterface * * @param integer $index */ - function deleteClassAce($index); + public function deleteClassAce($index); /** * Deletes a class-field-based ACE @@ -34,14 +34,14 @@ interface MutableAclInterface extends AclInterface * @param integer $index * @param string $field */ - function deleteClassFieldAce($index, $field); + public function deleteClassFieldAce($index, $field); /** * Deletes an object-based ACE * * @param integer $index */ - function deleteObjectAce($index); + public function deleteObjectAce($index); /** * Deletes an object-field-based ACE @@ -49,14 +49,14 @@ interface MutableAclInterface extends AclInterface * @param integer $index * @param string $field */ - function deleteObjectFieldAce($index, $field); + public function deleteObjectFieldAce($index, $field); /** * Returns the primary key of this ACL * * @return integer */ - function getId(); + public function getId(); /** * Inserts a class-based ACE @@ -67,7 +67,7 @@ interface MutableAclInterface extends AclInterface * @param Boolean $granting * @param string $strategy */ - function insertClassAce(SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null); + public function insertClassAce(SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null); /** * Inserts a class-field-based ACE @@ -79,7 +79,7 @@ interface MutableAclInterface extends AclInterface * @param Boolean $granting * @param string $strategy */ - function insertClassFieldAce($field, SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null); + public function insertClassFieldAce($field, SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null); /** * Inserts an object-based ACE @@ -90,7 +90,7 @@ interface MutableAclInterface extends AclInterface * @param Boolean $granting * @param string $strategy */ - function insertObjectAce(SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null); + public function insertObjectAce(SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null); /** * Inserts an object-field-based ACE @@ -102,14 +102,14 @@ interface MutableAclInterface extends AclInterface * @param Boolean $granting * @param string $strategy */ - function insertObjectFieldAce($field, SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null); + public function insertObjectFieldAce($field, SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null); /** * Sets whether entries are inherited * * @param Boolean $boolean */ - function setEntriesInheriting($boolean); + public function setEntriesInheriting($boolean); /** * Sets the parent ACL @@ -117,7 +117,7 @@ interface MutableAclInterface extends AclInterface * @param AclInterface|null $acl * @return void */ - function setParentAcl(AclInterface $acl = null); + public function setParentAcl(AclInterface $acl = null); /** * Updates a class-based ACE @@ -126,7 +126,7 @@ interface MutableAclInterface extends AclInterface * @param integer $mask * @param string $strategy if null the strategy should not be changed */ - function updateClassAce($index, $mask, $strategy = null); + public function updateClassAce($index, $mask, $strategy = null); /** * Updates a class-field-based ACE @@ -136,7 +136,7 @@ interface MutableAclInterface extends AclInterface * @param integer $mask * @param string $strategy if null the strategy should not be changed */ - function updateClassFieldAce($index, $field, $mask, $strategy = null); + public function updateClassFieldAce($index, $field, $mask, $strategy = null); /** * Updates an object-based ACE @@ -145,7 +145,7 @@ interface MutableAclInterface extends AclInterface * @param integer $mask * @param string $strategy if null the strategy should not be changed */ - function updateObjectAce($index, $mask, $strategy = null); + public function updateObjectAce($index, $mask, $strategy = null); /** * Updates an object-field-based ACE @@ -155,5 +155,5 @@ interface MutableAclInterface extends AclInterface * @param integer $mask * @param string $strategy if null the strategy should not be changed */ - function updateObjectFieldAce($index, $field, $mask, $strategy = null); + public function updateObjectFieldAce($index, $field, $mask, $strategy = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/MutableAclProviderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/MutableAclProviderInterface.php index 04cf237..cb34b72 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/MutableAclProviderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/MutableAclProviderInterface.php @@ -26,7 +26,7 @@ interface MutableAclProviderInterface extends AclProviderInterface * @param ObjectIdentityInterface $oid * @return MutableAclInterface */ - function createAcl(ObjectIdentityInterface $oid); + public function createAcl(ObjectIdentityInterface $oid); /** * Deletes the ACL for a given object identity. @@ -36,7 +36,7 @@ interface MutableAclProviderInterface extends AclProviderInterface * * @param ObjectIdentityInterface $oid */ - function deleteAcl(ObjectIdentityInterface $oid); + public function deleteAcl(ObjectIdentityInterface $oid); /** * Persists any changes which were made to the ACL, or any associated @@ -46,5 +46,5 @@ interface MutableAclProviderInterface extends AclProviderInterface * * @param MutableAclInterface $acl */ - function updateAcl(MutableAclInterface $acl); + public function updateAcl(MutableAclInterface $acl); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/ObjectIdentityInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/ObjectIdentityInterface.php index 7e892bf..8ad0eba 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/ObjectIdentityInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/ObjectIdentityInterface.php @@ -30,7 +30,7 @@ interface ObjectIdentityInterface * @param ObjectIdentityInterface $identity * @return Boolean */ - function equals(ObjectIdentityInterface $identity); + public function equals(ObjectIdentityInterface $identity); /** * Obtains a unique identifier for this object. The identifier must not be @@ -38,12 +38,12 @@ interface ObjectIdentityInterface * * @return string cannot return null */ - function getIdentifier(); + public function getIdentifier(); /** * Returns a type for the domain object. Typically, this is the PHP class name. * * @return string cannot return null */ - function getType(); + public function getType(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/ObjectIdentityRetrievalStrategyInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/ObjectIdentityRetrievalStrategyInterface.php index e53c3da..b0f7f78 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/ObjectIdentityRetrievalStrategyInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/ObjectIdentityRetrievalStrategyInterface.php @@ -24,5 +24,5 @@ interface ObjectIdentityRetrievalStrategyInterface * @param object $domainObject * @return ObjectIdentityInterface */ - function getObjectIdentity($domainObject); + public function getObjectIdentity($domainObject); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/PermissionGrantingStrategyInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/PermissionGrantingStrategyInterface.php index 7afdfac..7f8f81b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/PermissionGrantingStrategyInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/PermissionGrantingStrategyInterface.php @@ -27,7 +27,7 @@ interface PermissionGrantingStrategyInterface * @param Boolean $administrativeMode * @return Boolean */ - function isGranted(AclInterface $acl, array $masks, array $sids, $administrativeMode = false); + public function isGranted(AclInterface $acl, array $masks, array $sids, $administrativeMode = false); /** * Determines whether access to a domain object's field is to be granted @@ -40,5 +40,5 @@ interface PermissionGrantingStrategyInterface * * @return Boolean */ - function isFieldGranted(AclInterface $acl, $field, array $masks, array $sids, $administrativeMode = false); + public function isFieldGranted(AclInterface $acl, $field, array $masks, array $sids, $administrativeMode = false); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/SecurityIdentityInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/SecurityIdentityInterface.php index 5bf6189..0a24a54 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/SecurityIdentityInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/SecurityIdentityInterface.php @@ -26,5 +26,5 @@ interface SecurityIdentityInterface * * @param SecurityIdentityInterface $identity */ - function equals(SecurityIdentityInterface $identity); + public function equals(SecurityIdentityInterface $identity); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/SecurityIdentityRetrievalStrategyInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/SecurityIdentityRetrievalStrategyInterface.php index 3bbbaa4..c20f04b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/SecurityIdentityRetrievalStrategyInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Model/SecurityIdentityRetrievalStrategyInterface.php @@ -30,5 +30,5 @@ interface SecurityIdentityRetrievalStrategyInterface * @param TokenInterface $token * @return array of SecurityIdentityInterface implementations */ - function getSecurityIdentities(TokenInterface $token); + public function getSecurityIdentities(TokenInterface $token); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php index 6921558..df1fa7c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Permission/MaskBuilder.php @@ -175,7 +175,7 @@ class MaskBuilder * @throws \RuntimeException * @return string */ - static public function getCode($mask) + public static function getCode($mask) { if (!is_int($mask)) { throw new \InvalidArgumentException('$mask must be an integer.'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Permission/PermissionMapInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Permission/PermissionMapInterface.php index c2e49d5..44c15cc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Permission/PermissionMapInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Permission/PermissionMapInterface.php @@ -28,7 +28,7 @@ interface PermissionMapInterface * @param object $object * @return array may return null if permission/object combination is not supported */ - function getMasks($permission, $object); + public function getMasks($permission, $object); /** * Whether this map contains the given permission @@ -36,5 +36,5 @@ interface PermissionMapInterface * @param string $permission * @return Boolean */ - function contains($permission); + public function contains($permission); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Resources/bin/generateSql.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Resources/bin/generateSql.php index 25ded7a..d65874b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Resources/bin/generateSql.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Acl/Resources/bin/generateSql.php @@ -25,7 +25,6 @@ $loader->registerNamespaces(array( )); $loader->register(); - $schema = new Schema(array( 'class_table_name' => 'acl_classes', 'entry_table_name' => 'acl_entries', diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md index 2389ac3..0093677 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/CHANGELOG.md @@ -20,3 +20,8 @@ CHANGELOG * `ObjectIdentity::fromDomainObject`, `UserSecurityIdentity::fromAccount` and `UserSecurityIdentity::fromToken` now return correct identities for proxies objects (e.g. Doctrine proxies) + * [BC BREAK] moved the default authentication success and failure handling to + seperate classes. The order of arguments in the constructor of the + `AbstractAuthenticationListener` has changed. + * [BC BREAK] moved the default logout sucess handling to a seperate class. The + order of arguments in the constructor of `LogoutListener` has changed. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationManagerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationManagerInterface.php index 36cdc92..d8f4716 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationManagerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationManagerInterface.php @@ -31,5 +31,5 @@ interface AuthenticationManagerInterface * * @throws AuthenticationException if the authentication fails */ - function authenticate(TokenInterface $token); + public function authenticate(TokenInterface $token); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php index adcef3c..ac07db0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/AuthenticationTrustResolverInterface.php @@ -30,7 +30,7 @@ interface AuthenticationTrustResolverInterface * * @return Boolean */ - function isAnonymous(TokenInterface $token = null); + public function isAnonymous(TokenInterface $token = null); /** * Resolves whether the passed token implementation is authenticated @@ -40,7 +40,7 @@ interface AuthenticationTrustResolverInterface * * @return Boolean */ - function isRememberMe(TokenInterface $token = null); + public function isRememberMe(TokenInterface $token = null); /** * Resolves whether the passed token implementation is fully authenticated. @@ -49,5 +49,5 @@ interface AuthenticationTrustResolverInterface * * @return Boolean */ - function isFullFledged(TokenInterface $token = null); + public function isFullFledged(TokenInterface $token = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentTokenInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentTokenInterface.php index 38acbc3..6e9d891 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentTokenInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentTokenInterface.php @@ -23,29 +23,29 @@ interface PersistentTokenInterface * Returns the class of the user * @return string */ - function getClass(); + public function getClass(); /** * Returns the username * @return string */ - function getUsername(); + public function getUsername(); /** * Returns the series * @return string */ - function getSeries(); + public function getSeries(); /** * Returns the token value * @return string */ - function getTokenValue(); + public function getTokenValue(); /** * Returns the last time the cookie was used * @return \DateTime */ - function getLastUsed(); + public function getLastUsed(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php index db40a1c..c8cfbd1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/RememberMe/TokenProviderInterface.php @@ -27,14 +27,14 @@ interface TokenProviderInterface * * @return PersistentTokenInterface */ - function loadTokenBySeries($series); + public function loadTokenBySeries($series); /** * Deletes all tokens belonging to series. * * @param string $series */ - function deleteTokenBySeries($series); + public function deleteTokenBySeries($series); /** * Updates the token according to this data. @@ -43,12 +43,12 @@ interface TokenProviderInterface * @param string $tokenValue * @param DateTime $lastUsed */ - function updateToken($series, $tokenValue, \DateTime $lastUsed); + public function updateToken($series, $tokenValue, \DateTime $lastUsed); /** * Creates a new token. * * @param PersistentTokenInterface $token */ - function createNewToken(PersistentTokenInterface $token); + public function createNewToken(PersistentTokenInterface $token); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php index 3dafccc..dec31d5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Token/TokenInterface.php @@ -26,21 +26,21 @@ interface TokenInterface extends \Serializable * * @return string */ - function __toString(); + public function __toString(); /** * Returns the user roles. * * @return Role[] An array of Role instances. */ - function getRoles(); + public function getRoles(); /** * Returns the user credentials. * * @return mixed The user credentials */ - function getCredentials(); + public function getCredentials(); /** * Returns a user representation. @@ -48,54 +48,54 @@ interface TokenInterface extends \Serializable * @return mixed either returns an object which implements __toString(), or * a primitive string is returned. */ - function getUser(); + public function getUser(); /** * Sets a user. * * @param mixed $user */ - function setUser($user); + public function setUser($user); /** * Returns the username. * * @return string */ - function getUsername(); + public function getUsername(); /** * Returns whether the user is authenticated or not. * * @return Boolean true if the token has been authenticated, false otherwise */ - function isAuthenticated(); + public function isAuthenticated(); /** * Sets the authenticated flag. * * @param Boolean $isAuthenticated The authenticated flag */ - function setAuthenticated($isAuthenticated); + public function setAuthenticated($isAuthenticated); /** * Removes sensitive information from the token. */ - function eraseCredentials(); + public function eraseCredentials(); /** * Returns the token attributes. * * @return array The token attributes */ - function getAttributes(); + public function getAttributes(); /** * Sets the token attributes. * * @param array $attributes The token attributes */ - function setAttributes(array $attributes); + public function setAttributes(array $attributes); /** * Returns true if the attribute exists. @@ -104,7 +104,7 @@ interface TokenInterface extends \Serializable * * @return Boolean true if the attribute exists, false otherwise */ - function hasAttribute($name); + public function hasAttribute($name); /** * Returns an attribute value. @@ -115,7 +115,7 @@ interface TokenInterface extends \Serializable * * @throws \InvalidArgumentException When attribute doesn't exist for this token */ - function getAttribute($name); + public function getAttribute($name); /** * Sets an attribute. @@ -123,5 +123,5 @@ interface TokenInterface extends \Serializable * @param string $name The attribute name * @param mixed $value The attribute value */ - function setAttribute($name, $value); + public function setAttribute($name, $value); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php index 648047a..742ea74 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php @@ -29,7 +29,7 @@ interface AccessDecisionManagerInterface * * @return Boolean true if the access is granted, false otherwise */ - function decide(TokenInterface $token, array $attributes, $object = null); + public function decide(TokenInterface $token, array $attributes, $object = null); /** * Checks if the access decision manager supports the given attribute. @@ -38,7 +38,7 @@ interface AccessDecisionManagerInterface * * @return Boolean true if this decision manager supports the attribute, false otherwise */ - function supportsAttribute($attribute); + public function supportsAttribute($attribute); /** * Checks if the access decision manager supports the given class. @@ -47,5 +47,5 @@ interface AccessDecisionManagerInterface * * @return true if this decision manager can process the class */ - function supportsClass($class); + public function supportsClass($class); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php index 41d9e64..1fc93e5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authorization/Voter/VoterInterface.php @@ -31,7 +31,7 @@ interface VoterInterface * * @return Boolean true if this Voter supports the attribute, false otherwise */ - function supportsAttribute($attribute); + public function supportsAttribute($attribute); /** * Checks if the voter supports the given class. @@ -40,7 +40,7 @@ interface VoterInterface * * @return true if this Voter can process the class */ - function supportsClass($class); + public function supportsClass($class); /** * Returns the vote for the given parameters. @@ -54,5 +54,5 @@ interface VoterInterface * * @return integer either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED */ - function vote(TokenInterface $token, $object, array $attributes); + public function vote(TokenInterface $token, $object, array $attributes); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php index 7d34cc7..9429441 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/EncoderFactory.php @@ -11,8 +11,6 @@ namespace Symfony\Component\Security\Core\Encoder; -use Symfony\Component\Security\Core\User\UserInterface; - /** * A generic encoder factory implementation * diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/EncoderFactoryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/EncoderFactoryInterface.php index 125e57b..f6b4a25 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/EncoderFactoryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/EncoderFactoryInterface.php @@ -29,5 +29,5 @@ interface EncoderFactoryInterface * * @throws \RuntimeException when no password encoder could be found for the user */ - function getEncoder($user); + public function getEncoder($user); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php index dae6c69..78b4e42 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php @@ -26,7 +26,7 @@ interface PasswordEncoderInterface * * @return string The encoded password */ - function encodePassword($raw, $salt); + public function encodePassword($raw, $salt); /** * Checks a raw password against an encoded password. @@ -37,5 +37,5 @@ interface PasswordEncoderInterface * * @return Boolean true if the password is valid, false otherwise */ - function isPasswordValid($encoded, $raw, $salt); + public function isPasswordValid($encoded, $raw, $salt); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleHierarchyInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleHierarchyInterface.php index d873b80..c495a7f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleHierarchyInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleHierarchyInterface.php @@ -28,5 +28,5 @@ interface RoleHierarchyInterface * * @return array An array of all reachable roles */ - function getReachableRoles(array $roles); + public function getReachableRoles(array $roles); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleInterface.php index debda3a..a3cb266 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Role/RoleInterface.php @@ -31,5 +31,5 @@ interface RoleInterface * * @return string|null A string representation of the role, or null */ - function getRole(); + public function getRole(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContext.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContext.php index bc6493b..1ec43e6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContext.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContext.php @@ -55,7 +55,7 @@ class SecurityContext implements SecurityContextInterface * * @return Boolean */ - public final function isGranted($attributes, $object = null) + final public function isGranted($attributes, $object = null) { if (null === $this->token) { throw new AuthenticationCredentialsNotFoundException('The security context contains no authentication token. One possible reason may be that there is no firewall configured for this URL.'); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContextInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContextInterface.php index 77c5bf8..78d6477 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContextInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/SecurityContextInterface.php @@ -29,14 +29,14 @@ interface SecurityContextInterface * * @return TokenInterface|null A TokenInterface instance or null if no authentication information is available */ - function getToken(); + public function getToken(); /** * Sets the authentication token. * * @param TokenInterface $token */ - function setToken(TokenInterface $token = null); + public function setToken(TokenInterface $token = null); /** * Checks if the attributes are granted against the current authentication token and optionally supplied object. @@ -46,5 +46,5 @@ interface SecurityContextInterface * * @return Boolean */ - function isGranted($attributes, $object = null); + public function isGranted($attributes, $object = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/AdvancedUserInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/AdvancedUserInterface.php index e951c65..5b3a51a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/AdvancedUserInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/AdvancedUserInterface.php @@ -47,7 +47,7 @@ interface AdvancedUserInterface extends UserInterface * * @see AccountExpiredException */ - function isAccountNonExpired(); + public function isAccountNonExpired(); /** * Checks whether the user is locked. @@ -59,7 +59,7 @@ interface AdvancedUserInterface extends UserInterface * * @see LockedException */ - function isAccountNonLocked(); + public function isAccountNonLocked(); /** * Checks whether the user's credentials (password) has expired. @@ -71,7 +71,7 @@ interface AdvancedUserInterface extends UserInterface * * @see CredentialsExpiredException */ - function isCredentialsNonExpired(); + public function isCredentialsNonExpired(); /** * Checks whether the user is enabled. @@ -83,5 +83,5 @@ interface AdvancedUserInterface extends UserInterface * * @see DisabledException */ - function isEnabled(); + public function isEnabled(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/EquatableInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/EquatableInterface.php index e2bde9e..645b77c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/EquatableInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/EquatableInterface.php @@ -33,5 +33,5 @@ interface EquatableInterface * * @return Boolean */ - function isEqualTo(UserInterface $user); + public function isEqualTo(UserInterface $user); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php index 61f0f6e..3dd8d51 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserCheckerInterface.php @@ -25,12 +25,12 @@ interface UserCheckerInterface * * @param UserInterface $user a UserInterface instance */ - function checkPreAuth(UserInterface $user); + public function checkPreAuth(UserInterface $user); /** * Checks the user account after authentication. * * @param UserInterface $user a UserInterface instance */ - function checkPostAuth(UserInterface $user); + public function checkPostAuth(UserInterface $user); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserInterface.php index ce3b3a8..ed96ca9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserInterface.php @@ -47,7 +47,7 @@ interface UserInterface * * @return Role[] The user roles */ - function getRoles(); + public function getRoles(); /** * Returns the password used to authenticate the user. @@ -57,7 +57,7 @@ interface UserInterface * * @return string The password */ - function getPassword(); + public function getPassword(); /** * Returns the salt that was originally used to encode the password. @@ -66,14 +66,14 @@ interface UserInterface * * @return string The salt */ - function getSalt(); + public function getSalt(); /** * Returns the username used to authenticate the user. * * @return string The username */ - function getUsername(); + public function getUsername(); /** * Removes sensitive data from the user. @@ -83,5 +83,5 @@ interface UserInterface * * @return void */ - function eraseCredentials(); + public function eraseCredentials(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserProviderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserProviderInterface.php index dbd7924..6669c43 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserProviderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/User/UserProviderInterface.php @@ -48,7 +48,7 @@ interface UserProviderInterface * @throws UsernameNotFoundException if the user is not found * */ - function loadUserByUsername($username); + public function loadUserByUsername($username); /** * Refreshes the user for the account interface. @@ -63,7 +63,7 @@ interface UserProviderInterface * * @throws UnsupportedUserException if the account is not supported */ - function refreshUser(UserInterface $user); + public function refreshUser(UserInterface $user); /** * Whether this provider supports the given user class @@ -72,5 +72,5 @@ interface UserProviderInterface * * @return Boolean */ - function supportsClass($class); + public function supportsClass($class); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Validator/Constraint/UserPassword.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Validator/Constraint/UserPassword.php index ef6e1ec..3279e02 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Validator/Constraint/UserPassword.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Validator/Constraint/UserPassword.php @@ -18,7 +18,7 @@ use Symfony\Component\Validator\Constraint; */ class UserPassword extends Constraint { - public $message = 'This value should be the user current password'; + public $message = 'This value should be the user current password.'; public function validatedBy() { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/AccessMapInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/AccessMapInterface.php index dbd7282..7d15fee 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/AccessMapInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/AccessMapInterface.php @@ -29,5 +29,5 @@ interface AccessMapInterface * * @return array A tuple of security attributes and the required channel */ - function getPatterns(Request $request); + public function getPatterns(Request $request); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php index 9cd7496..8dbd29a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/AuthenticationFailureHandlerInterface.php @@ -33,7 +33,7 @@ interface AuthenticationFailureHandlerInterface * @param Request $request * @param AuthenticationException $exception * - * @return Response|null the response to return + * @return Response The response to return, never null */ - function onAuthenticationFailure(Request $request, AuthenticationException $exception); + public function onAuthenticationFailure(Request $request, AuthenticationException $exception); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php index 8917f3e..5c08e73 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/AuthenticationSuccessHandlerInterface.php @@ -33,7 +33,7 @@ interface AuthenticationSuccessHandlerInterface * @param Request $request * @param TokenInterface $token * - * @return Response|null the response to return + * @return Response never null */ - function onAuthenticationSuccess(Request $request, TokenInterface $token); + public function onAuthenticationSuccess(Request $request, TokenInterface $token); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php new file mode 100644 index 0000000..61d77a8 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationFailureHandler.php @@ -0,0 +1,87 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\Log\LoggerInterface; +use Symfony\Component\Security\Core\Exception\AuthenticationException; +use Symfony\Component\Security\Core\SecurityContextInterface; +use Symfony\Component\Security\Http\HttpUtils; + +/** + * Class with the default authentication failure handling logic. + * + * Can be optionally be extended from by the developer to alter the behaviour + * while keeping the default behaviour. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * @author Alexander + */ +class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandlerInterface +{ + protected $httpKernel; + protected $httpUtils; + protected $logger; + protected $options; + + /** + * Constructor. + * + * @param HttpKernelInterface $httpKernel + * @param HttpUtils $httpUtils + * @param array $options Options for processing a failed authentication attempt. + * @param LoggerInterface $logger Optional logger + */ + public function __construct(HttpKernelInterface $httpKernel, HttpUtils $httpUtils, array $options, LoggerInterface $logger = null) + { + $this->httpKernel = $httpKernel; + $this->httpUtils = $httpUtils; + $this->logger = $logger; + + $this->options = array_merge(array( + 'failure_path' => null, + 'failure_forward' => false, + 'login_path' => '/login', + ), $options); + } + + /** + * {@inheritDoc} + */ + public function onAuthenticationFailure(Request $request, AuthenticationException $exception) + { + if (null === $this->options['failure_path']) { + $this->options['failure_path'] = $this->options['login_path']; + } + + if ($this->options['failure_forward']) { + if (null !== $this->logger) { + $this->logger->debug(sprintf('Forwarding to %s', $this->options['failure_path'])); + } + + $subRequest = $this->httpUtils->createRequest($request, $this->options['failure_path']); + $subRequest->attributes->set(SecurityContextInterface::AUTHENTICATION_ERROR, $exception); + + return $this->httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST); + } + + if (null !== $this->logger) { + $this->logger->debug(sprintf('Redirecting to %s', $this->options['failure_path'])); + } + + $request->getSession()->set(SecurityContextInterface::AUTHENTICATION_ERROR, $exception); + + return $this->httpUtils->createRedirectResponse($request, $this->options['failure_path']); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php new file mode 100644 index 0000000..66d6bda --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authentication/DefaultAuthenticationSuccessHandler.php @@ -0,0 +1,111 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Authentication; + +use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Http\HttpUtils; + +/** + * Class with the default authentication success handling logic. + * + * Can be optionally be extended from by the developer to alter the behaviour + * while keeping the default behaviour. + * + * @author Fabien Potencier + * @author Johannes M. Schmitt + * @author Alexander + */ +class DefaultAuthenticationSuccessHandler implements AuthenticationSuccessHandlerInterface +{ + protected $httpUtils; + protected $options; + protected $providerKey; + + /** + * Constructor. + * + * @param HttpUtils $httpUtils + * @param array $options Options for processing a successful authentication attempt. + */ + public function __construct(HttpUtils $httpUtils, array $options) + { + $this->httpUtils = $httpUtils; + + $this->options = array_merge(array( + 'always_use_default_target_path' => false, + 'default_target_path' => '/', + 'login_path' => '/login', + 'target_path_parameter' => '_target_path', + 'use_referer' => false, + ), $options); + } + + /** + * {@inheritDoc} + */ + public function onAuthenticationSuccess(Request $request, TokenInterface $token) + { + return $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request)); + } + + + /** + * Get the provider key. + * + * @return string + */ + public function getProviderKey() + { + return $this->providerKey; + } + + /** + * Set the provider key. + * + * @param string $providerKey + */ + public function setProviderKey($providerKey) + { + $this->providerKey = $providerKey; + } + + /** + * Builds the target URL according to the defined options. + * + * @param Request $request + * + * @return string + */ + protected function determineTargetUrl(Request $request) + { + if ($this->options['always_use_default_target_path']) { + return $this->options['default_target_path']; + } + + if ($targetUrl = $request->get($this->options['target_path_parameter'], null, true)) { + return $targetUrl; + } + + if (null !== $this->providerKey && $targetUrl = $request->getSession()->get('_security.'.$this->providerKey.'.target_path')) { + $request->getSession()->remove('_security.'.$this->providerKey.'.target_path'); + + return $targetUrl; + } + + if ($this->options['use_referer'] && ($targetUrl = $request->headers->get('Referer')) && $targetUrl !== $request->getUriForPath($this->options['login_path'])) { + return $targetUrl; + } + + return $this->options['default_target_path']; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php index 8670cbb..a10a5d0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Authorization/AccessDeniedHandlerInterface.php @@ -30,5 +30,5 @@ interface AccessDeniedHandlerInterface * * @return Response may return null */ - function handle(Request $request, AccessDeniedException $accessDeniedException); + public function handle(Request $request, AccessDeniedException $accessDeniedException); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php index 9fc3501..d190fc7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/EntryPoint/AuthenticationEntryPointInterface.php @@ -30,5 +30,5 @@ interface AuthenticationEntryPointInterface * * @return Response */ - function start(Request $request, AuthenticationException $authException = null); + public function start(Request $request, AuthenticationException $authException = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php index 1caaf0a..f752e84 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractAuthenticationListener.php @@ -70,14 +70,14 @@ abstract class AbstractAuthenticationListener implements ListenerInterface * @param SessionAuthenticationStrategyInterface $sessionStrategy * @param HttpUtils $httpUtils An HttpUtilsInterface instance * @param string $providerKey + * @param AuthenticationSuccessHandlerInterface $successHandler + * @param AuthenticationFailureHandlerInterface $failureHandler * @param array $options An array of options for the processing of a * successful, or failed authentication attempt - * @param AuthenticationSuccessHandlerInterface $successHandler - * @param AuthenticationFailureHandlerInterface $failureHandler - * @param LoggerInterface $logger A LoggerInterface instance - * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance + * @param LoggerInterface $logger A LoggerInterface instance + * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance */ - public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, array $options = array(), AuthenticationSuccessHandlerInterface $successHandler = null, AuthenticationFailureHandlerInterface $failureHandler = null, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) + public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null) { if (empty($providerKey)) { throw new \InvalidArgumentException('$providerKey must not be empty.'); @@ -91,13 +91,6 @@ abstract class AbstractAuthenticationListener implements ListenerInterface $this->failureHandler = $failureHandler; $this->options = array_merge(array( 'check_path' => '/login_check', - 'login_path' => '/login', - 'always_use_default_target_path' => false, - 'default_target_path' => '/', - 'target_path_parameter' => '_target_path', - 'use_referer' => false, - 'failure_path' => null, - 'failure_forward' => false, ), $options); $this->logger = $logger; $this->dispatcher = $dispatcher; @@ -119,7 +112,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface * * @param GetResponseEvent $event A GetResponseEvent instance */ - public final function handle(GetResponseEvent $event) + final public function handle(GetResponseEvent $event) { $request = $event->getRequest(); @@ -191,34 +184,13 @@ abstract class AbstractAuthenticationListener implements ListenerInterface $this->securityContext->setToken(null); - if (null !== $this->failureHandler) { - if (null !== $response = $this->failureHandler->onAuthenticationFailure($request, $failed)) { - return $response; - } + $response = $this->failureHandler->onAuthenticationFailure($request, $failed); + + if (!$response instanceof Response) { + throw new \RuntimeException('Authentication Failure Handler did not return a Response.'); } - if (null === $this->options['failure_path']) { - $this->options['failure_path'] = $this->options['login_path']; - } - - if ($this->options['failure_forward']) { - if (null !== $this->logger) { - $this->logger->debug(sprintf('Forwarding to %s', $this->options['failure_path'])); - } - - $subRequest = $this->httpUtils->createRequest($request, $this->options['failure_path']); - $subRequest->attributes->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed); - - return $event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST); - } - - if (null !== $this->logger) { - $this->logger->debug(sprintf('Redirecting to %s', $this->options['failure_path'])); - } - - $request->getSession()->set(SecurityContextInterface::AUTHENTICATION_ERROR, $failed); - - return $this->httpUtils->createRedirectResponse($request, $this->options['failure_path']); + return $response; } private function onSuccess(GetResponseEvent $event, Request $request, TokenInterface $token) @@ -238,12 +210,10 @@ abstract class AbstractAuthenticationListener implements ListenerInterface $this->dispatcher->dispatch(SecurityEvents::INTERACTIVE_LOGIN, $loginEvent); } - $response = null; - if (null !== $this->successHandler) { - $response = $this->successHandler->onAuthenticationSuccess($request, $token); - } - if (null === $response) { - $response = $this->httpUtils->createRedirectResponse($request, $this->determineTargetUrl($request)); + $response = $this->successHandler->onAuthenticationSuccess($request, $token); + + if (!$response instanceof Response) { + throw new \RuntimeException('Authentication Success Handler did not return a Response.'); } if (null !== $this->rememberMeServices) { @@ -252,35 +222,4 @@ abstract class AbstractAuthenticationListener implements ListenerInterface return $response; } - - /** - * Builds the target URL according to the defined options. - * - * @param Request $request - * - * @return string - */ - private function determineTargetUrl(Request $request) - { - if ($this->options['always_use_default_target_path']) { - return $this->options['default_target_path']; - } - - if ($targetUrl = $request->get($this->options['target_path_parameter'], null, true)) { - return $targetUrl; - } - - $session = $request->getSession(); - if ($targetUrl = $session->get('_security.' . $this->providerKey . '.target_path')) { - $session->remove('_security.' . $this->providerKey . '.target_path'); - - return $targetUrl; - } - - if ($this->options['use_referer'] && ($targetUrl = $request->headers->get('Referer')) && $targetUrl !== $request->getUriForPath($this->options['login_path'])) { - return $targetUrl; - } - - return $this->options['default_target_path']; - } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php index 66d0ea1..66041be 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/AbstractPreAuthenticatedListener.php @@ -51,7 +51,7 @@ abstract class AbstractPreAuthenticatedListener implements ListenerInterface * * @param GetResponseEvent $event A GetResponseEvent instance */ - public final function handle(GetResponseEvent $event) + final public function handle(GetResponseEvent $event) { $request = $event->getRequest(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php index 9a53827..f134f9c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php @@ -97,6 +97,8 @@ class ExceptionListener return; } } elseif ($exception instanceof AccessDeniedException) { + $event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception)); + $token = $this->context->getToken(); if (!$this->authenticationTrustResolver->isFullFledged($token)) { if (null !== $this->logger) { @@ -127,10 +129,7 @@ class ExceptionListener $subRequest->attributes->set(SecurityContextInterface::ACCESS_DENIED_ERROR, $exception); $response = $event->getKernel()->handle($subRequest, HttpKernelInterface::SUB_REQUEST, true); - $response->setStatusCode(403); } else { - $event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception)); - return; } } catch (\Exception $e) { @@ -148,8 +147,6 @@ class ExceptionListener $this->logger->info(sprintf('Logout exception occurred; wrapping with AccessDeniedHttpException (%s)', $exception->getMessage())); } - $event->setException(new AccessDeniedHttpException($exception->getMessage(), $exception)); - return; } else { return; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php index ccde86e..b670474 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/ListenerInterface.php @@ -25,5 +25,5 @@ interface ListenerInterface * * @param GetResponseEvent $event */ - function handle(GetResponseEvent $event); + public function handle(GetResponseEvent $event); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php index d145fa1..32a0511 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/LogoutListener.php @@ -40,11 +40,11 @@ class LogoutListener implements ListenerInterface * * @param SecurityContextInterface $securityContext * @param HttpUtils $httpUtils An HttpUtilsInterface instance - * @param array $options An array of options to process a logout attempt * @param LogoutSuccessHandlerInterface $successHandler A LogoutSuccessHandlerInterface instance + * @param array $options An array of options to process a logout attempt * @param CsrfProviderInterface $csrfProvider A CsrfProviderInterface instance */ - public function __construct(SecurityContextInterface $securityContext, HttpUtils $httpUtils, array $options = array(), LogoutSuccessHandlerInterface $successHandler = null, CsrfProviderInterface $csrfProvider = null) + public function __construct(SecurityContextInterface $securityContext, HttpUtils $httpUtils, LogoutSuccessHandlerInterface $successHandler, array $options = array(), CsrfProviderInterface $csrfProvider = null) { $this->securityContext = $securityContext; $this->httpUtils = $httpUtils; @@ -52,7 +52,6 @@ class LogoutListener implements ListenerInterface 'csrf_parameter' => '_csrf_token', 'intention' => 'logout', 'logout_path' => '/logout', - 'target_url' => '/', ), $options); $this->successHandler = $successHandler; $this->csrfProvider = $csrfProvider; @@ -95,14 +94,9 @@ class LogoutListener implements ListenerInterface } } - if (null !== $this->successHandler) { - $response = $this->successHandler->onLogoutSuccess($request); - - if (!$response instanceof Response) { - throw new \RuntimeException('Logout Success Handler did not return a Response.'); - } - } else { - $response = $this->httpUtils->createRedirectResponse($request, $this->options['target_url']); + $response = $this->successHandler->onLogoutSuccess($request); + if (!$response instanceof Response) { + throw new \RuntimeException('Logout Success Handler did not return a Response.'); } // handle multiple logout attempts gracefully diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php index 35b0b11..22330a8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Firewall/UsernamePasswordFormAuthenticationListener.php @@ -37,15 +37,15 @@ class UsernamePasswordFormAuthenticationListener extends AbstractAuthenticationL /** * {@inheritdoc} */ - public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, array $options = array(), AuthenticationSuccessHandlerInterface $successHandler = null, AuthenticationFailureHandlerInterface $failureHandler = null, LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, CsrfProviderInterface $csrfProvider = null) + public function __construct(SecurityContextInterface $securityContext, AuthenticationManagerInterface $authenticationManager, SessionAuthenticationStrategyInterface $sessionStrategy, HttpUtils $httpUtils, $providerKey, AuthenticationSuccessHandlerInterface $successHandler, AuthenticationFailureHandlerInterface $failureHandler, array $options = array(), LoggerInterface $logger = null, EventDispatcherInterface $dispatcher = null, CsrfProviderInterface $csrfProvider = null) { - parent::__construct($securityContext, $authenticationManager, $sessionStrategy, $httpUtils, $providerKey, array_merge(array( + parent::__construct($securityContext, $authenticationManager, $sessionStrategy, $httpUtils, $providerKey, $successHandler, $failureHandler, array_merge(array( 'username_parameter' => '_username', 'password_parameter' => '_password', 'csrf_parameter' => '_csrf_token', 'intention' => 'authenticate', 'post_only' => true, - ), $options), $successHandler, $failureHandler, $logger, $dispatcher); + ), $options), $logger, $dispatcher); $this->csrfProvider = $csrfProvider; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/FirewallMapInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/FirewallMapInterface.php index 5a42ff1..336125f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/FirewallMapInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/FirewallMapInterface.php @@ -34,5 +34,5 @@ interface FirewallMapInterface * * @return array of the format array(array(AuthenticationListener), ExceptionListener) */ - function getListeners(Request $request); + public function getListeners(Request $request); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/DefaultLogoutSuccessHandler.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/DefaultLogoutSuccessHandler.php new file mode 100644 index 0000000..e06cb6d --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/DefaultLogoutSuccessHandler.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Security\Http\Logout; + +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Security\Http\HttpUtils; +use Symfony\Component\Security\Http\Logout\LogoutSuccessHandlerInterface; + +/** + * Default logout success handler will redirect users to a configured path. + * + * @author Fabien Potencier + * @author Alexander + */ +class DefaultLogoutSuccessHandler implements LogoutSuccessHandlerInterface +{ + protected $httpUtils; + protected $targetUrl; + + /** + * @param HttpUtils $httpUtils + * @param string $targetUrl + */ + public function __construct(HttpUtils $httpUtils, $targetUrl = '/') + { + $this->httpUtils = $httpUtils; + + $this->targetUrl = $targetUrl; + } + + /** + * {@inheritDoc} + */ + public function onLogoutSuccess(Request $request) + { + return $this->httpUtils->createRedirectResponse($request, $this->targetUrl); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/LogoutHandlerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/LogoutHandlerInterface.php index 71be388..5e1cea8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/LogoutHandlerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/LogoutHandlerInterface.php @@ -31,5 +31,5 @@ interface LogoutHandlerInterface * @param Response $response * @param TokenInterface $token */ - function logout(Request $request, Response $response, TokenInterface $token); + public function logout(Request $request, Response $response, TokenInterface $token); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php index fb1dd64..61642a8 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Logout/LogoutSuccessHandlerInterface.php @@ -33,5 +33,5 @@ interface LogoutSuccessHandlerInterface * * @return Response never null */ - function onLogoutSuccess(Request $request); + public function onLogoutSuccess(Request $request); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php index d61a6ce..4f7c5b9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php @@ -91,7 +91,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface * * @return TokenInterface */ - public final function autoLogin(Request $request) + final public function autoLogin(Request $request) { if (null === $cookie = $request->cookies->get($this->options['name'])) { return; @@ -156,7 +156,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface * * @param Request $request */ - public final function loginFail(Request $request) + final public function loginFail(Request $request) { $this->cancelCookie($request); $this->onLoginFail($request); @@ -170,7 +170,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface * @param Response $response * @param TokenInterface $token The token that resulted in a successful authentication */ - public final function loginSuccess(Request $request, Response $response, TokenInterface $token) + final public function loginSuccess(Request $request, Response $response, TokenInterface $token) { if (!$token->getUser() instanceof UserInterface) { if (null !== $this->logger) { @@ -221,7 +221,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface */ abstract protected function onLoginSuccess(Request $request, Response $response, TokenInterface $token); - protected final function getUserProvider($class) + final protected function getUserProvider($class) { foreach ($this->userProviders as $provider) { if ($provider->supportsClass($class)) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php index 0497c69..a00dcef 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/RememberMe/RememberMeServicesInterface.php @@ -51,7 +51,7 @@ interface RememberMeServicesInterface * * @return TokenInterface */ - function autoLogin(Request $request); + public function autoLogin(Request $request); /** * Called whenever an interactive authentication attempt was made, but the @@ -61,7 +61,7 @@ interface RememberMeServicesInterface * * @param Request $request */ - function loginFail(Request $request); + public function loginFail(Request $request); /** * Called whenever an interactive authentication attempt is successful @@ -78,5 +78,5 @@ interface RememberMeServicesInterface * @param Response $response * @param TokenInterface $token */ - function loginSuccess(Request $request, Response $response, TokenInterface $token); + public function loginSuccess(Request $request, Response $response, TokenInterface $token); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php index 34f5089..2bc292b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Http/Session/SessionAuthenticationStrategyInterface.php @@ -33,5 +33,5 @@ interface SessionAuthenticationStrategyInterface * @param Request $request * @param TokenInterface $token */ - function onAuthentication(Request $request, TokenInterface $token); + public function onAuthentication(Request $request, TokenInterface $token); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/SecurityIdentityRetrievalStrategyTest.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/SecurityIdentityRetrievalStrategyTest.php index 2083728..f649653 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/SecurityIdentityRetrievalStrategyTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Acl/Domain/SecurityIdentityRetrievalStrategyTest.php @@ -116,7 +116,6 @@ class SecurityIdentityRetrievalStrategyTest extends \PHPUnit_Framework_TestCase ->will($this->returnValue($username)) ; - return $account; } @@ -177,7 +176,6 @@ class SecurityIdentityRetrievalStrategyTest extends \PHPUnit_Framework_TestCase ; } - return new SecurityIdentityRetrievalStrategy($roleHierarchy, $trustResolver); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php index 8bff354..4da0337 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Core/Authentication/Provider/DaoAuthenticationProviderTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Security\Tests\Core\Authentication\Provider; - use Symfony\Component\Security\Core\Encoder\PlaintextPasswordEncoder; use Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Http/Firewall/LogoutListenerTest.php b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Http/Firewall/LogoutListenerTest.php index 6ffeed9..aa0f5a7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Http/Firewall/LogoutListenerTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Security/Tests/Http/Firewall/LogoutListenerTest.php @@ -103,7 +103,9 @@ class LogoutListenerTest extends \PHPUnit_Framework_TestCase public function testHandleMatchedPathWithoutSuccessHandlerAndCsrfValidation() { - list($listener, $context, $httpUtils, $options) = $this->getListener(); + $successHandler = $this->getSuccessHandler(); + + list($listener, $context, $httpUtils, $options) = $this->getListener($successHandler); list($event, $request) = $this->getGetResponseEvent(); @@ -112,9 +114,9 @@ class LogoutListenerTest extends \PHPUnit_Framework_TestCase ->with($request, $options['logout_path']) ->will($this->returnValue(true)); - $httpUtils->expects($this->once()) - ->method('createRedirectResponse') - ->with($request, $options['target_url']) + $successHandler->expects($this->once()) + ->method('onLogoutSuccess') + ->with($request) ->will($this->returnValue($response = new Response())); $context->expects($this->once()) @@ -231,13 +233,13 @@ class LogoutListenerTest extends \PHPUnit_Framework_TestCase $listener = new LogoutListener( $context = $this->getContext(), $httpUtils = $this->getHttpUtils(), + $successHandler ?: $this->getSuccessHandler(), $options = array( 'csrf_parameter' => '_csrf_token', 'intention' => 'logout', 'logout_path' => '/logout', 'target_url' => '/', ), - $successHandler, $csrfProvider ); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php new file mode 100644 index 0000000..f555c6a --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/ChainDecoder.php @@ -0,0 +1,82 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Encoder; + +use Symfony\Component\Serializer\Encoder\DecoderInterface; +use Symfony\Component\Serializer\Exception\RuntimeException; + +/** + * Decoder delegating the decoding to a chain of decoders. + * + * @author Jordi Boggiano + * @author Johannes M. Schmitt + * @author Lukas Kahwe Smith + */ +class ChainDecoder implements DecoderInterface +{ + protected $decoders = array(); + protected $decoderByFormat = array(); + + public function __construct(array $decoders = array()) + { + $this->decoders = $decoders; + } + + /** + * {@inheritdoc} + */ + final public function decode($data, $format) + { + return $this->getDecoder($format)->decode($data, $format); + } + + /** + * {@inheritdoc} + */ + public function supportsDecoding($format) + { + try { + $this->getDecoder($format); + } catch (RuntimeException $e) { + return false; + } + + return true; + } + + /** + * Gets the decoder supporting the format. + * + * @param string $format + * + * @return DecoderInterface + * @throws RuntimeException if no decoder is found + */ + private function getDecoder($format) + { + if (isset($this->decoderByFormat[$format]) + && isset($this->decoders[$this->decoderByFormat[$format]]) + ) { + return $this->decoders[$this->decoderByFormat[$format]]; + } + + foreach ($this->decoders as $i => $decoder) { + if ($decoder->supportsDecoding($format)) { + $this->decoderByFormat[$format] = $i; + + return $decoder; + } + } + + throw new RuntimeException(sprintf('No decoder found for format "%s".', $format)); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php new file mode 100644 index 0000000..ebb81ef --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/ChainEncoder.php @@ -0,0 +1,105 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Encoder; + +use Symfony\Component\Serializer\Encoder\EncoderInterface; +use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface; +use Symfony\Component\Serializer\Exception\RuntimeException; + +/** + * Encoder delegating the decoding to a chain of encoders. + * + * @author Jordi Boggiano + * @author Johannes M. Schmitt + * @author Lukas Kahwe Smith + */ +class ChainEncoder implements EncoderInterface +{ + protected $encoders = array(); + protected $encoderByFormat = array(); + + public function __construct(array $encoders = array()) + { + $this->encoders = $encoders; + } + + /** + * {@inheritdoc} + */ + final public function encode($data, $format) + { + return $this->getEncoder($format)->encode($data, $format); + } + + /** + * {@inheritdoc} + */ + public function supportsEncoding($format) + { + try { + $this->getEncoder($format); + } catch (RuntimeException $e) { + return false; + } + + return true; + } + + /** + * Checks whether the normalization is needed for the given format. + * + * @param string $format + * + * @return Boolean + */ + public function needsNormalization($format) + { + $encoder = $this->getEncoder($format); + + if (!$encoder instanceof NormalizationAwareInterface) { + return true; + } + + if ($encoder instanceof self) { + return $encoder->needsNormalization($format); + } + + return false; + } + + /** + * Gets the encoder supporting the format. + * + * @param string $format + * + * @return EncoderInterface + * @throws RuntimeException if no encoder is found + */ + private function getEncoder($format) + { + if (isset($this->encoderByFormat[$format]) + && isset($this->encoders[$this->encoderByFormat[$format]]) + ) { + return $this->encoders[$this->encoderByFormat[$format]]; + } + + foreach ($this->encoders as $i => $encoder) { + if ($encoder->supportsEncoding($format)) { + $this->encoderByFormat[$format] = $i; + + return $encoder; + } + } + + throw new RuntimeException(sprintf('No encoder found for format "%s".', $format)); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php index f312b3b..21a3678 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/DecoderInterface.php @@ -26,7 +26,7 @@ interface DecoderInterface * * @return mixed */ - function decode($data, $format); + public function decode($data, $format); /** * Checks whether the serializer can decode from given format @@ -34,5 +34,5 @@ interface DecoderInterface * @param string $format format name * @return Boolean */ - function supportsDecoding($format); + public function supportsDecoding($format); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php index 302db2f..b4739ed 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Encoder/EncoderInterface.php @@ -26,7 +26,7 @@ interface EncoderInterface * * @return scalar */ - function encode($data, $format); + public function encode($data, $format); /** * Checks whether the serializer can encode to given format @@ -34,5 +34,5 @@ interface EncoderInterface * @param string $format format name * @return Boolean */ - function supportsEncoding($format); + public function supportsEncoding($format); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php index e53b095..3f3bf88 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/DenormalizableInterface.php @@ -33,5 +33,5 @@ interface DenormalizableInterface * @param string|null $format The format is optionally given to be able to denormalize differently * based on different input formats. */ - function denormalize(DenormalizerInterface $denormalizer, $data, $format = null); + public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php index b7e7354..7c4fd4f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/DenormalizerInterface.php @@ -26,7 +26,7 @@ interface DenormalizerInterface * @param string $format format the given data was extracted from * @return object */ - function denormalize($data, $class, $format = null); + public function denormalize($data, $class, $format = null); /** * Checks whether the given class is supported for denormalization by this normalizer @@ -36,5 +36,5 @@ interface DenormalizerInterface * @param string $format The format being deserialized from. * @return Boolean */ - function supportsDenormalization($data, $type, $format = null); + public function supportsDenormalization($data, $type, $format = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php index 71ae28b..b7b8e51 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/NormalizableInterface.php @@ -33,5 +33,5 @@ interface NormalizableInterface * based on different output formats. * @return array|scalar */ - function normalize(NormalizerInterface $normalizer, $format = null); + public function normalize(NormalizerInterface $normalizer, $format = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php index 4ca8609..7b90d18 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/NormalizerInterface.php @@ -25,7 +25,7 @@ interface NormalizerInterface * @param string $format format the normalization result will be encoded as * @return array|scalar */ - function normalize($object, $format = null); + public function normalize($object, $format = null); /** * Checks whether the given class is supported for normalization by this normalizer @@ -34,5 +34,5 @@ interface NormalizerInterface * @param string $format The format being (de-)serialized from or into. * @return Boolean */ - function supportsNormalization($data, $format = null); + public function supportsNormalization($data, $format = null); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php index df9dd63..f2c513b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Serializer.php @@ -11,9 +11,10 @@ namespace Symfony\Component\Serializer; +use Symfony\Component\Serializer\Encoder\ChainDecoder; +use Symfony\Component\Serializer\Encoder\ChainEncoder; use Symfony\Component\Serializer\Encoder\EncoderInterface; use Symfony\Component\Serializer\Encoder\DecoderInterface; -use Symfony\Component\Serializer\Encoder\NormalizationAwareInterface; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; use Symfony\Component\Serializer\Exception\RuntimeException; @@ -36,12 +37,11 @@ use Symfony\Component\Serializer\Exception\UnexpectedValueException; */ class Serializer implements SerializerInterface, NormalizerInterface, DenormalizerInterface, EncoderInterface, DecoderInterface { + protected $encoder; + protected $decoder; protected $normalizers = array(); - protected $encoders = array(); protected $normalizerCache = array(); protected $denormalizerCache = array(); - protected $encoderByFormat = array(); - protected $decoderByFormat = array(); public function __construct(array $normalizers = array(), array $encoders = array()) { @@ -52,26 +52,33 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz } $this->normalizers = $normalizers; + $decoders = array(); + $realEncoders = array(); foreach ($encoders as $encoder) { if ($encoder instanceof SerializerAwareInterface) { $encoder->setSerializer($this); } + if ($encoder instanceof DecoderInterface) { + $decoders[] = $encoder; + } + if ($encoder instanceof EncoderInterface) { + $realEncoders[] = $encoder; + } } - $this->encoders = $encoders; + $this->encoder = new ChainEncoder($realEncoders); + $this->decoder = new ChainDecoder($decoders); } /** * {@inheritdoc} */ - public final function serialize($data, $format) + final public function serialize($data, $format) { if (!$this->supportsEncoding($format)) { throw new UnexpectedValueException('Serialization for the format '.$format.' is not supported'); } - $encoder = $this->getEncoder($format); - - if (!$encoder instanceof NormalizationAwareInterface) { + if ($this->encoder->needsNormalization($format)) { $data = $this->normalize($data, $format); } @@ -81,7 +88,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz /** * {@inheritdoc} */ - public final function deserialize($data, $type, $format) + final public function deserialize($data, $type, $format) { if (!$this->supportsDecoding($format)) { throw new UnexpectedValueException('Deserialization for the format '.$format.' is not supported'); @@ -195,17 +202,17 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz /** * {@inheritdoc} */ - public final function encode($data, $format) + final public function encode($data, $format) { - return $this->getEncoder($format)->encode($data, $format); + return $this->encoder->encode($data, $format); } /** * {@inheritdoc} */ - public final function decode($data, $format) + final public function decode($data, $format) { - return $this->getEncoder($format)->decode($data, $format); + return $this->decoder->decode($data, $format); } /** @@ -271,13 +278,7 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz */ public function supportsEncoding($format) { - try { - $this->getEncoder($format); - } catch (RuntimeException $e) { - return false; - } - - return true; + return $this->encoder->supportsEncoding($format); } /** @@ -285,60 +286,6 @@ class Serializer implements SerializerInterface, NormalizerInterface, Denormaliz */ public function supportsDecoding($format) { - try { - $this->getDecoder($format); - } catch (RuntimeException $e) { - return false; - } - - return true; - } - - /** - * {@inheritdoc} - */ - private function getEncoder($format) - { - if (isset($this->encoderByFormat[$format]) - && isset($this->encoders[$this->encoderByFormat[$format]]) - ) { - return $this->encoders[$this->encoderByFormat[$format]]; - } - - foreach ($this->encoders as $i => $encoder) { - if ($encoder instanceof EncoderInterface - && $encoder->supportsEncoding($format) - ) { - $this->encoderByFormat[$format] = $i; - - return $encoder; - } - } - - throw new RuntimeException(sprintf('No encoder found for format "%s".', $format)); - } - - /** - * {@inheritdoc} - */ - private function getDecoder($format) - { - if (isset($this->decoderByFormat[$format]) - && isset($this->encoders[$this->decoderByFormat[$format]]) - ) { - return $this->encoders[$this->decoderByFormat[$format]]; - } - - foreach ($this->encoders as $i => $encoder) { - if ($encoder instanceof DecoderInterface - && $encoder->supportsDecoding($format) - ) { - $this->decoderByFormat[$format] = $i; - - return $encoder; - } - } - - throw new RuntimeException(sprintf('No decoder found for format "%s".', $format)); + return $this->decoder->supportsDecoding($format); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/SerializerAwareInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/SerializerAwareInterface.php index d589e8d..dd0bb60 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/SerializerAwareInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/SerializerAwareInterface.php @@ -25,5 +25,5 @@ interface SerializerAwareInterface * * @param SerializerInterface $serializer */ - function setSerializer(SerializerInterface $serializer); + public function setSerializer(SerializerInterface $serializer); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/SerializerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/SerializerInterface.php index 9e2ac98..f187959 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/SerializerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/SerializerInterface.php @@ -25,7 +25,7 @@ interface SerializerInterface * @param string $format format name * @return string */ - function serialize($data, $format); + public function serialize($data, $format); /** * Deserializes data into the given type. @@ -34,5 +34,5 @@ interface SerializerInterface * @param string $type * @param string $format */ - function deserialize($data, $type, $format); + public function deserialize($data, $type, $format); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php index b510a37..468d444 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Serializer/Tests/Fixtures/DenormalizableDummy.php @@ -17,7 +17,7 @@ use Symfony\Component\Serializer\Normalizer\DenormalizerInterface; class DenormalizableDummy implements DenormalizableInterface { - function denormalize(DenormalizerInterface $denormalizer, $data, $format = null) + public function denormalize(DenormalizerInterface $denormalizer, $data, $format = null) { } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/Asset/PackageInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/Asset/PackageInterface.php index a3dcde9..a9ec65a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/Asset/PackageInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/Asset/PackageInterface.php @@ -23,7 +23,7 @@ interface PackageInterface * * @return string The version string */ - function getVersion(); + public function getVersion(); /** * Returns an absolute or root-relative public path. @@ -32,5 +32,5 @@ interface PackageInterface * * @return string The public path */ - function getUrl($path); + public function getUrl($path); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/DebuggerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/DebuggerInterface.php index 93e3f45..4302662 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/DebuggerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/DebuggerInterface.php @@ -24,5 +24,5 @@ interface DebuggerInterface * * @param string $message A message to log */ - function log($message); + public function log($message); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/EngineInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/EngineInterface.php index 3f3e29c..dfa9c55 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/EngineInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/EngineInterface.php @@ -44,7 +44,7 @@ interface EngineInterface * * @api */ - function render($name, array $parameters = array()); + public function render($name, array $parameters = array()); /** * Returns true if the template exists. @@ -55,7 +55,7 @@ interface EngineInterface * * @api */ - function exists($name); + public function exists($name); /** * Returns true if this class is able to render the given template. @@ -66,5 +66,5 @@ interface EngineInterface * * @api */ - function supports($name); + public function supports($name); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/Helper/HelperInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/Helper/HelperInterface.php index 650a83d..eeb6730 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/Helper/HelperInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/Helper/HelperInterface.php @@ -27,7 +27,7 @@ interface HelperInterface * * @api */ - function getName(); + public function getName(); /** * Sets the default charset. @@ -36,7 +36,7 @@ interface HelperInterface * * @api */ - function setCharset($charset); + public function setCharset($charset); /** * Gets the default charset. @@ -45,5 +45,5 @@ interface HelperInterface * * @api */ - function getCharset(); + public function getCharset(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/FilesystemLoader.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/FilesystemLoader.php index 3f3d4c2..d5cf32a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/FilesystemLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/FilesystemLoader.php @@ -108,7 +108,7 @@ class FilesystemLoader extends Loader * * @return true if the path exists and is absolute, false otherwise */ - static protected function isAbsolutePath($file) + protected static function isAbsolutePath($file) { if ($file[0] == '/' || $file[0] == '\\' || (strlen($file) > 3 && ctype_alpha($file[0]) diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/LoaderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/LoaderInterface.php index 0e5192c..4b6d525 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/LoaderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/Loader/LoaderInterface.php @@ -31,7 +31,7 @@ interface LoaderInterface * * @api */ - function load(TemplateReferenceInterface $template); + public function load(TemplateReferenceInterface $template); /** * Returns true if the template is still fresh. @@ -43,5 +43,5 @@ interface LoaderInterface * * @api */ - function isFresh(TemplateReferenceInterface $template, $time); + public function isFresh(TemplateReferenceInterface $template, $time); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/StreamingEngineInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/StreamingEngineInterface.php index 4b6b303..2911949 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/StreamingEngineInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/StreamingEngineInterface.php @@ -28,5 +28,5 @@ interface StreamingEngineInterface * * @throws \RuntimeException if the template cannot be rendered */ - function stream($name, array $parameters = array()); + public function stream($name, array $parameters = array()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/TemplateNameParserInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/TemplateNameParserInterface.php index bdc4065..6305f43 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/TemplateNameParserInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/TemplateNameParserInterface.php @@ -30,5 +30,5 @@ interface TemplateNameParserInterface * * @api */ - function parse($name); + public function parse($name); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/TemplateReferenceInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/TemplateReferenceInterface.php index 0f04742..60c910a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/TemplateReferenceInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/TemplateReferenceInterface.php @@ -27,7 +27,7 @@ interface TemplateReferenceInterface * * @api */ - function all(); + public function all(); /** * Sets a template parameter. @@ -41,7 +41,7 @@ interface TemplateReferenceInterface * * @api */ - function set($name, $value); + public function set($name, $value); /** * Gets a template parameter. @@ -54,7 +54,7 @@ interface TemplateReferenceInterface * * @api */ - function get($name); + public function get($name); /** * Returns the path to the template. @@ -65,7 +65,7 @@ interface TemplateReferenceInterface * * @api */ - function getPath(); + public function getPath(); /** * Returns the "logical" template name. @@ -76,5 +76,5 @@ interface TemplateReferenceInterface * * @api */ - function getLogicalName(); + public function getLogicalName(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php index 7985de1..3168a62 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Templating/Tests/Loader/FilesystemLoaderTest.php @@ -17,9 +17,9 @@ use Symfony\Component\Templating\TemplateReference; class FilesystemLoaderTest extends \PHPUnit_Framework_TestCase { - static protected $fixturesPath; + protected static $fixturesPath; - static public function setUpBeforeClass() + public static function setUpBeforeClass() { self::$fixturesPath = realpath(__DIR__.'/../Fixtures/'); } @@ -78,7 +78,7 @@ class ProjectTemplateLoader2 extends FilesystemLoader return $this->templatePathPatterns; } - static public function isAbsolutePath($path) + public static function isAbsolutePath($path) { return parent::isAbsolutePath($path); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/Translation/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Dumper/DumperInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Dumper/DumperInterface.php index 148b082..cebc65e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Dumper/DumperInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Dumper/DumperInterface.php @@ -27,5 +27,5 @@ interface DumperInterface * @param MessageCatalogue $messages The message catalogue * @param array $options Options that are used by the dumper */ - function dump(MessageCatalogue $messages, $options = array()); + public function dump(MessageCatalogue $messages, $options = array()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php index d0a20ed..270817e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Dumper/IcuResFileDumper.php @@ -113,7 +113,7 @@ class IcuResFileDumper implements DumperInterface { $padding = strlen($data) % 4; - if ($padding ) { + if ($padding) { return str_repeat("\xAA", 4 - $padding); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php index 5378a66..6f877c3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Extractor/ExtractorInterface.php @@ -27,12 +27,12 @@ interface ExtractorInterface * @param string $directory The path to look into * @param MessageCatalogue $catalogue The catalogue */ - function extract($directory, MessageCatalogue $catalogue); + public function extract($directory, MessageCatalogue $catalogue); /** * Sets the prefix that should be used for new found messages. * * @param string $prefix The prefix */ - function setPrefix($prefix); + public function setPrefix($prefix); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/Interval.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/Interval.php index 078e1a4..34532c1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/Interval.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/Interval.php @@ -39,7 +39,7 @@ class Interval * @param integer $number A number * @param string $interval An interval */ - static public function test($number, $interval) + public static function test($number, $interval) { $interval = trim($interval); @@ -71,7 +71,7 @@ class Interval * * @return string A Regexp (without the delimiters) */ - static public function getIntervalRegexp() + public static function getIntervalRegexp() { return << + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Translation\Tests; + +use Symfony\Component\Translation\PluralizationRules; + +/** + * Test should cover all languages mentioned on http://translate.sourceforge.net/wiki/l10n/pluralforms + * and Plural forms mentioned on http://www.gnu.org/software/gettext/manual/gettext.html#Plural-forms + * + * See also https://developer.mozilla.org/en/Localization_and_Plurals which mentions 15 rules having a maximum of 6 forms. + * The mozilla code is also interesting to check for. + * + * As mentioned by chx http://drupal.org/node/1273968 we can cover all by testing number from 0 to 199 + * + * The goal to cover all languagues is to far fetched so this test case is smaller. + * + * @author Clemens Tolboom clemens@build2be.nl + */ +class PluralizationRulesTest extends \PHPUnit_Framework_TestCase +{ + + /** + * We test failed langcode here. + * + * TODO: The languages mentioned in the data provide need to get fixed somehow within PluralizationRules. + * + * @dataProvider failingLangcodes + */ + public function testFailedLangcodes($nplural, $langCodes) + { + $matrix = $this->generateTestData($nplural, $langCodes); + $this->validateMatrix($nplural, $matrix, false); + } + + /** + * @dataProvider successLangcodes + */ + public function testLangcodes($nplural, $langCodes) + { + $matrix = $this->generateTestData($nplural, $langCodes); + $this->validateMatrix($nplural, $matrix); + } + + /** + * This array should contain all currently known langcodes. + * + * As it is impossible to have this ever complete we should try as hard as possible to have it almost complete. + * + * @return type + */ + public function successLangcodes() + { + return array( + array('1' , array('ay','bo', 'cgg','dz','id', 'ja', 'jbo', 'ka','kk','km','ko','ky')), + array('2' , array('nl', 'fr', 'en', 'de', 'de_GE')), + array('3' , array('be','bs','cs','hr')), + array('4' , array('cy','mt', 'sl')), + array('5' , array()), + array('6' , array('ar')), + ); + } + + /** + * This array should be at least empty within the near future. + * + * This both depends on a complete list trying to add above as understanding + * the plural rules of the current failing languages. + * + * @return array with nplural together with langcodes + */ + public function failingLangcodes() + { + return array( + array('1' , array('fa')), + array('2' , array('jbo')), + array('3' , array('cbs')), + array('4' , array('gd','kw')), + array('5' , array('ga')), + array('6' , array()), + ); + } + + /** + * We validate only on the plural coverage. Thus the real rules is not tested. + * + * @param string $nplural plural expected + * @param array $matrix containing langcodes and their plural index values. + * @param boolean $expectSuccess + */ + protected function validateMatrix($nplural, $matrix, $expectSuccess = true) + { + foreach ($matrix as $langCode => $data) { + $indexes = array_flip($data); + if ($expectSuccess) { + $this->assertEquals($nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); + } else { + $this->assertNotEquals((int) $nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); + } + } + } + + protected function generateTestData($plural, $langCodes) + { + $matrix = array(); + foreach ($langCodes as $langCode) { + for ($count=0; $count<200; $count++) { + $plural = PluralizationRules::get($count, $langCode); + $matrix[$langCode][$count] = $plural; + } + } + + return $matrix; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Translation/TranslatorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Translation/TranslatorInterface.php index 5c53d0d..2d75cf6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Translation/TranslatorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Translation/TranslatorInterface.php @@ -32,7 +32,7 @@ interface TranslatorInterface * * @api */ - function trans($id, array $parameters = array(), $domain = null, $locale = null); + public function trans($id, array $parameters = array(), $domain = null, $locale = null); /** * Translates the given choice message by choosing a translation according to a number. @@ -47,7 +47,7 @@ interface TranslatorInterface * * @api */ - function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null); + public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null); /** * Sets the current locale. @@ -56,7 +56,7 @@ interface TranslatorInterface * * @api */ - function setLocale($locale); + public function setLocale($locale); /** * Returns the current locale. @@ -65,5 +65,5 @@ interface TranslatorInterface * * @api */ - function getLocale(); + public function getLocale(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/.gitignore b/vendor/symfony/symfony/src/Symfony/Component/Validator/.gitignore new file mode 100644 index 0000000..d1502b0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/.gitignore @@ -0,0 +1,2 @@ +vendor/ +composer.lock diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/CHANGELOG.md b/vendor/symfony/symfony/src/Symfony/Component/Validator/CHANGELOG.md index 43d895d..dbc3e0b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/CHANGELOG.md +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/CHANGELOG.md @@ -5,8 +5,6 @@ CHANGELOG ----- * added support for `ctype_*` assertions in `TypeValidator` - * added a Range validator for numeric values - * added a Size validator for string & collections * improved the ImageValidator with min width, max width, min height, and max height constraints * added support for MIME with wildcard in FileValidator * changed Collection validator to add "missing" and "extra" errors to @@ -23,3 +21,8 @@ CHANGELOG * [BC BREAK] collections in fields annotated with `Valid` are not traversed recursively anymore by default. `Valid` contains a new property `deep` which enables the BC behavior. + * added Count constraint + * added Length constraint + * deprecated the Size constraint and renamed it to Range + * deprecated the Min and Max constraints + * deprecated the MinLength and MaxLength constraints diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php index 88d55ce..584f980 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintValidatorFactoryInterface.php @@ -27,5 +27,5 @@ interface ConstraintValidatorFactoryInterface * * @return ConstraintValidatorInterface */ - function getInstance(Constraint $constraint); + public function getInstance(Constraint $constraint); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintValidatorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintValidatorInterface.php index d4995a1..c66bea7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintValidatorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintValidatorInterface.php @@ -23,7 +23,7 @@ interface ConstraintValidatorInterface * * @param ExecutionContext $context The current validation context */ - function initialize(ExecutionContext $context); + public function initialize(ExecutionContext $context); /** * Checks if the passed value is valid. @@ -33,5 +33,5 @@ interface ConstraintValidatorInterface * * @api */ - function validate($value, Constraint $constraint); + public function validate($value, Constraint $constraint); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintViolationList.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintViolationList.php index ec248ac..0f19ffa 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintViolationList.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/ConstraintViolationList.php @@ -193,5 +193,4 @@ class ConstraintViolationList implements \IteratorAggregate, \Countable, \ArrayA { $this->remove($offset); } - } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/All.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/All.php index d90441b..612aaf2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/All.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/All.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** * @Annotation @@ -22,6 +23,28 @@ class All extends Constraint { public $constraints = array(); + /** + * {@inheritDoc} + */ + public function __construct($options = null) + { + parent::__construct($options); + + if (!is_array($this->constraints)) { + $this->constraints = array($this->constraints); + } + + foreach ($this->constraints as $constraint) { + if (!$constraint instanceof Constraint) { + throw new ConstraintDefinitionException('The value ' . $constraint . ' is not an instance of Constraint in constraint ' . __CLASS__); + } + + if ($constraint instanceof Valid) { + throw new ConstraintDefinitionException('The constraint Valid cannot be nested inside constraint ' . __CLASS__ . '. You can only declare the Valid constraint directly on a field or method.'); + } + } + } + public function getDefaultOption() { return 'constraints'; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/AllValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/AllValidator.php index d99d454..622a90b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/AllValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/AllValidator.php @@ -23,12 +23,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class AllValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { @@ -44,12 +39,8 @@ class AllValidator extends ConstraintValidator $group = $this->context->getGroup(); $propertyPath = $this->context->getPropertyPath(); - // cannot simply cast to array, because then the object is converted to an - // array instead of wrapped inside - $constraints = is_array($constraint->constraints) ? $constraint->constraints : array($constraint->constraints); - foreach ($value as $key => $element) { - foreach ($constraints as $constr) { + foreach ($constraint->constraints as $constr) { $walker->walkConstraint($constr, $element, $group, $propertyPath.'['.$key.']'); } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/BlankValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/BlankValidator.php index df6ecf2..0a67358 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/BlankValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/BlankValidator.php @@ -22,12 +22,7 @@ use Symfony\Component\Validator\ConstraintValidator; class BlankValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CallbackValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CallbackValidator.php index 5ff4555..ab3c56f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CallbackValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CallbackValidator.php @@ -26,12 +26,7 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException; class CallbackValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $object The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($object, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php index 2e3e186..96e2833 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/ChoiceValidator.php @@ -28,12 +28,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class ChoiceValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Collection.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Collection.php index c2c6a06..b618b41 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Collection.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Collection.php @@ -12,6 +12,9 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Constraints\Collection\Required; +use Symfony\Component\Validator\Constraints\Collection\Optional; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** * @Annotation @@ -38,6 +41,30 @@ class Collection extends Constraint } parent::__construct($options); + + if (!is_array($this->fields)) { + throw new ConstraintDefinitionException('The option "fields" is expected to be an array in constraint ' . __CLASS__); + } + + foreach ($this->fields as $fieldName => $field) { + if (!$field instanceof Optional && !$field instanceof Required) { + $this->fields[$fieldName] = $field = new Required($field); + } + + if (!is_array($field->constraints)) { + $field->constraints = array($field->constraints); + } + + foreach ($field->constraints as $constraint) { + if (!$constraint instanceof Constraint) { + throw new ConstraintDefinitionException('The value ' . $constraint . ' of the field ' . $fieldName . ' is not an instance of Constraint in constraint ' . __CLASS__); + } + + if ($constraint instanceof Valid) { + throw new ConstraintDefinitionException('The constraint Valid cannot be nested inside constraint ' . __CLASS__ . '. You can only declare the Valid constraint directly on a field or method.'); + } + } + } } public function getRequiredOptions() diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CollectionValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CollectionValidator.php index 66fecd5..b6aeb5f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CollectionValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CollectionValidator.php @@ -25,12 +25,7 @@ use Symfony\Component\Validator\Constraints\Collection\Required; class CollectionValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { @@ -52,17 +47,7 @@ class CollectionValidator extends ConstraintValidator (is_array($value) && array_key_exists($field, $value)) || ($value instanceof \ArrayAccess && $value->offsetExists($field)) ) { - if ($fieldConstraint instanceof Required || $fieldConstraint instanceof Optional) { - $constraints = $fieldConstraint->constraints; - } else { - $constraints = $fieldConstraint; - } - - // cannot simply cast to array, because then the object is converted to an - // array instead of wrapped inside - $constraints = is_array($constraints) ? $constraints : array($constraints); - - foreach ($constraints as $constr) { + foreach ($fieldConstraint->constraints as $constr) { $walker->walkConstraint($constr, $value[$field], $group, $propertyPath.'['.$field.']'); } } elseif (!$fieldConstraint instanceof Optional && !$constraint->allowMissingFields) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Count.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Count.php new file mode 100644 index 0000000..db0661d --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Count.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * @Annotation + * + * @api + */ +class Count extends Constraint +{ + public $minMessage = 'This collection should contain {{ limit }} elements or more.'; + public $maxMessage = 'This collection should contain {{ limit }} elements or less.'; + public $exactMessage = 'This collection should contain exactly {{ limit }} elements.'; + public $min; + public $max; + + public function __construct($options = null) + { + if (null !== $options && !is_array($options)) { + $options = array( + 'min' => $options, + 'max' => $options, + ); + } + + parent::__construct($options); + + if (null === $this->min && null === $this->max) { + throw new MissingOptionsException('Either option "min" or "max" must be given for constraint ' . __CLASS__, array('min', 'max')); + } + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CountValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CountValidator.php new file mode 100644 index 0000000..0a3be12 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CountValidator.php @@ -0,0 +1,63 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class CountValidator extends ConstraintValidator +{ + /** + * {@inheritDoc} + */ + public function validate($value, Constraint $constraint) + { + if (null === $value) { + return; + } + + if (!is_array($value) && !$value instanceof \Countable) { + throw new UnexpectedTypeException($value, 'array or \Countable'); + } + + $count = count($value); + + if ($constraint->min == $constraint->max && $count != $constraint->min) { + $this->context->addViolation($constraint->exactMessage, array( + '{{ count }}' => $count, + '{{ limit }}' => $constraint->min, + ), $value, (int) $constraint->min); + + return; + } + + if (null !== $constraint->max && $count > $constraint->max) { + $this->context->addViolation($constraint->maxMessage, array( + '{{ count }}' => $count, + '{{ limit }}' => $constraint->max, + ), $value, (int) $constraint->max); + + return; + } + + if (null !== $constraint->min && $count < $constraint->min) { + $this->context->addViolation($constraint->minMessage, array( + '{{ count }}' => $count, + '{{ limit }}' => $constraint->min, + ), $value, (int) $constraint->min); + } + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CountryValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CountryValidator.php index c786ab7..1d49954 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CountryValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/CountryValidator.php @@ -25,12 +25,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class CountryValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/DateValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/DateValidator.php index 4888c99..f891f9d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/DateValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/DateValidator.php @@ -25,12 +25,7 @@ class DateValidator extends ConstraintValidator const PATTERN = '/^(\d{4})-(\d{2})-(\d{2})$/'; /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/EmailValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/EmailValidator.php index cf59c6f..bfdad09 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/EmailValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/EmailValidator.php @@ -23,12 +23,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class EmailValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FalseValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FalseValidator.php index 3703948..7cead61 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FalseValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FalseValidator.php @@ -22,12 +22,7 @@ use Symfony\Component\Validator\ConstraintValidator; class FalseValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FileValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FileValidator.php index 76869c2..7d68882 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FileValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/FileValidator.php @@ -26,12 +26,7 @@ use Symfony\Component\HttpFoundation\File\UploadedFile; class FileValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/ImageValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/ImageValidator.php index ced333c..79e6bdc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/ImageValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/ImageValidator.php @@ -22,6 +22,9 @@ use Symfony\Component\Validator\Exception\ConstraintDefinitionException; */ class ImageValidator extends FileValidator { + /** + * {@inheritDoc} + */ public function validate($value, Constraint $constraint) { $violations = count($this->context->getViolations()); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Ip.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Ip.php index 6396a99..1698d11 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Ip.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Ip.php @@ -44,7 +44,7 @@ class Ip extends Constraint const V6_ONLY_PUBLIC = '6_public'; const ALL_ONLY_PUBLIC = 'all_public'; - static protected $versions = array( + protected static $versions = array( self::V4, self::V6, self::ALL, diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/IpValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/IpValidator.php index 2f1503d..3358ec2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/IpValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/IpValidator.php @@ -26,12 +26,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class IpValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LanguageValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LanguageValidator.php index 3d74097..5aed18a 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LanguageValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LanguageValidator.php @@ -25,12 +25,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class LanguageValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Length.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Length.php new file mode 100644 index 0000000..70554c0 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Length.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MissingOptionsException; + +/** + * @Annotation + * + * @api + */ +class Length extends Constraint +{ + public $maxMessage = 'This value is too long. It should have {{ limit }} characters or less.'; + public $minMessage = 'This value is too short. It should have {{ limit }} characters or more.'; + public $exactMessage = 'This value should have exactly {{ limit }} characters.'; + public $max; + public $min; + public $charset = 'UTF-8'; + + public function __construct($options = null) + { + if (null !== $options && !is_array($options)) { + $options = array( + 'min' => $options, + 'max' => $options, + ); + } + + parent::__construct($options); + + if (null === $this->min && null === $this->max) { + throw new MissingOptionsException('Either option "min" or "max" must be given for constraint ' . __CLASS__, array('min', 'max')); + } + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LengthValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LengthValidator.php new file mode 100644 index 0000000..8090a2c --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LengthValidator.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Constraints; + +use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\ConstraintValidator; +use Symfony\Component\Validator\Exception\UnexpectedTypeException; + +/** + * @author Bernhard Schussek + */ +class LengthValidator extends ConstraintValidator +{ + /** + * {@inheritDoc} + */ + public function validate($value, Constraint $constraint) + { + if (null === $value || '' === $value) { + return; + } + + if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { + throw new UnexpectedTypeException($value, 'string'); + } + + $stringValue = (string) $value; + + if (function_exists('grapheme_strlen') && 'UTF-8' === $constraint->charset) { + $length = grapheme_strlen($stringValue); + } elseif (function_exists('mb_strlen')) { + $length = mb_strlen($stringValue, $constraint->charset); + } else { + $length = strlen($stringValue); + } + + if ($constraint->min == $constraint->max && $length != $constraint->min) { + $this->context->addViolation($constraint->exactMessage, array( + '{{ value }}' => $stringValue, + '{{ limit }}' => $constraint->min, + ), $value, (int) $constraint->min); + + return; + } + + if (null !== $constraint->max && $length > $constraint->max) { + $this->context->addViolation($constraint->maxMessage, array( + '{{ value }}' => $stringValue, + '{{ limit }}' => $constraint->max, + ), $value, (int) $constraint->max); + + return; + } + + if (null !== $constraint->min && $length < $constraint->min) { + $this->context->addViolation($constraint->minMessage, array( + '{{ value }}' => $stringValue, + '{{ limit }}' => $constraint->min, + ), $value, (int) $constraint->min); + } + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LocaleValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LocaleValidator.php index 3310fc6..5cacdb4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LocaleValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/LocaleValidator.php @@ -25,12 +25,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class LocaleValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Max.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Max.php index ffb958e..814fc1f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Max.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Max.php @@ -17,6 +17,8 @@ use Symfony\Component\Validator\Constraint; * @Annotation * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class Max extends Constraint { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxLength.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxLength.php index c928bd5..765d548 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxLength.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxLength.php @@ -17,6 +17,8 @@ use Symfony\Component\Validator\Constraint; * @Annotation * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class MaxLength extends Constraint { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php index cb040ee..9b9e9b9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxLengthValidator.php @@ -19,16 +19,13 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; * @author Bernhard Schussek * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class MaxLengthValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { @@ -40,21 +37,21 @@ class MaxLengthValidator extends ConstraintValidator throw new UnexpectedTypeException($value, 'string'); } - $value = (string) $value; + $stringValue = (string) $value; if (function_exists('grapheme_strlen') && 'UTF-8' === $constraint->charset) { - $length = grapheme_strlen($value); + $length = grapheme_strlen($stringValue); } elseif (function_exists('mb_strlen')) { - $length = mb_strlen($value, $constraint->charset); + $length = mb_strlen($stringValue, $constraint->charset); } else { - $length = strlen($value); + $length = strlen($stringValue); } if ($length > $constraint->limit) { $this->context->addViolation($constraint->message, array( - '{{ value }}' => $value, + '{{ value }}' => $stringValue, '{{ limit }}' => $constraint->limit, - ), null, (int) $constraint->limit); + ), $value, (int) $constraint->limit); } } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxValidator.php index 90c9437..2019d69 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MaxValidator.php @@ -18,20 +18,17 @@ use Symfony\Component\Validator\ConstraintValidator; * @author Bernhard Schussek * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class MaxValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constrain for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { - if (null === $value) { + if (null === $value || '' === $value) { return; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Min.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Min.php index 78a4833..6e8b364 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Min.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Min.php @@ -17,6 +17,8 @@ use Symfony\Component\Validator\Constraint; * @Annotation * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class Min extends Constraint { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinLength.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinLength.php index 1ee1590..4457f6c 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinLength.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinLength.php @@ -17,6 +17,8 @@ use Symfony\Component\Validator\Constraint; * @Annotation * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class MinLength extends Constraint { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinLengthValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinLengthValidator.php index 5b3ea0c..80fcac4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinLengthValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinLengthValidator.php @@ -19,16 +19,13 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; * @author Bernhard Schussek * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class MinLengthValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { @@ -40,21 +37,21 @@ class MinLengthValidator extends ConstraintValidator throw new UnexpectedTypeException($value, 'string'); } - $value = (string) $value; + $stringValue = (string) $value; if (function_exists('grapheme_strlen') && 'UTF-8' === $constraint->charset) { - $length = grapheme_strlen($value); + $length = grapheme_strlen($stringValue); } elseif (function_exists('mb_strlen')) { - $length = mb_strlen($value, $constraint->charset); + $length = mb_strlen($stringValue, $constraint->charset); } else { - $length = strlen($value); + $length = strlen($stringValue); } if ($length < $constraint->limit) { $this->context->addViolation($constraint->message, array( - '{{ value }}' => $value, + '{{ value }}' => $stringValue, '{{ limit }}' => $constraint->limit, - ), null, (int) $constraint->limit); + ), $value, (int) $constraint->limit); } } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinValidator.php index 4ffe43a..c907793 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/MinValidator.php @@ -18,6 +18,8 @@ use Symfony\Component\Validator\ConstraintValidator; * @author Bernhard Schussek * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ class MinValidator extends ConstraintValidator { @@ -31,7 +33,7 @@ class MinValidator extends ConstraintValidator */ public function validate($value, Constraint $constraint) { - if (null === $value) { + if (null === $value || '' === $value) { return; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php index 5ca3f11..dd3dbdd 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NotBlankValidator.php @@ -22,12 +22,7 @@ use Symfony\Component\Validator\ConstraintValidator; class NotBlankValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NotNullValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NotNullValidator.php index 3015889..4ee6592 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NotNullValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NotNullValidator.php @@ -22,12 +22,7 @@ use Symfony\Component\Validator\ConstraintValidator; class NotNullValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NullValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NullValidator.php index febe97f..e8fa24e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NullValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/NullValidator.php @@ -22,12 +22,7 @@ use Symfony\Component\Validator\ConstraintValidator; class NullValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Range.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Range.php index 849cd95..20039f5 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Range.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Range.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\MissingOptionsException; /** * @Annotation @@ -20,17 +21,18 @@ use Symfony\Component\Validator\Constraint; */ class Range extends Constraint { - public $minMessage = 'This value should be {{ limit }} or more.'; - public $maxMessage = 'This value should be {{ limit }} or less.'; - public $invalidMessage = 'This value should be a valid number.'; + public $minMessage = 'This value should be {{ limit }} or more'; + public $maxMessage = 'This value should be {{ limit }} or less'; + public $invalidMessage = 'This value should be a valid number'; public $min; public $max; - /** - * {@inheritDoc} - */ - public function getRequiredOptions() + public function __construct($options = null) { - return array('min', 'max'); + parent::__construct($options); + + if (null === $this->min && null === $this->max) { + throw new MissingOptionsException('Either option "min" or "max" must be given for constraint ' . __CLASS__, array('min', 'max')); + } } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/RangeValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/RangeValidator.php index 32b3cf4..1a8ba15 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/RangeValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/RangeValidator.php @@ -16,20 +16,11 @@ use Symfony\Component\Validator\ConstraintValidator; /** * @author Bernhard Schussek - * - * @api */ class RangeValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @return Boolean Whether or not the value is valid - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { @@ -45,7 +36,7 @@ class RangeValidator extends ConstraintValidator return; } - if ($value > $constraint->max) { + if (null !== $constraint->max && $value > $constraint->max) { $this->context->addViolation($constraint->maxMessage, array( '{{ value }}' => $value, '{{ limit }}' => $constraint->max, @@ -54,7 +45,7 @@ class RangeValidator extends ConstraintValidator return; } - if ($value < $constraint->min) { + if (null !== $constraint->min && $value < $constraint->min) { $this->context->addViolation($constraint->minMessage, array( '{{ value }}' => $value, '{{ limit }}' => $constraint->min, diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Regex.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Regex.php index 0a55251..776be48 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Regex.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Regex.php @@ -12,7 +12,6 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** * @Annotation @@ -78,6 +77,7 @@ class Regex extends Constraint // Unescape the delimiter in pattern $pattern = str_replace('\\' . $delimiter, $delimiter, $pattern); + return $start . $pattern . $end; } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/RegexValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/RegexValidator.php index 283fe55..c39869d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/RegexValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/RegexValidator.php @@ -26,12 +26,7 @@ use Symfony\Component\Validator\Exception\UnexpectedTypeException; class RegexValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Size.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Size.php index d60dbaa..625f86e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Size.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Size.php @@ -17,73 +17,16 @@ use Symfony\Component\Validator\Constraint; * @Annotation * * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. */ -class Size extends Constraint +class Size extends Range { - const TYPE_STRING = 'string'; - const TYPE_COLLECTION = 'collection'; - - public $minMessage; - public $maxMessage; - public $exactMessage; - public $type; - public $min; - public $max; - public $charset = 'UTF-8'; - - private $stringMinMessage = 'This value is too short. It should have {{ limit }} characters or more.'; - private $stringMaxMessage = 'This value is too long. It should have {{ limit }} characters or less.'; - private $stringExactMessage = 'This value should have exactly {{ limit }} characters.'; - - private $collectionMinMessage = 'This collection should contain {{ limit }} elements or more.'; - private $collectionMaxMessage = 'This collection should contain {{ limit }} elements or less.'; - private $collectionExactMessage = 'This collection should contain exactly {{ limit }} elements.'; - - public function getMinMessage($type) + /** + * {@inheritDoc} + */ + public function validatedBy() { - if (null !== $this->minMessage) { - return $this->minMessage; - } - - switch ($type) { - case static::TYPE_STRING: - return $this->stringMinMessage; - case static::TYPE_COLLECTION: - return $this->collectionMinMessage; - default: - throw new \InvalidArgumentException('Invalid type specified.'); - } - } - - public function getMaxMessage($type) - { - if (null !== $this->maxMessage) { - return $this->maxMessage; - } - - switch ($type) { - case static::TYPE_STRING: - return $this->stringMaxMessage; - case static::TYPE_COLLECTION: - return $this->collectionMaxMessage; - default: - throw new \InvalidArgumentException('Invalid type specified.'); - } - } - - public function getExactMessage($type) - { - if (null !== $this->exactMessage) { - return $this->exactMessage; - } - - switch ($type) { - case static::TYPE_STRING: - return $this->stringExactMessage; - case static::TYPE_COLLECTION: - return $this->collectionExactMessage; - default: - throw new \InvalidArgumentException('Invalid type specified.'); - } + return get_parent_class($this).'Validator'; } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/SizeValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/SizeValidator.php index 842d3ef..605e74b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/SizeValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/SizeValidator.php @@ -13,151 +13,14 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; -use Symfony\Component\Validator\Exception\UnexpectedTypeException; -use Symfony\Component\Validator\Exception\ConstraintDefinitionException; -class SizeValidator extends ConstraintValidator +/** + * @author Bernhard Schussek + * + * @api + * + * @deprecated Deprecated since version 2.1, to be removed in 2.3. + */ +class SizeValidator extends RangeValidator { - /** - * {@inheritDoc} - */ - public function validate($value, Constraint $constraint) - { - if (null === $constraint->min && null === $constraint->max) { - throw new ConstraintDefinitionException( - 'Either "min" or "max" must be specified on constraint Size' - ); - } - - if (null === $constraint->type) { - $type = $this->guessType($value); - } else { - $type = $constraint->type; - } - - switch ($type) { - case Size::TYPE_STRING: - return $this->validateString($value, $constraint); - case Size::TYPE_COLLECTION: - return $this->validateCollection($value, $constraint); - default: - throw new ConstraintDefinitionException(sprintf( - 'The "type" on constraint Size must be either "%s" or "%s", "%s" given.', - Size::TYPE_STRING, - Size::TYPE_COLLECTION, - $type - )); - } - - } - - private function validateString($value, Constraint $constraint) - { - if (null === $value || '' === $value) { - return; - } - - if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) { - throw new UnexpectedTypeException($value, 'string, scalar or object with __toString()'); - } - - $value = (string) $value; - - if (function_exists('grapheme_strlen') && 'UTF-8' === $constraint->charset) { - $length = grapheme_strlen($value); - } elseif (function_exists('mb_strlen')) { - $length = mb_strlen($value, $constraint->charset); - } else { - $length = strlen($value); - } - - $this->validateSize( - $constraint, - $length, - Size::TYPE_STRING, - array('{{ value }}' => $value) - ); - } - - private function validateCollection($value, Constraint $constraint) - { - if (null === $value) { - return; - } - - if (!is_array($value) && !$value instanceof \Countable) { - throw new UnexpectedTypeException($value, 'array or Countable'); - } - - $count = count($value); - - $this->validateSize( - $constraint, - $count, - Size::TYPE_COLLECTION, - array('{{ count }}' => $count) - ); - } - - private function validateSize(Constraint $constraint, $size, $type, array $parameters) - { - if ($constraint->min == $constraint->max && $size != $constraint->max) { - $this->context->addViolation( - $constraint->getExactMessage($type), - array_merge(array('{{ limit }}' => $constraint->max), $parameters), - null, - (int) $constraint->max - ); - - return; - } - - if (null !== $constraint->max && $size > $constraint->max) { - $this->context->addViolation( - $constraint->getMaxMessage($type), - array_merge(array('{{ limit }}' => $constraint->max), $parameters), - null, - (int) $constraint->max - ); - - return; - } - - if (null !== $constraint->min && $size < $constraint->min) { - $this->context->addViolation( - $constraint->getMinMessage($type), - array_merge(array('{{ limit }}' => $constraint->min), $parameters), - null, - (int) $constraint->min - ); - } - } - - private function guessType($value) - { - if (null === $value || is_scalar($value)) { - return Size::TYPE_STRING; - } - - if (is_object($value) && method_exists($value, '__toString')) { - if ($value instanceof \Countable) { - throw new \RuntimeException( - 'The "type" must be specified on constraint Size because the '. - 'validator is not able to guess it since the value is an object '. - 'implementing both the __toString() method and the Countable '. - 'interface.' - ); - } - - return Size::TYPE_STRING; - } - - if (is_array($value) || $value instanceof \Countable) { - return Size::TYPE_COLLECTION; - } - - throw new UnexpectedTypeException( - $value, 'scalar, string, array, Countable or object with __toString()' - ); - } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TimeValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TimeValidator.php index 22c34bd..31259cc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TimeValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TimeValidator.php @@ -25,12 +25,7 @@ class TimeValidator extends ConstraintValidator const PATTERN = '/^(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/'; /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TrueValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TrueValidator.php index a404474..2f8c91f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TrueValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TrueValidator.php @@ -22,12 +22,7 @@ use Symfony\Component\Validator\ConstraintValidator; class TrueValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TypeValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TypeValidator.php index c21d784..ecc88df 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TypeValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/TypeValidator.php @@ -22,12 +22,7 @@ use Symfony\Component\Validator\ConstraintValidator; class TypeValidator extends ConstraintValidator { /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/UrlValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/UrlValidator.php index ca604f9..1fc380e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/UrlValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/UrlValidator.php @@ -38,12 +38,7 @@ class UrlValidator extends ConstraintValidator $~ixu'; /** - * Checks if the passed value is valid. - * - * @param mixed $value The value that should be validated - * @param Constraint $constraint The constraint for the validation - * - * @api + * {@inheritDoc} */ public function validate($value, Constraint $constraint) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Valid.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Valid.php index 10c8b0d..42b413e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Valid.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Constraints/Valid.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Validator\Constraints; use Symfony\Component\Validator\Constraint; +use Symfony\Component\Validator\Exception\ConstraintDefinitionException; /** * @Annotation @@ -23,4 +24,13 @@ class Valid extends Constraint public $traverse = true; public $deep = false; + + public function __construct($options = null) + { + if (is_array($options) && array_key_exists('groups', $options)) { + throw new ConstraintDefinitionException('The option "groups" is not supported by the constraint ' . __CLASS__); + } + + parent::__construct($options); + } } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/GroupSequenceProviderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/GroupSequenceProviderInterface.php index 676a3b3..62e8a5e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/GroupSequenceProviderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/GroupSequenceProviderInterface.php @@ -22,5 +22,5 @@ interface GroupSequenceProviderInterface * * @return array An array of validation groups */ - function getGroupSequence(); + public function getGroupSequence(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php index 780a8e2..2f9b031 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Cache/CacheInterface.php @@ -25,7 +25,7 @@ interface CacheInterface * * @param string $class */ - function has($class); + public function has($class); /** * Returns the metadata for the given class from the cache @@ -34,12 +34,12 @@ interface CacheInterface * * @return ClassMetadata|false A ClassMetadata instance or false on miss */ - function read($class); + public function read($class); /** * Stores a class metadata in the cache * * @param ClassMetadata $metadata A Class Metadata */ - function write(ClassMetadata $metadata); + public function write(ClassMetadata $metadata); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/ClassMetadataFactoryInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/ClassMetadataFactoryInterface.php index 02752c3..eb8c653 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/ClassMetadataFactoryInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/ClassMetadataFactoryInterface.php @@ -13,5 +13,5 @@ namespace Symfony\Component\Validator\Mapping; interface ClassMetadataFactoryInterface { - function getClassMetadata($class); + public function getClassMetadata($class); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php index 1e78fc8..bd679b0 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/LoaderInterface.php @@ -22,5 +22,5 @@ interface LoaderInterface * * @return Boolean */ - function loadClassMetadata(ClassMetadata $metadata); + public function loadClassMetadata(ClassMetadata $metadata); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php index 9e85d83..e4bfec3 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Mapping/Loader/YamlFileLoader.php @@ -55,7 +55,7 @@ class YamlFileLoader extends FileLoader $yaml = $this->classes[$metadata->getClassName()]; if (isset($yaml['group_sequence_provider'])) { - $metadata->setGroupSequenceProvider((bool)$yaml['group_sequence_provider']); + $metadata->setGroupSequenceProvider((bool) $yaml['group_sequence_provider']); } if (isset($yaml['constraints']) && is_array($yaml['constraints'])) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/ObjectInitializerInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/ObjectInitializerInterface.php index 224552d..424ff0b 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/ObjectInitializerInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/ObjectInitializerInterface.php @@ -30,5 +30,5 @@ interface ObjectInitializerInterface * * @api */ - function initialize($object); + public function initialize($object); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf index eeb0e16..af2d7c1 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.cs.xlf @@ -202,6 +202,18 @@ A PHP extension caused the upload to fail. Rozšíření PHP zabránilo nahrání souboru. + + This collection should contain {{ limit }} elements or more. + Tato kolekce musí obsahovat minimálně {{ limit }} prvek.|Tato kolekce musí obsahovat minimálně {{ limit }} prvky.|Tato kolekce musí obsahovat minimálně {{ limit }} prvků. + + + This collection should contain {{ limit }} elements or less. + Tato kolekce musí obsahovat maximálně {{ limit }} prvek.|Tato kolekce musí obsahovat maximálně {{ limit }} prvky.|Tato kolekce musí obsahovat maximálně {{ limit }} prvků. + + + This collection should contain exactly {{ limit }} elements. + Tato kolekce musí obsahovat přesně {{ limit }} prvek.|Tato kolekce musí obsahovat přesně {{ limit }} prvky.|Tato kolekce musí obsahovat přesně {{ limit }} prvků. + diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf index cc1ed9d..0920c7e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.es.xlf @@ -24,11 +24,11 @@ You must select at least {{ limit }} choices. - Debe seleccionar al menos {{ limit }} opciones. + Debe seleccionar al menos {{ limit }} opcion.|Debe seleccionar al menos {{ limit }} opciones. You must select at most {{ limit }} choices. - Debe seleccionar como máximo {{ limit }} opciones. + Debe seleccionar como máximo {{ limit }} opcion.|Debe seleccionar como máximo {{ limit }} opciones. One or more of the given values is invalid. @@ -76,7 +76,7 @@ This value is too long. It should have {{ limit }} characters or less. - Este valor es demasiado largo. Debería tener {{ limit }} caracteres o menos. + Este valor es demasiado largo. Debería tener {{ limit }} caracter o menos.|Este valor es demasiado largo. Debería tener {{ limit }} caracteres o menos. This value should be {{ limit }} or more. @@ -84,7 +84,7 @@ This value is too short. It should have {{ limit }} characters or more. - Este valor es demasiado corto. Debería tener {{ limit }} caracteres o más. + Este valor es demasiado corto. Debería tener {{ limit }} caracter o más.|Este valor es demasiado corto. Debería tener {{ limit }} caracteres o más. This value should not be blank. @@ -153,7 +153,7 @@ This value is already used. Este valor ya se ha utilizado. - + The size of the image could not be detected. No se pudo determinar el tamaño de la imagen. @@ -180,7 +180,7 @@ This value should have exactly {{ limit }} characters. - Este valor debería tener exactamente {{ limit }} caracteres. + Este valor debería tener exactamente {{ limit }} caracter.|Este valor debería tener exactamente {{ limit }} caracteres. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf index 1816ebe..4ba9bee 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.fr.xlf @@ -24,11 +24,11 @@ You must select at least {{ limit }} choices. - Vous devez sélectionner au moins {{ limit }} choix. + Vous devez sélectionner au moins {{ limit }} choix.|Vous devez sélectionner au moins {{ limit }} choix. You must select at most {{ limit }} choices. - Vous devez sélectionner au maximum {{ limit }} choix. + Vous devez sélectionner au maximum {{ limit }} choix.|Vous devez sélectionner au maximum {{ limit }} choix. One or more of the given values is invalid. diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf index 0914b37..5597838 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.he.xlf @@ -24,11 +24,11 @@ You must select at least {{ limit }} choices. - אתה צריך לבחור לפחות {{ limit }} אפשרויות. + אתה צריך לבחור לפחות {{ limit }} אפשרויות.|אתה צריך לבחור לפחות {{ limit }} אפשרויות. You must select at most {{ limit }} choices. - אתה צריך לבחור לכל היותר {{ limit }} אפשרויות. + אתה צריך לבחור לכל היותר {{ limit }} אפשרויות.|אתה צריך לבחור לכל היותר {{ limit }} אפשרויות. One or more of the given values is invalid. @@ -76,7 +76,7 @@ This value is too long. It should have {{ limit }} characters or less. - הערך ארוך מידי. הוא צריך להכיל {{ limit }} תווים לכל היותר. + הערך ארוך מידי. הוא צריך להכיל {{ limit }} תווים לכל היותר.|הערך ארוך מידי. הוא צריך להכיל {{ limit }} תווים לכל היותר. This value should be {{ limit }} or more. @@ -84,7 +84,7 @@ This value is too short. It should have {{ limit }} characters or more. - הערך קצר מידיץ הוא צריך להכיל {{ limit }} תווים לפחות. + הערך קצר מידיץ הוא צריך להכיל {{ limit }} תווים לפחות.|הערך קצר מידיץ הוא צריך להכיל {{ limit }} תווים לפחות. This value should not be blank. @@ -180,7 +180,7 @@ This value should have exactly {{ limit }} characters. - הערך צריך להיות בדיוק {{ limit }} תווים. + הערך צריך להיות בדיוק {{ limit }} תווים.|הערך צריך להיות בדיוק {{ limit }} תווים. The file was only partially uploaded. @@ -202,6 +202,18 @@ A PHP extension caused the upload to fail. סיומת PHP גרם להעלאה להיכשל. + + This collection should contain {{ limit }} elements or more. + האוסף אמור להכיל {{ limit }} אלמנטים או יותר.|האוסף אמור להכיל {{ limit }} אלמנטים או יותר. + + + This collection should contain {{ limit }} elements or less. + האוסף אמור להכיל {{ limit }} אלמנטים או פחות.|האוסף אמור להכיל {{ limit }} אלמנטים או פחות. + + + This collection should contain exactly {{ limit }} elements. + האוסף צריך להכיל בדיוק {{ limit }} אלמנטים.|האוסף צריך להכיל בדיוק {{ limit }} אלמנטים. + diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf index ba97b6b..751b3dc 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pl.xlf @@ -24,11 +24,11 @@ You must select at least {{ limit }} choices. - Powinieneś wybrać co najmniej {{ limit }} opcji. + Powinieneś wybrać co najmniej {{ limit }} opcję.|Powinieneś wybrać co najmniej {{ limit }} opcje.|Powinieneś wybrać co najmniej {{ limit }} opcji. You must select at most {{ limit }} choices. - Powinieneś wybrać maksymalnie {{ limit }} opcji. + Powinieneś wybrać maksymalnie {{ limit }} opcję.|Powinieneś wybrać maksymalnie {{ limit }} opcje.|Powinieneś wybrać maksymalnie {{ limit }} opcji. One or more of the given values is invalid. @@ -202,6 +202,18 @@ A PHP extension caused the upload to fail. Rozszerzenie PHP spowodowało błąd podczas wgrywania. + + This collection should contain {{ limit }} elements or more. + Ten zbiór powinien zawierać {{ limit }} lub więcej elementów. + + + This collection should contain {{ limit }} elements or less. + Ten zbiór powinien zawierać {{ limit }} lub mniej elementów. + + + This collection should contain exactly {{ limit }} elements. + Ten zbiór powinien zawierać dokładnie {{ limit }} element.|Ten zbiór powinien zawierać dokładnie {{ limit }} elementy.|Ten zbiór powinien zawierać dokładnie {{ limit }} elementów. + \ No newline at end of file diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf index c1dbdde..bbe3447 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pt.xlf @@ -24,11 +24,11 @@ You must select at least {{ limit }} choices. - Você deveria selecionar {{ limit }} opções no mínimo. + Você deveria selecionar {{ limit }} opção no mínimo.|Você deveria selecionar {{ limit }} opções no mínimo. You must select at most {{ limit }} choices. - Você deve selecionar, no máximo {{ limit }} opções. + Você deve selecionar, no máximo {{ limit }} opção.|Você deve selecionar, no máximo {{ limit }} opções. One or more of the given values is invalid. @@ -202,6 +202,18 @@ A PHP extension caused the upload to fail. Uma extensão PHP causou a falha no envio. + + This collection should contain {{ limit }} elements or more. + Esta coleção deve conter {{ limit }} elemento ou mais.|Esta coleção deve conter {{ limit }} elementos ou mais. + + + This collection should contain {{ limit }} elements or less. + Esta coleção deve conter {{ limit }} elemento ou menos.|Esta coleção deve conter {{ limit }} elementos ou menos. + + + This collection should contain exactly {{ limit }} elements. + Esta coleção deve conter exatamente {{ limit }} elemento.|Esta coleção deve conter exatamente {{ limit }} elementos. + diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf index f5ebb5a..6195bbb 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.pt_BR.xlf @@ -24,11 +24,11 @@ You must select at least {{ limit }} choices. - Você deve selecionar, no mínimo, {{ limit }} opções. + Você deve selecionar, no mínimo, {{ limit }} opção.|Você deve selecionar, no mínimo, {{ limit }} opções You must select at most {{ limit }} choices. - Você deve selecionar, no máximo, {{ limit }} opções. + Você deve selecionar, no máximo, {{ limit }} opção.|Você deve selecionar, no máximo, {{ limit }} opções. One or more of the given values is invalid. @@ -76,7 +76,7 @@ This value is too long. It should have {{ limit }} characters or less. - Este valor é muito longo. Deve ter {{ limit }} caracteres ou menos. + Este valor é muito longo. Deve ter {{ limit }} caractere ou menos.|Este valor é muito longo. Deve ter {{ limit }} caracteres ou menos. This value should be {{ limit }} or more. @@ -84,7 +84,7 @@ This value is too short. It should have {{ limit }} characters or more. - Este valor é muito curto. Deve ter {{ limit }} caracteres ou mais. + Este valor é muito curto. Deve ter {{ limit }} caractere ou mais.|Este valor é muito curto. Deve ter {{ limit }} caracteres ou mais. This value should not be blank. @@ -180,7 +180,7 @@ This value should have exactly {{ limit }} characters. - Este valor deve ter exatamente {{ limit }} caracteres. + Este valor deve ter exatamente {{ limit }} caractere.|Este valor deve ter exatamente {{ limit }} caracteres. The file was only partially uploaded. @@ -202,6 +202,18 @@ A PHP extension caused the upload to fail. Uma extensão PHP fez com que o envio falhasse. + + This collection should contain {{ limit }} elements or more. + Esta coleção deve conter {{ limit }} elemento ou mais.|Esta coleção deve conter {{ limit }} elementos ou mais. + + + This collection should contain {{ limit }} elements or less. + Esta coleção deve conter {{ limit }} elemento ou menos.|Esta coleção deve conter {{ limit }} elementos ou menos. + + + This collection should contain exactly {{ limit }} elements. + Esta coleção deve conter exatamente {{ limit }} elemento.|Esta coleção deve conter exatamente {{ limit }} elementos. + diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf index 325c348..3517600 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.ru.xlf @@ -216,4 +216,4 @@ - \ No newline at end of file + diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf index 005a112..1636b33 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sr_Cyrl.xlf @@ -182,6 +182,38 @@ This value should have exactly {{ limit }} characters. Вредност треба да има тачно {{ limit }} карактера. + + The file was only partially uploaded. + Датотека је само парцијално отпремљена. + + + No file was uploaded. + Датотека није отпремљена. + + + No temporary folder was configured in php.ini. + Привремени директоријум није конфигурисан у php.ini. + + + Cannot write temporary file to disk. + Немогуће писање привремене датотеке на диск. + + + A PHP extension caused the upload to fail. + PHP екстензија је проузроковала неуспех отпремања датотеке. + + + This collection should contain {{ limit }} elements or more. + Ова колекција треба да садржи {{ limit }} или више елемената.|Ова колекција треба да садржи {{ limit }} или више елемената.|Ова колекција треба да садржи {{ limit }} или више елемената. + + + This collection should contain {{ limit }} elements or less. + Ова колекција треба да садржи {{ limit }} или мање елемената.|Ова колекција треба да садржи {{ limit }} или мање елемената.|Ова колекција треба да садржи {{ limit }} или мање елемената. + + + This collection should contain exactly {{ limit }} elements. + Ова колекција треба да садржи тачно {{ limit }} елемент.|Ова колекција треба да садржи тачно {{ limit }} елемента.|Ова колекција треба да садржи тачно {{ limit }} елемената. + - \ No newline at end of file + diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf index afb051d..cf4666d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Resources/translations/validators.sr_Latn.xlf @@ -182,6 +182,38 @@ This value should have exactly {{ limit }} characters. Vrednost treba da ima tačno {{ limit }} karaktera. + + The file was only partially uploaded. + Datoteka je samo parcijalno otpremljena. + + + No file was uploaded. + Datoteka nije otpremljena. + + + No temporary folder was configured in php.ini. + Privremeni direktorijum nije konfigurisan u php.ini. + + + Cannot write temporary file to disk. + Nemoguće pisanje privremene datoteke na disk. + + + A PHP extension caused the upload to fail. + PHP ekstenzija je prouzrokovala neuspeh otpremanja datoteke. + + + This collection should contain {{ limit }} elements or more. + Ova kolekcija treba da sadrži {{ limit }} ili više elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili više elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili više elemenata. + + + This collection should contain {{ limit }} elements or less. + Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata.|Ova kolekcija treba da sadrži {{ limit }} ili manje elemenata. + + + This collection should contain exactly {{ limit }} elements. + Ova kolekcija treba da sadrži tačno {{ limit }} element.|Ova kolekcija treba da sadrži tačno {{ limit }} elementa.|Ova kolekcija treba da sadrži tačno {{ limit }} elemenata. + - \ No newline at end of file + diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php new file mode 100644 index 0000000..85b1283 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/AllTest.php @@ -0,0 +1,41 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Allator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\All; +use Symfony\Component\Validator\Constraints\Valid; + +/** + * @author Bernhard Schussek + */ +class AllTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectNonConstraints() + { + new All(array( + 'foo', + )); + } + + /** + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectValidConstraint() + { + new All(array( + new Valid(), + )); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php index ec4e6c5..f038128 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/AllValidatorTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Validator\Tests\Constraints; - use Symfony\Component\Validator\ExecutionContext; use Symfony\Component\Validator\Constraints\Min; use Symfony\Component\Validator\Constraints\Max; @@ -57,7 +56,6 @@ class AllValidatorTest extends \PHPUnit_Framework_TestCase $this->validator->validate(null, new All(new Min(4))); } - /** * @expectedException Symfony\Component\Validator\Exception\UnexpectedTypeException */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php index 269d5a2..bd56e15 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CallbackValidatorTest.php @@ -112,7 +112,6 @@ class CallbackValidatorTest extends \PHPUnit_Framework_TestCase '{{ value }}' => 'baz', )); - $this->validator->validate($object, new Callback(array( 'validateOne', 'validateTwo' ))); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php index fd5b1dc..34221ff 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/ChoiceValidatorTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Validator\Tests\Constraints; - use Symfony\Component\Validator\ExecutionContext; use Symfony\Component\Validator\Constraints\Choice; use Symfony\Component\Validator\Constraints\ChoiceValidator; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php new file mode 100644 index 0000000..184d254 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CollectionTest.php @@ -0,0 +1,73 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Collectionator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Collection; +use Symfony\Component\Validator\Constraints\Collection\Required; +use Symfony\Component\Validator\Constraints\Collection\Optional; +use Symfony\Component\Validator\Constraints\Valid; + +/** + * @author Bernhard Schussek + */ +class CollectionTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectInvalidFieldsOption() + { + new Collection(array( + 'fields' => 'foo', + )); + } + + /** + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectNonConstraints() + { + new Collection(array( + 'foo' => 'bar', + )); + } + + /** + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectValidConstraint() + { + new Collection(array( + 'foo' => new Valid(), + )); + } + + /** + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectValidConstraintWithinOptional() + { + new Collection(array( + 'foo' => new Optional(new Valid()), + )); + } + + /** + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectValidConstraintWithinRequired() + { + new Collection(array( + 'foo' => new Required(new Valid()), + )); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php index 7af7993..ef1c7c9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CollectionValidatorTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\Validator\Tests\Constraints; - use Symfony\Component\Validator\ExecutionContext; use Symfony\Component\Validator\Constraints\Min; use Symfony\Component\Validator\Constraints\NotNull; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorArrayTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorArrayTest.php new file mode 100644 index 0000000..5f562e7 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorArrayTest.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +/** + * @author Bernhard Schussek + */ +class CountValidatorArrayTest extends CountValidatorTest +{ + protected function createCollection(array $content) + { + return $content; + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorCountableTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorCountableTest.php new file mode 100644 index 0000000..ec4d8de --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorCountableTest.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +class CountValidatorCountableTest_Countable implements \Countable +{ + private $content; + + public function __construct(array $content) + { + $this->content = $content; + } + + public function count() + { + return count($this->content); + } +} + +/** + * @author Bernhard Schussek + */ +class CountValidatorCountableTest extends CountValidatorTest +{ + protected function createCollection(array $content) + { + return new CountValidatorCountableTest_Countable($content); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php new file mode 100644 index 0000000..c7d29c6 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/CountValidatorTest.php @@ -0,0 +1,195 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Count; +use Symfony\Component\Validator\Constraints\CountValidator; + +/** + * @author Bernhard Schussek + */ +abstract class CountValidatorTest extends \PHPUnit_Framework_TestCase +{ + protected $context; + protected $validator; + + protected function setUp() + { + $this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false); + $this->validator = new CountValidator(); + $this->validator->initialize($this->context); + } + + protected function tearDown() + { + $this->context = null; + $this->validator = null; + } + + abstract protected function createCollection(array $content); + + public function testNullIsValid() + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $this->validator->validate(null, new Count(6)); + } + + /** + * @expectedException Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsCountableType() + { + $this->validator->validate(new \stdClass(), new Count(5)); + } + + public function getThreeOrLessElements() + { + return array( + array($this->createCollection(array(1))), + array($this->createCollection(array(1, 2))), + array($this->createCollection(array(1, 2, 3))), + array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3))), + ); + } + + public function getFourElements() + { + return array( + array($this->createCollection(array(1, 2, 3, 4))), + array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4))), + ); + } + + public function getNotFourElements() + { + return array_merge( + $this->getThreeOrLessElements(), + $this->getFiveOrMoreElements() + ); + } + + public function getFiveOrMoreElements() + { + return array( + array($this->createCollection(array(1, 2, 3, 4, 5))), + array($this->createCollection(array(1, 2, 3, 4, 5, 6))), + array($this->createCollection(array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5))), + ); + } + + /** + * @dataProvider getThreeOrLessElements + */ + public function testValidValuesMax($value) + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $constraint = new Count(array('max' => 3)); + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getFiveOrMoreElements + */ + public function testValidValuesMin($value) + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $constraint = new Count(array('min' => 5)); + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getFourElements + */ + public function testValidValuesExact($value) + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $constraint = new Count(4); + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getFiveOrMoreElements + */ + public function testInvalidValuesMax($value) + { + $constraint = new Count(array( + 'max' => 4, + 'maxMessage' => 'myMessage' + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMessage', $this->identicalTo(array( + '{{ count }}' => count($value), + '{{ limit }}' => 4, + )), $value, 4); + + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getThreeOrLessElements + */ + public function testInvalidValuesMin($value) + { + $constraint = new Count(array( + 'min' => 4, + 'minMessage' => 'myMessage' + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMessage', $this->identicalTo(array( + '{{ count }}' => count($value), + '{{ limit }}' => 4, + )), $value, 4); + + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getNotFourElements + */ + public function testInvalidValuesExact($value) + { + $constraint = new Count(array( + 'min' => 4, + 'max' => 4, + 'exactMessage' => 'myMessage' + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMessage', $this->identicalTo(array( + '{{ count }}' => count($value), + '{{ limit }}' => 4, + )), $value, 4); + + $this->validator->validate($value, $constraint); + } + + public function testDefaultOption() + { + $constraint = new Count(5); + + $this->assertEquals(5, $constraint->min); + $this->assertEquals(5, $constraint->max); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php new file mode 100644 index 0000000..dbcef69 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/LengthValidatorTest.php @@ -0,0 +1,233 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Length; +use Symfony\Component\Validator\Constraints\LengthValidator; + +class LengthValidatorTest extends \PHPUnit_Framework_TestCase +{ + protected $context; + protected $validator; + + protected function setUp() + { + $this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false); + $this->validator = new LengthValidator(); + $this->validator->initialize($this->context); + } + + protected function tearDown() + { + $this->context = null; + $this->validator = null; + } + + public function testNullIsValid() + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $this->validator->validate(null, new Length(6)); + } + + public function testEmptyStringIsValid() + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $this->validator->validate('', new Length(6)); + } + + /** + * @expectedException Symfony\Component\Validator\Exception\UnexpectedTypeException + */ + public function testExpectsStringCompatibleType() + { + $this->validator->validate(new \stdClass(), new Length(5)); + } + + public function getThreeOrLessCharacters() + { + return array( + array(12), + array('12'), + array('üü', true), + array('éé', true), + array(123), + array('123'), + array('üüü', true), + array('ééé', true), + ); + } + + public function getFourCharacters() + { + return array( + array(1234), + array('1234'), + array('üüüü', true), + array('éééé', true), + ); + } + + public function getNotFourCharacters() + { + return array_merge( + $this->getThreeOrLessCharacters(), + $this->getFiveOrMoreCharacters() + ); + } + + public function getFiveOrMoreCharacters() + { + return array( + array(12345), + array('12345'), + array('üüüüü', true), + array('ééééé', true), + array(123456), + array('123456'), + array('üüüüüü', true), + array('éééééé', true), + ); + } + + /** + * @dataProvider getFiveOrMoreCharacters + */ + public function testValidValuesMin($value, $mbOnly = false) + { + if ($mbOnly && !function_exists('mb_strlen')) { + return $this->markTestSkipped('mb_strlen does not exist'); + } + + $this->context->expects($this->never()) + ->method('addViolation'); + + $constraint = new Length(array('min' => 5)); + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getThreeOrLessCharacters + */ + public function testValidValuesMax($value, $mbOnly = false) + { + if ($mbOnly && !function_exists('mb_strlen')) { + return $this->markTestSkipped('mb_strlen does not exist'); + } + + $this->context->expects($this->never()) + ->method('addViolation'); + + $constraint = new Length(array('max' => 3)); + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getFourCharacters + */ + public function testValidValuesExact($value, $mbOnly = false) + { + if ($mbOnly && !function_exists('mb_strlen')) { + return $this->markTestSkipped('mb_strlen does not exist'); + } + + $this->context->expects($this->never()) + ->method('addViolation'); + + $constraint = new Length(4); + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getThreeOrLessCharacters + */ + public function testInvalidValuesMin($value, $mbOnly = false) + { + if ($mbOnly && !function_exists('mb_strlen')) { + return $this->markTestSkipped('mb_strlen does not exist'); + } + + $constraint = new Length(array( + 'min' => 4, + 'minMessage' => 'myMessage' + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMessage', $this->identicalTo(array( + '{{ value }}' => (string) $value, + '{{ limit }}' => 4, + )), $this->identicalTo($value), 4); + + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getFiveOrMoreCharacters + */ + public function testInvalidValuesMax($value, $mbOnly = false) + { + if ($mbOnly && !function_exists('mb_strlen')) { + return $this->markTestSkipped('mb_strlen does not exist'); + } + + $constraint = new Length(array( + 'max' => 4, + 'maxMessage' => 'myMessage' + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMessage', $this->identicalTo(array( + '{{ value }}' => (string) $value, + '{{ limit }}' => 4, + )), $this->identicalTo($value), 4); + + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getNotFourCharacters + */ + public function testInvalidValuesExact($value, $mbOnly = false) + { + if ($mbOnly && !function_exists('mb_strlen')) { + return $this->markTestSkipped('mb_strlen does not exist'); + } + + $constraint = new Length(array( + 'min' => 4, + 'max' => 4, + 'exactMessage' => 'myMessage' + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMessage', $this->identicalTo(array( + '{{ value }}' => (string) $value, + '{{ limit }}' => 4, + )), $this->identicalTo($value), 4); + + $this->validator->validate($value, $constraint); + } + + public function testConstraintGetDefaultOption() + { + $constraint = new Length(5); + + $this->assertEquals(5, $constraint->min); + $this->assertEquals(5, $constraint->max); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxLengthValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxLengthValidatorTest.php index c68e3cc..12091b7 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxLengthValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxLengthValidatorTest.php @@ -98,10 +98,10 @@ class MaxLengthValidatorTest extends \PHPUnit_Framework_TestCase $this->context->expects($this->once()) ->method('addViolation') - ->with('myMessage', array( - '{{ value }}' => $value, + ->with('myMessage', $this->identicalTo(array( + '{{ value }}' => (string) $value, '{{ limit }}' => 5, - ), null, 5); + )), $this->identicalTo($value), 5); $this->validator->validate($value, $constraint); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxValidatorTest.php index f86b510..3ee95ee 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MaxValidatorTest.php @@ -40,6 +40,14 @@ class MaxValidatorTest extends \PHPUnit_Framework_TestCase $this->validator->validate(null, new Max(array('limit' => 10))); } + public function testEmptyStringIsValid() + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $this->validator->validate('', new Max(array('limit' => 10))); + } + /** * @dataProvider getValidValues */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinLengthValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinLengthValidatorTest.php index a3c0d61..e3a1d01 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinLengthValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinLengthValidatorTest.php @@ -98,10 +98,10 @@ class MinLengthValidatorTest extends \PHPUnit_Framework_TestCase $this->context->expects($this->once()) ->method('addViolation') - ->with('myMessage', array( - '{{ value }}' => $value, + ->with('myMessage', $this->identicalTo(array( + '{{ value }}' => (string) $value, '{{ limit }}' => 5, - ), null, 5); + )), $this->identicalTo($value), 5); $this->validator->validate($value, $constraint); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinValidatorTest.php index fb103ce..f760190 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/MinValidatorTest.php @@ -34,6 +34,14 @@ class MinValidatorTest extends \PHPUnit_Framework_TestCase $this->validator->validate(null, new Min(array('limit' => 10))); } + public function testEmptyStringIsValid() + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $this->validator->validate('', new Min(array('limit' => 10))); + } + /** * @dataProvider getValidValues */ diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php index 0e4401e..85db95d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/NotBlankValidatorTest.php @@ -106,4 +106,3 @@ class NotBlankValidatorTest extends \PHPUnit_Framework_TestCase $this->validator->validate(array(), $constraint); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php index 2b20278..c44b0ea 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/RangeValidatorTest.php @@ -34,19 +34,7 @@ class RangeValidatorTest extends \PHPUnit_Framework_TestCase $this->validator->validate(null, new Range(array('min' => 10, 'max' => 20))); } - /** - * @dataProvider getValidValues - */ - public function testValidValues($value) - { - $this->context->expects($this->never()) - ->method('addViolation'); - - $constraint = new Range(array('min' => 10, 'max' => 20)); - $this->validator->validate($value, $constraint); - } - - public function getValidValues() + public function getTenToTwenty() { return array( array(10.00001), @@ -60,18 +48,146 @@ class RangeValidatorTest extends \PHPUnit_Framework_TestCase ); } - /** - * @dataProvider getInvalidValues - */ - public function testInvalidValues($value) + public function getLessThanTen() { - $this->context->expects($this->once()) + return array( + array(9.99999), + array('9.99999'), + array(5), + array(1.0), + ); + } + + public function getMoreThanTwenty() + { + return array( + array(20.000001), + array('20.000001'), + array(21), + array(30.0), + ); + } + + /** + * @dataProvider getTenToTwenty + */ + public function testValidValuesMin($value) + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $constraint = new Range(array('min' => 10)); + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getTenToTwenty + */ + public function testValidValuesMax($value) + { + $this->context->expects($this->never()) + ->method('addViolation'); + + $constraint = new Range(array('max' => 20)); + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getTenToTwenty + */ + public function testValidValuesMinMax($value) + { + $this->context->expects($this->never()) ->method('addViolation'); $constraint = new Range(array('min' => 10, 'max' => 20)); $this->validator->validate($value, $constraint); } + /** + * @dataProvider getLessThanTen + */ + public function testInvalidValuesMin($value) + { + $constraint = new Range(array( + 'min' => 10, + 'minMessage' => 'myMessage', + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMessage', $this->identicalTo(array( + '{{ value }}' => $value, + '{{ limit }}' => 10, + ))); + + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getMoreThanTwenty + */ + public function testInvalidValuesMax($value) + { + $constraint = new Range(array( + 'max' => 20, + 'maxMessage' => 'myMessage', + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMessage', $this->identicalTo(array( + '{{ value }}' => $value, + '{{ limit }}' => 20, + ))); + + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getMoreThanTwenty + */ + public function testInvalidValuesCombinedMax($value) + { + $constraint = new Range(array( + 'min' => 10, + 'max' => 20, + 'minMessage' => 'myMinMessage', + 'maxMessage' => 'myMaxMessage', + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMaxMessage', $this->identicalTo(array( + '{{ value }}' => $value, + '{{ limit }}' => 20, + ))); + + $this->validator->validate($value, $constraint); + } + + /** + * @dataProvider getLessThanTen + */ + public function testInvalidValuesCombinedMin($value) + { + $constraint = new Range(array( + 'min' => 10, + 'max' => 20, + 'minMessage' => 'myMinMessage', + 'maxMessage' => 'myMaxMessage', + )); + + $this->context->expects($this->once()) + ->method('addViolation') + ->with('myMinMessage', $this->identicalTo(array( + '{{ value }}' => $value, + '{{ limit }}' => 10, + ))); + + $this->validator->validate($value, $constraint); + } + public function getInvalidValues() { return array( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/SizeTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/SizeTest.php deleted file mode 100644 index 4fb388c..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/SizeTest.php +++ /dev/null @@ -1,98 +0,0 @@ -assertEquals($expected, $size->getMinMessage($type)); - } - - public function getMinMessageData() - { - $size = new Size(); - - return array( - array(array(), Size::TYPE_STRING, $this->readAttribute($size, 'stringMinMessage')), - array(array(), Size::TYPE_COLLECTION, $this->readAttribute($size, 'collectionMinMessage')), - array(array('minMessage' => 'Custom min message'), Size::TYPE_STRING, 'Custom min message'), - array(array('minMessage' => 'Custom min message'), Size::TYPE_COLLECTION, 'Custom min message'), - ); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testGetMinMessageWithInvalidType() - { - $size = new Size(); - $size->getMinMessage('foo'); - } - - /** - * @dataProvider getMaxMessageData - */ - public function testGetMaxMessage($options, $type, $expected) - { - $size = new Size($options); - $this->assertEquals($expected, $size->getMaxMessage($type)); - } - - public function getMaxMessageData() - { - $size = new Size(); - - return array( - array(array(), Size::TYPE_STRING, $this->readAttribute($size, 'stringMaxMessage')), - array(array(), Size::TYPE_COLLECTION, $this->readAttribute($size, 'collectionMaxMessage')), - array(array('maxMessage' => 'Custom max message'), Size::TYPE_STRING, 'Custom max message'), - array(array('maxMessage' => 'Custom max message'), Size::TYPE_COLLECTION, 'Custom max message'), - ); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testGetMaxMessageWithInvalidType() - { - $size = new Size(); - $size->getMaxMessage('foo'); - } - - /** - * @dataProvider getExactMessageData - */ - public function testGetExactMessage($options, $type, $expected) - { - $size = new Size($options); - $this->assertEquals($expected, $size->getExactMessage($type)); - } - - public function getExactMessageData() - { - $size = new Size(); - - return array( - array(array(), Size::TYPE_STRING, $this->readAttribute($size, 'stringExactMessage')), - array(array(), Size::TYPE_COLLECTION, $this->readAttribute($size, 'collectionExactMessage')), - array(array('exactMessage' => 'Custom exact message'), Size::TYPE_STRING, 'Custom exact message'), - array(array('exactMessage' => 'Custom exact message'), Size::TYPE_COLLECTION, 'Custom exact message'), - ); - } - - /** - * @expectedException InvalidArgumentException - */ - public function testGetExactMessageWithInvalidType() - { - $size = new Size(); - $size->getExactMessage('foo'); - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/SizeValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/SizeValidatorTest.php deleted file mode 100644 index 24e9d19..0000000 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/SizeValidatorTest.php +++ /dev/null @@ -1,216 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Component\Validator\Tests\Constraints; - -use Symfony\Component\Validator\Constraints\Size; -use Symfony\Component\Validator\Constraints\SizeValidator; - -class SizeAmbiguous implements \Countable -{ - public function __toString() - { - return ''; - } - - public function count() - { - return 0; - } -} - -class SizeValidatorTest extends \PHPUnit_Framework_TestCase -{ - protected $context; - protected $validator; - - protected function setUp() - { - $this->context = $this->getMock('Symfony\Component\Validator\ExecutionContext', array(), array(), '', false); - $this->validator = new SizeValidator(); - $this->validator->initialize($this->context); - } - - public function testNullIsValid() - { - $this->context->expects($this->never())->method('addViolation'); - - $this->validator->validate(null, new Size(array('min' => 10, 'max' => 20))); - } - - public function testNullIsValidAsAString() - { - $this->context->expects($this->never())->method('addViolation'); - - $this->validator->validate(null, new Size(array('type' => 'string', 'min' => 10, 'max' => 20))); - } - - public function testNullIsValidAsACollectionCollection() - { - $this->context->expects($this->never())->method('addViolation'); - - $this->validator->validate(null, new Size(array('type' => 'collection', 'min' => 10, 'max' => 20))); - } - - public function testEmptyStringIsValid() - { - $this->context->expects($this->never())->method('addViolation'); - - $this->validator->validate('', new Size(array('min' => 10, 'max' => 20))); - } - - public function testEmptyStringIsValidAsAString() - { - $this->context->expects($this->never())->method('addViolation'); - - $this->validator->validate('', new Size(array('type' => 'string', 'min' => 10, 'max' => 20))); - } - - /** - * @dataProvider getValidStringValues - */ - public function testValidStringValues($value, $mbOnly = false) - { - if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); - } - - $this->context->expects($this->never()) - ->method('addViolation'); - - $constraint = new Size(array('min' => 6, 'max' => 10)); - $this->validator->validate($value, $constraint); - } - - public function getValidStringValues() - { - return array( - array(123456), - array(1234567890), - array('123456'), - array('1234567890'), - array('üüüüüü', true), - array('üüüüüüüüüü', true), - array('éééééé', true), - array('éééééééééé', true), - ); - } - - /** - * @dataProvider getInvalidStringValues - */ - public function testInvalidStringValues($value, $mbOnly = false) - { - if ($mbOnly && !function_exists('mb_strlen')) { - return $this->markTestSkipped('mb_strlen does not exist'); - } - - $this->context->expects($this->once())->method('addViolation'); - - $this->validator->validate($value, new Size(array('min' => 6, 'max' => 10))); - } - - public function getInvalidStringValues() - { - return array( - array(12345), - array(12345678901), - array('12345'), - array('12345678901'), - array('üüüüü', true), - array('üüüüüüüüüüü', true), - array('ééééé', true), - array('ééééééééééé', true), - ); - } - - /** - * @dataProvider getValidCollectionValues - */ - public function testValidCollectionValue($value) - { - $this->context->expects($this->never())->method('addViolation'); - - $this->validator->validate($value, new Size(array('min' => 10, 'max' => 20))); - } - - public function getValidCollectionValues() - { - $countable = $this->getMock('Countable'); - $countable->expects($this->any())->method('count')->will($this->returnValue(15)); - - return array( - array($countable), - array(range(1, 15)), - ); - } - - /** - * @dataProvider getInvalidCollectionValues - */ - public function testInvalidCollectionValue($value) - { - $this->context->expects($this->once())->method('addViolation'); - - $this->validator->validate($value, new Size(array('min' => 10, 'max' => 20))); - } - - public function getInvalidCollectionValues() - { - $tooSmallCountable = $this->getMock('Countable'); - $tooSmallCountable->expects($this->any())->method('count')->will($this->returnValue(5)); - - $tooBigCountable = $this->getmock('countable'); - $tooBigCountable->expects($this->any())->method('count')->will($this->returnValue(25)); - - return array( - array($tooSmallCountable), - array($tooBigCountable), - array(array()), - array(range(1, 5)), - array(range(1, 25)), - ); - } - - /** - * @expectedException RuntimeException - */ - public function throwsAnExceptionWhenOnAmbiguousValue() - { - $this->validator->validate(new SizeAmbiguous(), new Size(array('min' => 10, 'max' => 20))); - } - - /** - * @expectedException Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsEitherStringOrCollectionCompatible() - { - $this->validator->validate(new \stdCLass(), new Size(array('min' => 10, 'max' => 20))); - } - - /** - * @expectedException Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsStringCompatibleType() - { - $countable = $this->getMock('Countable'); - - $this->validator->validate($countable, new Size(array('type' => 'string', 'min' => 6, 'max' => 10))); - } - - /** - * @expectedException Symfony\Component\Validator\Exception\UnexpectedTypeException - */ - public function testExpectsCollectionCompatibleType() - { - $this->validator->validate('string', new Size(array('type' => 'collection', 'min' => 6, 'max' => 10))); - } -} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/ValidTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/ValidTest.php new file mode 100644 index 0000000..0957700 --- /dev/null +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Constraints/ValidTest.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Validator\Tests\Constraints; + +use Symfony\Component\Validator\Constraints\Valid; + +/** + * @author Bernhard Schussek + */ +class ValidTest extends \PHPUnit_Framework_TestCase +{ + /** + * @expectedException Symfony\Component\Validator\Exception\ConstraintDefinitionException + */ + public function testRejectGroupsOption() + { + new Valid(array('groups' => 'foo')); + } +} diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php index 702a904..30fa920 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Fixtures/ConstraintAValidator.php @@ -17,7 +17,7 @@ use Symfony\Component\Validator\ExecutionContext; class ConstraintAValidator extends ConstraintValidator { - static public $passedContext; + public static $passedContext; public function initialize(ExecutionContext $context) { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php index bca1076..99303e9 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/GetterMetadataTest.php @@ -36,4 +36,3 @@ class GetterMetadataTest extends \PHPUnit_Framework_TestCase $this->assertEquals('foobar from getter', $metadata->getValue($entity)); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php index 142bebd..647a568 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/LoaderChainTest.php @@ -82,4 +82,3 @@ class LoaderChainTest extends \PHPUnit_Framework_TestCase $this->assertFalse($chain->loadClassMetadata($metadata)); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php index 5ddb90d..f6269ed 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/StaticMethodLoaderTest.php @@ -59,7 +59,7 @@ class StaticMethodLoaderTest extends \PHPUnit_Framework_TestCase class StaticLoaderEntity { - static public $invokedWith = null; + public static $invokedWith = null; public static function loadMetadata(ClassMetadata $metadata) { @@ -73,7 +73,7 @@ class StaticLoaderDocument extends BaseStaticLoaderDocument class BaseStaticLoaderDocument { - static public function loadMetadata(ClassMetadata $metadata) + public static function loadMetadata(ClassMetadata $metadata) { $metadata->addConstraint(new ConstraintA()); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php index 4c2a1c6..0dc1bb6 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/PropertyMetadataTest.php @@ -33,4 +33,3 @@ class PropertyMetadataTest extends \PHPUnit_Framework_TestCase $this->assertEquals('foobar', $metadata->getValue($entity)); } } - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/ValidatorTest.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/ValidatorTest.php index 62f7a16..20398e4 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/ValidatorTest.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/ValidatorTest.php @@ -19,6 +19,7 @@ use Symfony\Component\Validator\Validator; use Symfony\Component\Validator\ConstraintViolation; use Symfony\Component\Validator\ConstraintViolationList; use Symfony\Component\Validator\ConstraintValidatorFactory; +use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\Mapping\ClassMetadata; class ValidatorTest extends \PHPUnit_Framework_TestCase @@ -200,6 +201,18 @@ class ValidatorTest extends \PHPUnit_Framework_TestCase $this->assertEquals($violations, $this->validator->validateValue('Bernhard', new FailingConstraint())); } + /** + * @expectedException Symfony\Component\Validator\Exception\ValidatorException + */ + public function testValidateValueRejectsValid() + { + $entity = new Entity(); + $metadata = new ClassMetadata(get_class($entity)); + $this->factory->addClassMetadata($metadata); + + $this->validator->validateValue($entity, new Valid()); + } + public function testGetMetadataFactory() { $this->assertInstanceOf( diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/Validator.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/Validator.php index 12cff98..c6e1faf 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/Validator.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/Validator.php @@ -11,7 +11,9 @@ namespace Symfony\Component\Validator; +use Symfony\Component\Validator\Constraints\Valid; use Symfony\Component\Validator\Mapping\ClassMetadataFactoryInterface; +use Symfony\Component\Validator\Exception\ValidatorException; /** * The default implementation of the ValidatorInterface. @@ -104,6 +106,22 @@ class Validator implements ValidatorInterface */ public function validateValue($value, Constraint $constraint, $groups = null) { + if ($constraint instanceof Valid) { + // Why can't the Valid constraint be executed directly? + // + // It cannot be executed like regular other constraints, because regular + // constraints are only executed *if they belong to the validated group*. + // The Valid constraint, on the other hand, is always executed and propagates + // the group to the cascaded object. The propagated group depends on + // + // * Whether a group sequence is currently being executed. Then the default + // group is propagated. + // + // * Otherwise the validated group is propagated. + + throw new ValidatorException('The constraint ' . get_class($constraint) . ' cannot be validated. Use the method validate() instead.'); + } + $walk = function(GraphWalker $walker, $group) use ($constraint, $value) { return $walker->walkConstraint($constraint, $value, $group, ''); }; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorContext.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorContext.php index 6da56bd..efe23e2 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorContext.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorContext.php @@ -33,7 +33,7 @@ class ValidatorContext implements ValidatorContextInterface protected $constraintValidatorFactory = null; /** - * @inheritDoc + * {@inheritDoc} */ public function setClassMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory) { @@ -43,7 +43,7 @@ class ValidatorContext implements ValidatorContextInterface } /** - * @inheritDoc + * {@inheritDoc} */ public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory) { @@ -53,7 +53,7 @@ class ValidatorContext implements ValidatorContextInterface } /** - * @inheritDoc + * {@inheritDoc} */ public function getValidator() { diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorContextInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorContextInterface.php index c93d9ed..ffe8b8f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorContextInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorContextInterface.php @@ -35,19 +35,19 @@ interface ValidatorContextInterface * * @param ClassMetadataFactoryInterface $classMetadataFactory The factory instance */ - function setClassMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory); + public function setClassMetadataFactory(ClassMetadataFactoryInterface $classMetadataFactory); /** * Sets the constraint validator factory used in the new validator * * @param ConstraintValidatorFactoryInterface $constraintValidatorFactory The factory instance */ - function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory); + public function setConstraintValidatorFactory(ConstraintValidatorFactoryInterface $constraintValidatorFactory); /** * Creates a new validator with the settings stored in this context * * @return ValidatorInterface The new validator */ - function getValidator(); + public function getValidator(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorFactory.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorFactory.php index 9f5fc5b..d48d484 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorFactory.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorFactory.php @@ -98,7 +98,7 @@ class ValidatorFactory implements ValidatorContextInterface * has neither the extension ".xml" nor * ".yml" nor ".yaml" */ - static public function buildDefault(array $mappingFiles = array(), $annotations = false, $staticMethod = null) + public static function buildDefault(array $mappingFiles = array(), $annotations = false, $staticMethod = null) { $xmlMappingFiles = array(); $yamlMappingFiles = array(); diff --git a/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorInterface.php b/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorInterface.php index fc645c1..5e2e33e 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorInterface.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Validator/ValidatorInterface.php @@ -32,7 +32,7 @@ interface ValidatorInterface * * @api */ - function validate($object, $groups = null); + public function validate($object, $groups = null); /** * Validate a single property of an object against its current value. @@ -45,7 +45,7 @@ interface ValidatorInterface * * @api */ - function validateProperty($object, $property, $groups = null); + public function validateProperty($object, $property, $groups = null); /** * Validate a single property of an object against the given value. @@ -59,7 +59,7 @@ interface ValidatorInterface * * @api */ - function validatePropertyValue($class, $property, $value, $groups = null); + public function validatePropertyValue($class, $property, $value, $groups = null); /** * Validates a given value against a specific Constraint. @@ -72,7 +72,7 @@ interface ValidatorInterface * * @api */ - function validateValue($value, Constraint $constraint, $groups = null); + public function validateValue($value, Constraint $constraint, $groups = null); /** * Returns the factory for ClassMetadata instances @@ -81,5 +81,5 @@ interface ValidatorInterface * * @api */ - function getMetadataFactory(); + public function getMetadataFactory(); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Escaper.php b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Escaper.php index 81a7d5f..fe9f33f 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Escaper.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Escaper.php @@ -25,13 +25,13 @@ class Escaper // first to ensure proper escaping because str_replace operates iteratively // on the input arrays. This ordering of the characters avoids the use of strtr, // which performs more slowly. - static private $escapees = array('\\\\', '\\"', + private static $escapees = array('\\\\', '\\"', "\x00", "\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\x09", "\x0a", "\x0b", "\x0c", "\x0d", "\x0e", "\x0f", "\x10", "\x11", "\x12", "\x13", "\x14", "\x15", "\x16", "\x17", "\x18", "\x19", "\x1a", "\x1b", "\x1c", "\x1d", "\x1e", "\x1f", "\xc2\x85", "\xc2\xa0", "\xe2\x80\xa8", "\xe2\x80\xa9"); - static private $escaped = array('\\"', '\\\\', + private static $escaped = array('\\"', '\\\\', "\\0", "\\x01", "\\x02", "\\x03", "\\x04", "\\x05", "\\x06", "\\a", "\\b", "\\t", "\\n", "\\v", "\\f", "\\r", "\\x0e", "\\x0f", "\\x10", "\\x11", "\\x12", "\\x13", "\\x14", "\\x15", "\\x16", "\\x17", @@ -45,7 +45,7 @@ class Escaper * * @return Boolean True if the value would require double quotes. */ - static public function requiresDoubleQuoting($value) + public static function requiresDoubleQuoting($value) { return preg_match('/'.self::REGEX_CHARACTER_TO_ESCAPE.'/u', $value); } @@ -57,7 +57,7 @@ class Escaper * * @return string The quoted, escaped string */ - static public function escapeWithDoubleQuotes($value) + public static function escapeWithDoubleQuotes($value) { return sprintf('"%s"', str_replace(self::$escapees, self::$escaped, $value)); } @@ -69,7 +69,7 @@ class Escaper * * @return Boolean True if the value would require single quotes. */ - static public function requiresSingleQuoting($value) + public static function requiresSingleQuoting($value) { return preg_match('/[ \s \' " \: \{ \} \[ \] , & \* \# \?] | \A[ - ? | < > = ! % @ ` ]/x', $value); } @@ -81,7 +81,7 @@ class Escaper * * @return string The quoted, escaped string */ - static public function escapeWithSingleQuotes($value) + public static function escapeWithSingleQuotes($value) { return sprintf("'%s'", str_replace('\'', '\'\'', $value)); } diff --git a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Inline.php b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Inline.php index 8bcfcda..df89285 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Inline.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Inline.php @@ -29,7 +29,7 @@ class Inline * * @return array A PHP array representing the YAML string */ - static public function parse($value) + public static function parse($value) { $value = trim($value); @@ -75,7 +75,7 @@ class Inline * * @throws DumpException When trying to dump PHP resource */ - static public function dump($value) + public static function dump($value) { switch (true) { case is_resource($value): @@ -125,7 +125,7 @@ class Inline * * @return string The YAML string representing the PHP array */ - static private function dumpArray($value) + private static function dumpArray($value) { // array $keys = array_keys($value); @@ -162,7 +162,7 @@ class Inline * * @throws ParseException When malformed inline YAML string is parsed */ - static public function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) + public static function parseScalar($scalar, $delimiters = null, $stringDelimiters = array('"', "'"), &$i = 0, $evaluate = true) { if (in_array($scalar[$i], $stringDelimiters)) { // quoted scalar @@ -207,7 +207,7 @@ class Inline * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseQuotedScalar($scalar, &$i) + private static function parseQuotedScalar($scalar, &$i) { // Only check the current item we're dealing with (for sequences) $subject = substr($scalar, $i); @@ -242,7 +242,7 @@ class Inline * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseSequence($sequence, &$i = 0) + private static function parseSequence($sequence, &$i = 0) { $output = array(); $len = strlen($sequence); @@ -298,7 +298,7 @@ class Inline * * @throws ParseException When malformed inline YAML string is parsed */ - static private function parseMapping($mapping, &$i = 0) + private static function parseMapping($mapping, &$i = 0) { $output = array(); $len = strlen($mapping); @@ -359,7 +359,7 @@ class Inline * * @return string A YAML string */ - static private function evaluateScalar($scalar) + private static function evaluateScalar($scalar) { $scalar = trim($scalar); @@ -404,7 +404,7 @@ class Inline * * @return string The regular expression */ - static private function getTimestampRegex() + private static function getTimestampRegex() { return << null, 'firstline' => 1, 'secondline' => 2) - diff --git a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml index 3b3be25..ec456ed 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml +++ b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Tests/Fixtures/embededPhp.yml @@ -1 +1 @@ -value: \ No newline at end of file +value: diff --git a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Unescaper.php b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Unescaper.php index 0061dfd..ac3a576 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Unescaper.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Unescaper.php @@ -48,7 +48,7 @@ class Unescaper public function unescapeDoubleQuotedString($value) { $self = $this; - $callback = function($match) use($self) { + $callback = function($match) use ($self) { return $self->unescapeCharacter($match[0]); }; diff --git a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Yaml.php b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Yaml.php index 29e9413..d35e67d 100644 --- a/vendor/symfony/symfony/src/Symfony/Component/Yaml/Yaml.php +++ b/vendor/symfony/symfony/src/Symfony/Component/Yaml/Yaml.php @@ -22,9 +22,9 @@ use Symfony\Component\Yaml\Exception\ParseException; */ class Yaml { - static public $enablePhpParsing = false; + public static $enablePhpParsing = false; - static public function enablePhpParsing() + public static function enablePhpParsing() { self::$enablePhpParsing = true; } @@ -49,7 +49,7 @@ class Yaml * * @api */ - static public function parse($input) + public static function parse($input) { // if input is a file, process it $file = ''; @@ -102,7 +102,7 @@ class Yaml * * @api */ - static public function dump($array, $inline = 2) + public static function dump($array, $inline = 2) { $yaml = new Dumper(); diff --git a/vendor/twig/twig/AUTHORS b/vendor/twig/twig/AUTHORS new file mode 100644 index 0000000..eb5db05 --- /dev/null +++ b/vendor/twig/twig/AUTHORS @@ -0,0 +1,9 @@ +Twig is written and maintained by the Twig Team: + +Lead Developer: + +- Fabien Potencier + +Project Founder: + +- Armin Ronacher diff --git a/vendor/twig/twig/CHANGELOG b/vendor/twig/twig/CHANGELOG new file mode 100644 index 0000000..a58cc17 --- /dev/null +++ b/vendor/twig/twig/CHANGELOG @@ -0,0 +1,532 @@ +* 1.9.1 (2012-XX-XX) + + * n/a + +* 1.9.0 (2012-07-13) + + * made the parsing independent of the template loaders + * fixed exception trace when an error occurs when rendering a child template + * added escaping strategies for CSS, URL, and HTML attributes + * fixed nested embed tag calls + * added the date_modify filter + +* 1.8.3 (2012-06-17) + + * fixed paths in the filesystem loader when passing a path that ends with a slash or a backslash + * fixed escaping when a project defines a function named html or js + * fixed chmod mode to apply the umask correctly + +* 1.8.2 (2012-05-30) + + * added the abs filter + * fixed a regression when using a number in template attributes + * fixed compiler when mbstring.func_overload is set to 2 + * fixed DateTimeZone support in date filter + +* 1.8.1 (2012-05-17) + + * fixed a regression when dealing with SimpleXMLElement instances in templates + * fixed "is_safe" value for the "dump" function when "html_errors" is not defined in php.ini + * switched to use mbstring whenever possible instead of iconv (you might need to update your encoding as mbstring and iconv encoding names sometimes differ) + +* 1.8.0 (2012-05-08) + + * enforced interface when adding tests, filters, functions, and node visitors from extensions + * fixed a side-effect of the date filter where the timezone might be changed + * simplified usage of the autoescape tag; the only (optional) argument is now the escaping strategy or false (with a BC layer) + * added a way to dynamically change the auto-escaping strategy according to the template "filename" + * changed the autoescape option to also accept a supported escaping strategy (for BC, true is equivalent to html) + * added an embed tag + +* 1.7.0 (2012-04-24) + + * fixed a PHP warning when using CIFS + * fixed template line number in some exceptions + * added an iterable test + * added an error when defining two blocks with the same name in a template + * added the preserves_safety option for filters + * fixed a PHP notice when trying to access a key on a non-object/array variable + * enhanced error reporting when the template file is an instance of SplFileInfo + * added Twig_Environment::mergeGlobals() + * added compilation checks to avoid misuses of the sandbox tag + * fixed filesystem loader freshness logic for high traffic websites + * fixed random function when charset is null + +* 1.6.5 (2012-04-11) + + * fixed a regression when a template only extends another one without defining any blocks + +* 1.6.4 (2012-04-02) + + * fixed PHP notice in Twig_Error::guessTemplateLine() introduced in 1.6.3 + * fixed performance when compiling large files + * optimized parent template creation when the template does not use dynamic inheritance + +* 1.6.3 (2012-03-22) + + * fixed usage of Z_ADDREF_P for PHP 5.2 in the C extension + * fixed compilation of numeric values used in templates when using a locale where the decimal separator is not a dot + * made the strategy used to guess the real template file name and line number in exception messages much faster and more accurate + +* 1.6.2 (2012-03-18) + + * fixed sandbox mode when used with inheritance + * added preserveKeys support for the slice filter + * fixed the date filter when a DateTime instance is passed with a specific timezone + * added a trim filter + +* 1.6.1 (2012-02-29) + + * fixed Twig C extension + * removed the creation of Twig_Markup instances when not needed + * added a way to set the default global timezone for dates + * fixed the slice filter on strings when the length is not specified + * fixed the creation of the cache directory in case of a race condition + +* 1.6.0 (2012-02-04) + + * fixed raw blocks when used with the whitespace trim option + * made a speed optimization to macro calls when imported via the "from" tag + * fixed globals, parsers, visitors, filters, tests, and functions management in Twig_Environment when a new one or new extension is added + * fixed the attribute function when passing arguments + * added slice notation support for the [] operator (syntactic sugar for the slice operator) + * added a slice filter + * added string support for the reverse filter + * fixed the empty test and the length filter for Twig_Markup instances + * added a date function to ease date comparison + * fixed unary operators precedence + * added recursive parsing support in the parser + * added string and integer handling for the random function + +* 1.5.1 (2012-01-05) + + * fixed a regression when parsing strings + +* 1.5.0 (2012-01-04) + + * added Traversable objects support for the join filter + +* 1.5.0-RC2 (2011-12-30) + + * added a way to set the default global date interval format + * fixed the date filter for DateInterval instances (setTimezone() does not exist for them) + * refactored Twig_Template::display() to ease its extension + * added a number_format filter + +* 1.5.0-RC1 (2011-12-26) + + * removed the need to quote hash keys + * allowed hash keys to be any expression + * added a do tag + * added a flush tag + * added support for dynamically named filters and functions + * added a dump function to help debugging templates + * added a nl2br filter + * added a random function + * added a way to change the default format for the date filter + * fixed the lexer when an operator ending with a letter ends a line + * added string interpolation support + * enhanced exceptions for unknown filters, functions, tests, and tags + +* 1.4.0 (2011-12-07) + + * fixed lexer when using big numbers (> PHP_INT_MAX) + * added missing preserveKeys argument to the reverse filter + * fixed macros containing filter tag calls + +* 1.4.0-RC2 (2011-11-27) + + * removed usage of Reflection in Twig_Template::getAttribute() + * added a C extension that can optionally replace Twig_Template::getAttribute() + * added negative timestamp support to the date filter + +* 1.4.0-RC1 (2011-11-20) + + * optimized variable access when using PHP 5.4 + * changed the precedence of the .. operator to be more consistent with languages that implements such a feature like Ruby + * added an Exception to Twig_Loader_Array::isFresh() method when the template does not exist to be consistent with other loaders + * added Twig_Function_Node to allow more complex functions to have their own Node class + * added Twig_Filter_Node to allow more complex filters to have their own Node class + * added Twig_Test_Node to allow more complex tests to have their own Node class + * added a better error message when a template is empty but contain a BOM + * fixed "in" operator for empty strings + * fixed the "defined" test and the "default" filter (now works with more than one call (foo.bar.foo) and for both values of the strict_variables option) + * changed the way extensions are loaded (addFilter/addFunction/addGlobal/addTest/addNodeVisitor/addTokenParser/addExtension can now be called in any order) + * added Twig_Environment::display() + * made the escape filter smarter when the encoding is not supported by PHP + * added a convert_encoding filter + * moved all node manipulations outside the compile() Node method + * made several speed optimizations + +* 1.3.0 (2011-10-08) + +no changes + +* 1.3.0-RC1 (2011-10-04) + + * added an optimization for the parent() function + * added cache reloading when auto_reload is true and an extension has been modified + * added the possibility to force the escaping of a string already marked as safe (instance of Twig_Markup) + * allowed empty templates to be used as traits + * added traits support for the "parent" function + +* 1.2.0 (2011-09-13) + +no changes + +* 1.2.0-RC1 (2011-09-10) + + * enhanced the exception when a tag remains unclosed + * added support for empty Countable objects for the "empty" test + * fixed algorithm that determines if a template using inheritance is valid (no output between block definitions) + * added better support for encoding problems when escaping a string (available as of PHP 5.4) + * added a way to ignore a missing template when using the "include" tag ({% include "foo" ignore missing %}) + * added support for an array of templates to the "include" and "extends" tags ({% include ['foo', 'bar'] %}) + * added support for bitwise operators in expressions + * added the "attribute" function to allow getting dynamic attributes on variables + * added Twig_Loader_Chain + * added Twig_Loader_Array::setTemplate() + * added an optimization for the set tag when used to capture a large chunk of static text + * changed name regex to match PHP one "[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*" (works for blocks, tags, functions, filters, and macros) + * removed the possibility to use the "extends" tag from a block + * added "if" modifier support to "for" loops + +* 1.1.2 (2011-07-30) + + * fixed json_encode filter on PHP 5.2 + * fixed regression introduced in 1.1.1 ({{ block(foo|lower) }}) + * fixed inheritance when using conditional parents + * fixed compilation of templates when the body of a child template is not empty + * fixed output when a macro throws an exception + * fixed a parsing problem when a large chunk of text is enclosed in a comment tag + * added PHPDoc for all Token parsers and Core extension functions + +* 1.1.1 (2011-07-17) + + * added a performance optimization in the Optimizer (also helps to lower the number of nested level calls) + * made some performance improvement for some edge cases + +* 1.1.0 (2011-06-28) + + * fixed json_encode filter + +* 1.1.0-RC3 (2011-06-24) + + * fixed method case-sensitivity when using the sandbox mode + * added timezone support for the date filter + * fixed possible security problems with NUL bytes + +* 1.1.0-RC2 (2011-06-16) + + * added an exception when the template passed to "use" is not a string + * made 'a.b is defined' not throw an exception if a is not defined (in strict mode) + * added {% line \d+ %} directive + +* 1.1.0-RC1 (2011-05-28) + +Flush your cache after upgrading. + + * fixed date filter when using a timestamp + * fixed the defined test for some cases + * fixed a parsing problem when a large chunk of text is enclosed in a raw tag + * added support for horizontal reuse of template blocks (see docs for more information) + * added whitespace control modifier to all tags (see docs for more information) + * added null as an alias for none (the null test is also an alias for the none test now) + * made TRUE, FALSE, NONE equivalent to their lowercase counterparts + * wrapped all compilation and runtime exceptions with Twig_Error_Runtime and added logic to guess the template name and line + * moved display() method to Twig_Template (generated templates should now use doDisplay() instead) + +* 1.0.0 (2011-03-27) + + * fixed output when using mbstring + * fixed duplicate call of methods when using the sandbox + * made the charset configurable for the escape filter + +* 1.0.0-RC2 (2011-02-21) + + * changed the way {% set %} works when capturing (the content is now marked as safe) + * added support for macro name in the endmacro tag + * make Twig_Error compatible with PHP 5.3.0 > + * fixed an infinite loop on some Windows configurations + * fixed the "length" filter for numbers + * fixed Template::getAttribute() as properties in PHP are case sensitive + * removed coupling between Twig_Node and Twig_Template + * fixed the ternary operator precedence rule + +* 1.0.0-RC1 (2011-01-09) + +Backward incompatibilities: + + * the "items" filter, which has been deprecated for quite a long time now, has been removed + * the "range" filter has been converted to a function: 0|range(10) -> range(0, 10) + * the "constant" filter has been converted to a function: {{ some_date|date('DATE_W3C'|constant) }} -> {{ some_date|date(constant('DATE_W3C')) }} + * the "cycle" filter has been converted to a function: {{ ['odd', 'even']|cycle(i) }} -> {{ cycle(['odd', 'even'], i) }} + * the "for" tag does not support "joined by" anymore + * the "autoescape" first argument is now "true"/"false" (instead of "on"/"off") + * the "parent" tag has been replaced by a "parent" function ({{ parent() }} instead of {% parent %}) + * the "display" tag has been replaced by a "block" function ({{ block('title') }} instead of {% display title %}) + * removed the grammar and simple token parser (moved to the Twig Extensions repository) + +Changes: + + * added "needs_context" option for filters and functions (the context is then passed as a first argument) + * added global variables support + * made macros return their value instead of echoing directly (fixes calling a macro in sandbox mode) + * added the "from" tag to import macros as functions + * added support for functions (a function is just syntactic sugar for a getAttribute() call) + * made macros callable when sandbox mode is enabled + * added an exception when a macro uses a reserved name + * the "default" filter now uses the "empty" test instead of just checking for null + * added the "empty" test + +* 0.9.10 (2010-12-16) + +Backward incompatibilities: + + * The Escaper extension is enabled by default, which means that all displayed + variables are now automatically escaped. You can revert to the previous + behavior by removing the extension via $env->removeExtension('escaper') + or just set the 'autoescape' option to 'false'. + * removed the "without loop" attribute for the "for" tag (not needed anymore + as the Optimizer take care of that for most cases) + * arrays and hashes have now a different syntax + * arrays keep the same syntax with square brackets: [1, 2] + * hashes now use curly braces (["a": "b"] should now be written as {"a": "b"}) + * support for "arrays with keys" and "hashes without keys" is not supported anymore ([1, "foo": "bar"] or {"foo": "bar", 1}) + * the i18n extension is now part of the Twig Extensions repository + +Changes: + + * added the merge filter + * removed 'is_escaper' option for filters (a left over from the previous version) -- you must use 'is_safe' now instead + * fixed usage of operators as method names (like is, in, and not) + * changed the order of execution for node visitors + * fixed default() filter behavior when used with strict_variables set to on + * fixed filesystem loader compatibility with PHAR files + * enhanced error messages when an unexpected token is parsed in an expression + * fixed filename not being added to syntax error messages + * added the autoescape option to enable/disable autoescaping + * removed the newline after a comment (mimicks PHP behavior) + * added a syntax error exception when parent block is used on a template that does not extend another one + * made the Escaper extension enabled by default + * fixed sandbox extension when used with auto output escaping + * fixed escaper when wrapping a Twig_Node_Print (the original class must be preserved) + * added an Optimizer extension (enabled by default; optimizes "for" loops and "raw" filters) + * added priority to node visitors + +* 0.9.9 (2010-11-28) + +Backward incompatibilities: + * the self special variable has been renamed to _self + * the odd and even filters are now tests: + {{ foo|odd }} must now be written {{ foo is odd }} + * the "safe" filter has been renamed to "raw" + * in Node classes, + sub-nodes are now accessed via getNode() (instead of property access) + attributes via getAttribute() (instead of array access) + * the urlencode filter had been renamed to url_encode + * the include tag now merges the passed variables with the current context by default + (the old behavior is still possible by adding the "only" keyword) + * moved Exceptions to Twig_Error_* (Twig_SyntaxError/Twig_RuntimeError are now Twig_Error_Syntax/Twig_Error_Runtime) + * removed support for {{ 1 < i < 3 }} (use {{ i > 1 and i < 3 }} instead) + * the "in" filter has been removed ({{ a|in(b) }} should now be written {{ a in b }}) + +Changes: + * added file and line to Twig_Error_Runtime exceptions thrown from Twig_Template + * changed trans tag to accept any variable for the plural count + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from complex statements) + * added the ** (power) operator + * changed the algorithm used for parsing expressions + * added the spaceless tag + * removed trim_blocks option + * added support for is*() methods for attributes (foo.bar now looks for foo->getBar() or foo->isBar()) + * changed all exceptions to extend Twig_Error + * fixed unary expressions ({{ not(1 or 0) }}) + * fixed child templates (with an extend tag) that uses one or more imports + * added support for {{ 1 not in [2, 3] }} (more readable than the current {{ not (1 in [2, 3]) }}) + * escaping has been rewritten + * the implementation of template inheritance has been rewritten + (blocks can now be called individually and still work with inheritance) + * fixed error handling for if tag when a syntax error occurs within a subparse process + * added a way to implement custom logic for resolving token parsers given a tag name + * fixed js escaper to be stricter (now uses a whilelist-based js escaper) + * added the following filers: "constant", "trans", "replace", "json_encode" + * added a "constant" test + * fixed objects with __toString() not being autoescaped + * fixed subscript expressions when calling __call() (methods now keep the case) + * added "test" feature (accessible via the "is" operator) + * removed the debug tag (should be done in an extension) + * fixed trans tag when no vars are used in plural form + * fixed race condition when writing template cache + * added the special _charset variable to reference the current charset + * added the special _context variable to reference the current context + * renamed self to _self (to avoid conflict) + * fixed Twig_Template::getAttribute() for protected properties + +* 0.9.8 (2010-06-28) + +Backward incompatibilities: + * the trans tag plural count is now attached to the plural tag: + old: `{% trans count %}...{% plural %}...{% endtrans %}` + new: `{% trans %}...{% plural count %}...{% endtrans %}` + + * added a way to translate strings coming from a variable ({% trans var %}) + * fixed trans tag when used with the Escaper extension + * fixed default cache umask + * removed Twig_Template instances from the debug tag output + * fixed objects with __isset() defined + * fixed set tag when used with a capture + * fixed type hinting for Twig_Environment::addFilter() method + +* 0.9.7 (2010-06-12) + +Backward incompatibilities: + * changed 'as' to '=' for the set tag ({% set title as "Title" %} must now be {% set title = "Title" %}) + * removed the sandboxed attribute of the include tag (use the new sandbox tag instead) + * refactored the Node system (if you have custom nodes, you will have to update them to use the new API) + + * added self as a special variable that refers to the current template (useful for importing macros from the current template) + * added Twig_Template instance support to the include tag + * added support for dynamic and conditional inheritance ({% extends some_var %} and {% extends standalone ? "minimum" : "base" %}) + * added a grammar sub-framework to ease the creation of custom tags + * fixed the for tag for large arrays (some loop variables are now only available for arrays and objects that implement the Countable interface) + * removed the Twig_Resource::resolveMissingFilter() method + * fixed the filter tag which did not apply filtering to included files + * added a bunch of unit tests + * added a bunch of phpdoc + * added a sandbox tag in the sandbox extension + * changed the date filter to support any date format supported by DateTime + * added strict_variable setting to throw an exception when an invalid variable is used in a template (disabled by default) + * added the lexer, parser, and compiler as arguments to the Twig_Environment constructor + * changed the cache option to only accepts an explicit path to a cache directory or false + * added a way to add token parsers, filters, and visitors without creating an extension + * added three interfaces: Twig_NodeInterface, Twig_TokenParserInterface, and Twig_FilterInterface + * changed the generated code to match the new coding standards + * fixed sandbox mode (__toString() method check was not enforced if called implicitly from a simple statement like {{ article }}) + * added an exception when a child template has a non-empty body (as it is always ignored when rendering) + +* 0.9.6 (2010-05-12) + + * fixed variables defined outside a loop and for which the value changes in a for loop + * fixed the test suite for PHP 5.2 and older versions of PHPUnit + * added support for __call() in expression resolution + * fixed node visiting for macros (macros are now visited by visitors as any other node) + * fixed nested block definitions with a parent call (rarely useful but nonetheless supported now) + * added the cycle filter + * fixed the Lexer when mbstring.func_overload is used with an mbstring.internal_encoding different from ASCII + * added a long-syntax for the set tag ({% set foo %}...{% endset %}) + * unit tests are now powered by PHPUnit + * added support for gettext via the `i18n` extension + * fixed twig_capitalize_string_filter() and fixed twig_length_filter() when used with UTF-8 values + * added a more useful exception if an if tag is not closed properly + * added support for escaping strategy in the autoescape tag + * fixed lexer when a template has a big chunk of text between/in a block + +* 0.9.5 (2010-01-20) + +As for any new release, don't forget to remove all cached templates after +upgrading. + +If you have defined custom filters, you MUST upgrade them for this release. To +upgrade, replace "array" with "new Twig_Filter_Function", and replace the +environment constant by the "needs_environment" option: + + // before + 'even' => array('twig_is_even_filter', false), + 'escape' => array('twig_escape_filter', true), + + // after + 'even' => new Twig_Filter_Function('twig_is_even_filter'), + 'escape' => new Twig_Filter_Function('twig_escape_filter', array('needs_environment' => true)), + +If you have created NodeTransformer classes, you will need to upgrade them to +the new interface (please note that the interface is not yet considered +stable). + + * fixed list nodes that did not extend the Twig_NodeListInterface + * added the "without loop" option to the for tag (it disables the generation of the loop variable) + * refactored node transformers to node visitors + * fixed automatic-escaping for blocks + * added a way to specify variables to pass to an included template + * changed the automatic-escaping rules to be more sensible and more configurable in custom filters (the documentation lists all the rules) + * improved the filter system to allow object methods to be used as filters + * changed the Array and String loaders to actually make use of the cache mechanism + * included the default filter function definitions in the extension class files directly (Core, Escaper) + * added the // operator (like the floor() PHP function) + * added the .. operator (as a syntactic sugar for the range filter when the step is 1) + * added the in operator (as a syntactic sugar for the in filter) + * added the following filters in the Core extension: in, range + * added support for arrays (same behavior as in PHP, a mix between lists and dictionaries, arrays and hashes) + * enhanced some error messages to provide better feedback in case of parsing errors + +* 0.9.4 (2009-12-02) + +If you have custom loaders, you MUST upgrade them for this release: The +Twig_Loader base class has been removed, and the Twig_LoaderInterface has also +been changed (see the source code for more information or the documentation). + + * added support for DateTime instances for the date filter + * fixed loop.last when the array only has one item + * made it possible to insert newlines in tag and variable blocks + * fixed a bug when a literal '\n' were present in a template text + * fixed bug when the filename of a template contains */ + * refactored loaders + +* 0.9.3 (2009-11-11) + +This release is NOT backward compatible with the previous releases. + + The loaders do not take the cache and autoReload arguments anymore. Instead, + the Twig_Environment class has two new options: cache and auto_reload. + Upgrading your code means changing this kind of code: + + $loader = new Twig_Loader_Filesystem('/path/to/templates', '/path/to/compilation_cache', true); + $twig = new Twig_Environment($loader); + + to something like this: + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + 'auto_reload' => true, + )); + + * deprecated the "items" filter as it is not needed anymore + * made cache and auto_reload options of Twig_Environment instead of arguments of Twig_Loader + * optimized template loading speed + * removed output when an error occurs in a template and render() is used + * made major speed improvements for loops (up to 300% on even the smallest loops) + * added properties as part of the sandbox mode + * added public properties support (obj.item can now be the item property on the obj object) + * extended set tag to support expression as value ({% set foo as 'foo' ~ 'bar' %} ) + * fixed bug when \ was used in HTML + +* 0.9.2 (2009-10-29) + + * made some speed optimizations + * changed the cache extension to .php + * added a js escaping strategy + * added support for short block tag + * changed the filter tag to allow chained filters + * made lexer more flexible as you can now change the default delimiters + * added set tag + * changed default directory permission when cache dir does not exist (more secure) + * added macro support + * changed filters first optional argument to be a Twig_Environment instance instead of a Twig_Template instance + * made Twig_Autoloader::autoload() a static method + * avoid writing template file if an error occurs + * added $ escaping when outputting raw strings + * enhanced some error messages to ease debugging + * fixed empty cache files when the template contains an error + +* 0.9.1 (2009-10-14) + + * fixed a bug in PHP 5.2.6 + * fixed numbers with one than one decimal + * added support for method calls with arguments ({{ foo.bar('a', 43) }}) + * made small speed optimizations + * made minor tweaks to allow better extensibility and flexibility + +* 0.9.0 (2009-10-12) + + * Initial release diff --git a/vendor/twig/twig/README.markdown b/vendor/twig/twig/README.markdown new file mode 100644 index 0000000..88d6fab --- /dev/null +++ b/vendor/twig/twig/README.markdown @@ -0,0 +1,17 @@ +Twig, the flexible, fast, and secure template language for PHP +============================================================== + +[![Build Status](https://secure.travis-ci.org/fabpot/Twig.png?branch=master)](http://travis-ci.org/fabpot/Twig) + +Twig is a template language for PHP, released under the new BSD license (code +and documentation). + +Twig uses a syntax similar to the Django and Jinja template languages which +inspired the Twig runtime environment. + +More Information +---------------- + +Read the [documentation][1] for more information. + +[1]: http://twig.sensiolabs.org/documentation diff --git a/vendor/twig/twig/bin/create_pear_package.php b/vendor/twig/twig/bin/create_pear_package.php new file mode 100644 index 0000000..4899927 --- /dev/null +++ b/vendor/twig/twig/bin/create_pear_package.php @@ -0,0 +1,42 @@ + date('Y-m-d'), + 'time' => date('H:m:00'), + 'version' => $argv[1], + 'api_version' => $argv[1], + 'stability' => $argv[2], + 'api_stability' => $argv[2], +); + +$context['files'] = ''; +$path = realpath(dirname(__FILE__).'/../lib/Twig'); +foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::LEAVES_ONLY) as $file) +{ + if (preg_match('/\.php$/', $file)) + { + $name = str_replace($path.'/', '', $file); + $context['files'] .= ' '."\n"; + } +} + +$template = file_get_contents(dirname(__FILE__).'/../package.xml.tpl'); +$content = preg_replace_callback('/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/', 'replace_parameters', $template); +file_put_contents(dirname(__FILE__).'/../package.xml', $content); + +function replace_parameters($matches) +{ + global $context; + + return isset($context[$matches[1]]) ? $context[$matches[1]] : null; +} diff --git a/vendor/twig/twig/doc/advanced.rst b/vendor/twig/twig/doc/advanced.rst new file mode 100644 index 0000000..388fe21 --- /dev/null +++ b/vendor/twig/twig/doc/advanced.rst @@ -0,0 +1,835 @@ +Extending Twig +============== + +Twig can be extended in many ways; you can add extra tags, filters, tests, +operators, global variables, and functions. You can even extend the parser +itself with node visitors. + +.. note:: + + The first section of this chapter describes how to extend Twig easily. If + you want to reuse your changes in different projects or if you want to + share them with others, you should then create an extension as described + in the following section. + +.. caution:: + + When extending Twig by calling methods on the Twig environment instance, + Twig won't be able to recompile your templates when the PHP code is + updated. To see your changes in real-time, either disable template caching + or package your code into an extension (see the next section of this + chapter). + +Before extending Twig, you must understand the differences between all the +different possible extension points and when to use them. + +First, remember that Twig has two main language constructs: + +* ``{{ }}``: used to print the result of an expression evaluation; + +* ``{% %}``: used to execute statements. + +To understand why Twig exposes so many extension points, let's see how to +implement a *Lorem ipsum* generator (it needs to know the number of words to +generate). + +You can use a ``lipsum`` *tag*: + +.. code-block:: jinja + + {% lipsum 40 %} + +That works, but using a tag for ``lipsum`` is not a good idea for at least +three main reasons: + +* ``lipsum`` is not a language construct; +* The tag outputs something; +* The tag is not flexible as you cannot use it in an expression: + + .. code-block:: jinja + + {{ 'some text' ~ {% lipsum 40 %} ~ 'some more text' }} + +In fact, you rarely need to create tags; and that's good news because tags are +the most complex extension point of Twig. + +Now, let's use a ``lipsum`` *filter*: + +.. code-block:: jinja + + {{ 40|lipsum }} + +Again, it works, but it looks weird. A filter transforms the passed value to +something else but here we use the value to indicate the number of words to +generate. + +Next, let's use a ``lipsum`` *function*: + +.. code-block:: jinja + + {{ lipsum(40) }} + +Here we go. For this specific example, the creation of a function is the +extension point to use. And you can use it anywhere an expression is accepted: + +.. code-block:: jinja + + {{ 'some text' ~ ipsum(40) ~ 'some more text' }} + + {% set ipsum = ipsum(40) %} + +Last but not the least, you can also use a *global* object with a method able +to generate lorem ipsum text: + +.. code-block:: jinja + + {{ text.lipsum(40) }} + +As a rule of thumb, use functions for frequently used features and global +objects for everything else. + +Keep in mind the following when you want to extend Twig: + +========== ========================== ========== ========================= +What? Implementation difficulty? How often? When? +========== ========================== ========== ========================= +*macro* trivial frequent Content generation +*global* trivial frequent Helper object +*function* trivial frequent Content generation +*filter* trivial frequent Value transformation +*tag* complex rare DSL language construct +*test* trivial rare Boolean decision +*operator* trivial rare Values transformation +========== ========================== ========== ========================= + +Globals +------- + +A global variable is like any other template variable, except that it's +available in all templates and macros:: + + $twig = new Twig_Environment($loader); + $twig->addGlobal('text', new Text()); + +You can then use the ``text`` variable anywhere in a template: + +.. code-block:: jinja + + {{ text.lipsum(40) }} + +Filters +------- + +A filter is a regular PHP function or an object method that takes the left +side of the filter (before the pipe ``|``) as first argument and the extra +arguments passed to the filter (within parentheses ``()``) as extra arguments. + +Defining a filter is as easy as associating the filter name with a PHP +callable. For instance, let's say you have the following code in a template: + +.. code-block:: jinja + + {{ 'TWIG'|lower }} + +When compiling this template to PHP, Twig looks for the PHP callable +associated with the ``lower`` filter. The ``lower`` filter is a built-in Twig +filter, and it is simply mapped to the PHP ``strtolower()`` function. After +compilation, the generated PHP code is roughly equivalent to: + +.. code-block:: html+php + + + +As you can see, the ``'TWIG'`` string is passed as a first argument to the PHP +function. + +A filter can also take extra arguments like in the following example: + +.. code-block:: jinja + + {{ now|date('d/m/Y') }} + +In this case, the extra arguments are passed to the function after the main +argument, and the compiled code is equivalent to: + +.. code-block:: html+php + + + +Let's see how to create a new filter. + +In this section, we will create a ``rot13`` filter, which should return the +`rot13`_ transformation of a string. Here is an example of its usage and the +expected output: + +.. code-block:: jinja + + {{ "Twig"|rot13 }} + + {# should displays Gjvt #} + +Adding a filter is as simple as calling the ``addFilter()`` method on the +``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addFilter('rot13', new Twig_Filter_Function('str_rot13')); + +The second argument of ``addFilter()`` is an instance of ``Twig_Filter``. +Here, we use ``Twig_Filter_Function`` as the filter is a PHP function. The +first argument passed to the ``Twig_Filter_Function`` constructor is the name +of the PHP function to call, here ``str_rot13``, a native PHP function. + +Let's say I now want to be able to add a prefix before the converted string: + +.. code-block:: jinja + + {{ "Twig"|rot13('prefix_') }} + + {# should displays prefix_Gjvt #} + +As the PHP ``str_rot13()`` function does not support this requirement, let's +create a new PHP function:: + + function project_compute_rot13($string, $prefix = '') + { + return $prefix.str_rot13($string); + } + +As you can see, the ``prefix`` argument of the filter is passed as an extra +argument to the ``project_compute_rot13()`` function. + +Adding this filter is as easy as before:: + + $twig->addFilter('rot13', new Twig_Filter_Function('project_compute_rot13')); + +For better encapsulation, a filter can also be defined as a static method of a +class. The ``Twig_Filter_Function`` class can also be used to register such +static methods as filters:: + + $twig->addFilter('rot13', new Twig_Filter_Function('SomeClass::rot13Filter')); + +.. tip:: + + In an extension, you can also define a filter as a static method of the + extension class. + +Environment aware Filters +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``Twig_Filter`` classes take options as their last argument. For instance, +if you want access to the current environment instance in your filter, set the +``needs_environment`` option to ``true``:: + + $filter = new Twig_Filter_Function('str_rot13', array('needs_environment' => true)); + +Twig will then pass the current environment as the first argument to the +filter call:: + + function twig_compute_rot13(Twig_Environment $env, $string) + { + // get the current charset for instance + $charset = $env->getCharset(); + + return str_rot13($string); + } + +Automatic Escaping +~~~~~~~~~~~~~~~~~~ + +If automatic escaping is enabled, the output of the filter may be escaped +before printing. If your filter acts as an escaper (or explicitly outputs html +or javascript code), you will want the raw output to be printed. In such a +case, set the ``is_safe`` option:: + + $filter = new Twig_Filter_Function('nl2br', array('is_safe' => array('html'))); + +Some filters may need to work on input that is already escaped or safe, for +example when adding (safe) html tags to originally unsafe output. In such a +case, set the ``pre_escape`` option to escape the input data before it is run +through your filter:: + + $filter = new Twig_Filter_Function('somefilter', array('pre_escape' => 'html', 'is_safe' => array('html'))); + +Dynamic Filters +~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + Dynamic filters support was added in Twig 1.5. + +A filter name containing the special ``*`` character is a dynamic filter as +the ``*`` can be any string:: + + $twig->addFilter('*_path', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $arguments) + { + // ... + } + +The following filters will be matched by the above defined dynamic filter: + +* ``product_path`` +* ``category_path`` + +A dynamic filter can define more than one dynamic parts:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $suffix, $arguments) + { + // ... + } + +The filter will receive all dynamic part values before the normal filters +arguments. For instance, a call to ``'foo'|a_path_b()`` will result in the +following PHP call: ``twig_path('a', 'b', 'foo')``. + +Functions +--------- + +A function is a regular PHP function or an object method that can be called from +templates. + +.. code-block:: jinja + + {{ constant("DATE_W3C") }} + +When compiling this template to PHP, Twig looks for the PHP callable +associated with the ``constant`` function. The ``constant`` function is a built-in Twig +function, and it is simply mapped to the PHP ``constant()`` function. After +compilation, the generated PHP code is roughly equivalent to: + +.. code-block:: html+php + + + +Adding a function is similar to adding a filter. This can be done by calling the +``addFunction()`` method on the ``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addFunction('functionName', new Twig_Function_Function('someFunction')); + +You can also expose extension methods as functions in your templates:: + + // $this is an object that implements Twig_ExtensionInterface. + $twig = new Twig_Environment($loader); + $twig->addFunction('otherFunction', new Twig_Function_Method($this, 'someMethod')); + +Functions also support ``needs_environment`` and ``is_safe`` parameters. + +Dynamic Functions +~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + Dynamic functions support was added in Twig 1.5. + +A function name containing the special ``*`` character is a dynamic function +as the ``*`` can be any string:: + + $twig->addFunction('*_path', new Twig_Function_Function('twig_path')); + + function twig_path($name, $arguments) + { + // ... + } + +The following functions will be matched by the above defined dynamic function: + +* ``product_path`` +* ``category_path`` + +A dynamic function can define more than one dynamic parts:: + + $twig->addFilter('*_path_*', new Twig_Filter_Function('twig_path')); + + function twig_path($name, $suffix, $arguments) + { + // ... + } + +The function will receive all dynamic part values before the normal functions +arguments. For instance, a call to ``a_path_b('foo')`` will result in the +following PHP call: ``twig_path('a', 'b', 'foo')``. + +Tags +---- + +One of the most exciting feature of a template engine like Twig is the +possibility to define new language constructs. This is also the most complex +feature as you need to understand how Twig's internals work. + +Let's create a simple ``set`` tag that allows the definition of simple +variables from within a template. The tag can be used like follows: + +.. code-block:: jinja + + {% set name = "value" %} + + {{ name }} + + {# should output value #} + +.. note:: + + The ``set`` tag is part of the Core extension and as such is always + available. The built-in version is slightly more powerful and supports + multiple assignments by default (cf. the template designers chapter for + more information). + +Three steps are needed to define a new tag: + +* Defining a Token Parser class (responsible for parsing the template code); + +* Defining a Node class (responsible for converting the parsed code to PHP); + +* Registering the tag. + +Registering a new tag +~~~~~~~~~~~~~~~~~~~~~ + +Adding a tag is as simple as calling the ``addTokenParser`` method on the +``Twig_Environment`` instance:: + + $twig = new Twig_Environment($loader); + $twig->addTokenParser(new Project_Set_TokenParser()); + +Defining a Token Parser +~~~~~~~~~~~~~~~~~~~~~~~ + +Now, let's see the actual code of this class:: + + class Project_Set_TokenParser extends Twig_TokenParser + { + public function parse(Twig_Token $token) + { + $lineno = $token->getLine(); + $name = $this->parser->getStream()->expect(Twig_Token::NAME_TYPE)->getValue(); + $this->parser->getStream()->expect(Twig_Token::OPERATOR_TYPE, '='); + $value = $this->parser->getExpressionParser()->parseExpression(); + + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Project_Set_Node($name, $value, $lineno, $this->getTag()); + } + + public function getTag() + { + return 'set'; + } + } + +The ``getTag()`` method must return the tag we want to parse, here ``set``. + +The ``parse()`` method is invoked whenever the parser encounters a ``set`` +tag. It should return a ``Twig_Node`` instance that represents the node (the +``Project_Set_Node`` calls creating is explained in the next section). + +The parsing process is simplified thanks to a bunch of methods you can call +from the token stream (``$this->parser->getStream()``): + +* ``getCurrent()``: Gets the current token in the stream. + +* ``next()``: Moves to the next token in the stream, *but returns the old one*. + +* ``test($type)``, ``test($value)`` or ``test($type, $value)``: Determines whether + the current token is of a particular type or value (or both). The value may be an + array of several possible values. + +* ``expect($type[, $value[, $message]])``: If the current token isn't of the given + type/value a syntax error is thrown. Otherwise, if the type and value are correct, + the token is returned and the stream moves to the next token. + +* ``look()``: Looks a the next token without consuming it. + +Parsing expressions is done by calling the ``parseExpression()`` like we did for +the ``set`` tag. + +.. tip:: + + Reading the existing ``TokenParser`` classes is the best way to learn all + the nitty-gritty details of the parsing process. + +Defining a Node +~~~~~~~~~~~~~~~ + +The ``Project_Set_Node`` class itself is rather simple:: + + class Project_Set_Node extends Twig_Node + { + public function __construct($name, Twig_Node_Expression $value, $lineno, $tag = null) + { + parent::__construct(array('value' => $value), array('name' => $name), $lineno, $tag); + } + + public function compile(Twig_Compiler $compiler) + { + $compiler + ->addDebugInfo($this) + ->write('$context[\''.$this->getAttribute('name').'\'] = ') + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + } + +The compiler implements a fluid interface and provides methods that helps the +developer generate beautiful and readable PHP code: + +* ``subcompile()``: Compiles a node. + +* ``raw()``: Writes the given string as is. + +* ``write()``: Writes the given string by adding indentation at the beginning + of each line. + +* ``string()``: Writes a quoted string. + +* ``repr()``: Writes a PHP representation of a given value (see + ``Twig_Node_For`` for a usage example). + +* ``addDebugInfo()``: Adds the line of the original template file related to + the current node as a comment. + +* ``indent()``: Indents the generated code (see ``Twig_Node_Block`` for a + usage example). + +* ``outdent()``: Outdents the generated code (see ``Twig_Node_Block`` for a + usage example). + +.. _creating_extensions: + +Creating an Extension +--------------------- + +The main motivation for writing an extension is to move often used code into a +reusable class like adding support for internationalization. An extension can +define tags, filters, tests, operators, global variables, functions, and node +visitors. + +Creating an extension also makes for a better separation of code that is +executed at compilation time and code needed at runtime. As such, it makes +your code faster. + +Most of the time, it is useful to create a single extension for your project, +to host all the specific tags and filters you want to add to Twig. + +.. tip:: + + When packaging your code into an extension, Twig is smart enough to + recompile your templates whenever you make a change to it (when the + ``auto_reload`` is enabled). + +.. note:: + + Before writing your own extensions, have a look at the Twig official + extension repository: http://github.com/fabpot/Twig-extensions. + +An extension is a class that implements the following interface:: + + interface Twig_ExtensionInterface + { + /** + * Initializes the runtime environment. + * + * This is where you can load some file that contains filter functions for instance. + * + * @param Twig_Environment $environment The current Twig_Environment instance + */ + function initRuntime(Twig_Environment $environment); + + /** + * Returns the token parser instances to add to the existing list. + * + * @return array An array of Twig_TokenParserInterface or Twig_TokenParserBrokerInterface instances + */ + function getTokenParsers(); + + /** + * Returns the node visitor instances to add to the existing list. + * + * @return array An array of Twig_NodeVisitorInterface instances + */ + function getNodeVisitors(); + + /** + * Returns a list of filters to add to the existing list. + * + * @return array An array of filters + */ + function getFilters(); + + /** + * Returns a list of tests to add to the existing list. + * + * @return array An array of tests + */ + function getTests(); + + /** + * Returns a list of functions to add to the existing list. + * + * @return array An array of functions + */ + function getFunctions(); + + /** + * Returns a list of operators to add to the existing list. + * + * @return array An array of operators + */ + function getOperators(); + + /** + * Returns a list of global variables to add to the existing list. + * + * @return array An array of global variables + */ + function getGlobals(); + + /** + * Returns the name of the extension. + * + * @return string The extension name + */ + function getName(); + } + +To keep your extension class clean and lean, it can inherit from the built-in +``Twig_Extension`` class instead of implementing the whole interface. That +way, you just need to implement the ``getName()`` method as the +``Twig_Extension`` provides empty implementations for all other methods. + +The ``getName()`` method must return a unique identifier for your extension. + +Now, with this information in mind, let's create the most basic extension +possible:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getName() + { + return 'project'; + } + } + +.. note:: + + Of course, this extension does nothing for now. We will customize it in + the next sections. + +Twig does not care where you save your extension on the filesystem, as all +extensions must be registered explicitly to be available in your templates. + +You can register an extension by using the ``addExtension()`` method on your +main ``Environment`` object:: + + $twig = new Twig_Environment($loader); + $twig->addExtension(new Project_Twig_Extension()); + +Of course, you need to first load the extension file by either using +``require_once()`` or by using an autoloader (see `spl_autoload_register()`_). + +.. tip:: + + The bundled extensions are great examples of how extensions work. + +Globals +~~~~~~~ + +Global variables can be registered in an extension via the ``getGlobals()`` +method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getGlobals() + { + return array( + 'text' => new Text(), + ); + } + + // ... + } + +Functions +~~~~~~~~~ + +Functions can be registered in an extension via the ``getFunctions()`` +method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFunctions() + { + return array( + 'lipsum' => new Twig_Function_Function('generate_lipsum'), + ); + } + + // ... + } + +Filters +~~~~~~~ + +To add a filter to an extension, you need to override the ``getFilters()`` +method. This method must return an array of filters to add to the Twig +environment:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFilters() + { + return array( + 'rot13' => new Twig_Filter_Function('str_rot13'), + ); + } + + // ... + } + +As you can see in the above code, the ``getFilters()`` method returns an array +where keys are the name of the filters (``rot13``) and the values the +definition of the filter (``new Twig_Filter_Function('str_rot13')``). + +As seen in the previous chapter, you can also define filters as static methods +on the extension class:: + +$twig->addFilter('rot13', new Twig_Filter_Function('Project_Twig_Extension::rot13Filter')); + +You can also use ``Twig_Filter_Method`` instead of ``Twig_Filter_Function`` +when defining a filter to use a method:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getFilters() + { + return array( + 'rot13' => new Twig_Filter_Method($this, 'rot13Filter'), + ); + } + + public function rot13Filter($string) + { + return str_rot13($string); + } + + // ... + } + +The first argument of the ``Twig_Filter_Method`` constructor is always +``$this``, the current extension object. The second one is the name of the +method to call. + +Using methods for filters is a great way to package your filter without +polluting the global namespace. This also gives the developer more flexibility +at the cost of a small overhead. + +Overriding default Filters +.......................... + +If some default core filters do not suit your needs, you can easily override +them by creating your own core extension. Of course, you don't need to copy +and paste the whole core extension code of Twig. Instead, you can just extends +it and override the filter(s) you want by overriding the ``getFilters()`` +method:: + + class MyCoreExtension extends Twig_Extension_Core + { + public function getFilters() + { + return array_merge(parent::getFilters(), array( + 'date' => new Twig_Filter_Method($this, 'dateFilter'), + // ... + )); + } + + public function dateFilter($timestamp, $format = 'F j, Y H:i') + { + return '...'.twig_date_format_filter($timestamp, $format); + } + + // ... + } + +Here, we override the ``date`` filter with a custom one. Using this new core +extension is as simple as registering the ``MyCoreExtension`` extension by +calling the ``addExtension()`` method on the environment instance:: + + $twig = new Twig_Environment($loader); + $twig->addExtension(new MyCoreExtension()); + +But I can already hear some people wondering how it can work as the Core +extension is loaded by default. That's true, but the trick is that both +extensions share the same unique identifier (``core`` - defined in the +``getName()`` method). By registering an extension with the same name as an +existing one, you have actually overridden the default one, even if it is +already registered:: + + $twig->addExtension(new Twig_Extension_Core()); + $twig->addExtension(new MyCoreExtension()); + +Tags +~~~~ + +Adding a tag in an extension can be done by overriding the +``getTokenParsers()`` method. This method must return an array of tags to add +to the Twig environment:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getTokenParsers() + { + return array(new Project_Set_TokenParser()); + } + + // ... + } + +In the above code, we have added a single new tag, defined by the +``Project_Set_TokenParser`` class. The ``Project_Set_TokenParser`` class is +responsible for parsing the tag and compiling it to PHP. + +Operators +~~~~~~~~~ + +The ``getOperators()`` methods allows to add new operators. Here is how to add +``!``, ``||``, and ``&&`` operators:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getOperators() + { + return array( + array( + '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + ), + array( + '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => Twig_ExpressionParser::OPERATOR_LEFT), + ), + ); + } + + // ... + } + +Tests +~~~~~ + +The ``getTests()`` methods allows to add new test functions:: + + class Project_Twig_Extension extends Twig_Extension + { + public function getTests() + { + return array( + 'even' => new Twig_Test_Function('twig_test_even'), + ); + } + + // ... + } + +.. _`spl_autoload_register()`: http://www.php.net/spl_autoload_register +.. _`rot13`: http://www.php.net/manual/en/function.str-rot13.php diff --git a/vendor/twig/twig/doc/api.rst b/vendor/twig/twig/doc/api.rst new file mode 100644 index 0000000..117bf27 --- /dev/null +++ b/vendor/twig/twig/doc/api.rst @@ -0,0 +1,510 @@ +Twig for Developers +=================== + +This chapter describes the API to Twig and not the template language. It will +be most useful as reference to those implementing the template interface to +the application and not those who are creating Twig templates. + +Basics +------ + +Twig uses a central object called the **environment** (of class +``Twig_Environment``). Instances of this class are used to store the +configuration and extensions, and are used to load templates from the file +system or other locations. + +Most applications will create one ``Twig_Environment`` object on application +initialization and use that to load templates. In some cases it's however +useful to have multiple environments side by side, if different configurations +are in use. + +The simplest way to configure Twig to load templates for your application +looks roughly like this:: + + require_once '/path/to/lib/Twig/Autoloader.php'; + Twig_Autoloader::register(); + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + )); + +This will create a template environment with the default settings and a loader +that looks up the templates in the ``/path/to/templates/`` folder. Different +loaders are available and you can also write your own if you want to load +templates from a database or other resources. + +.. note:: + + Notice that the second argument of the environment is an array of options. + The ``cache`` option is a compilation cache directory, where Twig caches + the compiled templates to avoid the parsing phase for sub-sequent + requests. It is very different from the cache you might want to add for + the evaluated templates. For such a need, you can use any available PHP + cache library. + +To load a template from this environment you just have to call the +``loadTemplate()`` method which then returns a ``Twig_Template`` instance:: + + $template = $twig->loadTemplate('index.html'); + +To render the template with some variables, call the ``render()`` method:: + + echo $template->render(array('the' => 'variables', 'go' => 'here')); + +.. note:: + + The ``display()`` method is a shortcut to output the template directly. + +You can also load and render the template in one fell swoop:: + + echo $twig->render('index.html', array('the' => 'variables', 'go' => 'here')); + +.. _environment_options: + +Environment Options +------------------- + +When creating a new ``Twig_Environment`` instance, you can pass an array of +options as the constructor second argument:: + + $twig = new Twig_Environment($loader, array('debug' => true)); + +The following options are available: + +* ``debug``: When set to ``true``, the generated templates have a + ``__toString()`` method that you can use to display the generated nodes + (default to ``false``). + +* ``charset``: The charset used by the templates (default to ``utf-8``). + +* ``base_template_class``: The base template class to use for generated + templates (default to ``Twig_Template``). + +* ``cache``: An absolute path where to store the compiled templates, or + ``false`` to disable caching (which is the default). + +* ``auto_reload``: When developing with Twig, it's useful to recompile the + template whenever the source code changes. If you don't provide a value for + the ``auto_reload`` option, it will be determined automatically based on the + ``debug`` value. + +* ``strict_variables``: If set to ``false``, Twig will silently ignore invalid + variables (variables and or attributes/methods that do not exist) and + replace them with a ``null`` value. When set to ``true``, Twig throws an + exception instead (default to ``false``). + +* ``autoescape``: If set to ``true``, auto-escaping will be enabled by default + for all templates (default to ``true``). As of Twig 1.8, you can set the + escaping strategy to use (``html``, ``js``, ``css``, ``false`` to disable, + or a PHP callback that takes the template "filename" and must return the + escaping strategy to use -- the callback cannot be a function name to avoid + collision with built-in escaping strategies). + +* ``optimizations``: A flag that indicates which optimizations to apply + (default to ``-1`` -- all optimizations are enabled; set it to ``0`` to + disable). + +Loaders +------- + +Loaders are responsible for loading templates from a resource such as the file +system. + +Compilation Cache +~~~~~~~~~~~~~~~~~ + +All template loaders can cache the compiled templates on the filesystem for +future reuse. It speeds up Twig a lot as templates are only compiled once; and +the performance boost is even larger if you use a PHP accelerator such as APC. +See the ``cache`` and ``auto_reload`` options of ``Twig_Environment`` above +for more information. + +Built-in Loaders +~~~~~~~~~~~~~~~~ + +Here is a list of the built-in loaders Twig provides: + +``Twig_Loader_Filesystem`` +.......................... + +``Twig_Loader_Filesystem`` loads templates from the file system. This loader +can find templates in folders on the file system and is the preferred way to +load them:: + + $loader = new Twig_Loader_Filesystem($templateDir); + +It can also look for templates in an array of directories:: + + $loader = new Twig_Loader_Filesystem(array($templateDir1, $templateDir2)); + +With such a configuration, Twig will first look for templates in +``$templateDir1`` and if they do not exist, it will fallback to look for them +in the ``$templateDir2``. + +``Twig_Loader_String`` +...................... + +``Twig_Loader_String`` loads templates from strings. It's a dummy loader as +the template reference is the template source code:: + + $loader = new Twig_Loader_String(); + $twig = new Twig_Environment($loader); + + echo $twig->render('Hello {{ name }}!', array('name' => 'Fabien')); + +This loader should only be used for unit testing as it has severe limitations: +several tags, like ``extends`` or ``include`` do not make sense to use as the +reference to the template is the template source code itself. + +``Twig_Loader_Array`` +..................... + +``Twig_Loader_Array`` loads a template from a PHP array. It's passed an array +of strings bound to template names:: + + $loader = new Twig_Loader_Array(array( + 'index.html' => 'Hello {{ name }}!', + )); + $twig = new Twig_Environment($loader); + + echo $twig->render('index.html', array('name' => 'Fabien')); + +This loader is very useful for unit testing. It can also be used for small +projects where storing all templates in a single PHP file might make sense. + +.. tip:: + + When using the ``Array`` or ``String`` loaders with a cache mechanism, you + should know that a new cache key is generated each time a template content + "changes" (the cache key being the source code of the template). If you + don't want to see your cache grows out of control, you need to take care + of clearing the old cache file by yourself. + +Create your own Loader +~~~~~~~~~~~~~~~~~~~~~~ + +All loaders implement the ``Twig_LoaderInterface``:: + + interface Twig_LoaderInterface + { + /** + * Gets the source code of a template, given its name. + * + * @param string $name string The name of the template to load + * + * @return string The template source code + */ + function getSource($name); + + /** + * Gets the cache key to use for the cache for a given template name. + * + * @param string $name string The name of the template to load + * + * @return string The cache key + */ + function getCacheKey($name); + + /** + * Returns true if the template is still fresh. + * + * @param string $name The template name + * @param timestamp $time The last modification time of the cached template + */ + function isFresh($name, $time); + } + +As an example, here is how the built-in ``Twig_Loader_String`` reads:: + + class Twig_Loader_String implements Twig_LoaderInterface + { + public function getSource($name) + { + return $name; + } + + public function getCacheKey($name) + { + return $name; + } + + public function isFresh($name, $time) + { + return false; + } + } + +The ``isFresh()`` method must return ``true`` if the current cached template +is still fresh, given the last modification time, or ``false`` otherwise. + +Using Extensions +---------------- + +Twig extensions are packages that add new features to Twig. Using an +extension is as simple as using the ``addExtension()`` method:: + + $twig->addExtension(new Twig_Extension_Sandbox()); + +Twig comes bundled with the following extensions: + +* *Twig_Extension_Core*: Defines all the core features of Twig. + +* *Twig_Extension_Escaper*: Adds automatic output-escaping and the possibility + to escape/unescape blocks of code. + +* *Twig_Extension_Sandbox*: Adds a sandbox mode to the default Twig + environment, making it safe to evaluated untrusted code. + +* *Twig_Extension_Optimizer*: Optimizers the node tree before compilation. + +The core, escaper, and optimizer extensions do not need to be added to the +Twig environment, as they are registered by default. You can disable an +already registered extension:: + + $twig->removeExtension('escaper'); + +Built-in Extensions +------------------- + +This section describes the features added by the built-in extensions. + +.. tip:: + + Read the chapter about extending Twig to learn how to create your own + extensions. + +Core Extension +~~~~~~~~~~~~~~ + +The ``core`` extension defines all the core features of Twig: + +* Tags: + + * ``for`` + * ``if`` + * ``extends`` + * ``include`` + * ``block`` + * ``filter`` + * ``macro`` + * ``import`` + * ``from`` + * ``set`` + * ``spaceless`` + +* Filters: + + * ``date`` + * ``format`` + * ``replace`` + * ``url_encode`` + * ``json_encode`` + * ``title`` + * ``capitalize`` + * ``upper`` + * ``lower`` + * ``striptags`` + * ``join`` + * ``reverse`` + * ``length`` + * ``sort`` + * ``merge`` + * ``default`` + * ``keys`` + * ``escape`` + * ``e`` + +* Functions: + + * ``range`` + * ``constant`` + * ``cycle`` + * ``parent`` + * ``block`` + +* Tests: + + * ``even`` + * ``odd`` + * ``defined`` + * ``sameas`` + * ``null`` + * ``divisibleby`` + * ``constant`` + * ``empty`` + +Escaper Extension +~~~~~~~~~~~~~~~~~ + +The ``escaper`` extension adds automatic output escaping to Twig. It defines a +tag, ``autoescape``, and a filter, ``raw``. + +When creating the escaper extension, you can switch on or off the global +output escaping strategy:: + + $escaper = new Twig_Extension_Escaper(true); + $twig->addExtension($escaper); + +If set to ``true``, all variables in templates are escaped (using the ``html`` +escaping strategy), except those using the ``raw`` filter: + +.. code-block:: jinja + + {{ article.to_html|raw }} + +You can also change the escaping mode locally by using the ``autoescape`` tag +(see the :doc:`autoescape` doc for the syntax used before +Twig 1.8): + +.. code-block:: jinja + + {% autoescape 'html' %} + {{ var }} + {{ var|raw }} {# var won't be escaped #} + {{ var|escape }} {# var won't be double-escaped #} + {% endautoescape %} + +.. warning:: + + The ``autoescape`` tag has no effect on included files. + +The escaping rules are implemented as follows: + +* Literals (integers, booleans, arrays, ...) used in the template directly as + variables or filter arguments are never automatically escaped: + + .. code-block:: jinja + + {{ "Twig
    " }} {# won't be escaped #} + + {% set text = "Twig
    " %} + {{ text }} {# will be escaped #} + +* Expressions which the result is always a literal or a variable marked safe + are never automatically escaped: + + .. code-block:: jinja + + {{ foo ? "Twig
    " : "
    Twig" }} {# won't be escaped #} + + {% set text = "Twig
    " %} + {{ foo ? text : "
    Twig" }} {# will be escaped #} + + {% set text = "Twig
    " %} + {{ foo ? text|raw : "
    Twig" }} {# won't be escaped #} + + {% set text = "Twig
    " %} + {{ foo ? text|escape : "
    Twig" }} {# the result of the expression won't be escaped #} + +* Escaping is applied before printing, after any other filter is applied: + + .. code-block:: jinja + + {{ var|upper }} {# is equivalent to {{ var|upper|escape }} #} + +* The `raw` filter should only be used at the end of the filter chain: + + .. code-block:: jinja + + {{ var|raw|upper }} {# will be escaped #} + + {{ var|upper|raw }} {# won't be escaped #} + +* Automatic escaping is not applied if the last filter in the chain is marked + safe for the current context (e.g. ``html`` or ``js``). ``escaper`` and + ``escaper('html')`` are marked safe for html, ``escaper('js')`` is marked + safe for javascript, ``raw`` is marked safe for everything. + + .. code-block:: jinja + + {% autoescape true js %} + {{ var|escape('html') }} {# will be escaped for html and javascript #} + {{ var }} {# will be escaped for javascript #} + {{ var|escape('js') }} {# won't be double-escaped #} + {% endautoescape %} + +.. note:: + + Note that autoescaping has some limitations as escaping is applied on + expressions after evaluation. For instance, when working with + concatenation, ``{{ foo|raw ~ bar }}`` won't give the expected result as + escaping is applied on the result of the concatenation, not on the + individual variables (so, the ``raw`` filter won't have any effect here). + +Sandbox Extension +~~~~~~~~~~~~~~~~~ + +The ``sandbox`` extension can be used to evaluate untrusted code. Access to +unsafe attributes and methods is prohibited. The sandbox security is managed +by a policy instance. By default, Twig comes with one policy class: +``Twig_Sandbox_SecurityPolicy``. This class allows you to white-list some +tags, filters, properties, and methods:: + + $tags = array('if'); + $filters = array('upper'); + $methods = array( + 'Article' => array('getTitle', 'getBody'), + ); + $properties = array( + 'Article' => array('title', 'body'), + ); + $functions = array('range'); + $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); + +With the previous configuration, the security policy will only allow usage of +the ``if`` tag, and the ``upper`` filter. Moreover, the templates will only be +able to call the ``getTitle()`` and ``getBody()`` methods on ``Article`` +objects, and the ``title`` and ``body`` public properties. Everything else +won't be allowed and will generate a ``Twig_Sandbox_SecurityError`` exception. + +The policy object is the first argument of the sandbox constructor:: + + $sandbox = new Twig_Extension_Sandbox($policy); + $twig->addExtension($sandbox); + +By default, the sandbox mode is disabled and should be enabled when including +untrusted template code by using the ``sandbox`` tag: + +.. code-block:: jinja + + {% sandbox %} + {% include 'user.html' %} + {% endsandbox %} + +You can sandbox all templates by passing ``true`` as the second argument of +the extension constructor:: + + $sandbox = new Twig_Extension_Sandbox($policy, true); + +Optimizer Extension +~~~~~~~~~~~~~~~~~~~ + +The ``optimizer`` extension optimizes the node tree before compilation:: + + $twig->addExtension(new Twig_Extension_Optimizer()); + +By default, all optimizations are turned on. You can select the ones you want +to enable by passing them to the constructor:: + + $optimizer = new Twig_Extension_Optimizer(Twig_NodeVisitor_Optimizer::OPTIMIZE_FOR); + + $twig->addExtension($optimizer); + +Exceptions +---------- + +Twig can throw exceptions: + +* ``Twig_Error``: The base exception for all errors. + +* ``Twig_Error_Syntax``: Thrown to tell the user that there is a problem with + the template syntax. + +* ``Twig_Error_Runtime``: Thrown when an error occurs at runtime (when a filter + does not exist for instance). + +* ``Twig_Error_Loader``: Thrown when an error occurs during template loading. + +* ``Twig_Sandbox_SecurityError``: Thrown when an unallowed tag, filter, or + method is called in a sandboxed template. diff --git a/vendor/twig/twig/doc/coding_standards.rst b/vendor/twig/twig/doc/coding_standards.rst new file mode 100644 index 0000000..e0aab35 --- /dev/null +++ b/vendor/twig/twig/doc/coding_standards.rst @@ -0,0 +1,101 @@ +Coding Standards +================ + +When writing Twig templates, we recommend you to follow these official coding +standards: + +* Put one (and only one) space after the start of a delimiter (``{{``, ``{%``, + and ``{#``) and before the end of a delimiter (``}}``, ``%}``, and ``#}``): + + .. code-block:: jinja + + {{ foo }} + {# comment #} + {% if foo %}{% endif %} + + When using the whitespace control character, do not put any spaces between + it and the delimiter: + + .. code-block:: jinja + + {{- foo -}} + {#- comment -#} + {%- if foo -%}{%- endif -%} + +* Put one (and only one) space before and after the following operators: + comparison operators (``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``), math + operators (``+``, ``-``, ``/``, ``*``, ``%``, ``//``, ``**``), logic + operators (``not``, ``and``, ``or``), ``~``, ``is``, ``in``, and the ternary + operator (``?:``): + + .. code-block:: jinja + + {{ 1 + 2 }} + {{ foo ~ bar }} + {{ true ? true : false }} + +* Put one (and only one) space after the ``:`` sign in hashes and ``,`` in + arrays and hashes: + + .. code-block:: jinja + + {{ [1, 2, 3] }} + {{ {'foo': 'bar'} }} + +* Do not put any spaces after an opening parenthesis and before a closing + parenthesis in expressions: + + .. code-block:: jinja + + {{ 1 + (2 * 3) }} + +* Do not put any spaces before and after string delimiters: + + .. code-block:: jinja + + {{ 'foo' }} + {{ "foo" }} + +* Do not put any spaces before and after the following operators: ``|``, + ``.``, ``..``, ``[]``: + + .. code-block:: jinja + + {{ foo|upper|lower }} + {{ user.name }} + {{ user[name] }} + {% for i in 1..12 %}{% endfor %} + +* Do not put any spaces before and after the parenthesis used for filter and + function calls: + + .. code-block:: jinja + + {{ foo|default('foo') }} + {{ range(1..10) }} + +* Do not put any spaces before and after the opening and the closing of arrays + and hashes: + + .. code-block:: jinja + + {{ [1, 2, 3] }} + {{ {'foo': 'bar'} }} + +* Use lower cased and underscored variable names: + + .. code-block:: jinja + + {% set foo = 'foo' %} + {% set foo_bar = 'foo' %} + +* Indent your code inside tags (use the same indentation as the one used for + the main language of the file): + + .. code-block:: jinja + + {% block foo %} + {% if true %} + true + {% endif %} + {% endblock %} diff --git a/vendor/twig/twig/doc/filters/abs.rst b/vendor/twig/twig/doc/filters/abs.rst new file mode 100644 index 0000000..3a82f62 --- /dev/null +++ b/vendor/twig/twig/doc/filters/abs.rst @@ -0,0 +1,18 @@ +``abs`` +======= + +The ``abs`` filter returns the absolute value. + +.. code-block:: jinja + + {# number = -5 #} + + {{ number|abs }} + + {# outputs 5 #} + +.. note:: + + Internally, Twig uses the PHP `abs`_ function. + +.. _`abs`: http://php.net/abs diff --git a/vendor/twig/twig/doc/filters/capitalize.rst b/vendor/twig/twig/doc/filters/capitalize.rst new file mode 100644 index 0000000..10546a1 --- /dev/null +++ b/vendor/twig/twig/doc/filters/capitalize.rst @@ -0,0 +1,11 @@ +``capitalize`` +============== + +The ``capitalize`` filter capitalizes a value. The first character will be +uppercase, all others lowercase: + +.. code-block:: jinja + + {{ 'my first car'|capitalize }} + + {# outputs 'My first car' #} diff --git a/vendor/twig/twig/doc/filters/convert_encoding.rst b/vendor/twig/twig/doc/filters/convert_encoding.rst new file mode 100644 index 0000000..2febab2 --- /dev/null +++ b/vendor/twig/twig/doc/filters/convert_encoding.rst @@ -0,0 +1,22 @@ +``convert_encoding`` +==================== + +.. versionadded:: 1.4 + The ``convert_encoding`` filter was added in Twig 1.4. + +The ``convert_encoding`` filter converts a string from one encoding to +another. The first argument is the expected output charset and the second one +is the input charset: + +.. code-block:: jinja + + {{ data|convert_encoding('UTF-8', 'iso-2022-jp') }} + +.. note:: + + This filter relies on the `iconv`_ or `mbstring`_ extension, so one of + them must be installed. In case both are installed, `mbstring`_ is used by + default (Twig before 1.8.1 uses `iconv`_ by default). + +.. _`iconv`: http://php.net/iconv +.. _`mbstring`: http://php.net/mbstring diff --git a/vendor/twig/twig/doc/filters/date.rst b/vendor/twig/twig/doc/filters/date.rst new file mode 100644 index 0000000..e6dc613 --- /dev/null +++ b/vendor/twig/twig/doc/filters/date.rst @@ -0,0 +1,65 @@ +``date`` +======== + +.. versionadded:: 1.1 + The timezone support has been added in Twig 1.1. + +.. versionadded:: 1.5 + The default date format support has been added in Twig 1.5. + +.. versionadded:: 1.6.1 + The default timezone support has been added in Twig 1.6.1. + +The ``date`` filter formats a date to a given format: + +.. code-block:: jinja + + {{ post.published_at|date("m/d/Y") }} + +The ``date`` filter accepts strings (it must be in a format supported by the +`strtotime`_ function), `DateTime`_ instances, or `DateInterval`_ instances. For +instance, to display the current date, filter the word "now": + +.. code-block:: jinja + + {{ "now"|date("m/d/Y") }} + +To escape words and characters in the date format use ``\\`` in front of each character: + +.. code-block:: jinja + + {{ post.published_at|date("F jS \\a\\t g:ia") }} + +You can also specify a timezone: + +.. code-block:: jinja + + {{ post.published_at|date("m/d/Y", "Europe/Paris") }} + +If no format is provided, Twig will use the default one: ``F j, Y H:i``. This +default can be easily changed by calling the ``setDateFormat()`` method on the +``core`` extension instance. The first argument is the default format for +dates and the second one is the default format for date intervals: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setDateFormat('d/m/Y', '%d days'); + +The default timezone can also be set globally by calling ``setTimezone()``: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setTimezone('Europe/Paris'); + +.. _`strtotime`: http://www.php.net/strtotime +.. _`DateTime`: http://www.php.net/DateTime +.. _`DateInterval`: http://www.php.net/DateInterval + +If the value passed to the ``date`` filter is null, it will return the current date by default. +If an empty string is desired instead of the current date, use a ternary operator: + +.. code-block:: jinja + + {{ post.published_at is empty ? "" : post.published_at|date("m/d/Y") }} diff --git a/vendor/twig/twig/doc/filters/date_modify.rst b/vendor/twig/twig/doc/filters/date_modify.rst new file mode 100644 index 0000000..a7ec621 --- /dev/null +++ b/vendor/twig/twig/doc/filters/date_modify.rst @@ -0,0 +1,18 @@ +``date_modify`` +=============== + +.. versionadded:: 1.9.0 + The date_modify filter has been added in Twig 1.9.0. + +The ``date_modify`` filter modifies a date with a given modifier string: + +.. code-block:: jinja + + {{ post.published_at|date_modify("+1 day")|date("m/d/Y") }} + +The ``date_modify`` filter accepts strings (it must be in a format supported by the +`strtotime`_ function) or `DateTime`_ instances. You can easily combine it with the `date`_ +filter for formatting. + +.. _`strtotime`: http://www.php.net/strtotime +.. _`DateTime`: http://www.php.net/DateTime diff --git a/vendor/twig/twig/doc/filters/default.rst b/vendor/twig/twig/doc/filters/default.rst new file mode 100644 index 0000000..4055ead --- /dev/null +++ b/vendor/twig/twig/doc/filters/default.rst @@ -0,0 +1,28 @@ +``default`` +=========== + +The ``default`` filter returns the passed default value if the value is +undefined or empty, otherwise the value of the variable: + +.. code-block:: jinja + + {{ var|default('var is not defined') }} + + {{ var.foo|default('foo item on var is not defined') }} + + {{ var['foo']|default('foo item on var is not defined') }} + + {{ ''|default('passed var is empty') }} + +When using the ``default`` filter on an expression that uses variables in some +method calls, be sure to use the ``default`` filter whenever a variable can be +undefined: + +.. code-block:: jinja + + {{ var.method(foo|default('foo'))|default('foo') }} + +.. note:: + + Read the documentation for the :doc:`defined<../tests/defined>` and + :doc:`empty<../tests/empty>` tests to learn more about their semantics. diff --git a/vendor/twig/twig/doc/filters/escape.rst b/vendor/twig/twig/doc/filters/escape.rst new file mode 100644 index 0000000..9685585 --- /dev/null +++ b/vendor/twig/twig/doc/filters/escape.rst @@ -0,0 +1,60 @@ +``escape`` +========== + +.. versionadded:: 1.9.0 + The ``css``, ``url``, and ``html_attr`` strategies were added in Twig + 1.9.0. + +The ``escape`` filter escapes a string for safe insertion into the final +output. It supports different escaping strategies depending on the template +context. + +By default, it uses the HTML escaping strategy: + +.. code-block:: jinja + + {{ user.username|escape }} + +For convenience, the ``e`` filter is defined as an alias: + +.. code-block:: jinja + + {{ user.username|e }} + +The ``escape`` filter can also be used in other contexts than HTML thanks to +an optional argument which defines the escaping strategy to use: + +.. code-block:: jinja + + {{ user.username|e }} + {# is equivalent to #} + {{ user.username|e('html') }} + +And here is how to escape variables included in JavaScript code: + +.. code-block:: jinja + + {{ user.username|escape('js') }} + {{ user.username|e('js') }} + +The ``escape`` filter supports the following escaping strategies: + +* ``html``: escapes a string for the **HTML body** context. + +* ``js``: escapes a string for the **JavaScript context**. + +* ``css``: escapes a string for the **CSS context**. CSS escaping can be + applied to any string being inserted into CSS and escapes everything except + alphanumerics. + +* ``url``: escapes a string for the **URI or parameter contexts**. This should + not be used to escape an entire URI; only a subcomponent being inserted. + +* ``html_attr``: escapes a string for the **HTML attribute** context. + +.. note:: + + Internally, ``escape`` uses the PHP native `htmlspecialchars`_ function + for the HTML escaping strategy. + +.. _`htmlspecialchars`: http://php.net/htmlspecialchars diff --git a/vendor/twig/twig/doc/filters/format.rst b/vendor/twig/twig/doc/filters/format.rst new file mode 100644 index 0000000..fd5b18d --- /dev/null +++ b/vendor/twig/twig/doc/filters/format.rst @@ -0,0 +1,16 @@ +``format`` +========== + +The ``format`` filter formats a given string by replacing the placeholders +(placeholders follows the `printf`_ notation): + +.. code-block:: jinja + + {{ "I like %s and %s."|format(foo, "bar") }} + + {# returns I like foo and bar + if the foo parameter equals to the foo string. #} + +.. _`printf`: http://www.php.net/printf + +.. seealso:: :doc:`replace` diff --git a/vendor/twig/twig/doc/filters/index.rst b/vendor/twig/twig/doc/filters/index.rst new file mode 100644 index 0000000..bd8f495 --- /dev/null +++ b/vendor/twig/twig/doc/filters/index.rst @@ -0,0 +1,30 @@ +Filters +======= + +.. toctree:: + :maxdepth: 1 + + date + format + replace + number_format + url_encode + json_encode + convert_encoding + title + capitalize + nl2br + upper + lower + striptags + join + reverse + length + sort + default + keys + escape + raw + merge + slice + trim diff --git a/vendor/twig/twig/doc/filters/join.rst b/vendor/twig/twig/doc/filters/join.rst new file mode 100644 index 0000000..eec2045 --- /dev/null +++ b/vendor/twig/twig/doc/filters/join.rst @@ -0,0 +1,18 @@ +``join`` +======== + +The ``join`` filter returns a string which is the concatenation of the items +of a sequence: + +.. code-block:: jinja + + {{ [1, 2, 3]|join }} + {# returns 123 #} + +The separator between elements is an empty string per default, but you can +define it with the optional first parameter: + +.. code-block:: jinja + + {{ [1, 2, 3]|join('|') }} + {# returns 1|2|3 #} diff --git a/vendor/twig/twig/doc/filters/json_encode.rst b/vendor/twig/twig/doc/filters/json_encode.rst new file mode 100644 index 0000000..c7d19b3 --- /dev/null +++ b/vendor/twig/twig/doc/filters/json_encode.rst @@ -0,0 +1,14 @@ +``json_encode`` +=============== + +The ``json_encode`` filter returns the JSON representation of a string: + +.. code-block:: jinja + + {{ data|json_encode() }} + +.. note:: + + Internally, Twig uses the PHP `json_encode`_ function. + +.. _`json_encode`: http://php.net/json_encode diff --git a/vendor/twig/twig/doc/filters/keys.rst b/vendor/twig/twig/doc/filters/keys.rst new file mode 100644 index 0000000..e4f090c --- /dev/null +++ b/vendor/twig/twig/doc/filters/keys.rst @@ -0,0 +1,11 @@ +``keys`` +======== + +The ``keys`` filter returns the keys of an array. It is useful when you want to +iterate over the keys of an array: + +.. code-block:: jinja + + {% for key in array|keys %} + ... + {% endfor %} diff --git a/vendor/twig/twig/doc/filters/length.rst b/vendor/twig/twig/doc/filters/length.rst new file mode 100644 index 0000000..f79b9bd --- /dev/null +++ b/vendor/twig/twig/doc/filters/length.rst @@ -0,0 +1,12 @@ +``length`` +========== + +The ``length`` filters returns the number of items of a sequence or mapping, or +the length of a string: + +.. code-block:: jinja + + {% if users|length > 10 %} + ... + {% endif %} + diff --git a/vendor/twig/twig/doc/filters/lower.rst b/vendor/twig/twig/doc/filters/lower.rst new file mode 100644 index 0000000..ef9faa9 --- /dev/null +++ b/vendor/twig/twig/doc/filters/lower.rst @@ -0,0 +1,10 @@ +``lower`` +========= + +The ``lower`` filter converts a value to lowercase: + +.. code-block:: jinja + + {{ 'WELCOME'|lower }} + + {# outputs 'welcome' #} diff --git a/vendor/twig/twig/doc/filters/merge.rst b/vendor/twig/twig/doc/filters/merge.rst new file mode 100644 index 0000000..4348e7a --- /dev/null +++ b/vendor/twig/twig/doc/filters/merge.rst @@ -0,0 +1,41 @@ +``merge`` +========= + +The ``merge`` filter merges an array with the another array: + +.. code-block:: jinja + + {% set values = [1, 2] %} + + {% set values = values|merge(['apple', 'orange']) %} + + {# values now contains [1, 2, 'apple', 'orange'] #} + +New values are added at the end of the existing ones. + +The ``merge`` filter also works on hashes: + +.. code-block:: jinja + + {% set items = { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'unknown' } %} + + {% set items = items|merge({ 'peugeot': 'car', 'renault': 'car' }) %} + + {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car', 'renault': 'car' } #} + +For hashes, the merging process occurs on the keys: if the key does not +already exist, it is added but if the key already exists, its value is +overridden. + +.. tip:: + + If you want to ensure that some values are defined in an array (by given + default values), reverse the two elements in the call: + + .. code-block:: jinja + + {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %} + + {% set items = { 'apple': 'unknown' }|merge(items) %} + + {# items now contains { 'apple': 'fruit', 'orange': 'fruit' } #} diff --git a/vendor/twig/twig/doc/filters/nl2br.rst b/vendor/twig/twig/doc/filters/nl2br.rst new file mode 100644 index 0000000..694c672 --- /dev/null +++ b/vendor/twig/twig/doc/filters/nl2br.rst @@ -0,0 +1,22 @@ +``nl2br`` +========= + +.. versionadded:: 1.5 + The nl2br filter was added in Twig 1.5. + +The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: + +.. code-block:: jinja + + {{ "I like Twig.\nYou will like it too."|nl2br }} + {# outputs + + I like Twig.
    + You will like it too. + + #} + +.. note:: + + The ``nl2br`` filter pre-escapes the input before applying the + transformation. diff --git a/vendor/twig/twig/doc/filters/number_format.rst b/vendor/twig/twig/doc/filters/number_format.rst new file mode 100644 index 0000000..ccc8f2f --- /dev/null +++ b/vendor/twig/twig/doc/filters/number_format.rst @@ -0,0 +1,38 @@ +``number_format`` +================= + +.. versionadded:: 1.5 + The number_format filter was added in Twig 1.5 + +The ``number_format`` filter formats numbers. It is a wrapper around PHP's +`number_format`_ function: + +.. code-block:: jinja + + {{ 200.35|number_format }} + +You can control the number of decimal places, decimal point, and thousands +separator using the additional arguments: + +.. code-block:: jinja + + {{ 9800.333|number_format(2, ',', '.') }} + +If no formatting options are provided then Twig will use the default formatting +options of: + +- 0 decimal places. +- ``.`` as the decimal point. +- ``,`` as the thousands separator. + +These defaults can be easily changed through the core extension: + +.. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setNumberFormat(3, ',', '.'); + +The defaults set for ``number_format`` can be over-ridden upon each call using the +additional parameters. + +.. _`number_format`: http://php.net/number_format diff --git a/vendor/twig/twig/doc/filters/raw.rst b/vendor/twig/twig/doc/filters/raw.rst new file mode 100644 index 0000000..434dd24 --- /dev/null +++ b/vendor/twig/twig/doc/filters/raw.rst @@ -0,0 +1,12 @@ +``raw`` +======= + +The ``raw`` filter marks the value as being "safe", which means that in an +environment with automatic escaping enabled this variable will not be escaped +if ``raw`` is the last filter applied to it: + +.. code-block:: jinja + + {% autoescape true %} + {{ var|raw }} {# var won't be escaped #} + {% endautoescape %} diff --git a/vendor/twig/twig/doc/filters/replace.rst b/vendor/twig/twig/doc/filters/replace.rst new file mode 100644 index 0000000..cc603fa --- /dev/null +++ b/vendor/twig/twig/doc/filters/replace.rst @@ -0,0 +1,14 @@ +``replace`` +=========== + +The ``replace`` filter formats a given string by replacing the placeholders +(placeholders are free-form): + +.. code-block:: jinja + + {{ "I like %this% and %that%."|replace({'%this%': foo, '%that%': "bar"}) }} + + {# returns I like foo and bar + if the foo parameter equals to the foo string. #} + +.. seealso:: :doc:`format` diff --git a/vendor/twig/twig/doc/filters/reverse.rst b/vendor/twig/twig/doc/filters/reverse.rst new file mode 100644 index 0000000..54fafb4 --- /dev/null +++ b/vendor/twig/twig/doc/filters/reverse.rst @@ -0,0 +1,23 @@ +``reverse`` +=========== + +.. versionadded:: 1.6 + Support for strings has been added in Twig 1.6. + +The ``reverse`` filter reverses a sequence, a mapping, or a string: + +.. code-block:: jinja + + {% for use in users|reverse %} + ... + {% endfor %} + + {{ '1234'|reverse }} + + {# outputs 4321 #} + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +.. _`Traversable`: http://php.net/Traversable diff --git a/vendor/twig/twig/doc/filters/slice.rst b/vendor/twig/twig/doc/filters/slice.rst new file mode 100644 index 0000000..80a4293 --- /dev/null +++ b/vendor/twig/twig/doc/filters/slice.rst @@ -0,0 +1,57 @@ +``slice`` +=========== + +.. versionadded:: 1.6 + The slice filter was added in Twig 1.6. + +The ``slice`` filter extracts a slice of a sequence, a mapping, or a string: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4]|slice(1, 2) %} + {# will iterate over 2 and 3 #} + {% endfor %} + + {{ '1234'|slice(1, 2) }} + + {# outputs 23 #} + +You can use any valid expression for both the start and the length: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4]|slice(start, length) %} + {# ... #} + {% endfor %} + +As syntactic sugar, you can also use the ``[]`` notation: + +.. code-block:: jinja + + {% for i in [1, 2, 3, 4][start:length] %} + {# ... #} + {% endfor %} + + {{ '1234'[1:2] }} + +The ``slice`` filter works as the `array_slice`_ PHP function for arrays and +`substr`_ for strings. + +If the start is non-negative, the sequence will start at that start in the +variable. If start is negative, the sequence will start that far from the end +of the variable. + +If length is given and is positive, then the sequence will have up to that +many elements in it. If the variable is shorter than the length, then only the +available variable elements will be present. If length is given and is +negative then the sequence will stop that many elements from the end of the +variable. If it is omitted, then the sequence will have everything from offset +up until the end of the variable. + +.. note:: + + It also works with objects implementing the `Traversable`_ interface. + +.. _`Traversable`: http://php.net/manual/en/class.traversable.php +.. _`array_slice`: http://php.net/array_slice +.. _`substr`: http://php.net/substr diff --git a/vendor/twig/twig/doc/filters/sort.rst b/vendor/twig/twig/doc/filters/sort.rst new file mode 100644 index 0000000..0e330d2 --- /dev/null +++ b/vendor/twig/twig/doc/filters/sort.rst @@ -0,0 +1,17 @@ +``sort`` +======== + +The ``sort`` filter sorts an array: + +.. code-block:: jinja + + {% for use in users|sort %} + ... + {% endfor %} + +.. note:: + + Internally, Twig uses the PHP `asort`_ function to maintain index + association. + +.. _`asort`: http://php.net/asort diff --git a/vendor/twig/twig/doc/filters/striptags.rst b/vendor/twig/twig/doc/filters/striptags.rst new file mode 100644 index 0000000..5ccca45 --- /dev/null +++ b/vendor/twig/twig/doc/filters/striptags.rst @@ -0,0 +1,15 @@ +``striptags`` +============= + +The ``striptags`` filter strips SGML/XML tags and replace adjacent whitespace +by one space: + +.. code-block:: jinja + + {% some_html|striptags %} + +.. note:: + + Internally, Twig uses the PHP `strip_tags`_ function. + +.. _`strip_tags`: http://php.net/strip_tags diff --git a/vendor/twig/twig/doc/filters/title.rst b/vendor/twig/twig/doc/filters/title.rst new file mode 100644 index 0000000..c5a318e --- /dev/null +++ b/vendor/twig/twig/doc/filters/title.rst @@ -0,0 +1,11 @@ +``title`` +========= + +The ``title`` filter returns a titlecased version of the value. Words will +start with uppercase letters, all remaining characters are lowercase: + +.. code-block:: jinja + + {{ 'my first car'|title }} + + {# outputs 'My First Car' #} diff --git a/vendor/twig/twig/doc/filters/trim.rst b/vendor/twig/twig/doc/filters/trim.rst new file mode 100644 index 0000000..f1215f6 --- /dev/null +++ b/vendor/twig/twig/doc/filters/trim.rst @@ -0,0 +1,24 @@ +``trim`` +======== + +.. versionadded:: 1.6.2 + The trim filter was added in Twig 1.6.2. + +The ``trim`` filter strips whitespace (or other characters) from the beginning +and end of a string: + +.. code-block:: jinja + + {{ ' I like Twig. '|trim }} + + {# outputs 'I like Twig.' #} + + {{ ' I like Twig.'|trim('.') }} + + {# outputs ' I like Twig' #} + +.. note:: + + Internally, Twig uses the PHP `trim`_ function. + +.. _`trim`: http://php.net/trim diff --git a/vendor/twig/twig/doc/filters/upper.rst b/vendor/twig/twig/doc/filters/upper.rst new file mode 100644 index 0000000..561cebe --- /dev/null +++ b/vendor/twig/twig/doc/filters/upper.rst @@ -0,0 +1,10 @@ +``upper`` +========= + +The ``upper`` filter converts a value to uppercase: + +.. code-block:: jinja + + {{ 'welcome'|upper }} + + {# outputs 'WELCOME' #} diff --git a/vendor/twig/twig/doc/filters/url_encode.rst b/vendor/twig/twig/doc/filters/url_encode.rst new file mode 100644 index 0000000..c141f3b --- /dev/null +++ b/vendor/twig/twig/doc/filters/url_encode.rst @@ -0,0 +1,14 @@ +``url_encode`` +============== + +The ``url_encode`` filter URL encodes a given string: + +.. code-block:: jinja + + {{ data|url_encode() }} + +.. note:: + + Internally, Twig uses the PHP `urlencode`_ function. + +.. _`urlencode`: http://php.net/urlencode diff --git a/vendor/twig/twig/doc/functions/attribute.rst b/vendor/twig/twig/doc/functions/attribute.rst new file mode 100644 index 0000000..3051bda --- /dev/null +++ b/vendor/twig/twig/doc/functions/attribute.rst @@ -0,0 +1,18 @@ +``attribute`` +============= + +.. versionadded:: 1.2 + The ``attribute`` function was added in Twig 1.2. + +``attribute`` can be used to access a "dynamic" attribute of a variable: + +.. code-block:: jinja + + {{ attribute(object, method) }} + {{ attribute(object, method, arguments) }} + {{ attribute(array, item) }} + +.. note:: + + The resolution algorithm is the same as the one used for the ``.`` + notation, except that the item can be any valid expression. diff --git a/vendor/twig/twig/doc/functions/block.rst b/vendor/twig/twig/doc/functions/block.rst new file mode 100644 index 0000000..fd571ef --- /dev/null +++ b/vendor/twig/twig/doc/functions/block.rst @@ -0,0 +1,15 @@ +``block`` +========= + +When a template uses inheritance and if you want to print a block multiple +times, use the ``block`` function: + +.. code-block:: jinja + + {% block title %}{% endblock %} + +

    {{ block('title') }}

    + + {% block body %}{% endblock %} + +.. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>` diff --git a/vendor/twig/twig/doc/functions/constant.rst b/vendor/twig/twig/doc/functions/constant.rst new file mode 100644 index 0000000..5b247b3 --- /dev/null +++ b/vendor/twig/twig/doc/functions/constant.rst @@ -0,0 +1,9 @@ +``constant`` +============ + +``constant`` returns the constant value for a given string: + +.. code-block:: jinja + + {{ some_date|date(constant('DATE_W3C')) }} + {{ constant('Namespace\\Classname::CONSTANT_NAME') }} diff --git a/vendor/twig/twig/doc/functions/cycle.rst b/vendor/twig/twig/doc/functions/cycle.rst new file mode 100644 index 0000000..fe11d68 --- /dev/null +++ b/vendor/twig/twig/doc/functions/cycle.rst @@ -0,0 +1,20 @@ +``cycle`` +========= + +The ``cycle`` function cycles on an array of values: + +.. code-block:: jinja + + {% for i in 0..10 %} + {{ cycle(['odd', 'even'], i) }} + {% endfor %} + +The array can contain any number of values: + +.. code-block:: jinja + + {% set fruits = ['apple', 'orange', 'citrus'] %} + + {% for i in 0..10 %} + {{ cycle(fruits, i) }} + {% endfor %} diff --git a/vendor/twig/twig/doc/functions/date.rst b/vendor/twig/twig/doc/functions/date.rst new file mode 100644 index 0000000..c1a011c --- /dev/null +++ b/vendor/twig/twig/doc/functions/date.rst @@ -0,0 +1,46 @@ +``date`` +======== + +.. versionadded:: 1.6 + The date function has been added in Twig 1.6. + +.. versionadded:: 1.6.1 + The default timezone support has been added in Twig 1.6.1. + +Converts an argument to a date to allow date comparison: + +.. code-block:: jinja + + {% if date(user.created_at) < date('+2days') %} + {# do something #} + {% endif %} + +The argument must be in a format supported by the `date`_ function. + +You can pass a timezone as the second argument: + +.. code-block:: jinja + + {% if date(user.created_at) < date('+2days', 'Europe/Paris') %} + {# do something #} + {% endif %} + +If no argument is passed, the function returns the current date: + +.. code-block:: jinja + + {% if date(user.created_at) < date() %} + {# always! #} + {% endif %} + +.. note:: + + You can set the default timezone globally by calling ``setTimezone()`` on + the ``core`` extension instance: + + .. code-block:: php + + $twig = new Twig_Environment($loader); + $twig->getExtension('core')->setTimezone('Europe/Paris'); + +.. _`date`: http://www.php.net/date diff --git a/vendor/twig/twig/doc/functions/dump.rst b/vendor/twig/twig/doc/functions/dump.rst new file mode 100644 index 0000000..8ff0c05 --- /dev/null +++ b/vendor/twig/twig/doc/functions/dump.rst @@ -0,0 +1,64 @@ +``dump`` +======== + +.. versionadded:: 1.5 + The dump function was added in Twig 1.5. + +The ``dump`` function dumps information about a template variable. This is +mostly useful to debug a template that does not behave as expected by +introspecting its variables: + +.. code-block:: jinja + + {{ dump(user) }} + +.. note:: + + The ``dump`` function is not available by default. You must add the + ``Twig_Extension_Debug`` extension explicitly when creating your Twig + environment:: + + $twig = new Twig_Environment($loader, array( + 'debug' => true, + // ... + )); + $twig->addExtension(new Twig_Extension_Debug()); + + Even when enabled, the ``dump`` function won't display anything if the + ``debug`` option on the environment is not enabled (to avoid leaking debug + information on a production server). + +In an HTML context, wrap the output with a ``pre`` tag to make it easier to +read: + +.. code-block:: jinja + +
    +        {{ dump(user) }}
    +    
    + +.. tip:: + + Using a ``pre`` tag is not needed when `XDebug`_ is enabled and + ``html_errors`` is ``on``; as a bonus, the output is also nicer with + XDebug enabled. + +You can debug several variables by passing them as additional arguments: + +.. code-block:: jinja + + {{ dump(user, categories) }} + +If you don't pass any value, all variables from the current context are +dumped: + +.. code-block:: jinja + + {{ dump() }} + +.. note:: + + Internally, Twig uses the PHP `var_dump`_ function. + +.. _`XDebug`: http://xdebug.org/docs/display +.. _`var_dump`: http://php.net/var_dump diff --git a/vendor/twig/twig/doc/functions/index.rst b/vendor/twig/twig/doc/functions/index.rst new file mode 100644 index 0000000..3315528 --- /dev/null +++ b/vendor/twig/twig/doc/functions/index.rst @@ -0,0 +1,15 @@ +Functions +========= + +.. toctree:: + :maxdepth: 1 + + range + cycle + constant + random + attribute + block + parent + dump + date diff --git a/vendor/twig/twig/doc/functions/parent.rst b/vendor/twig/twig/doc/functions/parent.rst new file mode 100644 index 0000000..f5bd200 --- /dev/null +++ b/vendor/twig/twig/doc/functions/parent.rst @@ -0,0 +1,20 @@ +``parent`` +========== + +When a template uses inheritance, it's possible to render the contents of the +parent block when overriding a block by using the ``parent`` function: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block sidebar %} +

    Table Of Contents

    + ... + {{ parent() }} + {% endblock %} + +The ``parent()`` call will return the content of the ``sidebar`` block as +defined in the ``base.html`` template. + +.. seealso:: :doc:`extends<../tags/extends>`, :doc:`block<../functions/block>`, :doc:`block<../tags/block>` diff --git a/vendor/twig/twig/doc/functions/random.rst b/vendor/twig/twig/doc/functions/random.rst new file mode 100644 index 0000000..104493d --- /dev/null +++ b/vendor/twig/twig/doc/functions/random.rst @@ -0,0 +1,24 @@ +``random`` +========== + +.. versionadded:: 1.5 + The random function was added in Twig 1.5. + +.. versionadded:: 1.6 + String and integer handling was added in Twig 1.6. + +The ``random`` function returns a random value depending on the supplied +parameter type: + +* a random item from a sequence; +* a random character from a string; +* a random integer between 0 and the integer parameter (inclusive). + +.. code-block:: jinja + + {{ random(['apple', 'orange', 'citrus']) }} {# example output: orange #} + {{ random('ABC') }} {# example output: C #} + {{ random() }} {# example output: 15386094 (works as native PHP `mt_rand`_ function) #} + {{ random(5) }} {# example output: 3 #} + +.. _`mt_rand`: http://php.net/mt_rand diff --git a/vendor/twig/twig/doc/functions/range.rst b/vendor/twig/twig/doc/functions/range.rst new file mode 100644 index 0000000..c9bdd96 --- /dev/null +++ b/vendor/twig/twig/doc/functions/range.rst @@ -0,0 +1,38 @@ +``range`` +========= + +Returns a list containing an arithmetic progression of integers: + +.. code-block:: jinja + + {% for i in range(0, 3) %} + {{ i }}, + {% endfor %} + + {# returns 0, 1, 2, 3 #} + +When step is given (as the third parameter), it specifies the increment (or +decrement): + +.. code-block:: jinja + + {% for i in range(0, 6, 2) %} + {{ i }}, + {% endfor %} + + {# returns 0, 2, 4, 6 #} + +The Twig built-in ``..`` operator is just syntactic sugar for the ``range`` +function (with a step of 1): + +.. code-block:: jinja + + {% for i in 0..3 %} + {{ i }}, + {% endfor %} + +.. tip:: + + The ``range`` function works as the native PHP `range`_ function. + +.. _`range`: http://php.net/range diff --git a/vendor/twig/twig/doc/index.rst b/vendor/twig/twig/doc/index.rst new file mode 100644 index 0000000..56012f7 --- /dev/null +++ b/vendor/twig/twig/doc/index.rst @@ -0,0 +1,17 @@ +Twig +==== + +.. toctree:: + :maxdepth: 2 + + intro + templates + api + advanced + internals + recipes + coding_standards + tags/index + filters/index + functions/index + tests/index diff --git a/vendor/twig/twig/doc/internals.rst b/vendor/twig/twig/doc/internals.rst new file mode 100644 index 0000000..79a3c8d --- /dev/null +++ b/vendor/twig/twig/doc/internals.rst @@ -0,0 +1,140 @@ +Twig Internals +============== + +Twig is very extensible and you can easily hack it. Keep in mind that you +should probably try to create an extension before hacking the core, as most +features and enhancements can be done with extensions. This chapter is also +useful for people who want to understand how Twig works under the hood. + +How Twig works? +--------------- + +The rendering of a Twig template can be summarized into four key steps: + +* **Load** the template: If the template is already compiled, load it and go + to the *evaluation* step, otherwise: + + * First, the **lexer** tokenizes the template source code into small pieces + for easier processing; + * Then, the **parser** converts the token stream into a meaningful tree + of nodes (the Abstract Syntax Tree); + * Eventually, the *compiler* transforms the AST into PHP code; + +* **Evaluate** the template: It basically means calling the ``display()`` + method of the compiled template and passing it the context. + +The Lexer +--------- + +The lexer tokenizes a template source code into a token stream (each token is +an instance of ``Twig_Token``, and the stream is an instance of +``Twig_TokenStream``). The default lexer recognizes 13 different token types: + +* ``Twig_Token::BLOCK_START_TYPE``, ``Twig_Token::BLOCK_END_TYPE``: Delimiters for blocks (``{% %}``) +* ``Twig_Token::VAR_START_TYPE``, ``Twig_Token::VAR_END_TYPE``: Delimiters for variables (``{{ }}``) +* ``Twig_Token::TEXT_TYPE``: A text outside an expression; +* ``Twig_Token::NAME_TYPE``: A name in an expression; +* ``Twig_Token::NUMBER_TYPE``: A number in an expression; +* ``Twig_Token::STRING_TYPE``: A string in an expression; +* ``Twig_Token::OPERATOR_TYPE``: An operator; +* ``Twig_Token::PUNCTUATION_TYPE``: A punctuation sign; +* ``Twig_Token::INTERPOLATION_START_TYPE``, ``Twig_Token::INTERPOLATION_END_TYPE`` (as of Twig 1.5): Delimiters for string interpolation; +* ``Twig_Token::EOF_TYPE``: Ends of template. + +You can manually convert a source code into a token stream by calling the +``tokenize()`` of an environment:: + + $stream = $twig->tokenize($source, $identifier); + +As the stream has a ``__toString()`` method, you can have a textual +representation of it by echoing the object:: + + echo $stream."\n"; + +Here is the output for the ``Hello {{ name }}`` template: + +.. code-block:: text + + TEXT_TYPE(Hello ) + VAR_START_TYPE() + NAME_TYPE(name) + VAR_END_TYPE() + EOF_TYPE() + +.. note:: + + You can change the default lexer use by Twig (``Twig_Lexer``) by calling + the ``setLexer()`` method:: + + $twig->setLexer($lexer); + +The Parser +---------- + +The parser converts the token stream into an AST (Abstract Syntax Tree), or a +node tree (an instance of ``Twig_Node_Module``). The core extension defines +the basic nodes like: ``for``, ``if``, ... and the expression nodes. + +You can manually convert a token stream into a node tree by calling the +``parse()`` method of an environment:: + + $nodes = $twig->parse($stream); + +Echoing the node object gives you a nice representation of the tree:: + + echo $nodes."\n"; + +Here is the output for the ``Hello {{ name }}`` template: + +.. code-block:: text + + Twig_Node_Module( + Twig_Node_Text(Hello ) + Twig_Node_Print( + Twig_Node_Expression_Name(name) + ) + ) + +.. note:: + + The default parser (``Twig_TokenParser``) can be also changed by calling the + ``setParser()`` method:: + + $twig->setParser($parser); + +The Compiler +------------ + +The last step is done by the compiler. It takes a node tree as an input and +generates PHP code usable for runtime execution of the template. + +You can call the compiler by hand with the ``compile()`` method of an +environment:: + + $php = $twig->compile($nodes); + +The ``compile()`` method returns the PHP source code representing the node. + +The generated template for a ``Hello {{ name }}`` template reads as follows +(the actual output can differ depending on the version of Twig you are +using):: + + /* Hello {{ name }} */ + class __TwigTemplate_1121b6f109fe93ebe8c6e22e3712bceb extends Twig_Template + { + protected function doDisplay(array $context, array $blocks = array()) + { + // line 1 + echo "Hello "; + echo twig_escape_filter($this->env, $this->getContext($context, "name"), "ndex", null, true); + } + + // some more code + } + +.. note:: + + As for the lexer and the parser, the default compiler (``Twig_Compiler``) can + be changed by calling the ``setCompiler()`` method:: + + $twig->setCompiler($compiler); diff --git a/vendor/twig/twig/doc/intro.rst b/vendor/twig/twig/doc/intro.rst new file mode 100644 index 0000000..f9dc226 --- /dev/null +++ b/vendor/twig/twig/doc/intro.rst @@ -0,0 +1,160 @@ +Introduction +============ + +This is the documentation for Twig, the flexible, fast, and secure template +engine for PHP. + +If you have any exposure to other text-based template languages, such as +Smarty, Django, or Jinja, you should feel right at home with Twig. It's both +designer and developer friendly by sticking to PHP's principles and adding +functionality useful for templating environments. + +The key-features are... + +* *Fast*: Twig compiles templates down to plain optimized PHP code. The + overhead compared to regular PHP code was reduced to the very minimum. + +* *Secure*: Twig has a sandbox mode to evaluate untrusted template code. This + allows Twig to be used as a template language for applications where users + may modify the template design. + +* *Flexible*: Twig is powered by a flexible lexer and parser. This allows the + developer to define its own custom tags and filters, and create its own DSL. + +Prerequisites +------------- + +Twig needs at least **PHP 5.2.4** to run. + +Installation +------------ + +You have multiple ways to install Twig. If you are unsure what to do, go with +the tarball. + +Installing from the tarball release +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Download the most recent tarball from the `download page`_ +2. Unpack the tarball +3. Move the files somewhere in your project + +Installing the development version +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Install Subversion or Git +2. For Git: ``git clone git://github.com/fabpot/Twig.git`` +3. For Subversion: ``svn co http://svn.twig-project.org/trunk/ twig`` + +Installing the PEAR package +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +1. Install PEAR +2. ``pear channel-discover pear.twig-project.org`` +3. ``pear install twig/Twig`` (or ``pear install twig/Twig-beta``) + +Installing via Composer +~~~~~~~~~~~~~~~~~~~~~~~ + +1. Install composer in your project: + +.. code-block:: bash + + curl -s http://getcomposer.org/installer | php + +2. Create a ``composer.json`` file in your project root: + +.. code-block:: javascript + + { + "require": { + "twig/twig": "1.*" + } + } + +3. Install via composer + +.. code-block:: bash + + php composer.phar install + +.. note:: + If you want to learn more about Composer, the ``composer.json`` file syntax + and its usage, you can read the `online documentation`_. + +Installing the C extension +~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.4 + The C extension was added in Twig 1.4. + +Twig comes with a C extension that enhances the performance of the Twig +runtime engine. You can install it like any other PHP extension: + +.. code-block:: bash + + $ cd ext/twig + $ phpize + $ ./configure + $ make + $ make install + +Finally, enable the extension in your ``php.ini`` configuration file: + +.. code-block:: ini + + extension=twig.so + +And from now on, Twig will automatically compile your templates to take +advantage of the C extension. Note that this extension does not replace the +PHP code but only provides an optimized version of the +``Twig_Template::getAttribute()`` method. + +.. tip:: + + On Windows, you can also simply download and install a `pre-build DLL`_. + +Basic API Usage +--------------- + +This section gives you a brief introduction to the PHP API for Twig. + +The first step to use Twig is to register its autoloader:: + + require_once '/path/to/lib/Twig/Autoloader.php'; + Twig_Autoloader::register(); + +Replace the ``/path/to/lib/`` path with the path you used for Twig +installation. + +.. note:: + + Twig follows the PEAR convention names for its classes, which means you + can easily integrate Twig classes loading in your own autoloader. + +.. code-block:: php + + $loader = new Twig_Loader_String(); + $twig = new Twig_Environment($loader); + + echo $twig->render('Hello {{ name }}!', array('name' => 'Fabien')); + +Twig uses a loader (``Twig_Loader_String``) to locate templates, and an +environment (``Twig_Environment``) to store the configuration. + +The ``render()`` method loads the template passed as a first argument and +renders it with the variables passed as a second argument. + +As templates are generally stored on the filesystem, Twig also comes with a +filesystem loader:: + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'cache' => '/path/to/compilation_cache', + )); + + echo $twig->render('index.html', array('name' => 'Fabien')); + +.. _`download page`: https://github.com/fabpot/Twig/tags +.. _`online documentation`: http://getcomposer.org/doc +.. _`pre-build DLL`: https://github.com/stealth35/stealth35.github.com/downloads diff --git a/vendor/twig/twig/doc/recipes.rst b/vendor/twig/twig/doc/recipes.rst new file mode 100644 index 0000000..5f98504 --- /dev/null +++ b/vendor/twig/twig/doc/recipes.rst @@ -0,0 +1,368 @@ +Recipes +======= + +Making a Layout conditional +--------------------------- + +Working with Ajax means that the same content is sometimes displayed as is, +and sometimes decorated with a layout. As Twig layout template names can be +any valid expression, you can pass a variable that evaluates to ``true`` when +the request is made via Ajax and choose the layout accordingly: + +.. code-block:: jinja + + {% extends request.ajax ? "base_ajax.html" : "base.html" %} + + {% block content %} + This is the content to be displayed. + {% endblock %} + +Making an Include dynamic +------------------------- + +When including a template, its name does not need to be a string. For +instance, the name can depend on the value of a variable: + +.. code-block:: jinja + + {% include var ~ '_foo.html' %} + +If ``var`` evaluates to ``index``, the ``index_foo.html`` template will be +rendered. + +As a matter of fact, the template name can be any valid expression, such as +the following: + +.. code-block:: jinja + + {% include var|default('index') ~ '_foo.html' %} + +Overriding a Template that also extends itself +---------------------------------------------- + +A template can be customized in two different ways: + +* *Inheritance*: A template *extends* a parent template and overrides some + blocks; + +* *Replacement*: If you use the filesystem loader, Twig loads the first + template it finds in a list of configured directories; a template found in a + directory *replaces* another one from a directory further in the list. + +But how do you combine both: *replace* a template that also extends itself +(aka a template in a directory further in the list)? + +Let's say that your templates are loaded from both ``.../templates/mysite`` +and ``.../templates/default`` in this order. The ``page.twig`` template, +stored in ``.../templates/default`` reads as follows: + +.. code-block:: jinja + + {# page.twig #} + {% extends "layout.twig" %} + + {% block content %} + {% endblock %} + +You can replace this template by putting a file with the same name in +``.../templates/mysite``. And if you want to extend the original template, you +might be tempted to write the following: + +.. code-block:: jinja + + {# page.twig in .../templates/mysite #} + {% extends "page.twig" %} {# from .../templates/default #} + +Of course, this will not work as Twig will always load the template from +``.../templates/mysite``. + +It turns out it is possible to get this to work, by adding a directory right +at the end of your template directories, which is the parent of all of the +other directories: ``.../templates`` in our case. This has the effect of +making every template file within our system uniquely addressable. Most of the +time you will use the "normal" paths, but in the special case of wanting to +extend a template with an overriding version of itself we can reference its +parent's full, unambiguous template path in the extends tag: + +.. code-block:: jinja + + {# page.twig in .../templates/mysite #} + {% extends "default/page.twig" %} {# from .../templates #} + +.. note:: + + This recipe was inspired by the following Django wiki page: + http://code.djangoproject.com/wiki/ExtendingTemplates + +Customizing the Syntax +---------------------- + +Twig allows some syntax customization for the block delimiters. It's not +recommended to use this feature as templates will be tied with your custom +syntax. But for specific projects, it can make sense to change the defaults. + +To change the block delimiters, you need to create your own lexer object:: + + $twig = new Twig_Environment(); + + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('{#', '#}'), + 'tag_block' => array('{%', '%}'), + 'tag_variable' => array('{{', '}}'), + )); + $twig->setLexer($lexer); + +Here are some configuration example that simulates some other template engines +syntax:: + + // Ruby erb syntax + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('<%#', '%>'), + 'tag_block' => array('<%', '%>'), + 'tag_variable' => array('<%=', '%>'), + )); + + // SGML Comment Syntax + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array(''), + 'tag_block' => array(''), + 'tag_variable' => array('${', '}'), + )); + + // Smarty like + $lexer = new Twig_Lexer($twig, array( + 'tag_comment' => array('{*', '*}'), + 'tag_block' => array('{', '}'), + 'tag_variable' => array('{$', '}'), + )); + +Using dynamic Object Properties +------------------------------- + +When Twig encounters a variable like ``article.title``, it tries to find a +``title`` public property in the ``article`` object. + +It also works if the property does not exist but is rather defined dynamically +thanks to the magic ``__get()`` method; you just need to also implement the +``__isset()`` magic method like shown in the following snippet of code:: + + class Article + { + public function __get($name) + { + if ('title' == $name) { + return 'The title'; + } + + // throw some kind of error + } + + public function __isset($name) + { + if ('title' == $name) { + return true; + } + + return false; + } + } + +Accessing the parent Context in Nested Loops +-------------------------------------------- + +Sometimes, when using nested loops, you need to access the parent context. The +parent context is always accessible via the ``loop.parent`` variable. For +instance, if you have the following template data:: + + $data = array( + 'topics' => array( + 'topic1' => array('Message 1 of topic 1', 'Message 2 of topic 1'), + 'topic2' => array('Message 1 of topic 2', 'Message 2 of topic 2'), + ), + ); + +And the following template to display all messages in all topics: + +.. code-block:: jinja + + {% for topic, messages in topics %} + * {{ loop.index }}: {{ topic }} + {% for message in messages %} + - {{ loop.parent.loop.index }}.{{ loop.index }}: {{ message }} + {% endfor %} + {% endfor %} + +The output will be similar to: + +.. code-block:: text + + * 1: topic1 + - 1.1: The message 1 of topic 1 + - 1.2: The message 2 of topic 1 + * 2: topic2 + - 2.1: The message 1 of topic 2 + - 2.2: The message 2 of topic 2 + +In the inner loop, the ``loop.parent`` variable is used to access the outer +context. So, the index of the current ``topic`` defined in the outer for loop +is accessible via the ``loop.parent.loop.index`` variable. + +Defining undefined Functions and Filters on the Fly +--------------------------------------------------- + +When a function (or a filter) is not defined, Twig defaults to throw a +``Twig_Error_Syntax`` exception. However, it can also call a `callback`_ (any +valid PHP callable) which should return a function (or a filter). + +For filters, register callbacks with ``registerUndefinedFilterCallback()``. +For functions, use ``registerUndefinedFunctionCallback()``:: + + // auto-register all native PHP functions as Twig functions + // don't try this at home as it's not secure at all! + $twig->registerUndefinedFunctionCallback(function ($name) { + if (function_exists($name)) { + return new Twig_Function_Function($name); + } + + return false; + }); + +If the callable is not able to return a valid function (or filter), it must +return ``false``. + +If you register more than one callback, Twig will call them in turn until one +does not return ``false``. + +.. tip:: + + As the resolution of functions and filters is done during compilation, + there is no overhead when registering these callbacks. + +Validating the Template Syntax +------------------------------ + +When template code is providing by a third-party (through a web interface for +instance), it might be interesting to validate the template syntax before +saving it. If the template code is stored in a `$template` variable, here is +how you can do it:: + + try { + $twig->parse($twig->tokenize($template)); + + // the $template is valid + } catch (Twig_Error_Syntax $e) { + // $template contains one or more syntax errors + } + +If you iterate over a set of files, you can pass the filename to the +``tokenize()`` method to get the filename in the exception message:: + + foreach ($files as $file) { + try { + $twig->parse($twig->tokenize($template, $file)); + + // the $template is valid + } catch (Twig_Error_Syntax $e) { + // $template contains one or more syntax errors + } + } + +.. note:: + + This method won't catch any sandbox policy violations because the policy + is enforced during template rendering (as Twig needs the context for some + checks like allowed methods on objects). + +Refreshing modified Templates when APC is enabled and apc.stat = 0 +------------------------------------------------------------------ + +When using APC with ``apc.stat`` set to ``0`` and Twig cache enabled, clearing +the template cache won't update the APC cache. To get around this, one can +extend ``Twig_Environment`` and force the update of the APC cache when Twig +rewrites the cache:: + + class Twig_Environment_APC extends Twig_Environment + { + protected function writeCacheFile($file, $content) + { + parent::writeCacheFile($file, $content); + + // Compile cached file into bytecode cache + apc_compile_file($file); + } + } + +Reusing a stateful Node Visitor +------------------------------- + +When attaching a visitor to a ``Twig_Environment`` instance, Twig uses it to +visit *all* templates it compiles. If you need to keep some state information +around, you probably want to reset it when visiting a new template. + +This can be easily achieved with the following code:: + + protected $someTemplateState = array(); + + public function enterNode(Twig_NodeInterface $node, Twig_Environment $env) + { + if ($node instanceof Twig_Node_Module) { + // reset the state as we are entering a new template + $this->someTemplateState = array(); + } + + // ... + + return $node; + } + +Using the Template name to set the default Escaping Strategy +------------------------------------------------------------ + +.. versionadded:: 1.8 + This recipe requires Twig 1.8 or later. + +The ``autoescape`` option determines the default escaping strategy to use when +no escaping is applied on a variable. When Twig is used to mostly generate +HTML files, you can set it to ``html`` and explicitly change it to ``js`` when +you have some dynamic JavaScript files thanks to the ``autoescape`` tag: + +.. code-block:: jinja + + {% autoescape js %} + ... some JS ... + {% endautoescape %} + +But if you have many HTML and JS files, and if your template names follow some +conventions, you can instead determine the default escaping strategy to use +based on the template name. Let's say that your template names always ends +with ``.html`` for HTML files, ``.js`` for JavaScript ones, and ``.css`` for +stylesheets, here is how you can configure Twig:: + + class TwigEscapingGuesser + { + function guess($filename) + { + // get the format + $format = substr($filename, strrpos($filename, '.') + 1); + + switch ($format) { + case 'js': + return 'js'; + case 'css': + return 'css'; + case 'html': + default: + return 'html'; + } + } + } + + $loader = new Twig_Loader_Filesystem('/path/to/templates'); + $twig = new Twig_Environment($loader, array( + 'autoescape' => array(new TwigEscapingGuesser(), 'guess'), + )); + +This dynamic strategy does not incur any overhead at runtime as auto-escaping +is done at compilation time. + +.. _callback: http://www.php.net/manual/en/function.is-callable.php diff --git a/vendor/twig/twig/doc/tags/autoescape.rst b/vendor/twig/twig/doc/tags/autoescape.rst new file mode 100644 index 0000000..c5ff0c2 --- /dev/null +++ b/vendor/twig/twig/doc/tags/autoescape.rst @@ -0,0 +1,71 @@ +``autoescape`` +============== + +Whether automatic escaping is enabled or not, you can mark a section of a +template to be escaped or not by using the ``autoescape`` tag: + +.. code-block:: jinja + + {# The following syntax works as of Twig 1.8 -- see the note below for previous versions #} + + {% autoescape %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape 'html' %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape 'js' %} + Everything will be automatically escaped in this block + using the js escaping strategy + {% endautoescape %} + + {% autoescape false %} + Everything will be outputted as is in this block + {% endautoescape %} + +.. note:: + + Before Twig 1.8, the syntax was different: + + .. code-block:: jinja + + {% autoescape true %} + Everything will be automatically escaped in this block + using the HTML strategy + {% endautoescape %} + + {% autoescape false %} + Everything will be outputted as is in this block + {% endautoescape %} + + {% autoescape true js %} + Everything will be automatically escaped in this block + using the js escaping strategy + {% endautoescape %} + +When automatic escaping is enabled everything is escaped by default except for +values explicitly marked as safe. Those can be marked in the template by using +the :doc:`raw<../filters/raw>` filter: + +.. code-block:: jinja + + {% autoescape %} + {{ safe_value|raw }} + {% endautoescape %} + +Functions returning template data (like :doc:`macros` and +:doc:`parent<../functions/parent>`) always return safe markup. + +.. note:: + + Twig is smart enough to not escape an already escaped value by the + :doc:`escape<../filters/escape>` filter. + +.. note:: + + The chapter :doc:`Twig for Developers<../api>` gives more information + about when and how automatic escaping is applied. diff --git a/vendor/twig/twig/doc/tags/block.rst b/vendor/twig/twig/doc/tags/block.rst new file mode 100644 index 0000000..e380482 --- /dev/null +++ b/vendor/twig/twig/doc/tags/block.rst @@ -0,0 +1,11 @@ +``block`` +========= + +Blocks are used for inheritance and act as placeholders and replacements at +the same time. They are documented in detail in the documentation for the +:doc:`extends<../tags/extends>` tag. + +Block names should consist of alphanumeric characters, and underscores. Dashes +are not permitted. + +.. seealso:: :doc:`block<../functions/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>`, :doc:`extends<../tags/extends>` diff --git a/vendor/twig/twig/doc/tags/do.rst b/vendor/twig/twig/doc/tags/do.rst new file mode 100644 index 0000000..eca63d0 --- /dev/null +++ b/vendor/twig/twig/doc/tags/do.rst @@ -0,0 +1,12 @@ +``do`` +====== + +.. versionadded:: 1.5 + The do tag was added in Twig 1.5. + +The ``do`` tag works exactly like the regular variable expression (``{{ ... +}}``) just that it doesn't print anything: + +.. code-block:: jinja + + {% do 1 + 2 %} diff --git a/vendor/twig/twig/doc/tags/embed.rst b/vendor/twig/twig/doc/tags/embed.rst new file mode 100644 index 0000000..5a6a029 --- /dev/null +++ b/vendor/twig/twig/doc/tags/embed.rst @@ -0,0 +1,178 @@ +``embed`` +========= + +.. versionadded:: 1.8 + The ``embed`` tag was added in Twig 1.8. + +The ``embed`` tag combines the behaviour of :doc:`include` and +:doc:`extends`. +It allows you to include another template's contents, just like ``include`` +does. But it also allows you to override any block defined inside the +included template, like when extending a template. + +Think of an embedded template as a "micro layout skeleton". + +.. code-block:: jinja + + {% embed "teasers_skeleton.twig" %} + {# These blocks are defined in "teasers_skeleton.twig" #} + {# and we override them right here: #} + {% block left_teaser %} + Some content for the left teaser box + {% endblock %} + {% block right_teaser %} + Some content for the right teaser box + {% endblock %} + {% endembed %} + +The ``embed`` tag takes the idea of template inheritance to the level of +content fragments. While template inheritance allows for "document skeletons", +which are filled with life by child templates, the ``embed`` tag allows you to +create "skeletons" for smaller units of content and re-use and fill them +anywhere you like. + +Since the use case may not be obvious, let's look at a simplified example. +Imagine a base template shared by multiple HTML pages, defining a single block +named "content": + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ │ │ + │ │ │ │ + │ │ (child template to │ │ + │ │ put content here) │ │ + │ │ │ │ + │ │ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +Some pages ("foo" and "bar") share the same content structure - +two vertically stacked boxes: + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ ┌─ block "top" ───┐ │ │ + │ │ │ │ │ │ + │ │ └─────────────────┘ │ │ + │ │ ┌─ block "bottom" ┐ │ │ + │ │ │ │ │ │ + │ │ └─────────────────┘ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +While other pages ("boom" and "baz") share a different content structure - +two boxes side by side: + +.. code-block:: text + + ┌─── page layout ─────────────────────┐ + │ │ + │ ┌── block "content" ──┐ │ + │ │ │ │ + │ │ ┌ block ┐ ┌ block ┐ │ │ + │ │ │"left" │ │"right"│ │ │ + │ │ │ │ │ │ │ │ + │ │ │ │ │ │ │ │ + │ │ └───────┘ └───────┘ │ │ + │ └─────────────────────┘ │ + │ │ + └─────────────────────────────────────┘ + +Without the ``embed`` tag, you have two ways to design your templates: + + * Create two "intermediate" base templates that extend the master layout + template: one with vertically stacked boxes to be used by the "foo" and + "bar" pages and another one with side-by-side boxes for the "boom" and + "baz" pages. + + * Embed the markup for the top/bottom and left/right boxes into each page + template directly. + +These two solutions do not scale well because they each have a major drawback: + + * The first solution may indeed work for this simplified example. But imagine + we add a sidebar, which may again contain different, recurring structures + of content. Now we would need to create intermediate base templates for + all occurring combinations of content structure and sidebar structure... + and so on. + + * The second solution involves duplication of common code with all its negative + consequences: any change involves finding and editing all affected copies + of the structure, correctness has to be verified for each copy, copies may + go out of sync by careless modifications etc. + +In such a situation, the ``embed`` tag comes in handy. The common layout +code can live in a single base template, and the two different content structures, +let's call them "micro layouts" go into separate templates which are embedded +as necessary: + +Page template ``foo.twig``: + +.. code-block:: jinja + + {% extends "layout_skeleton.twig" %} + + {% block content %} + {% embed "vertical_boxes_skeleton.twig" %} + {% block top %} + Some content for the top box + {% endblock %} + + {% block bottom %} + Some content for the bottom box + {% endblock %} + {% endembed %} + {% endblock %} + +And here is the code for ``vertical_boxes_skeleton.twig``: + +.. code-block:: html+jinja + +
    + {% block top %} + Top box default content + {% endblock %} +
    + +
    + {% block bottom %} + Bottom box default content + {% endblock %} +
    + +The goal of the ``vertical_boxes_skeleton.twig`` template being to factor +out the HTML markup for the boxes. + +The ``embed`` tag takes the exact same arguments as the ``include`` tag: + +.. code-block:: jinja + + {% embed "base" with {'foo': 'bar'} %} + ... + {% endembed %} + + {% embed "base" with {'foo': 'bar'} only %} + ... + {% endembed %} + + {% embed "base" ignore missing %} + ... + {% endembed %} + +.. warning:: + + As embedded templates do not have "names", auto-escaping strategies based + on the template "filename" won't work as expected if you change the + context (for instance, if you embed a CSS/JavaScript template into an HTML + one). In that case, explicitly set the default auto-escaping strategy with + the ``autoescape`` tag. + +.. seealso:: :doc:`include<../tags/include>` diff --git a/vendor/twig/twig/doc/tags/extends.rst b/vendor/twig/twig/doc/tags/extends.rst new file mode 100644 index 0000000..8d64436 --- /dev/null +++ b/vendor/twig/twig/doc/tags/extends.rst @@ -0,0 +1,187 @@ +``extends`` +=========== + +The ``extends`` tag can be used to extend a template from another one. + +.. note:: + + Like PHP, Twig does not support multiple inheritance. So you can only have + one extends tag called per rendering. However, Twig supports horizontal + :doc:`reuse`. + +Let's define a base template, ``base.html``, which defines a simple HTML +skeleton document: + +.. code-block:: html+jinja + + + + + {% block head %} + + {% block title %}{% endblock %} - My Webpage + {% endblock %} + + +
    {% block content %}{% endblock %}
    + + + + +In this example, the :doc:`block` tags define four blocks that child +templates can fill in. All the ``block`` tag does is to tell the template +engine that a child template may override those portions of the template. + +Child Template +-------------- + +A child template might look like this: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}Index{% endblock %} + {% block head %} + {{ parent() }} + + {% endblock %} + {% block content %} +

    Index

    +

    + Welcome on my awesome homepage. +

    + {% endblock %} + +The ``extends`` tag is the key here. It tells the template engine that this +template "extends" another template. When the template system evaluates this +template, first it locates the parent. The extends tag should be the first tag +in the template. + +Note that since the child template doesn't define the ``footer`` block, the +value from the parent template is used instead. + +You can't define multiple ``block`` tags with the same name in the same +template. This limitation exists because a block tag works in "both" +directions. That is, a block tag doesn't just provide a hole to fill - it also +defines the content that fills the hole in the *parent*. If there were two +similarly-named ``block`` tags in a template, that template's parent wouldn't +know which one of the blocks' content to use. + +If you want to print a block multiple times you can however use the +``block`` function: + +.. code-block:: jinja + + {% block title %}{% endblock %} +

    {{ block('title') }}

    + {% block body %}{% endblock %} + +Parent Blocks +------------- + +It's possible to render the contents of the parent block by using the +:doc:`parent<../functions/parent>` function. This gives back the results of +the parent block: + +.. code-block:: jinja + + {% block sidebar %} +

    Table Of Contents

    + ... + {{ parent() }} + {% endblock %} + +Named Block End-Tags +-------------------- + +Twig allows you to put the name of the block after the end tag for better +readability: + +.. code-block:: jinja + + {% block sidebar %} + {% block inner_sidebar %} + ... + {% endblock inner_sidebar %} + {% endblock sidebar %} + +Of course, the name after the ``endblock`` word must match the block name. + +Block Nesting and Scope +----------------------- + +Blocks can be nested for more complex layouts. Per default, blocks have access +to variables from outer scopes: + +.. code-block:: jinja + + {% for item in seq %} +
  • {% block loop_item %}{{ item }}{% endblock %}
  • + {% endfor %} + +Block Shortcuts +--------------- + +For blocks with few content, it's possible to use a shortcut syntax. The +following constructs do the same: + +.. code-block:: jinja + + {% block title %} + {{ page_title|title }} + {% endblock %} + +.. code-block:: jinja + + {% block title page_title|title %} + +Dynamic Inheritance +------------------- + +Twig supports dynamic inheritance by using a variable as the base template: + +.. code-block:: jinja + + {% extends some_var %} + +If the variable evaluates to a ``Twig_Template`` object, Twig will use it as +the parent template:: + + // {% extends layout %} + + $layout = $twig->loadTemplate('some_layout_template.twig'); + + $twig->display('template.twig', array('layout' => $layout)); + +.. versionadded:: 1.2 + The possibility to pass an array of templates has been added in Twig 1.2. + +You can also provide a list of templates that are checked for existence. The +first template that exists will be used as a parent: + +.. code-block:: jinja + + {% extends ['layout.html', 'base_layout.html'] %} + +Conditional Inheritance +----------------------- + +As the template name for the parent can be any valid Twig expression, it's +possible to make the inheritance mechanism conditional: + +.. code-block:: jinja + + {% extends standalone ? "minimum.html" : "base.html" %} + +In this example, the template will extend the "minimum.html" layout template +if the ``standalone`` variable evaluates to ``true``, and "base.html" +otherwise. + +.. seealso:: :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` diff --git a/vendor/twig/twig/doc/tags/filter.rst b/vendor/twig/twig/doc/tags/filter.rst new file mode 100644 index 0000000..82ca5c6 --- /dev/null +++ b/vendor/twig/twig/doc/tags/filter.rst @@ -0,0 +1,21 @@ +``filter`` +========== + +Filter sections allow you to apply regular Twig filters on a block of template +data. Just wrap the code in the special ``filter`` section: + +.. code-block:: jinja + + {% filter upper %} + This text becomes uppercase + {% endfilter %} + +You can also chain filters: + +.. code-block:: jinja + + {% filter lower|escape %} + SOME TEXT + {% endfilter %} + + {# outputs "<strong>some text</strong>" #} diff --git a/vendor/twig/twig/doc/tags/flush.rst b/vendor/twig/twig/doc/tags/flush.rst new file mode 100644 index 0000000..55ef593 --- /dev/null +++ b/vendor/twig/twig/doc/tags/flush.rst @@ -0,0 +1,17 @@ +``flush`` +========= + +.. versionadded:: 1.5 + The flush tag was added in Twig 1.5. + +The ``flush`` tag tells Twig to flush the output buffer: + +.. code-block:: jinja + + {% flush %} + +.. note:: + + Internally, Twig uses the PHP `flush`_ function. + +.. _`flush`: http://php.net/flush diff --git a/vendor/twig/twig/doc/tags/for.rst b/vendor/twig/twig/doc/tags/for.rst new file mode 100644 index 0000000..722861a --- /dev/null +++ b/vendor/twig/twig/doc/tags/for.rst @@ -0,0 +1,157 @@ +``for`` +======= + +Loop over each item in a sequence. For example, to display a list of users +provided in a variable called ``users``: + +.. code-block:: jinja + +

    Members

    +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +.. note:: + + A sequence can be either an array or an object implementing the + ``Traversable`` interface. + +If you do need to iterate over a sequence of numbers, you can use the ``..`` +operator: + +.. code-block:: jinja + + {% for i in 0..10 %} + * {{ i }} + {% endfor %} + +The above snippet of code would print all numbers from 0 to 10. + +It can be also useful with letters: + +.. code-block:: jinja + + {% for letter in 'a'..'z' %} + * {{ letter }} + {% endfor %} + +The ``..`` operator can take any expression at both sides: + +.. code-block:: jinja + + {% for letter in 'a'|upper..'z'|upper %} + * {{ letter }} + {% endfor %} + +.. tip: + + If you need a step different from 1, you can use the ``range`` function + instead. + +The `loop` variable +------------------- + +Inside of a ``for`` loop block you can access some special variables: + +===================== ============================================================= +Variable Description +===================== ============================================================= +``loop.index`` The current iteration of the loop. (1 indexed) +``loop.index0`` The current iteration of the loop. (0 indexed) +``loop.revindex`` The number of iterations from the end of the loop (1 indexed) +``loop.revindex0`` The number of iterations from the end of the loop (0 indexed) +``loop.first`` True if first iteration +``loop.last`` True if last iteration +``loop.length`` The number of items in the sequence +``loop.parent`` The parent context +===================== ============================================================= + +.. code-block:: jinja + + {% for user in users %} + {{ loop.index }} - {{ user.username }} + {% endfor %} + +.. note:: + + The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and + ``loop.last`` variables are only available for PHP arrays, or objects that + implement the ``Countable`` interface. They are also not available when + looping with a condition. + +.. versionadded:: 1.2 + The ``if`` modifier support has been added in Twig 1.2. + +Adding a condition +------------------ + +Unlike in PHP, it's not possible to ``break`` or ``continue`` in a loop. You +can however filter the sequence during iteration which allows you to skip +items. The following example skips all the users which are not active: + +.. code-block:: jinja + +
      + {% for user in users if user.active %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +The advantage is that the special loop variable will count correctly thus not +counting the users not iterated over. Keep in mind that properties like +``loop.last`` will not be defined when using loop conditions. + +.. note:: + + Using the ``loop`` variable within the condition is not recommended as it + will probably not be doing what you expect it to. For instance, adding a + condition like ``loop.index > 4`` won't work as the index is only + incremented when the condition is true (so the condition will never + match). + +The `else` Clause +----------------- + +If no iteration took place because the sequence was empty, you can render a +replacement block by using ``else``: + +.. code-block:: jinja + +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% else %} +
    • no user found
    • + {% endfor %} +
    + +Iterating over Keys +------------------- + +By default, a loop iterates over the values of the sequence. You can iterate +on keys by using the ``keys`` filter: + +.. code-block:: jinja + +

    Members

    +
      + {% for key in users|keys %} +
    • {{ key }}
    • + {% endfor %} +
    + +Iterating over Keys and Values +------------------------------ + +You can also access both keys and values: + +.. code-block:: jinja + +

    Members

    +
      + {% for key, user in users %} +
    • {{ key }}: {{ user.username|e }}
    • + {% endfor %} +
    diff --git a/vendor/twig/twig/doc/tags/from.rst b/vendor/twig/twig/doc/tags/from.rst new file mode 100644 index 0000000..5337a23 --- /dev/null +++ b/vendor/twig/twig/doc/tags/from.rst @@ -0,0 +1,8 @@ +``from`` +======== + +The ``from`` tags import :doc:`macro<../tags/macro>` names into the current +namespace. The tag is documented in detail in the documentation for the +:doc:`import<../tags/import>` tag. + +.. seealso:: :doc:`macro<../tags/macro>`, :doc:`import<../tags/import>` diff --git a/vendor/twig/twig/doc/tags/if.rst b/vendor/twig/twig/doc/tags/if.rst new file mode 100644 index 0000000..14e12b1 --- /dev/null +++ b/vendor/twig/twig/doc/tags/if.rst @@ -0,0 +1,43 @@ +``if`` +====== + +The ``if`` statement in Twig is comparable with the if statements of PHP. + +In the simplest form you can use it to test if an expression evaluates to +``true``: + +.. code-block:: jinja + + {% if online == false %} +

    Our website is in maintenance mode. Please, come back later.

    + {% endif %} + +You can also test if an array is not empty: + +.. code-block:: jinja + + {% if users %} +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + {% endif %} + +.. note:: + + If you want to test if the variable is defined, use ``if users is + defined`` instead. + +For multiple branches ``elseif`` and ``else`` can be used like in PHP. You can use +more complex ``expressions`` there too: + +.. code-block:: jinja + + {% if kenny.sick %} + Kenny is sick. + {% elseif kenny.dead %} + You killed Kenny! You bastard!!! + {% else %} + Kenny looks okay --- so far + {% endif %} diff --git a/vendor/twig/twig/doc/tags/import.rst b/vendor/twig/twig/doc/tags/import.rst new file mode 100644 index 0000000..8d47b36 --- /dev/null +++ b/vendor/twig/twig/doc/tags/import.rst @@ -0,0 +1,79 @@ +``import`` +========== + +Twig supports putting often used code into :doc:`macros<../tags/macro>`. These +macros can go into different templates and get imported from there. + +There are two ways to import templates. You can import the complete template +into a variable or request specific macros from it. + +Imagine we have a helper module that renders forms (called ``forms.html``): + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {% macro textarea(name, value, rows) %} + + {% endmacro %} + +The easiest and most flexible is importing the whole module into a variable. +That way you can access the attributes: + +.. code-block:: jinja + + {% import 'forms.html' as forms %} + +
    +
    Username
    +
    {{ forms.input('username') }}
    +
    Password
    +
    {{ forms.input('password', null, 'password') }}
    +
    +

    {{ forms.textarea('comment') }}

    + +Alternatively you can import names from the template into the current +namespace: + +.. code-block:: jinja + + {% from 'forms.html' import input as input_field, textarea %} + +
    +
    Username
    +
    {{ input_field('username') }}
    +
    Password
    +
    {{ input_field('password', '', 'password') }}
    +
    +

    {{ textarea('comment') }}

    + +Importing is not needed if the macros and the template are defined in the same +file; use the special ``_self`` variable instead: + +.. code-block:: jinja + + {# index.html template #} + + {% macro textarea(name, value, rows) %} + + {% endmacro %} + +

    {{ _self.textarea('comment') }}

    + +But you can still create an alias by importing from the ``_self`` variable: + +.. code-block:: jinja + + {# index.html template #} + + {% macro textarea(name, value, rows) %} + + {% endmacro %} + + {% import _self as forms %} + +

    {{ forms.textarea('comment') }}

    + +.. seealso:: :doc:`macro<../tags/macro>`, :doc:`from<../tags/from>` diff --git a/vendor/twig/twig/doc/tags/include.rst b/vendor/twig/twig/doc/tags/include.rst new file mode 100644 index 0000000..1440c50 --- /dev/null +++ b/vendor/twig/twig/doc/tags/include.rst @@ -0,0 +1,86 @@ +``include`` +=========== + +The ``include`` statement includes a template and return the rendered content +of that file into the current namespace: + +.. code-block:: jinja + + {% include 'header.html' %} + Body + {% include 'footer.html' %} + +Included templates have access to the variables of the active context. + +If you are using the filesystem loader, the templates are looked for in the +paths defined by it. + +You can add additional variables by passing them after the ``with`` keyword: + +.. code-block:: jinja + + {# the foo template will have access to the variables from the current context and the foo one #} + {% include 'foo' with {'foo': 'bar'} %} + + {% set vars = {'foo': 'bar'} %} + {% include 'foo' with vars %} + +You can disable access to the context by appending the ``only`` keyword: + +.. code-block:: jinja + + {# only the foo variable will be accessible #} + {% include 'foo' with {'foo': 'bar'} only %} + +.. code-block:: jinja + + {# no variable will be accessible #} + {% include 'foo' only %} + +.. tip:: + + When including a template created by an end user, you should consider + sandboxing it. More information in the :doc:`Twig for Developers<../api>` + chapter and in the :doc:`sandbox<../tags/sandbox>` tag documentation. + +The template name can be any valid Twig expression: + +.. code-block:: jinja + + {% include some_var %} + {% include ajax ? 'ajax.html' : 'not_ajax.html' %} + +And if the expression evaluates to a ``Twig_Template`` object, Twig will use it +directly:: + + // {% include template %} + + $template = $twig->loadTemplate('some_template.twig'); + + $twig->loadTemplate('template.twig')->display(array('template' => $template)); + +.. versionadded:: 1.2 + The ``ignore missing`` feature has been added in Twig 1.2. + +You can mark an include with ``ignore missing`` in which case Twig will ignore +the statement if the template to be ignored does not exist. It has to be +placed just after the template name. Here some valid examples: + +.. code-block:: jinja + + {% include "sidebar.html" ignore missing %} + {% include "sidebar.html" ignore missing with {'foo': 'bar} %} + {% include "sidebar.html" ignore missing only %} + +.. versionadded:: 1.2 + The possibility to pass an array of templates has been added in Twig 1.2. + +You can also provide a list of templates that are checked for existence before +inclusion. The first template that exists will be included: + +.. code-block:: jinja + + {% include ['page_detailed.html', 'page.html'] %} + +If ``ignore missing`` is given, it will fall back to rendering nothing if none +of the templates exist, otherwise it will throw an exception. diff --git a/vendor/twig/twig/doc/tags/index.rst b/vendor/twig/twig/doc/tags/index.rst new file mode 100644 index 0000000..fe0a00f --- /dev/null +++ b/vendor/twig/twig/doc/tags/index.rst @@ -0,0 +1,24 @@ +Tags +==== + +.. toctree:: + :maxdepth: 1 + + for + if + macro + filter + set + extends + block + include + import + from + use + spaceless + autoescape + raw + flush + do + sandbox + embed diff --git a/vendor/twig/twig/doc/tags/macro.rst b/vendor/twig/twig/doc/tags/macro.rst new file mode 100644 index 0000000..3d920e3 --- /dev/null +++ b/vendor/twig/twig/doc/tags/macro.rst @@ -0,0 +1,91 @@ +``macro`` +========= + +Macros are comparable with functions in regular programming languages. They +are useful to put often used HTML idioms into reusable elements to not repeat +yourself. + +Here is a small example of a macro that renders a form element: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + +Macros differs from native PHP functions in a few ways: + +* Default argument values are defined by using the ``default`` filter in the + macro body; + +* Arguments of a macro are always optional. + +But as PHP functions, macros don't have access to the current template +variables. + +.. tip:: + + You can pass the whole context as an argument by using the special + ``_context`` variable. + +Macros can be defined in any template, and need to be "imported" before being +used (see the documentation for the :doc:`import<../tags/import>` tag for more +information): + +.. code-block:: jinja + + {% import "forms.html" as forms %} + +The above ``import`` call imports the "forms.html" file (which can contain only +macros, or a template and some macros), and import the functions as items of +the ``forms`` variable. + +The macro can then be called at will: + +.. code-block:: jinja + +

    {{ forms.input('username') }}

    +

    {{ forms.input('password', null, 'password') }}

    + +If macros are defined and used in the same template, you can use the +special ``_self`` variable, without importing them: + +.. code-block:: jinja + +

    {{ _self.input('username') }}

    + +When you want to use a macro in another one from the same file, use the ``_self`` +variable: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {% macro wrapped_input(name, value, type, size) %} +
    + {{ _self.input(name, value, type, size) }} +
    + {% endmacro %} + +When the macro is defined in another file, you need to import it: + +.. code-block:: jinja + + {# forms.html #} + + {% macro input(name, value, type, size) %} + + {% endmacro %} + + {# shortcuts.html #} + + {% macro wrapped_input(name, value, type, size) %} + {% import "forms.html" as forms %} +
    + {{ forms.input(name, value, type, size) }} +
    + {% endmacro %} + +.. seealso:: :doc:`from<../tags/from>`, :doc:`import<../tags/import>` diff --git a/vendor/twig/twig/doc/tags/raw.rst b/vendor/twig/twig/doc/tags/raw.rst new file mode 100644 index 0000000..4136c70 --- /dev/null +++ b/vendor/twig/twig/doc/tags/raw.rst @@ -0,0 +1,16 @@ +``raw`` +======= + +The ``raw`` tag marks sections as being raw text that should not be parsed. +For example to put Twig syntax as example into a template you can use this +snippet: + +.. code-block:: jinja + + {% raw %} +
      + {% for item in seq %} +
    • {{ item }}
    • + {% endfor %} +
    + {% endraw %} diff --git a/vendor/twig/twig/doc/tags/sandbox.rst b/vendor/twig/twig/doc/tags/sandbox.rst new file mode 100644 index 0000000..0275537 --- /dev/null +++ b/vendor/twig/twig/doc/tags/sandbox.rst @@ -0,0 +1,30 @@ +``sandbox`` +=========== + +The ``sandbox`` tag can be used to enable the sandboxing mode for an included +template, when sandboxing is not enabled globally for the Twig environment: + +.. code-block:: jinja + + {% sandbox %} + {% include 'user.html' %} + {% endsandbox %} + +.. warning:: + + The ``sandbox`` tag is only available when the sandbox extension is + enabled (see the :doc:`Twig for Developers<../api>` chapter). + +.. note:: + + The ``sandbox`` tag can only be used to sandbox an include tag and it + cannot be used to sandbox a section of a template. The following example + won't work for example: + + .. code-block:: jinja + + {% sandbox %} + {% for i in 1..2 %} + {{ i }} + {% endfor %} + {% endsandbox %} diff --git a/vendor/twig/twig/doc/tags/set.rst b/vendor/twig/twig/doc/tags/set.rst new file mode 100644 index 0000000..15090e7 --- /dev/null +++ b/vendor/twig/twig/doc/tags/set.rst @@ -0,0 +1,32 @@ +``set`` +======= + +Inside code blocks you can also assign values to variables. Assignments use +the ``set`` tag and can have multiple targets: + +.. code-block:: jinja + + {% set foo = 'foo' %} + + {% set foo = [1, 2] %} + + {% set foo = {'foo': 'bar'} %} + + {% set foo = 'foo' ~ 'bar' %} + + {% set foo, bar = 'foo', 'bar' %} + +The ``set`` tag can also be used to 'capture' chunks of text: + +.. code-block:: jinja + + {% set foo %} + + {% endset %} + +.. caution:: + + If you enable automatic output escaping, Twig will only consider the + content to be safe when capturing chunks of text. diff --git a/vendor/twig/twig/doc/tags/spaceless.rst b/vendor/twig/twig/doc/tags/spaceless.rst new file mode 100644 index 0000000..12e77b2 --- /dev/null +++ b/vendor/twig/twig/doc/tags/spaceless.rst @@ -0,0 +1,37 @@ +``spaceless`` +============= + +Use the ``spaceless`` tag to remove whitespace *between HTML tags*, not +whitespace within HTML tags or whitespace in plain text: + +.. code-block:: jinja + + {% spaceless %} +
    + foo +
    + {% endspaceless %} + + {# output will be
    foo
    #} + +This tag is not meant to "optimize" the size of the generated HTML content but +merely to avoid extra whitespace between HTML tags to avoid browser rendering +quirks under some circumstances. + +.. tip:: + + If you want to optimize the size of the generated HTML content, gzip + compress the output instead. + +.. tip:: + + If you want to create a tag that actually removes all extra whitespace in + an HTML string, be warned that this is not as easy as it seems to be + (think of ``textarea`` or ``pre`` tags for instance). Using a third-party + library like Tidy is probably a better idea. + +.. tip:: + + For more information on whitespace control, read the + :doc:`dedicated<../templates>` section of the documentation and learn how + you can also use the whitespace control modifier on your tags. diff --git a/vendor/twig/twig/doc/tags/use.rst b/vendor/twig/twig/doc/tags/use.rst new file mode 100644 index 0000000..085f916 --- /dev/null +++ b/vendor/twig/twig/doc/tags/use.rst @@ -0,0 +1,123 @@ +``use`` +======= + +.. versionadded:: 1.1 + Horizontal reuse was added in Twig 1.1. + +.. note:: + + Horizontal reuse is an advanced Twig feature that is hardly ever needed in + regular templates. It is mainly used by projects that need to make + template blocks reusable without using inheritance. + +Template inheritance is one of the most powerful Twig's feature but it is +limited to single inheritance; a template can only extend one other template. +This limitation makes template inheritance simple to understand and easy to +debug: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +Horizontal reuse is a way to achieve the same goal as multiple inheritance, +but without the associated complexity: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +The ``use`` statement tells Twig to import the blocks defined in +```blocks.html`` into the current template (it's like macros, but for blocks): + +.. code-block:: jinja + + # blocks.html + {% block sidebar %}{% endblock %} + +In this example, the ``use`` statement imports the ``sidebar`` block into the +main template. The code is mostly equivalent to the following one (the +imported blocks are not outputted automatically): + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block sidebar %}{% endblock %} + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +.. note:: + + The ``use`` tag only imports a template if it does not extend another + template, if it does not define macros, and if the body is empty. But it + can *use* other templates. + +.. note:: + + Because ``use`` statements are resolved independently of the context + passed to the template, the template reference cannot be an expression. + +The main template can also override any imported block. If the template +already defines the ``sidebar`` block, then the one defined in ``blocks.html`` +is ignored. To avoid name conflicts, you can rename imported blocks: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" with sidebar as base_sidebar %} + + {% block sidebar %}{% endblock %} + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +.. versionadded:: 1.3 + The ``parent()`` support was added in Twig 1.3. + +The ``parent()`` function automatically determines the correct inheritance +tree, so it can be used when overriding a block defined in an imported +template: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" %} + + {% block sidebar %} + {{ parent() }} + {% endblock %} + + {% block title %}{% endblock %} + {% block content %}{% endblock %} + +In this example, ``parent()`` will correctly call the ``sidebar`` block from +the ``blocks.html`` template. + +.. tip:: + + In Twig 1.2, renaming allows you to simulate inheritance by calling the + "parent" block: + + .. code-block:: jinja + + {% extends "base.html" %} + + {% use "blocks.html" with sidebar as parent_sidebar %} + + {% block sidebar %} + {{ block('parent_sidebar') }} + {% endblock %} + +.. note:: + + You can use as many ``use`` statements as you want in any given template. + If two imported templates define the same block, the latest one wins. diff --git a/vendor/twig/twig/doc/templates.rst b/vendor/twig/twig/doc/templates.rst new file mode 100644 index 0000000..cf6d19d --- /dev/null +++ b/vendor/twig/twig/doc/templates.rst @@ -0,0 +1,745 @@ +Twig for Template Designers +=========================== + +This document describes the syntax and semantics of the template engine and +will be most useful as reference to those creating Twig templates. + +Synopsis +-------- + +A template is simply a text file. It can generate any text-based format (HTML, +XML, CSV, LaTeX, etc.). It doesn't have a specific extension, ``.html`` or +``.xml`` are just fine. + +A template contains **variables** or **expressions**, which get replaced with +values when the template is evaluated, and **tags**, which control the logic +of the template. + +Below is a minimal template that illustrates a few basics. We will cover the +details later on: + +.. code-block:: html+jinja + + + + + My Webpage + + + + +

    My Webpage

    + {{ a_variable }} + + + +There are two kinds of delimiters: ``{% ... %}`` and ``{{ ... }}``. The first +one is used to execute statements such as for-loops, the latter prints the +result of an expression to the template. + +IDEs Integration +---------------- + +Many IDEs support syntax highlighting and auto-completion for Twig: + +* *Textmate* via the `Twig bundle`_ +* *Vim* via the `Jinja syntax plugin`_ +* *Netbeans* via the `Twig syntax plugin`_ +* *PhpStorm* (native as of 2.1) +* *Eclipse* via the `Twig plugin`_ +* *Sublime Text* via the `Twig bundle`_ +* *GtkSourceView* via the `Twig language definition`_ (used by gedit and other projects) +* *Coda* and *SubEthaEdit* via the `Twig syntax mode`_ +* *Coda 2* via the `other Twig syntax mode`_ +* *Komodo* and *Komodo Edit* via the Django highlight/syntax check mode + +Variables +--------- + +The application passes variables to the templates you can mess around in the +template. Variables may have attributes or elements on them you can access +too. How a variable looks like heavily depends on the application providing +those. + +You can use a dot (``.``) to access attributes of a variable (methods or +properties of a PHP object, or items of a PHP array), or the so-called +"subscript" syntax (``[]``): + +.. code-block:: jinja + + {{ foo.bar }} + {{ foo['bar'] }} + +.. note:: + + It's important to know that the curly braces are *not* part of the + variable but the print statement. If you access variables inside tags + don't put the braces around. + +If a variable or attribute does not exist, you will get back a ``null`` value +when the ``strict_variables`` option is set to ``false``, otherwise Twig will +throw an error (see :ref:`environment options`). + +.. sidebar:: Implementation + + For convenience sake ``foo.bar`` does the following things on the PHP + layer: + + * check if ``foo`` is an array and ``bar`` a valid element; + * if not, and if ``foo`` is an object, check that ``bar`` is a valid property; + * if not, and if ``foo`` is an object, check that ``bar`` is a valid method + (even if ``bar`` is the constructor - use ``__construct()`` instead); + * if not, and if ``foo`` is an object, check that ``getBar`` is a valid method; + * if not, and if ``foo`` is an object, check that ``isBar`` is a valid method; + * if not, return a ``null`` value. + + ``foo['bar']`` on the other hand only works with PHP arrays: + + * check if ``foo`` is an array and ``bar`` a valid element; + * if not, return a ``null`` value. + +.. note:: + + If you want to get a dynamic attribute on a variable, use the + :doc:`attribute` function instead. + +Global Variables +~~~~~~~~~~~~~~~~ + +The following variables are always available in templates: + +* ``_self``: references the current template; +* ``_context``: references the current context; +* ``_charset``: references the current charset. + +Setting Variables +~~~~~~~~~~~~~~~~~ + +You can assign values to variables inside code blocks. Assignments use the +:doc:`set` tag: + +.. code-block:: jinja + + {% set foo = 'foo' %} + {% set foo = [1, 2] %} + {% set foo = {'foo': 'bar'} %} + +Filters +------- + +Variables can be modified by **filters**. Filters are separated from the +variable by a pipe symbol (``|``) and may have optional arguments in +parentheses. Multiple filters can be chained. The output of one filter is +applied to the next. + +The following example removes all HTML tags from the ``name`` and title-cases +it: + +.. code-block:: jinja + + {{ name|striptags|title }} + +Filters that accept arguments have parentheses around the arguments. This +example will join a list by commas: + +.. code-block:: jinja + + {{ list|join(', ') }} + +To apply a filter on a section of code, wrap it with the +:doc:`filter` tag: + +.. code-block:: jinja + + {% filter upper %} + This text becomes uppercase + {% endfilter %} + +Go to the :doc:`filters` page to learn more about the built-in +filters. + +Functions +--------- + +Functions can be called to generate content. Functions are called by their +name followed by parentheses (``()``) and may have arguments. + +For instance, the ``range`` function returns a list containing an arithmetic +progression of integers: + +.. code-block:: jinja + + {% for i in range(0, 3) %} + {{ i }}, + {% endfor %} + +Go to the :doc:`functions` page to learn more about the +built-in functions. + +Control Structure +----------------- + +A control structure refers to all those things that control the flow of a +program - conditionals (i.e. ``if``/``elseif``/``else``), ``for``-loops, as +well as things like blocks. Control structures appear inside ``{% ... %}`` +blocks. + +For example, to display a list of users provided in a variable called +``users``, use the :doc:`for` tag: + +.. code-block:: jinja + +

    Members

    +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + +The :doc:`if` tag can be used to test an expression: + +.. code-block:: jinja + + {% if users|length > 0 %} +
      + {% for user in users %} +
    • {{ user.username|e }}
    • + {% endfor %} +
    + {% endif %} + +Go to the :doc:`tags` page to learn more about the built-in tags. + +Comments +-------- + +To comment-out part of a line in a template, use the comment syntax ``{# ... +#}``. This is useful for debugging or to add information for other template +designers or yourself: + +.. code-block:: jinja + + {# note: disabled template because we no longer use this + {% for user in users %} + ... + {% endfor %} + #} + +Including other Templates +------------------------- + +The :doc:`include` tag is useful to include a template and +return the rendered content of that template into the current one: + +.. code-block:: jinja + + {% include 'sidebar.html' %} + +Per default included templates are passed the current context. + +The context that is passed to the included template includes variables defined +in the template: + +.. code-block:: jinja + + {% for box in boxes %} + {% include "render_box.html" %} + {% endfor %} + +The included template ``render_box.html`` is able to access ``box``. + +The filename of the template depends on the template loader. For instance, the +``Twig_Loader_Filesystem`` allows you to access other templates by giving the +filename. You can access templates in subdirectories with a slash: + +.. code-block:: jinja + + {% include "sections/articles/sidebar.html" %} + +This behavior depends on the application embedding Twig. + +Template Inheritance +-------------------- + +The most powerful part of Twig is template inheritance. Template inheritance +allows you to build a base "skeleton" template that contains all the common +elements of your site and defines **blocks** that child templates can +override. + +Sounds complicated but is very basic. It's easier to understand it by +starting with an example. + +Let's define a base template, ``base.html``, which defines a simple HTML +skeleton document that you might use for a simple two-column page: + +.. code-block:: html+jinja + + + + + {% block head %} + + {% block title %}{% endblock %} - My Webpage + {% endblock %} + + +
    {% block content %}{% endblock %}
    + + + + +In this example, the :doc:`block` tags define four blocks that +child templates can fill in. All the ``block`` tag does is to tell the +template engine that a child template may override those portions of the +template. + +A child template might look like this: + +.. code-block:: jinja + + {% extends "base.html" %} + + {% block title %}Index{% endblock %} + {% block head %} + {{ parent() }} + + {% endblock %} + {% block content %} +

    Index

    +

    + Welcome to my awesome homepage. +

    + {% endblock %} + +The :doc:`extends` tag is the key here. It tells the template +engine that this template "extends" another template. When the template system +evaluates this template, first it locates the parent. The extends tag should +be the first tag in the template. + +Note that since the child template doesn't define the ``footer`` block, the +value from the parent template is used instead. + +It's possible to render the contents of the parent block by using the +:doc:`parent` function. This gives back the results of the +parent block: + +.. code-block:: jinja + + {% block sidebar %} +

    Table Of Contents

    + ... + {{ parent() }} + {% endblock %} + +.. tip:: + + The documentation page for the :doc:`extends` tag describes + more advanced features like block nesting, scope, dynamic inheritance, and + conditional inheritance. + +.. note:: + + Twig also supports multiple inheritance with the so called horizontal reuse + with the help of the :doc:`use` tag. This is an advanced feature + hardly ever needed in regular templates. + +HTML Escaping +------------- + +When generating HTML from templates, there's always a risk that a variable +will include characters that affect the resulting HTML. There are two +approaches: manually escaping each variable or automatically escaping +everything by default. + +Twig supports both, automatic escaping is enabled by default. + +.. note:: + + Automatic escaping is only supported if the *escaper* extension has been + enabled (which is the default). + +Working with Manual Escaping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If manual escaping is enabled, it is **your** responsibility to escape +variables if needed. What to escape? Any variable you don't trust. + +Escaping works by piping the variable through the +:doc:`escape` or ``e`` filter: + +.. code-block:: jinja + + {{ user.username|e }} + +By default, the ``escape`` filter uses the ``html`` strategy, but depending on +the escaping context, you might want to explicitly use any other available +strategies: + + {{ user.username|e('js') }} + {{ user.username|e('css') }} + {{ user.username|e('url') }} + {{ user.username|e('html_attr') }} + +Working with Automatic Escaping +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Whether automatic escaping is enabled or not, you can mark a section of a +template to be escaped or not by using the :doc:`autoescape` +tag: + +.. code-block:: jinja + + {% autoescape %} + Everything will be automatically escaped in this block (using the HTML strategy) + {% endautoescape %} + +By default, auto-escaping uses the ``html`` escaping strategy. If you output +variables in other contexts, you need to explicitly escape them with the +appropriate escaping strategy: + +.. code-block:: jinja + + {% autoescape 'js' %} + Everything will be automatically escaped in this block (using the JS strategy) + {% endautoescape %} + +Escaping +-------- + +It is sometimes desirable or even necessary to have Twig ignore parts it would +otherwise handle as variables or blocks. For example if the default syntax is +used and you want to use ``{{`` as raw string in the template and not start a +variable you have to use a trick. + +The easiest way is to output the variable delimiter (``{{``) by using a variable +expression: + +.. code-block:: jinja + + {{ '{{' }} + +For bigger sections it makes sense to mark a block :doc:`raw`. + +Macros +------ + +Macros are comparable with functions in regular programming languages. They +are useful to reuse often used HTML fragments to not repeat yourself. + +A macro is defined via the :doc:`macro` tag. Here is a small example +(subsequently called ``forms.html``) of a macro that renders a form element: + +.. code-block:: jinja + + {% macro input(name, value, type, size) %} + + {% endmacro %} + +Macros can be defined in any template, and need to be "imported" via the +:doc:`import` tag before being used: + +.. code-block:: jinja + + {% import "forms.html" as forms %} + +

    {{ forms.input('username') }}

    + +Alternatively, you can import individual macro names from a template into the +current namespace via the :doc:`from` tag and optionally alias them: + +.. code-block:: jinja + + {% from 'forms.html' import input as input_field %} + +
    +
    Username
    +
    {{ input_field('username') }}
    +
    Password
    +
    {{ input_field('password', '', 'password') }}
    +
    + +Expressions +----------- + +Twig allows expressions everywhere. These work very similar to regular PHP and +even if you're not working with PHP you should feel comfortable with it. + +.. note:: + + The operator precedence is as follows, with the lowest-precedence + operators listed first: ``b-and``, ``b-xor``, ``b-or``, ``or``, ``and``, + ``==``, ``!=``, ``<``, ``>``, ``>=``, ``<=``, ``in``, ``..``, ``+``, + ``-``, ``~``, ``*``, ``/``, ``//``, ``%``, ``is``, and ``**``. + +Literals +~~~~~~~~ + +.. versionadded:: 1.5 + Support for hash keys as names and expressions was added in Twig 1.5. + +The simplest form of expressions are literals. Literals are representations +for PHP types such as strings, numbers, and arrays. The following literals +exist: + +* ``"Hello World"``: Everything between two double or single quotes is a + string. They are useful whenever you need a string in the template (for + example as arguments to function calls, filters or just to extend or + include a template). + +* ``42`` / ``42.23``: Integers and floating point numbers are created by just + writing the number down. If a dot is present the number is a float, + otherwise an integer. + +* ``["foo", "bar"]``: Arrays are defined by a sequence of expressions + separated by a comma (``,``) and wrapped with squared brackets (``[]``). + +* ``{"foo": "bar"}``: Hashes are defined by a list of keys and values + separated by a comma (``,``) and wrapped with curly braces (``{}``): + + .. code-block:: jinja + + {# keys as string #} + { 'foo': 'foo', 'bar': 'bar' } + + {# keys as names (equivalent to the previous hash) -- as of Twig 1.5 #} + { foo: 'foo', bar: 'bar' } + + {# keys as integer #} + { 2: 'foo', 4: 'bar' } + + {# keys as expressions (the expression must be enclosed into parentheses) -- as of Twig 1.5 #} + { (1 + 1): 'foo', (a ~ 'b'): 'bar' } + +* ``true`` / ``false``: ``true`` represents the true value, ``false`` + represents the false value. + +* ``null``: ``null`` represents no specific value. This is the value returned + when a variable does not exist. ``none`` is an alias for ``null``. + +Arrays and hashes can be nested: + +.. code-block:: jinja + + {% set foo = [1, {"foo": "bar"}] %} + +Math +~~~~ + +Twig allows you to calculate with values. This is rarely useful in templates +but exists for completeness' sake. The following operators are supported: + +* ``+``: Adds two objects together (the operands are casted to numbers). ``{{ + 1 + 1 }}`` is ``2``. + +* ``-``: Substracts the second number from the first one. ``{{ 3 - 2 }}`` is + ``1``. + +* ``/``: Divides two numbers. The returned value will be a floating point + number. ``{{ 1 / 2 }}`` is ``{{ 0.5 }}``. + +* ``%``: Calculates the remainder of an integer division. ``{{ 11 % 7 }}`` is + ``4``. + +* ``//``: Divides two numbers and returns the truncated integer result. ``{{ + 20 // 7 }}`` is ``2``. + +* ``*``: Multiplies the left operand with the right one. ``{{ 2 * 2 }}`` would + return ``4``. + +* ``**``: Raises the left operand to the power of the right operand. ``{{ 2 ** + 3 }}`` would return ``8``. + +Logic +~~~~~ + +You can combine multiple expressions with the following operators: + +* ``and``: Returns true if the left and the right operands are both true. + +* ``or``: Returns true if the left or the right operand is true. + +* ``not``: Negates a statement. + +* ``(expr)``: Groups an expression. + +.. note:: + + Twig also support bitwise operators (``b-and``, ``b-xor``, and ``b-or``). + +Comparisons +~~~~~~~~~~~ + +The following comparison operators are supported in any expression: ``==``, +``!=``, ``<``, ``>``, ``>=``, and ``<=``. + +Containment Operator +~~~~~~~~~~~~~~~~~~~~ + +The ``in`` operator performs containment test. + +It returns ``true`` if the left operand is contained in the right: + +.. code-block:: jinja + + {# returns true #} + + {{ 1 in [1, 2, 3] }} + + {{ 'cd' in 'abcde' }} + +.. tip:: + + You can use this filter to perform a containment test on strings, arrays, + or objects implementing the ``Traversable`` interface. + +To perform a negative test, use the ``not in`` operator: + +.. code-block:: jinja + + {% if 1 not in [1, 2, 3] %} + + {# is equivalent to #} + {% if not (1 in [1, 2, 3]) %} + +Test Operator +~~~~~~~~~~~~~ + +The ``is`` operator performs tests. Tests can be used to test a variable against +a common expression. The right operand is name of the test: + +.. code-block:: jinja + + {# find out if a variable is odd #} + + {{ name is odd }} + +Tests can accept arguments too: + +.. code-block:: jinja + + {% if loop.index is divisibleby(3) %} + +Tests can be negated by using the ``is not`` operator: + +.. code-block:: jinja + + {% if loop.index is not divisibleby(3) %} + + {# is equivalent to #} + {% if not (loop.index is divisibleby(3)) %} + +Go to the :doc:`tests` page to learn more about the built-in +tests. + +Other Operators +~~~~~~~~~~~~~~~ + +The following operators are very useful but don't fit into any of the other +categories: + +* ``..``: Creates a sequence based on the operand before and after the + operator (this is just syntactic sugar for the :doc:`range` + function). + +* ``|``: Applies a filter. + +* ``~``: Converts all operands into strings and concatenates them. ``{{ "Hello + " ~ name ~ "!" }}`` would return (assuming ``name`` is ``'John'``) ``Hello + John!``. + +* ``.``, ``[]``: Gets an attribute of an object. + +* ``?:``: The PHP ternary operator: ``{{ foo ? 'yes' : 'no' }}`` + +String Interpolation +~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 1.5 + String interpolation was added in Twig 1.5. + +String interpolation (`#{expression}`) allows any valid expression to appear +within a string. The result of evaluating that expression is inserted into the +string: + +.. code-block:: jinja + + {{ "foo #{bar} baz" }} + {{ "foo #{1 + 2} baz" }} + +Whitespace Control +------------------ + +.. versionadded:: 1.1 + Tag level whitespace control was added in Twig 1.1. + +The first newline after a template tag is removed automatically (like in PHP.) +Whitespace is not further modified by the template engine, so each whitespace +(spaces, tabs, newlines etc.) is returned unchanged. + +Use the ``spaceless`` tag to remove whitespace *between HTML tags*: + +.. code-block:: jinja + + {% spaceless %} +
    + foo +
    + {% endspaceless %} + + {# output will be
    foo
    #} + +In addition to the spaceless tag you can also control whitespace on a per tag +level. By using the whitespace control modifier on your tags, you can trim +leading and or trailing whitespace: + +.. code-block:: jinja + + {% set value = 'no spaces' %} + {#- No leading/trailing whitespace -#} + {%- if true -%} + {{- value -}} + {%- endif -%} + + {# output 'no spaces' #} + +The above sample shows the default whitespace control modifier, and how you can +use it to remove whitespace around tags. Trimming space will consume all whitespace +for that side of the tag. It is possible to use whitespace trimming on one side +of a tag: + +.. code-block:: jinja + + {% set value = 'no spaces' %} +
  • {{- value }}
  • + + {# outputs '
  • no spaces
  • ' #} + +Extensions +---------- + +Twig can be easily extended. + +If you are looking for new tags, filters, or functions, have a look at the Twig official +`extension repository`_. + +If you want to create your own, read the :ref:`Creating an +Extension` chapter. + +.. _`Twig bundle`: https://github.com/Anomareh/PHP-Twig.tmbundle +.. _`Jinja syntax plugin`: http://jinja.pocoo.org/2/documentation/integration +.. _`Twig syntax plugin`: http://plugins.netbeans.org/plugin/37069/php-twig +.. _`Twig plugin`: https://github.com/pulse00/Twig-Eclipse-Plugin +.. _`Twig language definition`: https://github.com/gabrielcorpse/gedit-twig-template-language +.. _`extension repository`: http://github.com/fabpot/Twig-extensions +.. _`Twig syntax mode`: https://github.com/bobthecow/Twig-HTML.mode +.. _`other Twig syntax mode`: https://github.com/muxx/Twig-HTML.mode diff --git a/vendor/twig/twig/doc/tests/constant.rst b/vendor/twig/twig/doc/tests/constant.rst new file mode 100644 index 0000000..7970933 --- /dev/null +++ b/vendor/twig/twig/doc/tests/constant.rst @@ -0,0 +1,11 @@ +``constant`` +============ + +``constant`` checks if a variable has the exact same value as a constant. You +can use either global constants or class constants: + +.. code-block:: jinja + + {% if post.status is constant('Post::PUBLISHED') %} + the status attribute is exactly the same as Post::PUBLISHED + {% endif %} diff --git a/vendor/twig/twig/doc/tests/defined.rst b/vendor/twig/twig/doc/tests/defined.rst new file mode 100644 index 0000000..702ce72 --- /dev/null +++ b/vendor/twig/twig/doc/tests/defined.rst @@ -0,0 +1,30 @@ +``defined`` +=========== + +``defined`` checks if a variable is defined in the current context. This is very +useful if you use the ``strict_variables`` option: + +.. code-block:: jinja + + {# defined works with variable names #} + {% if foo is defined %} + ... + {% endif %} + + {# and attributes on variables names #} + {% if foo.bar is defined %} + ... + {% endif %} + + {% if foo['bar'] is defined %} + ... + {% endif %} + +When using the ``defined`` test on an expression that uses variables in some +method calls, be sure that they are all defined first: + +.. code-block:: jinja + + {% if var is defined and foo.method(var) is defined %} + ... + {% endif %} diff --git a/vendor/twig/twig/doc/tests/divisibleby.rst b/vendor/twig/twig/doc/tests/divisibleby.rst new file mode 100644 index 0000000..9b0b964 --- /dev/null +++ b/vendor/twig/twig/doc/tests/divisibleby.rst @@ -0,0 +1,10 @@ +``divisibleby`` +=============== + +``divisibleby`` checks if a variable is divisible by a number: + +.. code-block:: jinja + + {% if loop.index is divisibleby(3) %} + ... + {% endif %} diff --git a/vendor/twig/twig/doc/tests/empty.rst b/vendor/twig/twig/doc/tests/empty.rst new file mode 100644 index 0000000..0d1eb32 --- /dev/null +++ b/vendor/twig/twig/doc/tests/empty.rst @@ -0,0 +1,11 @@ +``empty`` +========= + +``empty`` checks if a variable is empty: + +.. code-block:: jinja + + {# evaluates to true if the foo variable is null, false, or the empty string #} + {% if foo is empty %} + ... + {% endif %} diff --git a/vendor/twig/twig/doc/tests/even.rst b/vendor/twig/twig/doc/tests/even.rst new file mode 100644 index 0000000..6ab5cc3 --- /dev/null +++ b/vendor/twig/twig/doc/tests/even.rst @@ -0,0 +1,10 @@ +``even`` +======== + +``even`` returns ``true`` if the given number is even: + +.. code-block:: jinja + + {{ var is even }} + +.. seealso:: :doc:`odd<../tests/odd>` diff --git a/vendor/twig/twig/doc/tests/index.rst b/vendor/twig/twig/doc/tests/index.rst new file mode 100644 index 0000000..7b8c535 --- /dev/null +++ b/vendor/twig/twig/doc/tests/index.rst @@ -0,0 +1,15 @@ +Tests +===== + +.. toctree:: + :maxdepth: 1 + + divisibleby + null + even + odd + sameas + constant + defined + empty + iterable diff --git a/vendor/twig/twig/doc/tests/iterable.rst b/vendor/twig/twig/doc/tests/iterable.rst new file mode 100644 index 0000000..89a172f --- /dev/null +++ b/vendor/twig/twig/doc/tests/iterable.rst @@ -0,0 +1,19 @@ +``iterable`` +============ + +.. versionadded:: 1.7 + The iterable test was added in Twig 1.7. + +``iterable`` checks if a variable is an array or a traversable object: + +.. code-block:: jinja + + {# evaluates to true if the foo variable is iterable #} + {% if users is iterable %} + {% for user in users %} + Hello {{ user }}! + {% endfor %} + {% else %} + {# users is probably a string #} + Hello {{ users }}! + {% endif %} diff --git a/vendor/twig/twig/doc/tests/null.rst b/vendor/twig/twig/doc/tests/null.rst new file mode 100644 index 0000000..44eec62 --- /dev/null +++ b/vendor/twig/twig/doc/tests/null.rst @@ -0,0 +1,12 @@ +``null`` +======== + +``null`` returns ``true`` if the variable is ``null``: + +.. code-block:: jinja + + {{ var is null }} + +.. note:: + + ``none`` is an alias for ``null``. diff --git a/vendor/twig/twig/doc/tests/odd.rst b/vendor/twig/twig/doc/tests/odd.rst new file mode 100644 index 0000000..9eece77 --- /dev/null +++ b/vendor/twig/twig/doc/tests/odd.rst @@ -0,0 +1,10 @@ +``odd`` +======= + +``odd`` returns ``true`` if the given number is odd: + +.. code-block:: jinja + + {{ var is odd }} + +.. seealso:: :doc:`even<../tests/even>` diff --git a/vendor/twig/twig/doc/tests/sameas.rst b/vendor/twig/twig/doc/tests/sameas.rst new file mode 100644 index 0000000..efb15c3 --- /dev/null +++ b/vendor/twig/twig/doc/tests/sameas.rst @@ -0,0 +1,11 @@ +``sameas`` +========== + +``sameas`` checks if a variable points to the same memory address than another +variable: + +.. code-block:: jinja + + {% if foo.attribute is sameas(false) %} + the foo attribute really is the ``false`` PHP value + {% endif %} diff --git a/vendor/twig/twig/ext/twig/.gitignore b/vendor/twig/twig/ext/twig/.gitignore new file mode 100644 index 0000000..56ea76c --- /dev/null +++ b/vendor/twig/twig/ext/twig/.gitignore @@ -0,0 +1,30 @@ +*.sw* +.deps +Makefile +Makefile.fragments +Makefile.global +Makefile.objects +acinclude.m4 +aclocal.m4 +build/ +config.cache +config.guess +config.h +config.h.in +config.log +config.nice +config.status +config.sub +configure +configure.in +install-sh +libtool +ltmain.sh +missing +mkinstalldirs +run-tests.php +twig.loT +.libs/ +modules/ +twig.la +twig.lo diff --git a/vendor/twig/twig/ext/twig/php_twig.h b/vendor/twig/twig/ext/twig/php_twig.h index d230111..fb8a425 100644 --- a/vendor/twig/twig/ext/twig/php_twig.h +++ b/vendor/twig/twig/ext/twig/php_twig.h @@ -15,7 +15,7 @@ #ifndef PHP_TWIG_H #define PHP_TWIG_H -#define PHP_TWIG_VERSION "1.9.0-DEV" +#define PHP_TWIG_VERSION "1.9.1-DEV" #include "php.h" diff --git a/vendor/twig/twig/lib/Twig/Environment.php b/vendor/twig/twig/lib/Twig/Environment.php index 916979f..26633a0 100644 --- a/vendor/twig/twig/lib/Twig/Environment.php +++ b/vendor/twig/twig/lib/Twig/Environment.php @@ -17,7 +17,7 @@ */ class Twig_Environment { - const VERSION = '1.9.0-DEV'; + const VERSION = '1.9.1-DEV'; protected $charset; protected $loader; diff --git a/vendor/twig/twig/lib/Twig/Error.php b/vendor/twig/twig/lib/Twig/Error.php index 4b74e40..b5ac00e 100644 --- a/vendor/twig/twig/lib/Twig/Error.php +++ b/vendor/twig/twig/lib/Twig/Error.php @@ -156,16 +156,14 @@ class Twig_Error extends Exception foreach (debug_backtrace() as $trace) { if (isset($trace['object']) && $trace['object'] instanceof Twig_Template && 'Twig_Template' !== get_class($trace['object'])) { $template = $trace['object']; - - // update template filename - if (null === $this->filename) { - $this->filename = $template->getTemplateName(); - } - - break; } } + // update template filename + if (null !== $template && null === $this->filename) { + $this->filename = $template->getTemplateName(); + } + if (null === $template || $this->lineno > -1) { return; } diff --git a/vendor/twig/twig/lib/Twig/Extension/Core.php b/vendor/twig/twig/lib/Twig/Extension/Core.php index ed9ef2d..6587f3e 100644 --- a/vendor/twig/twig/lib/Twig/Extension/Core.php +++ b/vendor/twig/twig/lib/Twig/Extension/Core.php @@ -314,8 +314,8 @@ function twig_cycle($values, $i) * - a random character from a string * - a random integer between 0 and the integer parameter * - * @param Twig_Environment $env A Twig_Environment instance - * @param Traversable|array|int|string $values The values to pick a random item from + * @param Twig_Environment $env A Twig_Environment instance + * @param Traversable|array|integer|string $values The values to pick a random item from * * @throws Twig_Error_Runtime When $values is an empty array (does not apply to an empty string which is returned as is). * @@ -480,7 +480,7 @@ function twig_date_converter(Twig_Environment $env, $date = null, $timezone = nu * * @param Twig_Environment $env A Twig_Environment instance * @param mixed $number A float/int/string of the number to format - * @param int $decimal The number of decimal points to display. + * @param integer $decimal The number of decimal points to display. * @param string $decimalPoint The character(s) to use for the decimal point. * @param string $thousandSep The character(s) to use for the thousands separator. * @@ -956,259 +956,17 @@ function _twig_escape_css_callback($matches) */ function _twig_escape_html_attr_callback($matches) { + /* + * While HTML supports far more named entities, the lowest common denominator + * has become HTML5's XML Serialisation which is restricted to the those named + * entities that XML supports. Using HTML entities would result in this error: + * XML Parsing Error: undefined entity + */ static $entityMap = array( - 34 => 'quot', /* quotation mark */ - 38 => 'amp', /* ampersand */ - 60 => 'lt', /* less-than sign */ - 62 => 'gt', /* greater-than sign */ - 160 => 'nbsp', /* no-break space */ - 161 => 'iexcl', /* inverted exclamation mark */ - 162 => 'cent', /* cent sign */ - 163 => 'pound', /* pound sign */ - 164 => 'curren', /* currency sign */ - 165 => 'yen', /* yen sign */ - 166 => 'brvbar', /* broken bar */ - 167 => 'sect', /* section sign */ - 168 => 'uml', /* diaeresis */ - 169 => 'copy', /* copyright sign */ - 170 => 'ordf', /* feminine ordinal indicator */ - 171 => 'laquo', /* left-pointing double angle quotation mark */ - 172 => 'not', /* not sign */ - 173 => 'shy', /* soft hyphen */ - 174 => 'reg', /* registered sign */ - 175 => 'macr', /* macron */ - 176 => 'deg', /* degree sign */ - 177 => 'plusmn', /* plus-minus sign */ - 178 => 'sup2', /* superscript two */ - 179 => 'sup3', /* superscript three */ - 180 => 'acute', /* acute accent */ - 181 => 'micro', /* micro sign */ - 182 => 'para', /* pilcrow sign */ - 183 => 'middot', /* middle dot */ - 184 => 'cedil', /* cedilla */ - 185 => 'sup1', /* superscript one */ - 186 => 'ordm', /* masculine ordinal indicator */ - 187 => 'raquo', /* right-pointing double angle quotation mark */ - 188 => 'frac14', /* vulgar fraction one quarter */ - 189 => 'frac12', /* vulgar fraction one half */ - 190 => 'frac34', /* vulgar fraction three quarters */ - 191 => 'iquest', /* inverted question mark */ - 192 => 'Agrave', /* Latin capital letter a with grave */ - 193 => 'Aacute', /* Latin capital letter a with acute */ - 194 => 'Acirc', /* Latin capital letter a with circumflex */ - 195 => 'Atilde', /* Latin capital letter a with tilde */ - 196 => 'Auml', /* Latin capital letter a with diaeresis */ - 197 => 'Aring', /* Latin capital letter a with ring above */ - 198 => 'AElig', /* Latin capital letter ae */ - 199 => 'Ccedil', /* Latin capital letter c with cedilla */ - 200 => 'Egrave', /* Latin capital letter e with grave */ - 201 => 'Eacute', /* Latin capital letter e with acute */ - 202 => 'Ecirc', /* Latin capital letter e with circumflex */ - 203 => 'Euml', /* Latin capital letter e with diaeresis */ - 204 => 'Igrave', /* Latin capital letter i with grave */ - 205 => 'Iacute', /* Latin capital letter i with acute */ - 206 => 'Icirc', /* Latin capital letter i with circumflex */ - 207 => 'Iuml', /* Latin capital letter i with diaeresis */ - 208 => 'ETH', /* Latin capital letter eth */ - 209 => 'Ntilde', /* Latin capital letter n with tilde */ - 210 => 'Ograve', /* Latin capital letter o with grave */ - 211 => 'Oacute', /* Latin capital letter o with acute */ - 212 => 'Ocirc', /* Latin capital letter o with circumflex */ - 213 => 'Otilde', /* Latin capital letter o with tilde */ - 214 => 'Ouml', /* Latin capital letter o with diaeresis */ - 215 => 'times', /* multiplication sign */ - 216 => 'Oslash', /* Latin capital letter o with stroke */ - 217 => 'Ugrave', /* Latin capital letter u with grave */ - 218 => 'Uacute', /* Latin capital letter u with acute */ - 219 => 'Ucirc', /* Latin capital letter u with circumflex */ - 220 => 'Uuml', /* Latin capital letter u with diaeresis */ - 221 => 'Yacute', /* Latin capital letter y with acute */ - 222 => 'THORN', /* Latin capital letter thorn */ - 223 => 'szlig', /* Latin small letter sharp sXCOMMAX German Eszett */ - 224 => 'agrave', /* Latin small letter a with grave */ - 225 => 'aacute', /* Latin small letter a with acute */ - 226 => 'acirc', /* Latin small letter a with circumflex */ - 227 => 'atilde', /* Latin small letter a with tilde */ - 228 => 'auml', /* Latin small letter a with diaeresis */ - 229 => 'aring', /* Latin small letter a with ring above */ - 230 => 'aelig', /* Latin lowercase ligature ae */ - 231 => 'ccedil', /* Latin small letter c with cedilla */ - 232 => 'egrave', /* Latin small letter e with grave */ - 233 => 'eacute', /* Latin small letter e with acute */ - 234 => 'ecirc', /* Latin small letter e with circumflex */ - 235 => 'euml', /* Latin small letter e with diaeresis */ - 236 => 'igrave', /* Latin small letter i with grave */ - 237 => 'iacute', /* Latin small letter i with acute */ - 238 => 'icirc', /* Latin small letter i with circumflex */ - 239 => 'iuml', /* Latin small letter i with diaeresis */ - 240 => 'eth', /* Latin small letter eth */ - 241 => 'ntilde', /* Latin small letter n with tilde */ - 242 => 'ograve', /* Latin small letter o with grave */ - 243 => 'oacute', /* Latin small letter o with acute */ - 244 => 'ocirc', /* Latin small letter o with circumflex */ - 245 => 'otilde', /* Latin small letter o with tilde */ - 246 => 'ouml', /* Latin small letter o with diaeresis */ - 247 => 'divide', /* division sign */ - 248 => 'oslash', /* Latin small letter o with stroke */ - 249 => 'ugrave', /* Latin small letter u with grave */ - 250 => 'uacute', /* Latin small letter u with acute */ - 251 => 'ucirc', /* Latin small letter u with circumflex */ - 252 => 'uuml', /* Latin small letter u with diaeresis */ - 253 => 'yacute', /* Latin small letter y with acute */ - 254 => 'thorn', /* Latin small letter thorn */ - 255 => 'yuml', /* Latin small letter y with diaeresis */ - 338 => 'OElig', /* Latin capital ligature oe */ - 339 => 'oelig', /* Latin small ligature oe */ - 352 => 'Scaron', /* Latin capital letter s with caron */ - 353 => 'scaron', /* Latin small letter s with caron */ - 376 => 'Yuml', /* Latin capital letter y with diaeresis */ - 402 => 'fnof', /* Latin small letter f with hook */ - 710 => 'circ', /* modifier letter circumflex accent */ - 732 => 'tilde', /* small tilde */ - 913 => 'Alpha', /* Greek capital letter alpha */ - 914 => 'Beta', /* Greek capital letter beta */ - 915 => 'Gamma', /* Greek capital letter gamma */ - 916 => 'Delta', /* Greek capital letter delta */ - 917 => 'Epsilon', /* Greek capital letter epsilon */ - 918 => 'Zeta', /* Greek capital letter zeta */ - 919 => 'Eta', /* Greek capital letter eta */ - 920 => 'Theta', /* Greek capital letter theta */ - 921 => 'Iota', /* Greek capital letter iota */ - 922 => 'Kappa', /* Greek capital letter kappa */ - 923 => 'Lambda', /* Greek capital letter lambda */ - 924 => 'Mu', /* Greek capital letter mu */ - 925 => 'Nu', /* Greek capital letter nu */ - 926 => 'Xi', /* Greek capital letter xi */ - 927 => 'Omicron', /* Greek capital letter omicron */ - 928 => 'Pi', /* Greek capital letter pi */ - 929 => 'Rho', /* Greek capital letter rho */ - 931 => 'Sigma', /* Greek capital letter sigma */ - 932 => 'Tau', /* Greek capital letter tau */ - 933 => 'Upsilon', /* Greek capital letter upsilon */ - 934 => 'Phi', /* Greek capital letter phi */ - 935 => 'Chi', /* Greek capital letter chi */ - 936 => 'Psi', /* Greek capital letter psi */ - 937 => 'Omega', /* Greek capital letter omega */ - 945 => 'alpha', /* Greek small letter alpha */ - 946 => 'beta', /* Greek small letter beta */ - 947 => 'gamma', /* Greek small letter gamma */ - 948 => 'delta', /* Greek small letter delta */ - 949 => 'epsilon', /* Greek small letter epsilon */ - 950 => 'zeta', /* Greek small letter zeta */ - 951 => 'eta', /* Greek small letter eta */ - 952 => 'theta', /* Greek small letter theta */ - 953 => 'iota', /* Greek small letter iota */ - 954 => 'kappa', /* Greek small letter kappa */ - 955 => 'lambda', /* Greek small letter lambda */ - 956 => 'mu', /* Greek small letter mu */ - 957 => 'nu', /* Greek small letter nu */ - 958 => 'xi', /* Greek small letter xi */ - 959 => 'omicron', /* Greek small letter omicron */ - 960 => 'pi', /* Greek small letter pi */ - 961 => 'rho', /* Greek small letter rho */ - 962 => 'sigmaf', /* Greek small letter final sigma */ - 963 => 'sigma', /* Greek small letter sigma */ - 964 => 'tau', /* Greek small letter tau */ - 965 => 'upsilon', /* Greek small letter upsilon */ - 966 => 'phi', /* Greek small letter phi */ - 967 => 'chi', /* Greek small letter chi */ - 968 => 'psi', /* Greek small letter psi */ - 969 => 'omega', /* Greek small letter omega */ - 977 => 'thetasym', /* Greek theta symbol */ - 978 => 'upsih', /* Greek upsilon with hook symbol */ - 982 => 'piv', /* Greek pi symbol */ - 8194 => 'ensp', /* en space */ - 8195 => 'emsp', /* em space */ - 8201 => 'thinsp', /* thin space */ - 8204 => 'zwnj', /* zero width non-joiner */ - 8205 => 'zwj', /* zero width joiner */ - 8206 => 'lrm', /* left-to-right mark */ - 8207 => 'rlm', /* right-to-left mark */ - 8211 => 'ndash', /* en dash */ - 8212 => 'mdash', /* em dash */ - 8216 => 'lsquo', /* left single quotation mark */ - 8217 => 'rsquo', /* right single quotation mark */ - 8218 => 'sbquo', /* single low-9 quotation mark */ - 8220 => 'ldquo', /* left double quotation mark */ - 8221 => 'rdquo', /* right double quotation mark */ - 8222 => 'bdquo', /* double low-9 quotation mark */ - 8224 => 'dagger', /* dagger */ - 8225 => 'Dagger', /* double dagger */ - 8226 => 'bull', /* bullet */ - 8230 => 'hellip', /* horizontal ellipsis */ - 8240 => 'permil', /* per mille sign */ - 8242 => 'prime', /* prime */ - 8243 => 'Prime', /* double prime */ - 8249 => 'lsaquo', /* single left-pointing angle quotation mark */ - 8250 => 'rsaquo', /* single right-pointing angle quotation mark */ - 8254 => 'oline', /* overline */ - 8260 => 'frasl', /* fraction slash */ - 8364 => 'euro', /* euro sign */ - 8465 => 'image', /* black-letter capital i */ - 8472 => 'weierp', /* script capital pXCOMMAX Weierstrass p */ - 8476 => 'real', /* black-letter capital r */ - 8482 => 'trade', /* trademark sign */ - 8501 => 'alefsym', /* alef symbol */ - 8592 => 'larr', /* leftwards arrow */ - 8593 => 'uarr', /* upwards arrow */ - 8594 => 'rarr', /* rightwards arrow */ - 8595 => 'darr', /* downwards arrow */ - 8596 => 'harr', /* left right arrow */ - 8629 => 'crarr', /* downwards arrow with corner leftwards */ - 8656 => 'lArr', /* leftwards double arrow */ - 8657 => 'uArr', /* upwards double arrow */ - 8658 => 'rArr', /* rightwards double arrow */ - 8659 => 'dArr', /* downwards double arrow */ - 8660 => 'hArr', /* left right double arrow */ - 8704 => 'forall', /* for all */ - 8706 => 'part', /* partial differential */ - 8707 => 'exist', /* there exists */ - 8709 => 'empty', /* empty set */ - 8711 => 'nabla', /* nabla */ - 8712 => 'isin', /* element of */ - 8713 => 'notin', /* not an element of */ - 8715 => 'ni', /* contains as member */ - 8719 => 'prod', /* n-ary product */ - 8721 => 'sum', /* n-ary summation */ - 8722 => 'minus', /* minus sign */ - 8727 => 'lowast', /* asterisk operator */ - 8730 => 'radic', /* square root */ - 8733 => 'prop', /* proportional to */ - 8734 => 'infin', /* infinity */ - 8736 => 'ang', /* angle */ - 8743 => 'and', /* logical and */ - 8744 => 'or', /* logical or */ - 8745 => 'cap', /* intersection */ - 8746 => 'cup', /* union */ - 8747 => 'int', /* integral */ - 8756 => 'there4', /* therefore */ - 8764 => 'sim', /* tilde operator */ - 8773 => 'cong', /* congruent to */ - 8776 => 'asymp', /* almost equal to */ - 8800 => 'ne', /* not equal to */ - 8801 => 'equiv', /* identical toXCOMMAX equivalent to */ - 8804 => 'le', /* less-than or equal to */ - 8805 => 'ge', /* greater-than or equal to */ - 8834 => 'sub', /* subset of */ - 8835 => 'sup', /* superset of */ - 8836 => 'nsub', /* not a subset of */ - 8838 => 'sube', /* subset of or equal to */ - 8839 => 'supe', /* superset of or equal to */ - 8853 => 'oplus', /* circled plus */ - 8855 => 'otimes', /* circled times */ - 8869 => 'perp', /* up tack */ - 8901 => 'sdot', /* dot operator */ - 8968 => 'lceil', /* left ceiling */ - 8969 => 'rceil', /* right ceiling */ - 8970 => 'lfloor', /* left floor */ - 8971 => 'rfloor', /* right floor */ - 9001 => 'lang', /* left-pointing angle bracket */ - 9002 => 'rang', /* right-pointing angle bracket */ - 9674 => 'loz', /* lozenge */ - 9824 => 'spades', /* black spade suit */ - 9827 => 'clubs', /* black club suit */ - 9829 => 'hearts', /* black heart suit */ - 9830 => 'diams', /* black diamond suit */ + 34 => 'quot', /* quotation mark */ + 38 => 'amp', /* ampersand */ + 60 => 'lt', /* less-than sign */ + 62 => 'gt', /* greater-than sign */ ); $chr = $matches[0]; diff --git a/vendor/twig/twig/lib/Twig/Function/Node.php b/vendor/twig/twig/lib/Twig/Function/Node.php index a687a84..df937e5 100644 --- a/vendor/twig/twig/lib/Twig/Function/Node.php +++ b/vendor/twig/twig/lib/Twig/Function/Node.php @@ -15,7 +15,7 @@ * @package twig * @author Fabien Potencier */ -class Twig_Function_Node extends Twig_Filter +class Twig_Function_Node extends Twig_Function { protected $class; diff --git a/vendor/twig/twig/lib/Twig/Loader/String.php b/vendor/twig/twig/lib/Twig/Loader/String.php index bc792b1..a103bce 100644 --- a/vendor/twig/twig/lib/Twig/Loader/String.php +++ b/vendor/twig/twig/lib/Twig/Loader/String.php @@ -12,6 +12,10 @@ /** * Loads a template from a string. * + * This loader should only be used for unit testing as it has many limitations + * (for instance, the include or extends tag does not make any sense for a string + * loader). + * * When using this loader with a cache mechanism, you should know that a new cache * key is generated each time a template content "changes" (the cache key being the * source code of the template). If you don't want to see your cache grows out of diff --git a/vendor/twig/twig/lib/Twig/Parser.php b/vendor/twig/twig/lib/Twig/Parser.php index 771a7bd..66f5d2a 100644 --- a/vendor/twig/twig/lib/Twig/Parser.php +++ b/vendor/twig/twig/lib/Twig/Parser.php @@ -30,7 +30,6 @@ class Twig_Parser implements Twig_ParserInterface protected $env; protected $reservedMacroNames; protected $importedFunctions; - protected $tmpVarCount; protected $traits; protected $embeddedTemplates = array(); @@ -51,7 +50,7 @@ class Twig_Parser implements Twig_ParserInterface public function getVarName() { - return sprintf('__internal_%s_%d', substr($this->env->getTemplateClass($this->stream->getFilename()), strlen($this->env->getTemplateClassPrefix())), ++$this->tmpVarCount); + return sprintf('__internal_%s', hash('sha1', uniqid(mt_rand(), true), false)); } /** @@ -68,8 +67,6 @@ class Twig_Parser implements Twig_ParserInterface unset($vars['stack'], $vars['env'], $vars['handlers'], $vars['visitors'], $vars['expressionParser']); $this->stack[] = $vars; - $this->tmpVarCount = 0; - // tag handlers if (null === $this->handlers) { $this->handlers = $this->env->getTokenParsers(); diff --git a/vendor/twig/twig/package.xml.tpl b/vendor/twig/twig/package.xml.tpl new file mode 100644 index 0000000..f9a9b89 --- /dev/null +++ b/vendor/twig/twig/package.xml.tpl @@ -0,0 +1,64 @@ + + + Twig + pear.twig-project.org + Twig is a PHP template engine. + + Twig is a template language for PHP, released under the new BSD license + (code and documentation). + + Twig uses a syntax similar to the Django and Jinja template languages which + inspired the Twig runtime environment. + + + Fabien Potencier + fabpot + fabien.potencier@symfony-project.org + yes + + + Armin Ronacher + armin + armin.ronacher@active-4.com + no + + {{ date }} + + + {{ version }} + {{ api_version }} + + + {{ stability }} + {{ stability }} + + BSD Style + - + + + + + + + + +{{ files }} + + + + + + + + 5.2.4 + + + 1.4.0 + + + + + diff --git a/vendor/twig/twig/phpunit.xml.dist b/vendor/twig/twig/phpunit.xml.dist new file mode 100644 index 0000000..6c5046f --- /dev/null +++ b/vendor/twig/twig/phpunit.xml.dist @@ -0,0 +1,25 @@ + + + + + + ./test/Twig/ + + + + + + ./lib/Twig/ + + + diff --git a/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php b/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php new file mode 100644 index 0000000..c8b7999 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/AutoloaderTest.php @@ -0,0 +1,21 @@ +assertFalse(class_exists('FooBarFoo'), '->autoload() does not try to load classes that does not begin with Twig'); + + $autoloader = new Twig_Autoloader(); + $this->assertNull($autoloader->autoload('Foo'), '->autoload() returns false if it is not able to load a class'); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/CompilerTest.php b/vendor/twig/twig/test/Twig/Tests/CompilerTest.php new file mode 100644 index 0000000..ebe79ae --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/CompilerTest.php @@ -0,0 +1,33 @@ +markTestSkipped('Your platform does not support locales.'); + } + + $required_locales = array('fr_FR.UTF-8', 'fr_FR.UTF8', 'fr_FR.utf-8', 'fr_FR.utf8', 'French_France.1252'); + if (false === setlocale(LC_ALL, $required_locales)) { + $this->markTestSkipped('Could not set any of required locales: ' . implode(", ", $required_locales)); + } + + $this->assertEquals('1.2', $compiler->repr(1.2)->getSource()); + $this->assertContains('fr', strtolower(setlocale(LC_NUMERIC, 0))); + + setlocale(LC_ALL, $locale); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php b/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php new file mode 100644 index 0000000..76731ea --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/EnvironmentTest.php @@ -0,0 +1,35 @@ + '{{ foo }} {{ foo }}', + 'js' => '{{ bar }} {{ bar }}', + )); + + $twig = new Twig_Environment($loader, array( + 'debug' => true, + 'cache' => false, + 'autoescape' => array($this, 'escapingStrategyCallback'), + )); + + $this->assertEquals('foo<br/ > foo<br/ >', $twig->render('html', array('foo' => 'foo
    '))); + $this->assertEquals('foo\x3Cbr\x2F\x20\x3E foo\x3Cbr\x2F\x20\x3E', $twig->render('js', array('bar' => 'foo
    '))); + } + + public function escapingStrategyCallback($filename) + { + return $filename; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/ErrorTest.php b/vendor/twig/twig/test/Twig/Tests/ErrorTest.php new file mode 100644 index 0000000..9d20c4d --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/ErrorTest.php @@ -0,0 +1,136 @@ +setTemplateFile(new SplFileInfo(__FILE__)); + + $this->assertContains('test'.DIRECTORY_SEPARATOR.'Twig'.DIRECTORY_SEPARATOR.'Tests'.DIRECTORY_SEPARATOR.'ErrorTest.php', $error->getMessage()); + } + + public function testErrorWithArrayFilename() + { + $error = new Twig_Error('foo'); + $error->setTemplateFile(array('foo' => 'bar')); + + $this->assertEquals('foo in {"foo":"bar"}', $error->getMessage()); + } + + public function testTwigExceptionAddsFileAndLineWhenMissing() + { + $loader = new Twig_Loader_Array(array('index' => "\n\n{{ foo.bar }}\n\n\n{{ 'foo' }}")); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index'); + + try { + $template->render(array()); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('Variable "foo" does not exist in "index" at line 3', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index', $e->getTemplateFile()); + } + } + + public function testRenderWrapsExceptions() + { + $loader = new Twig_Loader_Array(array('index' => "\n\n\n{{ foo.bar }}\n\n\n\n{{ 'foo' }}")); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index'); + + try { + $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index" at line 4.', $e->getMessage()); + $this->assertEquals(4, $e->getTemplateLine()); + $this->assertEquals('index', $e->getTemplateFile()); + } + } + + public function testTwigExceptionAddsFileAndLineWhenMissingWithInheritance() + { + $loader = new Twig_Loader_Array(array( + 'index' => "{% extends 'base' %} + {% block content %} + {{ foo.bar }} + {% endblock %} + {% block foo %} + {{ foo.bar }} + {% endblock %}", + 'base' => '{% block content %}{% endblock %}' + )); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index'); + try { + $template->render(array()); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('Variable "foo" does not exist in "index" at line 3', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index', $e->getTemplateFile()); + } + + try { + $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index" at line 3.', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index', $e->getTemplateFile()); + } + } + + public function testTwigExceptionAddsFileAndLineWhenMissingWithInheritanceOnDisk() + { + $loader = new Twig_Loader_Filesystem(dirname(__FILE__).'/Fixtures/errors'); + $twig = new Twig_Environment($loader, array('strict_variables' => true, 'debug' => true, 'cache' => false)); + + $template = $twig->loadTemplate('index.html'); + try { + $template->render(array()); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('Variable "foo" does not exist in "index.html" at line 3', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index.html', $e->getTemplateFile()); + } + + try { + $template->render(array('foo' => new Twig_Tests_ErrorTest_Foo())); + + $this->fail(); + } catch (Twig_Error_Runtime $e) { + $this->assertEquals('An exception has been thrown during the rendering of a template ("Runtime error...") in "index.html" at line 3.', $e->getMessage()); + $this->assertEquals(3, $e->getTemplateLine()); + $this->assertEquals('index.html', $e->getTemplateFile()); + } + } +} + +class Twig_Tests_ErrorTest_Foo +{ + public function bar() + { + throw new Exception('Runtime error...'); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php b/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php new file mode 100644 index 0000000..b3f300f --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/ExpressionParserTest.php @@ -0,0 +1,217 @@ + false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize($template, 'index')); + } + + public function getFailingTestsForAssignment() + { + return array( + array('{% set false = "foo" %}'), + array('{% set true = "foo" %}'), + array('{% set none = "foo" %}'), + array('{% set 3 = "foo" %}'), + array('{% set 1 + 2 = "foo" %}'), + array('{% set "bar" = "foo" %}'), + array('{% set %}{% endset %}') + ); + } + + /** + * @dataProvider getTestsForArray + */ + public function testArrayExpression($template, $expected) + { + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $stream = $env->tokenize($template, 'index'); + $parser = new Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); + } + + /** + * @expectedException Twig_Error_Syntax + * @dataProvider getFailingTestsForArray + */ + public function testArraySyntaxError($template) + { + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $parser = new Twig_Parser($env); + + $parser->parse($env->tokenize($template, 'index')); + } + + public function getFailingTestsForArray() + { + return array( + array('{{ [1, "a": "b"] }}'), + array('{{ {"a": "b", 2} }}'), + ); + } + + public function getTestsForArray() + { + return array( + // simple array + array('{{ [1, 2] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + ), + + // array with trailing , + array('{{ [1, 2, ] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + ), + + // simple hash + array('{{ {"a": "b", "b": "c"} }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), + + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), + + // hash with trailing , + array('{{ {"a": "b", "b": "c", } }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), + + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), + + // hash in an array + array('{{ [1, {"a": "b", "b": "c"}] }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Constant('b', 1), + + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), 1), + ), + + // array in a hash + array('{{ {"a": [1, 2], "b": "c"} }}', new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant('a', 1), + new Twig_Node_Expression_Array(array( + new Twig_Node_Expression_Constant(0, 1), + new Twig_Node_Expression_Constant(1, 1), + + new Twig_Node_Expression_Constant(1, 1), + new Twig_Node_Expression_Constant(2, 1), + ), 1), + new Twig_Node_Expression_Constant('b', 1), + new Twig_Node_Expression_Constant('c', 1), + ), 1), + ), + ); + } + + /** + * @expectedException Twig_Error_Syntax + */ + public function testStringExpressionDoesNotConcatenateTwoConsecutiveStrings() + { + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $stream = $env->tokenize('{{ "a" "b" }}', 'index'); + $parser = new Twig_Parser($env); + + $parser->parse($stream); + } + + /** + * @dataProvider getTestsForString + */ + public function testStringExpression($template, $expected) + { + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false, 'optimizations' => 0)); + $stream = $env->tokenize($template, 'index'); + $parser = new Twig_Parser($env); + + $this->assertEquals($expected, $parser->parse($stream)->getNode('body')->getNode(0)->getNode('expr')); + } + + public function getTestsForString() + { + return array( + array( + '{{ "foo" }}', new Twig_Node_Expression_Constant('foo', 1), + ), + array( + '{{ "foo #{bar}" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 + ), + ), + array( + '{{ "foo #{bar} baz" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 + ) + ), + + array( + '{{ "foo #{"foo #{bar} baz"} baz" }}', new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Binary_Concat( + new Twig_Node_Expression_Constant('foo ', 1), + new Twig_Node_Expression_Name('bar', 1), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 + ), + 1 + ), + new Twig_Node_Expression_Constant(' baz', 1), + 1 + ), + ), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php b/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php new file mode 100644 index 0000000..77a8101 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Extension/CoreTest.php @@ -0,0 +1,115 @@ +assertTrue(in_array(twig_random(new Twig_Environment(), $value), $expectedInArray, true)); // assertContains() would not consider the type + } + } + + public function getRandomFunctionTestData() + { + return array( + array( // array + array('apple', 'orange', 'citrus'), + array('apple', 'orange', 'citrus'), + ), + array( // Traversable + new ArrayObject(array('apple', 'orange', 'citrus')), + array('apple', 'orange', 'citrus'), + ), + array( // unicode string + 'Ä€é', + array('Ä', '€', 'é'), + ), + array( // numeric but string + '123', + array('1', '2', '3'), + ), + array( // integer + 5, + range(0, 5, 1), + ), + array( // float + 5.9, + range(0, 5, 1), + ), + array( // negative + -2, + array(0, -1, -2), + ), + ); + } + + public function testRandomFunctionWithoutParameter() + { + $max = mt_getrandmax(); + + for ($i = 0; $i < 100; $i++) { + $val = twig_random(new Twig_Environment()); + $this->assertTrue(is_int($val) && $val >= 0 && $val <= $max); + } + } + + public function testRandomFunctionReturnsAsIs() + { + $this->assertSame('', twig_random(new Twig_Environment(), '')); + $this->assertSame('', twig_random(new Twig_Environment(null, array('charset' => null)), '')); + + $instance = new stdClass(); + $this->assertSame($instance, twig_random(new Twig_Environment(), $instance)); + } + + /** + * @expectedException Twig_Error_Runtime + */ + public function testRandomFunctionOfEmptyArrayThrowsException() + { + twig_random(new Twig_Environment(), array()); + } + + public function testRandomFunctionOnNonUTF8String() + { + if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + $this->markTestSkipped('needs iconv or mbstring'); + } + + $twig = new Twig_Environment(); + $twig->setCharset('ISO-8859-1'); + + $text = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + for ($i = 0; $i < 30; $i++) { + $rand = twig_random($twig, $text); + $this->assertTrue(in_array(twig_convert_encoding($rand, 'UTF-8', 'ISO-8859-1'), array('Ä', 'é'), true)); + } + } + + public function testReverseFilterOnNonUTF8String() + { + if (!function_exists('iconv') && !function_exists('mb_convert_encoding')) { + $this->markTestSkipped('needs iconv or mbstring'); + } + + $twig = new Twig_Environment(); + $twig->setCharset('ISO-8859-1'); + + $input = twig_convert_encoding('Äé', 'ISO-8859-1', 'UTF-8'); + $output = twig_convert_encoding(twig_reverse_filter($twig, $input), 'UTF-8', 'ISO-8859-1'); + + $this->assertEquals($output, 'éÄ'); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php b/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php new file mode 100644 index 0000000..0768c65 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Extension/SandboxTest.php @@ -0,0 +1,209 @@ + 'Fabien', + 'obj' => new FooObject(), + 'arr' => array('obj' => new FooObject()), + ); + + self::$templates = array( + '1_basic1' => '{{ obj.foo }}', + '1_basic2' => '{{ name|upper }}', + '1_basic3' => '{% if name %}foo{% endif %}', + '1_basic4' => '{{ obj.bar }}', + '1_basic5' => '{{ obj }}', + '1_basic6' => '{{ arr.obj }}', + '1_basic7' => '{{ cycle(["foo","bar"], 1) }}', + '1_basic8' => '{{ obj.getfoobar }}{{ obj.getFooBar }}', + '1_basic' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + '1_layout' => '{% block content %}{% endblock %}', + '1_child' => '{% extends "1_layout" %}{% block content %}{{ "a"|json_encode }}{% endblock %}', + ); + } + + /** + * @expectedException Twig_Sandbox_SecurityError + * @expectedExceptionMessage Filter "json_encode" is not allowed in "1_child". + */ + public function testSandboxWithInheritance() + { + $twig = $this->getEnvironment(true, array(), self::$templates, array('block')); + $twig->loadTemplate('1_child')->render(array()); + } + + public function testSandboxGloballySet() + { + $twig = $this->getEnvironment(false, array(), self::$templates); + $this->assertEquals('FOO', $twig->loadTemplate('1_basic')->render(self::$params), 'Sandbox does nothing if it is disabled globally'); + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic1')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method is called'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic2')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed filter is called'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic3')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed tag is used in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic4')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed property is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic5')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic6')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed method (__toString()) is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('1_basic7')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception if an unallowed function is called in the template'); + } catch (Twig_Sandbox_SecurityError $e) { + } + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => 'foo')); + FooObject::reset(); + $this->assertEquals('foo', $twig->loadTemplate('1_basic1')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals(1, FooObject::$called['foo'], 'Sandbox only calls method once'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => '__toString')); + FooObject::reset(); + $this->assertEquals('foo', $twig->loadTemplate('1_basic5')->render(self::$params), 'Sandbox allow some methods'); + $this->assertEquals(1, FooObject::$called['__toString'], 'Sandbox only calls method once'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array('upper')); + $this->assertEquals('FABIEN', $twig->loadTemplate('1_basic2')->render(self::$params), 'Sandbox allow some filters'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array('if')); + $this->assertEquals('foo', $twig->loadTemplate('1_basic3')->render(self::$params), 'Sandbox allow some tags'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array('FooObject' => 'bar')); + $this->assertEquals('bar', $twig->loadTemplate('1_basic4')->render(self::$params), 'Sandbox allow some properties'); + + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array(), array(), array('cycle')); + $this->assertEquals('bar', $twig->loadTemplate('1_basic7')->render(self::$params), 'Sandbox allow some functions'); + + foreach (array('getfoobar', 'getFoobar', 'getFooBar') as $name) { + $twig = $this->getEnvironment(true, array(), self::$templates, array(), array(), array('FooObject' => $name)); + FooObject::reset(); + $this->assertEquals('foobarfoobar', $twig->loadTemplate('1_basic8')->render(self::$params), 'Sandbox allow methods in a case-insensitive way'); + $this->assertEquals(2, FooObject::$called['getFooBar'], 'Sandbox only calls method once'); + } + } + + public function testSandboxLocallySetForAnInclude() + { + self::$templates = array( + '2_basic' => '{{ obj.foo }}{% include "2_included" %}{{ obj.foo }}', + '2_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + ); + + $twig = $this->getEnvironment(false, array(), self::$templates); + $this->assertEquals('fooFOOfoo', $twig->loadTemplate('2_basic')->render(self::$params), 'Sandbox does nothing if disabled globally and sandboxed not used for the include'); + + self::$templates = array( + '3_basic' => '{{ obj.foo }}{% sandbox %}{% include "3_included" %}{% endsandbox %}{{ obj.foo }}', + '3_included' => '{% if obj.foo %}{{ obj.foo|upper }}{% endif %}', + ); + + $twig = $this->getEnvironment(true, array(), self::$templates); + try { + $twig->loadTemplate('3_basic')->render(self::$params); + $this->fail('Sandbox throws a SecurityError exception when the included file is sandboxed'); + } catch (Twig_Sandbox_SecurityError $e) { + } + } + + public function testMacrosInASandbox() + { + $twig = $this->getEnvironment(true, array('autoescape' => true), array('index' => <<{{ text }}

    {% endmacro %} +{{ _self.test('username') }} +EOF + ), array('macro'), array('escape')); + + $this->assertEquals('

    username

    ', $twig->loadTemplate('index')->render(array())); + } + + protected function getEnvironment($sandboxed, $options, $templates, $tags = array(), $filters = array(), $methods = array(), $properties = array(), $functions = array()) + { + $loader = new Twig_Loader_Array($templates); + $twig = new Twig_Environment($loader, array_merge(array('debug' => true, 'cache' => false, 'autoescape' => false), $options)); + $policy = new Twig_Sandbox_SecurityPolicy($tags, $filters, $methods, $properties, $functions); + $twig->addExtension(new Twig_Extension_Sandbox($policy, $sandboxed)); + + return $twig; + } +} + +class FooObject +{ + static public $called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); + + public $bar = 'bar'; + + static public function reset() + { + self::$called = array('__toString' => 0, 'foo' => 0, 'getFooBar' => 0); + } + + public function __toString() + { + ++self::$called['__toString']; + + return 'foo'; + } + + public function foo() + { + ++self::$called['foo']; + + return 'foo'; + } + + public function getFooBar() + { + ++self::$called['getFooBar']; + + return 'foobar'; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php b/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php new file mode 100644 index 0000000..2c77c06 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/FileCachingTest.php @@ -0,0 +1,70 @@ +tmpDir = sys_get_temp_dir().'/TwigTests'; + if (!file_exists($this->tmpDir)) { + @mkdir($this->tmpDir, 0777, true);; + } + + if (!is_writable($this->tmpDir)) { + $this->markTestSkipped(sprintf('Unable to run the tests as "%s" is not writable.', $this->tmpDir)); + } + + $this->env = new Twig_Environment(new Twig_Loader_String(), array('cache' => $this->tmpDir)); + } + + public function tearDown() + { + if ($this->fileName) { + unlink($this->fileName); + } + + $this->removeDir($this->tmpDir); + } + + public function testWritingCacheFiles() + { + $name = 'This is just text.'; + $template = $this->env->loadTemplate($name); + $cacheFileName = $this->env->getCacheFilename($name); + + $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); + $this->fileName = $cacheFileName; + } + + public function testClearingCacheFiles() + { + $name = 'I will be deleted.'; + $template = $this->env->loadTemplate($name); + $cacheFileName = $this->env->getCacheFilename($name); + + $this->assertTrue(file_exists($cacheFileName), 'Cache file does not exist.'); + $this->env->clearCacheFiles(); + $this->assertFalse(file_exists($cacheFileName), 'Cache file was not cleared.'); + } + + private function removeDir($target) + { + $fp = opendir($target); + while (false !== $file = readdir($fp)) { + if (in_array($file, array('.', '..'))) { + continue; + } + + if (is_dir($target.'/'.$file)) { + self::removeDir($target.'/'.$file); + } else { + unlink($target.'/'.$file); + } + } + closedir($fp); + rmdir($target); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html b/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html new file mode 100644 index 0000000..cb0dbe4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/base.html @@ -0,0 +1 @@ +{% block content %}{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html b/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html new file mode 100644 index 0000000..df57c82 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/errors/index.html @@ -0,0 +1,7 @@ +{% extends 'base.html' %} +{% block content %} + {{ foo.bar }} +{% endblock %} +{% block foo %} + {{ foo.bar }} +{% endblock %} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test new file mode 100644 index 0000000..02245e9 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/exceptions/unclosed_tag.test @@ -0,0 +1,20 @@ +--TEST-- +Exception for an unclosed tag +--TEMPLATE-- +{% block foo %} + {% if foo %} + + + + + {% for i in fo %} + + + + {% endfor %} + + + +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Unexpected tag name "endblock" (expecting closing tag for the "if" tag defined near line 4) in "index.twig" at line 16 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test new file mode 100644 index 0000000..c69b119 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array.test @@ -0,0 +1,61 @@ +--TEST-- +Twig supports array notation +--TEMPLATE-- +{# empty array #} +{{ []|join(',') }} + +{{ [1, 2]|join(',') }} +{{ ['foo', "bar"]|join(',') }} +{{ {0: 1, 'foo': 'bar'}|join(',') }} +{{ {0: 1, 'foo': 'bar'}|keys|join(',') }} + +{{ {0: 1, foo: 'bar'}|join(',') }} +{{ {0: 1, foo: 'bar'}|keys|join(',') }} + +{# nested arrays #} +{% set a = [1, 2, [1, 2], {'foo': {'foo': 'bar'}}] %} +{{ a[2]|join(',') }} +{{ a[3]["foo"]|join(',') }} + +{# works even if [] is used inside the array #} +{{ [foo[bar]]|join(',') }} + +{# elements can be any expression #} +{{ ['foo'|upper, bar|upper, bar == foo]|join(',') }} + +{# arrays can have a trailing , like in PHP #} +{{ + [ + 1, + 2, + ]|join(',') +}} + +{# keys can be any expression #} +{% set a = 1 %} +{% set b = "foo" %} +{% set ary = { (a): 'a', (b): 'b', 'c': 'c', (a ~ b): 'd' } %} +{{ ary|keys|join(',') }} +{{ ary|join(',') }} +--DATA-- +return array('bar' => 'bar', 'foo' => array('bar' => 'bar')) +--EXPECT-- +1,2 +foo,bar +1,bar +0,foo + +1,bar +0,foo + +1,2 +bar + +bar + +FOO,BAR, + +1,2 + +1,foo,c,1foo +a,b,c,d diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test new file mode 100644 index 0000000..f3df328 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/array_call.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports method calls +--TEMPLATE-- +{{ items.foo }} +{{ items['foo'] }} +{{ items[foo] }} +{{ items[items[foo]] }} +--DATA-- +return array('foo' => 'bar', 'items' => array('foo' => 'bar', 'bar' => 'foo')) +--EXPECT-- +bar +bar +foo +bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test new file mode 100644 index 0000000..f5e6845 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/binary.test @@ -0,0 +1,46 @@ +--TEST-- +Twig supports binary operations (+, -, *, /, ~, %, and, or) +--TEMPLATE-- +{{ 1 + 1 }} +{{ 2 - 1 }} +{{ 2 * 2 }} +{{ 2 / 2 }} +{{ 3 % 2 }} +{{ 1 and 1 }} +{{ 1 and 0 }} +{{ 0 and 1 }} +{{ 0 and 0 }} +{{ 1 or 1 }} +{{ 1 or 0 }} +{{ 0 or 1 }} +{{ 0 or 0 }} +{{ 0 or 1 and 0 }} +{{ 1 or 0 and 1 }} +{{ "foo" ~ "bar" }} +{{ foo ~ "bar" }} +{{ "foo" ~ bar }} +{{ foo ~ bar }} +{{ 20 // 7 }} +--DATA-- +return array('foo' => 'bar', 'bar' => 'foo') +--EXPECT-- +2 +1 +4 +1 +1 +1 + + + +1 +1 +1 + + +1 +foobar +barbar +foofoo +barfoo +2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test new file mode 100644 index 0000000..911094c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/bitwise.test @@ -0,0 +1,12 @@ +--TEST-- +Twig supports bitwise operations +--TEMPLATE-- +{{ 1 b-and 5 }} +{{ 1 b-or 5 }} +{{ 1 b-xor 5 }} +--DATA-- +return array() +--EXPECT-- +1 +5 +4 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test new file mode 100644 index 0000000..726b850 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/comparison.test @@ -0,0 +1,14 @@ +--TEST-- +Twig supports comparison operators (==, !=, <, >, >=, <=) +--TEMPLATE-- +{{ 1 > 2 }}/{{ 1 > 1 }}/{{ 1 >= 2 }}/{{ 1 >= 1 }} +{{ 1 < 2 }}/{{ 1 < 1 }}/{{ 1 <= 2 }}/{{ 1 <= 1 }} +{{ 1 == 1 }}/{{ 1 == 2 }} +{{ 1 != 1 }}/{{ 1 != 2 }} +--DATA-- +return array() +--EXPECT-- +///1 +1//1/1 +1/ +/1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test new file mode 100644 index 0000000..9cd0676 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/dotdot.test @@ -0,0 +1,20 @@ +--TEST-- +Twig supports the .. operator +--TEMPLATE-- +{% for i in 0..10 %}{{ i }} {% endfor %} + +{% for letter in 'a'..'z' %}{{ letter }} {% endfor %} + +{% for letter in 'a'|upper..'z'|upper %}{{ letter }} {% endfor %} + +{% for i in foo[0]..foo[1] %}{{ i }} {% endfor %} + +{% for i in 0 + 1 .. 10 - 1 %}{{ i }} {% endfor %} +--DATA-- +return array('foo' => array(1, 10)) +--EXPECT-- +0 1 2 3 4 5 6 7 8 9 10 +a b c d e f g h i j k l m n o p q r s t u v w x y z +A B C D E F G H I J K L M N O P Q R S T U V W X Y Z +1 2 3 4 5 6 7 8 9 10 +1 2 3 4 5 6 7 8 9 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test new file mode 100644 index 0000000..79f8e0b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/grouping.test @@ -0,0 +1,8 @@ +--TEST-- +Twig supports grouping of expressions +--TEMPLATE-- +{{ (2 + 2) / 2 }} +--DATA-- +return array() +--EXPECT-- +2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test new file mode 100644 index 0000000..7ae3bae --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/literals.test @@ -0,0 +1,22 @@ +--TEST-- +Twig supports literals +--TEMPLATE-- +1 {{ true }} +2 {{ TRUE }} +3 {{ false }} +4 {{ FALSE }} +5 {{ none }} +6 {{ NONE }} +7 {{ null }} +8 {{ NULL }} +--DATA-- +return array() +--EXPECT-- +1 1 +2 1 +3 +4 +5 +6 +7 +8 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test new file mode 100644 index 0000000..159db96 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/magic_call.test @@ -0,0 +1,27 @@ +--TEST-- +Twig supports __call() for attributes +--TEMPLATE-- +{{ foo.foo }} +{{ foo.bar }} +--DATA-- +class TestClassForMagicCallAttributes +{ + public function getBar() + { + return 'bar_from_getbar'; + } + + public function __call($method, $arguments) + { + if ('foo' === $method) + { + return 'foo_from_call'; + } + + return false; + } +} +return array('foo' => new TestClassForMagicCallAttributes()) +--EXPECT-- +foo_from_call +bar_from_getbar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test new file mode 100644 index 0000000..9d84a4c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/method_call.test @@ -0,0 +1,28 @@ +--TEST-- +Twig supports method calls +--TEMPLATE-- +{{ items.foo.foo }} +{{ items.foo.getFoo() }} +{{ items.foo.bar }} +{{ items.foo['bar'] }} +{{ items.foo.bar('a', 43) }} +{{ items.foo.bar(foo) }} +{{ items.foo.self.foo() }} +{{ items.foo.is }} +{{ items.foo.in }} +{{ items.foo.not }} +--DATA-- +return array('foo' => 'bar', 'items' => array('foo' => new Foo(), 'bar' => 'foo')) +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +foo +foo +bar + +bar_a-43 +bar_bar +foo +is +in +not diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test new file mode 100644 index 0000000..db047c0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/postfix.test @@ -0,0 +1,21 @@ +--TEST-- +Twig parses postfix expressions +--TEMPLATE-- + +{% macro foo() %}foo{% endmacro %} + +{{ 'a' }} +{{ 'a'|upper }} +{{ ('a')|upper }} +{{ -1|upper }} +{{ _self.foo() }} +{{ (_self).foo() }} +--DATA-- +return array(); +--EXPECT-- +a +A +A +-1 +foo +foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test new file mode 100644 index 0000000..a911661 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/strings.test @@ -0,0 +1,10 @@ +--TEST-- +Twig supports string interpolation +--TEMPLATE-- +{{ "foo #{"foo #{bar} baz"} baz" }} +{{ "foo #{bar}#{bar} baz" }} +--DATA-- +return array('bar' => 'BAR'); +--EXPECT-- +foo foo BAR baz baz +foo BARBAR baz diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test new file mode 100644 index 0000000..0e6fa96 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/ternary_operator.test @@ -0,0 +1,18 @@ +--TEST-- +Twig supports the ternary operator +--TEMPLATE-- +{{ 1 ? 'YES' : 'NO' }} +{{ 0 ? 'YES' : 'NO' }} +{{ 0 ? 'YES' : (1 ? 'YES1' : 'NO1') }} +{{ 0 ? 'YES' : (0 ? 'YES1' : 'NO1') }} +{{ 1 == 1 ? 'foo
    ':'' }} +{{ foo ~ (bar ? ('-' ~ bar) : '') }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--EXPECT-- +YES +NO +YES1 +NO1 +foo
    +foo-bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test new file mode 100644 index 0000000..b79219a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary.test @@ -0,0 +1,12 @@ +--TEST-- +Twig supports unary operators (not, -, +) +--TEMPLATE-- +{{ not 1 }}/{{ not 0 }} +{{ +1 + 1 }}/{{ -1 - 1 }} +{{ not (false or true) }} +--DATA-- +return array() +--EXPECT-- +/1 +2/-2 + diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test new file mode 100644 index 0000000..cc6eef8 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/expressions/unary_precedence.test @@ -0,0 +1,14 @@ +--TEST-- +Twig unary operators precedence +--TEMPLATE-- +{{ -1 - 1 }} +{{ -1 - -1 }} +{{ -1 * -1 }} +{{ 4 / -1 * 5 }} +--DATA-- +return array() +--EXPECT-- +-2 +0 +1 +-20 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test new file mode 100644 index 0000000..27e93fd --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/abs.test @@ -0,0 +1,30 @@ +--TEST-- +"abs" filter +--TEMPLATE-- +{{ (-5.5)|abs }} +{{ (-5)|abs }} +{{ (-0)|abs }} +{{ 0|abs }} +{{ 5|abs }} +{{ 5.5|abs }} +{{ number1|abs }} +{{ number2|abs }} +{{ number3|abs }} +{{ number4|abs }} +{{ number5|abs }} +{{ number6|abs }} +--DATA-- +return array('number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5) +--EXPECT-- +5.5 +5 +0 +0 +5 +5.5 +5.5 +5 +0 +0 +5 +5.5 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test new file mode 100644 index 0000000..380b04b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/convert_encoding.test @@ -0,0 +1,10 @@ +--TEST-- +"convert_encoding" filter +--CONDITION-- +function_exists('iconv') || function_exists('mb_convert_encoding') +--TEMPLATE-- +{{ "愛していますか?"|convert_encoding('ISO-2022-JP', 'UTF-8')|convert_encoding('UTF-8', 'ISO-2022-JP') }} +--DATA-- +return array() +--EXPECT-- +愛していますか? diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test new file mode 100644 index 0000000..ae6d0da --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date.test @@ -0,0 +1,56 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +{{ date1|date('d/m/Y H:i:s', 'Europe/Paris') }} +{{ date1|date('d/m/Y H:i:s P', 'Europe/Paris') }} +{{ date1|date('d/m/Y H:i:s P', 'America/Chicago') }} +{{ date1|date('e') }} +{{ date1|date('d/m/Y H:i:s') }} +{{ date2|date }} +{{ date2|date('d/m/Y') }} +{{ date2|date('d/m/Y H:i:s', 'Europe/Paris') }} +{{ date2|date('d/m/Y H:i:s') }} +{{ date3|date }} +{{ date3|date('d/m/Y') }} +{{ date4|date }} +{{ date4|date('d/m/Y') }} +{{ date5|date }} +{{ date5|date('d/m/Y') }} +{{ date6|date('d/m/Y H:i:s P', 'Europe/Paris') }} +{{ date6|date('d/m/Y H:i:s P', 'Asia/Hong_Kong') }} +{{ date6|date('e', 'Europe/Paris') }} +{{ date6|date('e') }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date1' => mktime(13, 45, 0, 10, 4, 2010), + 'date2' => new DateTime('2010-10-04 13:45'), + 'date3' => '2010-10-04 13:45', + 'date4' => 1286199900, + 'date5' => -86410, + 'date6' => new DateTime('2010-10-04 13:45', new DateTimeZone('America/New_York')), +) +--EXPECT-- +October 4, 2010 13:45 +04/10/2010 +04/10/2010 15:45:00 +04/10/2010 15:45:00 +02:00 +04/10/2010 08:45:00 -05:00 +UTC +04/10/2010 13:45:00 +October 4, 2010 13:45 +04/10/2010 +04/10/2010 15:45:00 +04/10/2010 13:45:00 +October 4, 2010 13:45 +04/10/2010 +October 4, 2010 13:45 +04/10/2010 +December 30, 1969 23:59 +30/12/1969 +04/10/2010 19:45:00 +02:00 +05/10/2010 01:45:00 +08:00 +Europe/Paris +America/New_York \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test new file mode 100644 index 0000000..11a1ef4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format.test @@ -0,0 +1,14 @@ +--TEST-- +"date" filter +--TEMPLATE-- +{{ date1|date }} +{{ date1|date('d/m/Y') }} +--DATA-- +date_default_timezone_set('UTC'); +$twig->getExtension('core')->setDateFormat('Y-m-d', '%d days %h hours'); +return array( + 'date1' => mktime(13, 45, 0, 10, 4, 2010), +) +--EXPECT-- +2010-10-04 +04/10/2010 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test new file mode 100644 index 0000000..e6d3707 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_default_format_interval.test @@ -0,0 +1,16 @@ +--TEST-- +"date" filter (interval support as of PHP 5.3) +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ date2|date }} +{{ date2|date('%d days') }} +--DATA-- +date_default_timezone_set('UTC'); +$twig->getExtension('core')->setDateFormat('Y-m-d', '%d days %h hours'); +return array( + 'date2' => new DateInterval('P2D'), +) +--EXPECT-- +2 days 0 hours +2 days diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test new file mode 100644 index 0000000..2d5adc1 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_interval.test @@ -0,0 +1,16 @@ +--TEST-- +"date" filter (interval support as of PHP 5.3) +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +{{ date6|date }} +{{ date6|date('%d days %h hours') }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date5' => -86410, + 'date6' => new DateInterval('P2D'), +) +--EXPECT-- +2 days +2 days 0 hours diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test new file mode 100644 index 0000000..53d3a69 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/date_modify.test @@ -0,0 +1,14 @@ +--TEST-- +"date_modify" filter +--TEMPLATE-- +{{ date1|date_modify('-1day')|date('Y-m-d H:i:s') }} +{{ date2|date_modify('-1day')|date('Y-m-d H:i:s') }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date1' => '2010-10-04 13:45', + 'date2' => new DateTime('2010-10-04 13:45'), +) +--EXPECT-- +2010-10-03 13:45:00 +2010-10-03 13:45:00 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test new file mode 100644 index 0000000..22e86e4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/default.test @@ -0,0 +1,150 @@ +--TEST-- +"default" filter +--TEMPLATE-- +Variable: +{{ definedVar |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ zeroVar |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ emptyVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nullVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ undefinedVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +Array access: +{{ nested.definedVar |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ nested['definedVar'] |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ nested.zeroVar |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ nested.emptyVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nested.nullVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nested.undefinedVar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nested['undefinedVar'] |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ undefinedVar.foo |default('default') is sameas('default') ? 'ok' : 'ko' }} +Plain values: +{{ 'defined' |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ 0 |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ '' |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ null |default('default') is sameas('default') ? 'ok' : 'ko' }} +Precedence: +{{ 'o' ~ nullVar |default('k') }} +{{ 'o' ~ nested.nullVar |default('k') }} +Object methods: +{{ object.foo |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.undefinedMethod |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ object.getFoo() |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.getFoo('a') |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.undefinedMethod() |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ object.undefinedMethod('a') |default('default') is sameas('default') ? 'ok' : 'ko' }} +Deep nested: +{{ nested.undefinedVar.foo.bar |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ nested.definedArray.0 |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ nested['definedArray'][0] |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.self.foo |default('default') is sameas('default') ? 'ko' : 'ok' }} +{{ object.self.undefinedMethod |default('default') is sameas('default') ? 'ok' : 'ko' }} +{{ object.undefinedMethod.self |default('default') is sameas('default') ? 'ok' : 'ko' }} +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new Foo(), +) +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +Variable: +ok +ok +ok +ok +ok +Array access: +ok +ok +ok +ok +ok +ok +ok +ok +Plain values: +ok +ok +ok +ok +Precedence: +ok +ok +Object methods: +ok +ok +ok +ok +ok +ok +Deep nested: +ok +ok +ok +ok +ok +ok +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'emptyVar' => '', + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new Foo(), +) +--CONFIG-- +return array('strict_variables' => true) +--EXPECT-- +Variable: +ok +ok +ok +ok +ok +Array access: +ok +ok +ok +ok +ok +ok +ok +ok +Plain values: +ok +ok +ok +ok +Precedence: +ok +ok +Object methods: +ok +ok +ok +ok +ok +ok +Deep nested: +ok +ok +ok +ok +ok +ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test new file mode 100644 index 0000000..93c5913 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/dynamic_filter.test @@ -0,0 +1,10 @@ +--TEST-- +dynamic filter +--TEMPLATE-- +{{ 'bar'|foo_path }} +{{ 'bar'|a_foo_b_bar }} +--DATA-- +return array() +--EXPECT-- +foo/bar +a/b/bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test new file mode 100644 index 0000000..a606c10 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "foo
    "|e }} +--DATA-- +return array() +--EXPECT-- +foo <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test new file mode 100644 index 0000000..bba26a0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/escape_non_supported_charset.test @@ -0,0 +1,8 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{{ "愛していますか?
    "|e }} +--DATA-- +return array() +--EXPECT-- +愛していますか? <br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test new file mode 100644 index 0000000..85a9b71 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/force_escape.test @@ -0,0 +1,18 @@ +--TEST-- +"escape" filter +--TEMPLATE-- +{% set foo %} + foo
    +{% endset %} + +{{ foo|e('html') -}} +{{ foo|e('js') }} +{% autoescape true %} + {{ foo }} +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + foo<br /> +\x20\x20\x20\x20foo\x3Cbr\x20\x2F\x3E\x0A + foo
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test new file mode 100644 index 0000000..97221ff --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/format.test @@ -0,0 +1,8 @@ +--TEST-- +"format" filter +--TEMPLATE-- +{{ string|format(foo, 3) }} +--DATA-- +return array('string' => '%s/%d', 'foo' => 'bar') +--EXPECT-- +bar/3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test new file mode 100644 index 0000000..8feef63 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/join.test @@ -0,0 +1,12 @@ +--TEST-- +"join" filter +--TEMPLATE-- +{{ ["foo", "bar"]|join(', ') }} +{{ foo|join(', ') }} +{{ bar|join(', ') }} +--DATA-- +return array('foo' => new Foo(), 'bar' => new ArrayObject(array(3, 4))) +--EXPECT-- +foo, bar +1, 2 +3, 4 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test new file mode 100644 index 0000000..1738d40 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/json_encode.test @@ -0,0 +1,12 @@ +--TEST-- +"json_encode" filter +--TEMPLATE-- +{{ "foo"|json_encode|raw }} +{{ foo|json_encode|raw }} +{{ [foo, "foo"]|json_encode|raw }} +--DATA-- +return array('foo' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +"foo" +"foo" +["foo","foo"] diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test new file mode 100644 index 0000000..3347474 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length.test @@ -0,0 +1,14 @@ +--TEST-- +"length" filter +--TEMPLATE-- +{{ array|length }} +{{ string|length }} +{{ number|length }} +{{ markup|length }} +--DATA-- +return array('array' => array(1, 4), 'string' => 'foo', 'number' => 1000, 'markup' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +2 +3 +4 +3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test new file mode 100644 index 0000000..5d5e243 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/length_utf8.test @@ -0,0 +1,12 @@ +--TEST-- +"length" filter +--CONDITION-- +function_exists('mb_get_info') +--TEMPLATE-- +{{ string|length }} +{{ markup|length }} +--DATA-- +return array('string' => 'été', 'markup' => new Twig_Markup('foo', 'UTF-8')) +--EXPECT-- +3 +3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test new file mode 100644 index 0000000..357b352 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/merge.test @@ -0,0 +1,14 @@ +--TEST-- +"merge" filter +--TEMPLATE-- +{{ items|merge({'bar': 'foo'})|join }} +{{ items|merge({'bar': 'foo'})|keys|join }} +{{ {'bar': 'foo'}|merge(items)|join }} +{{ {'bar': 'foo'}|merge(items)|keys|join }} +--DATA-- +return array('items' => array('foo' => 'bar')) +--EXPECT-- +barfoo +foobar +foobar +barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test new file mode 100644 index 0000000..6545a9b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/nl2br.test @@ -0,0 +1,14 @@ +--TEST-- +"nl2br" filter +--TEMPLATE-- +{{ "I like Twig.\nYou will like it too.\n\nEverybody like it!"|nl2br }} +{{ text|nl2br }} +--DATA-- +return array('text' => "If you have some HTML\nit will be escaped.") +--EXPECT-- +I like Twig.
    +You will like it too.
    +
    +Everybody like it! +If you have some <strong>HTML</strong>
    +it will be escaped. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test new file mode 100644 index 0000000..639a865 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format.test @@ -0,0 +1,18 @@ +--TEST-- +"number_format" filter +--TEMPLATE-- +{{ 20|number_format }} +{{ 20.25|number_format }} +{{ 20.25|number_format(2) }} +{{ 20.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',', '.') }} +--DATA-- +return array(); +--EXPECT-- +20 +20 +20.25 +20,25 +1,020,25 +1.020,25 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test new file mode 100644 index 0000000..c6903cc --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/number_format_default.test @@ -0,0 +1,21 @@ +--TEST-- +"number_format" filter with defaults. +--TEMPLATE-- +{{ 20|number_format }} +{{ 20.25|number_format }} +{{ 20.25|number_format(1) }} +{{ 20.25|number_format(2, ',') }} +{{ 1020.25|number_format }} +{{ 1020.25|number_format(2, ',') }} +{{ 1020.25|number_format(2, ',', '.') }} +--DATA-- +$twig->getExtension('core')->setNumberFormat(2, '!', '='); +return array(); +--EXPECT-- +20!00 +20!25 +20!3 +20,25 +1=020!25 +1=020,25 +1.020,25 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test new file mode 100644 index 0000000..4021660 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/replace.test @@ -0,0 +1,8 @@ +--TEST-- +"replace" filter +--TEMPLATE-- +{{ "I like %this% and %that%."|replace({'%this%': "foo", '%that%': "bar"}) }} +--DATA-- +return array() +--EXPECT-- +I like foo and bar. diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test new file mode 100644 index 0000000..3c5f410 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/reverse.test @@ -0,0 +1,12 @@ +--TEST-- +"reverse" filter +--TEMPLATE-- +{{ [1, 2, 3, 4]|reverse|join('') }} +{{ '1234évènement'|reverse }} +{{ arr|reverse|join('') }} +--DATA-- +return array('arr' => new ArrayObject(array(1, 2, 3, 4))) +--EXPECT-- +4321 +tnemenèvé4321 +4321 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test new file mode 100644 index 0000000..bb32dfb --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/slice.test @@ -0,0 +1,40 @@ +--TEST-- +"slice" filter +--TEMPLATE-- +{{ [1, 2, 3, 4][1:2]|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}[1:2]|join('') }} +{{ [1, 2, 3, 4][start:length]|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2)|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2)|keys|join('') }} +{{ [1, 2, 3, 4]|slice(1, 2, true)|keys|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|join('') }} +{{ {a: 1, b: 2, c: 3, d: 4}|slice(1, 2)|keys|join('') }} +{{ '1234'|slice(1, 2) }} +{{ '1234'[1:2] }} +{{ arr|slice(1, 2)|join('') }} +{{ arr[1:2]|join('') }} + +{{ [1, 2, 3, 4]|slice(1)|join('') }} +{{ [1, 2, 3, 4][1:]|join('') }} +{{ '1234'|slice(1) }} +{{ '1234'[1:] }} +--DATA-- +return array('start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4))) +--EXPECT-- +23 +23 +23 +23 +01 +12 +23 +bc +23 +23 +23 +23 + +234 +234 +234 +234 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test new file mode 100644 index 0000000..21d575f --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/sort.test @@ -0,0 +1,10 @@ +--TEST-- +"sort" filter +--TEMPLATE-- +{{ array1|sort|join }} +{{ array2|sort|join }} +--DATA-- +return array('array1' => array(4, 1), 'array2' => array('foo', 'bar')) +--EXPECT-- +14 +barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test new file mode 100644 index 0000000..cc91900 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"☃" custom filter +--TEMPLATE-- +{{ 'foo'|☃ }} +--DATA-- +return array() +--EXPECT-- +☃foo☃ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test new file mode 100644 index 0000000..3192062 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/filters/trim.test @@ -0,0 +1,12 @@ +--TEST-- +"trim" filter +--TEMPLATE-- +{{ " I like Twig. "|trim }} +{{ text|trim }} +{{ " foo/"|trim("/") }} +--DATA-- +return array('text' => " If you have some HTML it will be escaped. ") +--EXPECT-- +I like Twig. +If you have some <strong>HTML</strong> it will be escaped. + foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test new file mode 100644 index 0000000..ba7d5e8 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/attribute.test @@ -0,0 +1,12 @@ +--TEST-- +"attribute" function +--TEMPLATE-- +{{ attribute(obj, method) }} +{{ attribute(array, item) }} +{{ attribute(obj, "bar", ["a", "b"]) }} +--DATA-- +return array('obj' => new Foo(), 'method' => 'foo', 'array' => array('foo' => 'bar'), 'item' => 'foo') +--EXPECT-- +foo +bar +bar_a-b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test new file mode 100644 index 0000000..8e54059 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/block.test @@ -0,0 +1,12 @@ +--TEST-- +"block" function +--TEMPLATE-- +{% extends 'base.twig' %} +{% block bar %}BAR{% endblock %} +--TEMPLATE(base.twig)-- +{% block foo %}{{ block('bar') }}{% endblock %} +{% block bar %}BAR_BASE{% endblock %} +--DATA-- +return array() +--EXPECT-- +BARBAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test new file mode 100644 index 0000000..6d4b374 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/constant.test @@ -0,0 +1,12 @@ +--TEST-- +"constant" function +--TEMPLATE-- +{% if constant('DATE_W3C') == expect %} +true +{% else %} +false +{% endif %} +--DATA-- +return array('expect' => DATE_W3C); +--EXPECT-- +true diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test new file mode 100644 index 0000000..522a63b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/cycle.test @@ -0,0 +1,16 @@ +--TEST-- +"cycle" function +--TEMPLATE-- +{% for i in 0..6 %} +{{ cycle(array1, i) }}-{{ cycle(array2, i) }} +{% endfor %} +--DATA-- +return array('array1' => array('odd', 'even'), 'array2' => array('apple', 'orange', 'citrus')) +--EXPECT-- +odd-apple +even-orange +odd-citrus +even-apple +odd-orange +even-citrus +odd-apple diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test new file mode 100644 index 0000000..caeee7a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/date.test @@ -0,0 +1,25 @@ +--TEST-- +"date" function +--TEMPLATE-- +{{ date() == date('now') ? 'OK' : 'KO' }} +{{ date() > date('-1day') ? 'OK' : 'KO' }} +{{ date(date1) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date2) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date3) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +{{ date(date4) == date('2010-10-04 13:45') ? 'OK' : 'KO' }} +--DATA-- +date_default_timezone_set('UTC'); +return array( + 'date1' => mktime(13, 45, 0, 10, 4, 2010), + 'date2' => new DateTime('2010-10-04 13:45'), + 'date3' => '2010-10-04 13:45', + 'date4' => 1286199900, + 'date5' => -86410, +) +--EXPECT-- +OK +OK +OK +OK +OK +OK diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test new file mode 100644 index 0000000..371a587 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump.test @@ -0,0 +1,14 @@ +--TEST-- +"dump" function +--TEMPLATE-- +{{ dump('foo') }} +{{ dump('foo', 'bar') }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--CONFIG-- +return array('debug' => true, 'autoescape' => false); +--EXPECT-- +string(3) "foo" + +string(3) "foo" +string(3) "bar" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test new file mode 100644 index 0000000..889b7a9 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dump_array.test @@ -0,0 +1,19 @@ +--TEST-- +"dump" function, xdebug is not loaded or xdebug <2.2-dev is loaded +--CONDITION-- +!extension_loaded('xdebug') || (($r = new ReflectionExtension('xdebug')) && version_compare($r->getVersion(), '2.2-dev', '<')) +--TEMPLATE-- +{{ dump() }} +--DATA-- +return array('foo' => 'foo', 'bar' => 'bar') +--CONFIG-- +return array('debug' => true, 'autoescape' => false); +--EXPECT-- +array(3) { + ["foo"]=> + string(3) "foo" + ["bar"]=> + string(3) "bar" + ["global"]=> + string(6) "global" +} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test new file mode 100644 index 0000000..913fbc9 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/dynamic_function.test @@ -0,0 +1,10 @@ +--TEST-- +dynamic function +--TEMPLATE-- +{{ foo_path('bar') }} +{{ a_foo_b_bar('bar') }} +--DATA-- +return array() +--EXPECT-- +foo/bar +a/b/bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test new file mode 100644 index 0000000..f602b0d --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/functions/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"☃" custom function +--TEMPLATE-- +{{ ☃('foo') }} +--DATA-- +return array() +--EXPECT-- +☃foo☃ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test new file mode 100644 index 0000000..6a366cd --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/simple.test @@ -0,0 +1,22 @@ +--TEST-- +macro +--TEMPLATE-- +{% import _self as test %} +{% from _self import test %} + +{% macro test(a, b) -%} + {{ a|default('a') }}
    + {{- b|default('b') }}
    +{%- endmacro %} + +{{ test.test() }} +{{ test() }} +{{ test.test(1, "c") }} +{{ test(1, "c") }} +--DATA-- +return array(); +--EXPECT-- +a
    b
    +a
    b
    +1
    c
    +1
    c
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test new file mode 100644 index 0000000..685626f --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/macros/with_filters.test @@ -0,0 +1,14 @@ +--TEST-- +macro with a filter +--TEMPLATE-- +{% import _self as test %} + +{% macro test() %} + {% filter escape %}foo
    {% endfilter %} +{% endmacro %} + +{{ test.test() }} +--DATA-- +return array(); +--EXPECT-- +foo<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test new file mode 100644 index 0000000..65f6cd2 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/empty_token.test @@ -0,0 +1,8 @@ +--TEST-- +Twig outputs 0 nodes correctly +--TEMPLATE-- +{{ foo }}0{{ foo }} +--DATA-- +return array('foo' => 'foo') +--EXPECT-- +foo0foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test new file mode 100644 index 0000000..110aef8 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/simple_xml_element.test @@ -0,0 +1,17 @@ +--TEST-- +Twig is able to deal with SimpleXMLElement instances as variables +--CONDITION-- +version_compare(phpversion(), '5.3.0', '>=') +--TEMPLATE-- +Hello '{{ images.image.0.group }}'! +{{ images.children().count() }} +{% for image in images %} + - {{ image.group }} +{% endfor %} +--DATA-- +return array('images' => new SimpleXMLElement('foobar')) +--EXPECT-- +Hello 'foo'! +2 + - foo + - bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test new file mode 100644 index 0000000..e18e110 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/regression/strings_like_numbers.test @@ -0,0 +1,8 @@ +--TEST-- +Twig does not confuse strings with integers in getAttribute() +--TEMPLATE-- +{{ hash['2e2'] }} +--DATA-- +return array('hash' => array('2e2' => 'works')) +--EXPECT-- +works diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test new file mode 100644 index 0000000..2f6a3e1 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/basic.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tag applies escaping on its children +--TEMPLATE-- +{% autoescape %} +{{ var }}
    +{% endautoescape %} +{% autoescape 'html' %} +{{ var }}
    +{% endautoescape %} +{% autoescape false %} +{{ var }}
    +{% endautoescape %} +{% autoescape true %} +{{ var }}
    +{% endautoescape %} +{% autoescape false %} +{{ var }}
    +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br />
    +<br />
    +

    +<br />
    +

    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test new file mode 100644 index 0000000..05ab83c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/blocks.test @@ -0,0 +1,12 @@ +--TEST-- +"autoescape" tag applies escaping on embedded blocks +--TEMPLATE-- +{% autoescape 'html' %} + {% block foo %} + {{ var }} + {% endblock %} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test new file mode 100644 index 0000000..9c09724 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/double_escaping.test @@ -0,0 +1,10 @@ +--TEST-- +"autoescape" tag does not double-escape +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|escape }} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test new file mode 100644 index 0000000..ce7ea78 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/functions.test @@ -0,0 +1,83 @@ +--TEST-- +"autoescape" tag applies escaping after calling functions +--TEMPLATE-- + +autoescape false +{% autoescape false %} + +safe_br +{{ safe_br() }} + +unsafe_br +{{ unsafe_br() }} + +{% endautoescape %} + +autoescape 'html' +{% autoescape 'html' %} + +safe_br +{{ safe_br() }} + +unsafe_br +{{ unsafe_br() }} + +unsafe_br()|raw +{{ (unsafe_br())|raw }} + +safe_br()|escape +{{ (safe_br())|escape }} + +safe_br()|raw +{{ (safe_br())|raw }} + +unsafe_br()|escape +{{ (unsafe_br())|escape }} + +{% endautoescape %} + +autoescape js +{% autoescape 'js' %} + +safe_br +{{ safe_br() }} + +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + +autoescape false + +safe_br +
    + +unsafe_br +
    + + +autoescape 'html' + +safe_br +
    + +unsafe_br +<br /> + +unsafe_br()|raw +
    + +safe_br()|escape +<br /> + +safe_br()|raw +
    + +unsafe_br()|escape +<br /> + + +autoescape js + +safe_br +\x3Cbr\x20\x2F\x3E diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test new file mode 100644 index 0000000..775bfd0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/literal.test @@ -0,0 +1,45 @@ +--TEST-- +"autoescape" tag does not apply escaping on literals +--TEMPLATE-- +{% autoescape 'html' %} + +1. Simple literal +{{ "
    " }} + +2. Conditional expression with only literals +{{ true ? "
    " : "
    " }} + +3. Conditonal expression with a variable +{{ true ? "
    " : someVar }} + +4. Nested conditionals with only literals +{{ true ? (true ? "
    " : "
    ") : "\n" }} + +5. Nested conditionals with a variable +{{ true ? (true ? "
    " : someVar) : "\n" }} + +6. Nested conditionals with a variable marked safe +{{ true ? (true ? "
    " : someVar|raw) : "\n" }} + +{% endautoescape %} +--DATA-- +return array() +--EXPECT-- + +1. Simple literal +
    + +2. Conditional expression with only literals +
    + +3. Conditonal expression with a variable +<br /> + +4. Nested conditionals with only literals +
    + +5. Nested conditionals with a variable +<br /> + +6. Nested conditionals with a variable marked safe +
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test new file mode 100644 index 0000000..798e6fe --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/nested.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tags can be nested at will +--TEMPLATE-- +{{ var }} +{% autoescape 'html' %} + {{ var }} + {% autoescape false %} + {{ var }} + {% autoescape 'html' %} + {{ var }} + {% endautoescape %} + {{ var }} + {% endautoescape %} + {{ var }} +{% endautoescape %} +{{ var }} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +<br /> + <br /> +
    + <br /> +
    + <br /> +<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test new file mode 100644 index 0000000..e896aa4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/objects.test @@ -0,0 +1,26 @@ +--TEST-- +"autoescape" tag applies escaping to object method calls +--TEMPLATE-- +{% autoescape 'html' %} +{{ user.name }} +{{ user.name|lower }} +{{ user }} +{% endautoescape %} +--DATA-- +class UserForAutoEscapeTest +{ + public function getName() + { + return 'Fabien
    '; + } + + public function __toString() + { + return 'Fabien
    '; + } +} +return array('user' => new UserForAutoEscapeTest()) +--EXPECT-- +Fabien<br /> +fabien<br /> +Fabien<br /> diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test new file mode 100644 index 0000000..9f1cedd --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/raw.test @@ -0,0 +1,10 @@ +--TEST-- +"autoescape" tag does not escape when raw is used as a filter +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|raw }} +{% endautoescape %} +--DATA-- +return array('var' => '
    ') +--EXPECT-- +
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test new file mode 100644 index 0000000..cf8ccee --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/strategy.test @@ -0,0 +1,17 @@ +--TEST-- +"autoescape" tag accepts an escaping strategy +--TEMPLATE-- +{% autoescape true js %}{{ var }}{% endautoescape %} + +{% autoescape true html %}{{ var }}{% endautoescape %} + +{% autoescape 'js' %}{{ var }}{% endautoescape %} + +{% autoescape 'html' %}{{ var }}{% endautoescape %} +--DATA-- +return array('var' => '
    "') +--EXPECT-- +\x3Cbr\x20\x2F\x3E\x22 +<br />" +\x3Cbr\x20\x2F\x3E\x22 +<br />" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test new file mode 100644 index 0000000..4f41520 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/type.test @@ -0,0 +1,69 @@ +--TEST-- +escape types +--TEMPLATE-- + +1. autoescape 'html' |escape('js') + +{% autoescape 'html' %} + +{% endautoescape %} + +2. autoescape 'html' |escape('js') + +{% autoescape 'html' %} + +{% endautoescape %} + +3. autoescape 'js' |escape('js') + +{% autoescape 'js' %} + +{% endautoescape %} + +4. no escape + +{% autoescape false %} + +{% endautoescape %} + +5. |escape('js')|escape('html') + +{% autoescape false %} + +{% endautoescape %} + +6. autoescape 'html' |escape('js')|escape('html') + +{% autoescape 'html' %} + +{% endautoescape %} + +--DATA-- +return array('msg' => "<>\n'\"") +--EXPECT-- + +1. autoescape 'html' |escape('js') + + + +2. autoescape 'html' |escape('js') + + + +3. autoescape 'js' |escape('js') + + + +4. no escape + + + +5. |escape('js')|escape('html') + + + +6. autoescape 'html' |escape('js')|escape('html') + + + diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test new file mode 100644 index 0000000..7821a9a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters.test @@ -0,0 +1,131 @@ +--TEST-- +"autoescape" tag applies escaping after calling filters +--TEMPLATE-- +{% autoescape 'html' %} + +(escape_and_nl2br is an escaper filter) + +1. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped ) +{{ var|escape_and_nl2br }} + +2. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped, |raw is redundant ) +{{ var|escape_and_nl2br|raw }} + +3. Explicit escape +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is explicitly escaped by |escape ) +{{ var|escape_and_nl2br|escape }} + +4. Escape non-escaper filter output +( var is upper-cased by |upper, + the output is auto-escaped ) +{{ var|upper }} + +5. Escape if last filter is not an escaper +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is upper-cased by |upper, + the output is auto-escaped as |upper is not an escaper ) +{{ var|escape_and_nl2br|upper }} + +6. Don't escape escaper filter output +( var is upper cased by upper, + the output is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped as |escape_and_nl2br is an escaper ) +{{ var|upper|escape_and_nl2br }} + +7. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + the output is auto-escaped ) +{{ "%s"|format(var) }} + +8. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + |raw is redundant, + the output is auto-escaped ) +{{ "%s"|raw|format(var) }} + +9. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end ) +{{ "%s"|format(var)|raw }} + +10. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end, + the |raw filter on var is redundant ) +{{ "%s"|format(var|raw)|raw }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(escape_and_nl2br is an escaper filter) + +1. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped ) +<Fabien>
    +Twig + +2. Don't escape escaper filter output +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped, |raw is redundant ) +<Fabien>
    +Twig + +3. Explicit escape +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is explicitly escaped by |escape ) +&lt;Fabien&gt;<br /> +Twig + +4. Escape non-escaper filter output +( var is upper-cased by |upper, + the output is auto-escaped ) +<FABIEN> +TWIG + +5. Escape if last filter is not an escaper +( var is escaped by |escape_and_nl2br, line-breaks are added, + the output is upper-cased by |upper, + the output is auto-escaped as |upper is not an escaper ) +&LT;FABIEN&GT;<BR /> +TWIG + +6. Don't escape escaper filter output +( var is upper cased by upper, + the output is escaped by |escape_and_nl2br, line-breaks are added, + the output is not escaped as |escape_and_nl2br is an escaper ) +<FABIEN>
    +TWIG + +7. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + the output is auto-escaped ) +<b><Fabien> +Twig</b> + +8. Escape if last filter is not an escaper +( the output of |format is "" ~ var ~ "", + |raw is redundant, + the output is auto-escaped ) +<b><Fabien> +Twig</b> + +9. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end ) + +Twig + +10. Don't escape escaper filter output +( the output of |format is "" ~ var ~ "", + the output is not escaped due to |raw filter at the end, + the |raw filter on var is redundant ) + +Twig diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test new file mode 100644 index 0000000..f58a1e0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_filters_arguments.test @@ -0,0 +1,23 @@ +--TEST-- +"autoescape" tag do not applies escaping on filter arguments +--TEMPLATE-- +{% autoescape 'html' %} +{{ var|nl2br("
    ") }} +{{ var|nl2br("
    "|escape) }} +{{ var|nl2br(sep) }} +{{ var|nl2br(sep|raw) }} +{{ var|nl2br(sep|escape) }} +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig", 'sep' => '
    ') +--EXPECT-- +<Fabien>
    +Twig +<Fabien><br /> +Twig +<Fabien>
    +Twig +<Fabien>
    +Twig +<Fabien><br /> +Twig diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test new file mode 100644 index 0000000..134c77e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test @@ -0,0 +1,68 @@ +--TEST-- +"autoescape" tag applies escaping after calling filters, and before calling pre_escape filters +--TEMPLATE-- +{% autoescape 'html' %} + +(nl2br is pre_escaped for "html" and declared safe for "html") + +1. Pre-escape and don't post-escape +( var|escape|nl2br ) +{{ var|nl2br }} + +2. Don't double-pre-escape +( var|escape|nl2br ) +{{ var|escape|nl2br }} + +3. Don't escape safe values +( var|raw|nl2br ) +{{ var|raw|nl2br }} + +4. Don't escape safe values +( var|escape|nl2br|nl2br ) +{{ var|nl2br|nl2br }} + +5. Re-escape values that are escaped for an other contexts +( var|escape_something|escape|nl2br ) +{{ var|escape_something|nl2br }} + +6. Still escape when using filters not declared safe +( var|escape|nl2br|upper|escape ) +{{ var|nl2br|upper }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(nl2br is pre_escaped for "html" and declared safe for "html") + +1. Pre-escape and don't post-escape +( var|escape|nl2br ) +<Fabien>
    +Twig + +2. Don't double-pre-escape +( var|escape|nl2br ) +<Fabien>
    +Twig + +3. Don't escape safe values +( var|raw|nl2br ) +
    +Twig + +4. Don't escape safe values +( var|escape|nl2br|nl2br ) +<Fabien>

    +Twig + +5. Re-escape values that are escaped for an other contexts +( var|escape_something|escape|nl2br ) +<FABIEN>
    +TWIG + +6. Still escape when using filters not declared safe +( var|escape|nl2br|upper|escape ) +&LT;FABIEN&GT;<BR /> +TWIG + diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test new file mode 100644 index 0000000..32d3943 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_preserves_safety_filters.test @@ -0,0 +1,50 @@ +--TEST-- +"autoescape" tag handles filters preserving the safety +--TEMPLATE-- +{% autoescape 'html' %} + +(preserves_safety is preserving safety for "html") + +1. Unsafe values are still unsafe +( var|preserves_safety|escape ) +{{ var|preserves_safety }} + +2. Safe values are still safe +( var|escape|preserves_safety ) +{{ var|escape|preserves_safety }} + +3. Re-escape values that are escaped for an other contexts +( var|escape_something|preserves_safety|escape ) +{{ var|escape_something|preserves_safety }} + +4. Still escape when using filters not declared safe +( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) +{{ var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'}) }} + +{% endautoescape %} +--DATA-- +return array('var' => "\nTwig") +--EXPECT-- + +(preserves_safety is preserving safety for "html") + +1. Unsafe values are still unsafe +( var|preserves_safety|escape ) +<FABIEN> +TWIG + +2. Safe values are still safe +( var|escape|preserves_safety ) +<FABIEN> +TWIG + +3. Re-escape values that are escaped for an other contexts +( var|escape_something|preserves_safety|escape ) +<FABIEN> +TWIG + +4. Still escape when using filters not declared safe +( var|escape|preserves_safety|replace({'FABIEN': 'FABPOT'})|escape ) +&LT;FABPOT&GT; +TWIG + diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test new file mode 100644 index 0000000..360dcf0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/basic.test @@ -0,0 +1,11 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block title1 %}FOO{% endblock %} +{% block title2 foo|lower %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array('foo' => 'bar') +--EXPECT-- +FOObar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test new file mode 100644 index 0000000..5c205c0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/block_unique_name.test @@ -0,0 +1,11 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block content %} + {% block content %} + {% endblock %} +{% endblock %} +--DATA-- +return array() +--EXCEPTION-- +Twig_Error_Syntax: The block 'content' has already been defined line 2 in "index.twig" at line 3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test new file mode 100644 index 0000000..441570c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/block/special_chars.test @@ -0,0 +1,10 @@ +--TEST-- +"☃" special chars in a block name +--TEMPLATE-- +{% block ☃ %} +☃ +{% endblock ☃ %} +--DATA-- +return array() +--EXPECT-- +☃ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test new file mode 100644 index 0000000..f44296e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/basic.test @@ -0,0 +1,35 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test new file mode 100644 index 0000000..da161e6 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/multiple.test @@ -0,0 +1,50 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +FOO +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} +{% endembed %} + +BAR +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +FOO + +A + block1 + + block1extended + B + block2 +C + +A + block1 + + block1extended + B + block2 +C +BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test new file mode 100644 index 0000000..81563dc --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/nested.test @@ -0,0 +1,42 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +{% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + {% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} + {% endembed %} + + {% endblock %} +{% endembed %} +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +A + block1 + + +A + block1 + + block1extended + B + block2 +C + B + block2 +C diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test new file mode 100644 index 0000000..cf7953d --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/embed/with_extends.test @@ -0,0 +1,57 @@ +--TEST-- +"embed" tag +--TEMPLATE-- +{% extends "base.twig" %} + +{% block c1 %} + {{ parent() }} + blockc1baseextended +{% endblock %} + +{% block c2 %} + {{ parent() }} + + {% embed "foo.twig" %} + {% block c1 %} + {{ parent() }} + block1extended + {% endblock %} + {% endembed %} +{% endblock %} +--TEMPLATE(base.twig)-- +A +{% block c1 %} + blockc1base +{% endblock %} +{% block c2 %} + blockc2base +{% endblock %} +B +--TEMPLATE(foo.twig)-- +A +{% block c1 %} + block1 +{% endblock %} +B +{% block c2 %} + block2 +{% endblock %} +C +--DATA-- +return array() +--EXPECT-- +A + blockc1base + + blockc1baseextended + blockc2base + + + +A + block1 + + block1extended + B + block2 +CB \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test new file mode 100644 index 0000000..82094f2 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"filter" tag applies a filter on its children +--TEMPLATE-- +{% filter upper %} +Some text with a {{ var }} +{% endfilter %} +--DATA-- +return array('var' => 'var') +--EXPECT-- +SOME TEXT WITH A VAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test new file mode 100644 index 0000000..3e7148b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test @@ -0,0 +1,8 @@ +--TEST-- +"filter" tag applies a filter on its children +--TEMPLATE-- +{% filter json_encode|raw %}test{% endfilter %} +--DATA-- +return array() +--EXPECT-- +"test" diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test new file mode 100644 index 0000000..75512ef --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test @@ -0,0 +1,10 @@ +--TEST-- +"filter" tags accept multiple chained filters +--TEMPLATE-- +{% filter lower|title %} + {{ var }} +{% endfilter %} +--DATA-- +return array('var' => 'VAR') +--EXPECT-- + Var diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test new file mode 100644 index 0000000..7e4e4eb --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test @@ -0,0 +1,16 @@ +--TEST-- +"filter" tags can be nested at will +--TEMPLATE-- +{% filter lower|title %} + {{ var }} + {% filter upper %} + {{ var }} + {% endfilter %} + {{ var }} +{% endfilter %} +--DATA-- +return array('var' => 'var') +--EXPECT-- + Var + Var + Var diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test new file mode 100644 index 0000000..22745ea --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test @@ -0,0 +1,13 @@ +--TEST-- +"filter" tag applies the filter on "for" tags +--TEMPLATE-- +{% filter upper %} +{% for item in items %} +{{ item }} +{% endfor %} +{% endfilter %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- +A +B diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test new file mode 100644 index 0000000..afd95b2 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test @@ -0,0 +1,29 @@ +--TEST-- +"filter" tag applies the filter on "if" tags +--TEMPLATE-- +{% filter upper %} +{% if items %} +{{ items|join(', ') }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% else %} +{{ items.1 }} +{% endif %} + +{% if items.3 is defined %} +FOO +{% elseif items.1 %} +{{ items.0 }} +{% endif %} + +{% endfilter %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- +A, B + +B + +A diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test new file mode 100644 index 0000000..9e4eb9b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/condition.test @@ -0,0 +1,14 @@ +--TEST-- +"for" tag takes a condition +--TEMPLATE-- +{% for i in 1..5 if i is odd -%} + {{ loop.index }}.{{ i }} +{% endfor %} +--DATA-- +return array() +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +1.1 +2.3 +3.5 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test new file mode 100644 index 0000000..ddc6930 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/context.test @@ -0,0 +1,18 @@ +--TEST-- +"for" tag keeps the context safe +--TEMPLATE-- +{% for item in items %} + {% for item in items %} + * {{ item }} + {% endfor %} + * {{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b + * a + * a + * b + * b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test new file mode 100644 index 0000000..20ccc88 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/else.test @@ -0,0 +1,23 @@ +--TEST-- +"for" tag can use an "else" clause +--TEMPLATE-- +{% for item in items %} + * {{ item }} +{% else %} + no item +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b +--DATA-- +return array('items' => array()) +--EXPECT-- + no item +--DATA-- +return array() +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- + no item diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test new file mode 100644 index 0000000..49fb9ca --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/inner_variables.test @@ -0,0 +1,17 @@ +--TEST-- +"for" tag does not reset inner variables +--TEMPLATE-- +{% for i in 1..2 %} + {% for j in 0..2 %} + {{k}}{% set k = k+1 %} {{ loop.parent.loop.index }} + {% endfor %} +{% endfor %} +--DATA-- +return array('k' => 0) +--EXPECT-- + 0 1 + 1 1 + 2 1 + 3 2 + 4 2 + 5 2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test new file mode 100644 index 0000000..4e22cb4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag can iterate over keys +--TEMPLATE-- +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 0 + * 1 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test new file mode 100644 index 0000000..4c21168 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/keys_and_values.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag can iterate over keys and values +--TEMPLATE-- +{% for key, item in items %} + * {{ key }}/{{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 0/a + * 1/b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test new file mode 100644 index 0000000..93bc76a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context.test @@ -0,0 +1,19 @@ +--TEST-- +"for" tag adds a loop variable to the context +--TEMPLATE-- +{% for item in items %} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.revindex }}/{{ loop.revindex0 }} + * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} + +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * 1/0 + * 2/1 + * 1//2 + + * 2/1 + * 1/0 + * /1/2 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test new file mode 100644 index 0000000..58af2c3 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/loop_context_local.test @@ -0,0 +1,10 @@ +--TEST-- +"for" tag adds a loop variable to the context locally +--TEMPLATE-- +{% for item in items %} +{% endfor %} +{% if loop is not defined %}WORKS{% endif %} +--DATA-- +return array('items' => array()) +--EXPECT-- +WORKS diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test new file mode 100644 index 0000000..f8b9f6b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/nested_else.test @@ -0,0 +1,17 @@ +--TEST-- +"for" tag can use an "else" clause +--TEMPLATE-- +{% for item in items %} + {% for item in items1 %} + * {{ item }} + {% else %} + no {{ item }} + {% endfor %} +{% else %} + no item1 +{% endfor %} +--DATA-- +return array('items' => array('a', 'b'), 'items1' => array()) +--EXPECT-- +no a + no b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test new file mode 100644 index 0000000..5034437 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects.test @@ -0,0 +1,43 @@ +--TEST-- +"for" tag iterates over iterable objects +--TEMPLATE-- +{% for item in items %} + * {{ item }} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.first }} + +{% endfor %} + +{% for key, value in items %} + * {{ key }}/{{ value }} +{% endfor %} + +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +class ItemsIterator implements Iterator +{ + protected $values = array('foo' => 'bar', 'bar' => 'foo'); + public function current() { return current($this->values); } + public function key() { return key($this->values); } + public function next() { return next($this->values); } + public function rewind() { return reset($this->values); } + public function valid() { return false !== current($this->values); } +} +return array('items' => new ItemsIterator()) +--EXPECT-- + * bar + * 1/0 + * 1 + + * foo + * 2/1 + * + + + * foo/bar + * bar/foo + + * foo + * bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test new file mode 100644 index 0000000..4a1ff61 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/objects_countable.test @@ -0,0 +1,47 @@ +--TEST-- +"for" tag iterates over iterable and countable objects +--TEMPLATE-- +{% for item in items %} + * {{ item }} + * {{ loop.index }}/{{ loop.index0 }} + * {{ loop.revindex }}/{{ loop.revindex0 }} + * {{ loop.first }}/{{ loop.last }}/{{ loop.length }} + +{% endfor %} + +{% for key, value in items %} + * {{ key }}/{{ value }} +{% endfor %} + +{% for key in items|keys %} + * {{ key }} +{% endfor %} +--DATA-- +class ItemsIteratorCountable implements Iterator, Countable +{ + protected $values = array('foo' => 'bar', 'bar' => 'foo'); + public function current() { return current($this->values); } + public function key() { return key($this->values); } + public function next() { return next($this->values); } + public function rewind() { return reset($this->values); } + public function valid() { return false !== current($this->values); } + public function count() { return count($this->values); } +} +return array('items' => new ItemsIteratorCountable()) +--EXPECT-- + * bar + * 1/0 + * 2/1 + * 1//2 + + * foo + * 2/1 + * 1/0 + * /1/2 + + + * foo/bar + * bar/foo + + * foo + * bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test new file mode 100644 index 0000000..17b2e22 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/recursive.test @@ -0,0 +1,18 @@ +--TEST-- +"for" tags can be nested +--TEMPLATE-- +{% for key, item in items %} +* {{ key }} ({{ loop.length }}): +{% for value in item %} + * {{ value }} ({{ loop.length }}) +{% endfor %} +{% endfor %} +--DATA-- +return array('items' => array('a' => array('a1', 'a2', 'a3'), 'b' => array('b1'))) +--EXPECT-- +* a (2): + * a1 (3) + * a2 (3) + * a3 (3) +* b (2): + * b1 (1) diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test new file mode 100644 index 0000000..82f2ae8 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/for/values.test @@ -0,0 +1,11 @@ +--TEST-- +"for" tag iterates over item values +--TEMPLATE-- +{% for item in items %} + * {{ item }} +{% endfor %} +--DATA-- +return array('items' => array('a', 'b')) +--EXPECT-- + * a + * b diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test new file mode 100644 index 0000000..5f5da0e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/from.test @@ -0,0 +1,14 @@ +--TEST-- +global variables +--TEMPLATE-- +{% include "included.twig" %} +{% from "included.twig" import foobar %} +{{ foobar() }} +--TEMPLATE(included.twig)-- +{% macro foobar() %} +called foobar +{% endmacro %} +--DATA-- +return array(); +--EXPECT-- +called foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test new file mode 100644 index 0000000..c1c3d27 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/basic.test @@ -0,0 +1,22 @@ +--TEST-- +"if" creates a condition +--TEMPLATE-- +{% if a is defined %} + {{ a }} +{% elseif b is defined %} + {{ b }} +{% else %} + NOTHING +{% endif %} +--DATA-- +return array('a' => 'a') +--EXPECT-- + a +--DATA-- +return array('b' => 'b') +--EXPECT-- + b +--DATA-- +return array() +--EXPECT-- + NOTHING diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test new file mode 100644 index 0000000..edfb73d --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/if/expression.test @@ -0,0 +1,22 @@ +--TEST-- +"if" takes an expression as a test +--TEMPLATE-- +{% if a < 2 %} + A1 +{% elseif a > 10 %} + A2 +{% else %} + A3 +{% endif %} +--DATA-- +return array('a' => 1) +--EXPECT-- + A1 +--DATA-- +return array('a' => 12) +--EXPECT-- + A2 +--DATA-- +return array('a' => 7) +--EXPECT-- + A3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test new file mode 100644 index 0000000..8fe1a6c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/basic.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag +--TEMPLATE-- +FOO +{% include "foo.twig" %} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array() +--EXPECT-- +FOO + +FOOBAR +BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test new file mode 100644 index 0000000..eaeeb11 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/expression.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag allows expressions for the template to include +--TEMPLATE-- +FOO +{% include foo %} + +BAR +--TEMPLATE(foo.twig)-- +FOOBAR +--DATA-- +return array('foo' => 'foo.twig') +--EXPECT-- +FOO + +FOOBAR +BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test new file mode 100644 index 0000000..24aed06 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/ignore_missing.test @@ -0,0 +1,10 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ["foo.twig", "bar.twig"] ignore missing %} +{% include "foo.twig" ignore missing %} +{% include "foo.twig" ignore missing with {} %} +{% include "foo.twig" ignore missing with {} only %} +--DATA-- +return array() +--EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test new file mode 100644 index 0000000..77760a0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/only.test @@ -0,0 +1,16 @@ +--TEST-- +"include" tag accept variables and only +--TEMPLATE-- +{% include "foo.twig" %} +{% include "foo.twig" only %} +{% include "foo.twig" with {'foo1': 'bar'} %} +{% include "foo.twig" with {'foo1': 'bar'} only %} +--TEMPLATE(foo.twig)-- +{% for k, v in _context %}{{ k }},{% endfor %} +--DATA-- +return array('foo' => 'bar') +--EXPECT-- +foo,global,_parent, +global,_parent, +foo,global,foo1,_parent, +foo1,global,_parent, diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test new file mode 100644 index 0000000..6ba064a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/template_instance.test @@ -0,0 +1,10 @@ +--TEST-- +"include" tag accepts Twig_Template instance +--TEMPLATE-- +{% include foo %} FOO +--TEMPLATE(foo.twig)-- +BAR +--DATA-- +return array('foo' => $twig->loadTemplate('foo.twig')) +--EXPECT-- +BAR FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test new file mode 100644 index 0000000..ab670ee --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/templates_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"include" tag +--TEMPLATE-- +{% include ["foo.twig", "bar.twig"] %} +{% include ["bar.twig", "foo.twig"] %} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return array() +--EXPECT-- +foo +foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test new file mode 100644 index 0000000..41384ac --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/include/with_variables.test @@ -0,0 +1,12 @@ +--TEST-- +"include" tag accept variables +--TEMPLATE-- +{% include "foo.twig" with {'foo': 'bar'} %} +{% include "foo.twig" with vars %} +--TEMPLATE(foo.twig)-- +{{ foo }} +--DATA-- +return array('vars' => array('foo' => 'bar')) +--EXPECT-- +bar +bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test new file mode 100644 index 0000000..0778a4b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} +FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array() +--EXPECT-- +FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test new file mode 100644 index 0000000..8576e77 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends standalone ? foo : 'bar.twig' %} + +{% block content %}{{ parent() }}FOO{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}FOO{% endblock %} +--TEMPLATE(bar.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array('foo' => 'foo.twig', 'standalone' => true) +--EXPECT-- +FOOFOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test new file mode 100644 index 0000000..ee06ddc --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends foo %} + +{% block content %} +FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}{% endblock %} +--DATA-- +return array('foo' => 'foo.twig') +--EXPECT-- +FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test new file mode 100644 index 0000000..784f357 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test @@ -0,0 +1,10 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} +--TEMPLATE(foo.twig)-- +{% block content %}FOO{% endblock %} +--DATA-- +return array() +--EXPECT-- +FOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test new file mode 100644 index 0000000..a1cb1ce --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends ["foo.twig", "bar.twig"] %} +--TEMPLATE(bar.twig)-- +{% block content %} +foo +{% endblock %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test new file mode 100644 index 0000000..dfc2b6c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "layout.twig" %}{% block content %}{{ parent() }}index {% endblock %} +--TEMPLATE(layout.twig)-- +{% extends "base.twig" %}{% block content %}{{ parent() }}layout {% endblock %} +--TEMPLATE(base.twig)-- +{% block content %}base {% endblock %} +--DATA-- +return array() +--EXPECT-- +base layout index diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test new file mode 100644 index 0000000..faca925 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test @@ -0,0 +1,22 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} + {% block subcontent %} + {% block subsubcontent %} + SUBSUBCONTENT + {% endblock %} + {% endblock %} +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %} + {% block subcontent %} + SUBCONTENT + {% endblock %} +{% endblock %} +--DATA-- +return array() +--EXPECT-- +SUBSUBCONTENT diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test new file mode 100644 index 0000000..0ad11d0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test @@ -0,0 +1,15 @@ +--TEST-- +"block" tag +--TEMPLATE-- +{% block content %} + CONTENT + {%- block subcontent -%} + SUBCONTENT + {%- endblock -%} + ENDCONTENT +{% endblock %} +--TEMPLATE(foo.twig)-- +--DATA-- +return array() +--EXPECT-- +CONTENTSUBCONTENTENDCONTENT diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test new file mode 100644 index 0000000..71e3cdf --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test @@ -0,0 +1,16 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "layout.twig" %} +{% block inside %}INSIDE{% endblock inside %} +--TEMPLATE(layout.twig)-- +{% extends "base.twig" %} +{% block body %} + {% block inside '' %} +{% endblock body %} +--TEMPLATE(base.twig)-- +{% block body '' %} +--DATA-- +return array() +--EXPECT-- +INSIDE diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test new file mode 100644 index 0000000..4f975db --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test @@ -0,0 +1,12 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %}{{ parent() }}FOO{{ parent() }}{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array() +--EXPECT-- +BARFOOBAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test new file mode 100644 index 0000000..a8bc90c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test @@ -0,0 +1,16 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends foo ? 'foo.twig' : 'bar.twig' %} +--TEMPLATE(foo.twig)-- +FOO +--TEMPLATE(bar.twig)-- +BAR +--DATA-- +return array('foo' => true) +--EXPECT-- +FOO +--DATA-- +return array('foo' => false) +--EXPECT-- +BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test new file mode 100644 index 0000000..c9e86b1 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test @@ -0,0 +1,8 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% block content %} + {% extends "foo.twig" %} +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Cannot extend from a block in "index.twig" at line 3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test new file mode 100644 index 0000000..6281671 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test @@ -0,0 +1,20 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "base.twig" %} +{% block content %}{% include "included.twig" %}{% endblock %} + +{% block footer %}Footer{% endblock %} +--TEMPLATE(included.twig)-- +{% extends "base.twig" %} +{% block content %}Included Content{% endblock %} +--TEMPLATE(base.twig)-- +{% block content %}Default Content{% endblock %} + +{% block footer %}Default Footer{% endblock %} +--DATA-- +return array() +--EXPECT-- +Included Content +Default Footer +Footer diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test new file mode 100644 index 0000000..71e7c20 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test @@ -0,0 +1,28 @@ +--TEST-- +"extends" tag +--TEMPLATE-- +{% extends "foo.twig" %} + +{% block content %} + {% block inside %} + INSIDE OVERRIDDEN + {% endblock %} + + BEFORE + {{ parent() }} + AFTER +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %} + BAR +{% endblock %} +--DATA-- +return array() +--EXPECT-- + +INSIDE OVERRIDDEN + + BEFORE + BAR + + AFTER diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test new file mode 100644 index 0000000..a9eaa4c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test @@ -0,0 +1,8 @@ +--TEST-- +"parent" tag +--TEMPLATE-- +{% block content %} + {{ parent() }} +{% endblock %} +--EXCEPTION-- +Twig_Error_Syntax: Calling "parent" on a template that does not extend nor "use" another template is forbidden in "index.twig" at line 3 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test new file mode 100644 index 0000000..63c7305 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test @@ -0,0 +1,14 @@ +--TEST-- +"parent" tag +--TEMPLATE-- +{% use 'foo.twig' %} + +{% block content %} + {{ parent() }} +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array() +--EXPECT-- +BAR diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test new file mode 100644 index 0000000..d1876a5 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test @@ -0,0 +1,14 @@ +--TEST-- +"extends" tag accepts Twig_Template instance +--TEMPLATE-- +{% extends foo %} + +{% block content %} +{{ parent() }}FOO +{% endblock %} +--TEMPLATE(foo.twig)-- +{% block content %}BAR{% endblock %} +--DATA-- +return array('foo' => $twig->loadTemplate('foo.twig')) +--EXPECT-- +BARFOO diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test new file mode 100644 index 0000000..8f9ece7 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test @@ -0,0 +1,44 @@ +--TEST-- +"parent" function +--TEMPLATE-- +{% extends "parent.twig" %} + +{% use "use1.twig" %} +{% use "use2.twig" %} + +{% block content_parent %} + {{ parent() }} +{% endblock %} + +{% block content_use1 %} + {{ parent() }} +{% endblock %} + +{% block content_use2 %} + {{ parent() }} +{% endblock %} + +{% block content %} + {{ block('content_use1_only') }} + {{ block('content_use2_only') }} +{% endblock %} +--TEMPLATE(parent.twig)-- +{% block content_parent 'content_parent' %} +{% block content_use1 'content_parent' %} +{% block content_use2 'content_parent' %} +{% block content '' %} +--TEMPLATE(use1.twig)-- +{% block content_use1 'content_use1' %} +{% block content_use2 'content_use1' %} +{% block content_use1_only 'content_use1_only' %} +--TEMPLATE(use2.twig)-- +{% block content_use2 'content_use2' %} +{% block content_use2_only 'content_use2_only' %} +--DATA-- +return array() +--EXPECT-- + content_parent + content_use1 + content_use2 + content_use1_only + content_use2_only diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test new file mode 100644 index 0000000..ef59a57 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/basic.test @@ -0,0 +1,15 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{{ _self.input('username') }} +{{ _self.input('password', null, 'password', 1) }} + +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test new file mode 100644 index 0000000..fa81189 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/endmacro_name.test @@ -0,0 +1,14 @@ +--TEST-- +"macro" tag supports name for endmacro +--TEMPLATE-- +{{ _self.foo() }} +{{ _self.bar() }} + +{% macro foo() %}foo{% endmacro %} +{% macro bar() %}bar{% endmacro bar %} +--DATA-- +return array() +--EXPECT-- +foo +bar + diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test new file mode 100644 index 0000000..5cd3dae --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/external.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import 'forms.twig' as forms %} + +{{ forms.input('username') }} +{{ forms.input('password', null, 'password', 1) }} +--TEMPLATE(forms.twig)-- +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test new file mode 100644 index 0000000..205f591 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/from.test @@ -0,0 +1,18 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% from 'forms.twig' import foo %} +{% from 'forms.twig' import foo as foobar, bar %} + +{{ foo('foo') }} +{{ foobar('foo') }} +{{ bar('foo') }} +--TEMPLATE(forms.twig)-- +{% macro foo(name) %}foo{{ name }}{% endmacro %} +{% macro bar(name) %}bar{{ name }}{% endmacro %} +--DATA-- +return array() +--EXPECT-- +foofoo +foofoo +barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test new file mode 100644 index 0000000..6b37176 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/global.test @@ -0,0 +1,14 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% from 'forms.twig' import foo %} + +{{ foo('foo') }} +{{ foo() }} +--TEMPLATE(forms.twig)-- +{% macro foo(name) %}{{ name|default('foo') }}{{ global }}{% endmacro %} +--DATA-- +return array() +--EXPECT-- +fooglobal +fooglobal diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test new file mode 100644 index 0000000..17756cb --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/self_import.test @@ -0,0 +1,17 @@ +--TEST-- +"macro" tag +--TEMPLATE-- +{% import _self as forms %} + +{{ forms.input('username') }} +{{ forms.input('password', null, 'password', 1) }} + +{% macro input(name, value, type, size) %} + +{% endmacro %} +--DATA-- +return array() +--EXPECT-- + + + diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test new file mode 100644 index 0000000..e61716e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/macro/special_chars.test @@ -0,0 +1,12 @@ +--TEST-- +"☃" as a macro name +--TEMPLATE-- +{{ _self.☃('foo') }} + +{% macro ☃(foo) %} + ☃{{ foo }}☃ +{% endmacro %} +--DATA-- +return array() +--EXPECT-- +☃foo☃ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.test new file mode 100644 index 0000000..0445e85 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/basic.test @@ -0,0 +1,10 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +{% raw %} +{{ foo }} +{% endraw %} +--DATA-- +return array() +--EXPECT-- +{{ foo }} diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.test new file mode 100644 index 0000000..352bb18 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/raw/whitespace_control.test @@ -0,0 +1,56 @@ +--TEST-- +"raw" tag +--TEMPLATE-- +1*** + +{%- raw %} + {{ 'bla' }} +{% endraw %} + +1*** +2*** + +{%- raw -%} + {{ 'bla' }} +{% endraw %} + +2*** +3*** + +{%- raw -%} + {{ 'bla' }} +{% endraw -%} + +3*** +4*** + +{%- raw -%} + {{ 'bla' }} +{%- endraw %} + +4*** +5*** + +{%- raw -%} + {{ 'bla' }} +{%- endraw -%} + +5*** +--DATA-- +return array() +--EXPECT-- +1*** + {{ 'bla' }} + + +1*** +2***{{ 'bla' }} + + +2*** +3***{{ 'bla' }} +3*** +4***{{ 'bla' }} + +4*** +5***{{ 'bla' }}5*** diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test new file mode 100644 index 0000000..683c59a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid1.test @@ -0,0 +1,11 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} + a +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--EXCEPTION-- +Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 4 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test new file mode 100644 index 0000000..3dcfa88 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/not_valid2.test @@ -0,0 +1,14 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} + + {% if 1 %} + {%- include "foo.twig" %} + {% endif %} +{%- endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--EXCEPTION-- +Twig_Error_Syntax: Only "include" tags are allowed within a "sandbox" section in "index.twig" at line 5 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test new file mode 100644 index 0000000..de20f3d --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/sandbox/simple.test @@ -0,0 +1,22 @@ +--TEST-- +sandbox tag +--TEMPLATE-- +{%- sandbox %} + {%- include "foo.twig" %} +{%- endsandbox %} + +{%- sandbox %} + {%- include "foo.twig" %} + {%- include "foo.twig" %} +{%- endsandbox %} + +{%- sandbox %}{% include "foo.twig" %}{% endsandbox %} +--TEMPLATE(foo.twig)-- +foo +--DATA-- +return array() +--EXPECT-- +foo +foo +foo +foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test new file mode 100644 index 0000000..a5a9f83 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/basic.test @@ -0,0 +1,20 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo = 'foo' %} +{% set bar = 'foo
    ' %} + +{{ foo }} +{{ bar }} + +{% set foo, bar = 'foo', 'bar' %} + +{{ foo }}{{ bar }} +--DATA-- +return array() +--EXPECT-- +foo +foo<br /> + + +foobar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test new file mode 100644 index 0000000..ec657f0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture-empty.test @@ -0,0 +1,9 @@ +--TEST-- +"set" tag block empty capture +--TEMPLATE-- +{% set foo %}{% endset %} + +{% if foo %}FAIL{% endif %} +--DATA-- +return array() +--EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test new file mode 100644 index 0000000..f156a1a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/capture.test @@ -0,0 +1,10 @@ +--TEST-- +"set" tag block capture +--TEMPLATE-- +{% set foo %}f
    o
    o{% endset %} + +{{ foo }} +--DATA-- +return array() +--EXPECT-- +f
    o
    o diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test new file mode 100644 index 0000000..8ff434a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/set/expression.test @@ -0,0 +1,12 @@ +--TEST-- +"set" tag +--TEMPLATE-- +{% set foo, bar = 'foo' ~ 'bar', 'bar' ~ 'foo' %} + +{{ foo }} +{{ bar }} +--DATA-- +return array() +--EXPECT-- +foobar +barfoo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test new file mode 100644 index 0000000..dd06dec --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/spaceless/simple.test @@ -0,0 +1,12 @@ +--TEST-- +"spaceless" tag removes whites between HTML tags +--TEMPLATE-- +{% spaceless %} + +
    foo
    + +{% endspaceless %} +--DATA-- +return array() +--EXPECT-- +
    foo
    diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test new file mode 100644 index 0000000..d584d9e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/special_chars.test @@ -0,0 +1,8 @@ +--TEST-- +"☃" custom tag +--TEMPLATE-- +{% ☃ %} +--DATA-- +return array() +--EXPECT-- +☃ diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test new file mode 100644 index 0000000..1d2273f --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/trim_block.test @@ -0,0 +1,74 @@ +--TEST-- +Whitespace trimming on tags. +--TEMPLATE-- +{{ 5 * '{#-'|length }} +{{ '{{-'|length * 5 + '{%-'|length }} + +Trim on control tag: +{% for i in range(1, 9) -%} + {{ i }} +{%- endfor %} + + +Trim on output tag: +{% for i in range(1, 9) %} + {{- i -}} +{% endfor %} + + +Trim comments: + +{#- Invisible -#} + +After the comment. + +Trim leading space: +{% if leading %} + + {{- leading }} +{% endif %} + +{%- if leading %} + {{- leading }} + +{%- endif %} + + +Trim trailing space: +{% if trailing -%} + {{ trailing -}} + +{% endif -%} + +Combined: + +{%- if both -%} +
      +
    • {{- both -}}
    • +
    + +{%- endif -%} + +end +--DATA-- +return array('leading' => 'leading space', 'trailing' => 'trailing space', 'both' => 'both') +--EXPECT-- +15 +18 + +Trim on control tag: +123456789 + +Trim on output tag: +123456789 + +Trim comments:After the comment. + +Trim leading space: +leading space +leading space + +Trim trailing space: +trailing spaceCombined:
      +
    • both
    • +
    end diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test new file mode 100644 index 0000000..f887006 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/aliases.test @@ -0,0 +1,12 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "blocks.twig" with content as foo %} + +{{ block('foo') }} +--TEMPLATE(blocks.twig)-- +{% block content 'foo' %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test new file mode 100644 index 0000000..7364d76 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/basic.test @@ -0,0 +1,12 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "blocks.twig" %} + +{{ block('content') }} +--TEMPLATE(blocks.twig)-- +{% block content 'foo' %} +--DATA-- +return array() +--EXPECT-- +foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test new file mode 100644 index 0000000..b551a1e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep.test @@ -0,0 +1,22 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +--TEMPLATE(foo.twig)-- +{% use "bar.twig" %} + +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +foo +foo +bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test new file mode 100644 index 0000000..05cca68 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/deep_empty.test @@ -0,0 +1,10 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} +--TEMPLATE(foo.twig)-- +{% use "bar.twig" %} +--TEMPLATE(bar.twig)-- +--DATA-- +return array() +--EXPECT-- diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test new file mode 100644 index 0000000..198be0c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple.test @@ -0,0 +1,21 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" %} +{% use "bar.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +--TEMPLATE(foo.twig)-- +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +bar +foo +bar diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test new file mode 100644 index 0000000..8de871a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/use/multiple_aliases.test @@ -0,0 +1,23 @@ +--TEST-- +"use" tag +--TEMPLATE-- +{% use "foo.twig" with content as foo_content %} +{% use "bar.twig" %} + +{{ block('content') }} +{{ block('foo') }} +{{ block('bar') }} +{{ block('foo_content') }} +--TEMPLATE(foo.twig)-- +{% block content 'foo' %} +{% block foo 'foo' %} +--TEMPLATE(bar.twig)-- +{% block content 'bar' %} +{% block bar 'bar' %} +--DATA-- +return array() +--EXPECT-- +bar +foo +bar +foo diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test new file mode 100644 index 0000000..1429d37 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/array.test @@ -0,0 +1,24 @@ +--TEST-- +array index test +--TEMPLATE-- +{% for key, value in days %} +{{ key }} +{% endfor %} +--DATA-- +return array('days' => array( + 1 => array('money' => 9), + 2 => array('money' => 21), + 3 => array('money' => 38), + 4 => array('money' => 6), + 18 => array('money' => 6), + 19 => array('money' => 3), + 31 => array('money' => 11), +)); +--EXPECT-- +1 +2 +3 +4 +18 +19 +31 diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test new file mode 100644 index 0000000..fb3d288 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/constant.test @@ -0,0 +1,12 @@ +--TEST-- +"const" test +--TEMPLATE-- +{{ 8 is constant('E_NOTICE') ? 'ok' : 'no' }} +{{ 'bar' is constant('Foo::BAR_NAME') ? 'ok' : 'no' }} +{{ value is constant('Foo::BAR_NAME') ? 'ok' : 'no' }} +--DATA-- +return array('value' => 'bar'); +--EXPECT-- +ok +ok +ok \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test new file mode 100644 index 0000000..2fbaa86 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined.test @@ -0,0 +1,108 @@ +--TEST-- +"defined" test +--TEMPLATE-- +{{ definedVar is defined ? 'ok' : 'ko' }} +{{ definedVar is not defined ? 'ko' : 'ok' }} +{{ undefinedVar is defined ? 'ko' : 'ok' }} +{{ undefinedVar is not defined ? 'ok' : 'ko' }} +{{ zeroVar is defined ? 'ok' : 'ko' }} +{{ nullVar is defined ? 'ok' : 'ko' }} +{{ nested.definedVar is defined ? 'ok' : 'ko' }} +{{ nested['definedVar'] is defined ? 'ok' : 'ko' }} +{{ nested.definedVar is not defined ? 'ko' : 'ok' }} +{{ nested.undefinedVar is defined ? 'ko' : 'ok' }} +{{ nested['undefinedVar'] is defined ? 'ko' : 'ok' }} +{{ nested.undefinedVar is not defined ? 'ok' : 'ko' }} +{{ nested.zeroVar is defined ? 'ok' : 'ko' }} +{{ nested.nullVar is defined ? 'ok' : 'ko' }} +{{ nested.definedArray.0 is defined ? 'ok' : 'ko' }} +{{ nested['definedArray'][0] is defined ? 'ok' : 'ko' }} +{{ object.foo is defined ? 'ok' : 'ko' }} +{{ object.undefinedMethod is defined ? 'ko' : 'ok' }} +{{ object.getFoo() is defined ? 'ok' : 'ko' }} +{{ object.getFoo('a') is defined ? 'ok' : 'ko' }} +{{ object.undefinedMethod() is defined ? 'ko' : 'ok' }} +{{ object.undefinedMethod('a') is defined ? 'ko' : 'ok' }} +{{ object.self.foo is defined ? 'ok' : 'ko' }} +{{ object.self.undefinedMethod is defined ? 'ko' : 'ok' }} +{{ object.undefinedMethod.self is defined ? 'ko' : 'ok' }} +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new Foo(), +); +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +--DATA-- +return array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'nested' => array( + 'definedVar' => 'defined', + 'zeroVar' => 0, + 'nullVar' => null, + 'definedArray' => array(0), + ), + 'object' => new Foo(), +); +--CONFIG-- +return array('strict_variables' => false) +--EXPECT-- +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok +ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test new file mode 100644 index 0000000..a776d03 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/empty.test @@ -0,0 +1,45 @@ +--TEST-- +"empty" test +--TEMPLATE-- +{{ foo is empty ? 'ok' : 'ko' }} +{{ bar is empty ? 'ok' : 'ko' }} +{{ foobar is empty ? 'ok' : 'ko' }} +{{ array is empty ? 'ok' : 'ko' }} +{{ zero is empty ? 'ok' : 'ko' }} +{{ string is empty ? 'ok' : 'ko' }} +{{ countable_empty is empty ? 'ok' : 'ko' }} +{{ countable_not_empty is empty ? 'ok' : 'ko' }} +{{ markup_empty is empty ? 'ok' : 'ko' }} +{{ markup_not_empty is empty ? 'ok' : 'ko' }} +--DATA-- + +class CountableStub implements Countable +{ + private $items; + + public function __construct(array $items) + { + $this->items = $items; + } + + public function count() + { + return count($this->items); + } +} +return array( + 'foo' => '', 'bar' => null, 'foobar' => false, 'array' => array(), 'zero' => 0, 'string' => '0', + 'countable_empty' => new CountableStub(array()), 'countable_not_empty' => new CountableStub(array(1, 2)), + 'markup_empty' => new Twig_Markup('', 'UTF-8'), 'markup_not_empty' => new Twig_Markup('test', 'UTF-8'), +); +--EXPECT-- +ok +ok +ok +ok +ko +ko +ok +ko +ok +ko diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test new file mode 100644 index 0000000..695b4c2 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/even.test @@ -0,0 +1,14 @@ +--TEST-- +"even" test +--TEMPLATE-- +{{ 1 is even ? 'ko' : 'ok' }} +{{ 2 is even ? 'ok' : 'ko' }} +{{ 1 is not even ? 'ok' : 'ko' }} +{{ 2 is not even ? 'ko' : 'ok' }} +--DATA-- +return array() +--EXPECT-- +ok +ok +ok +ok diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test new file mode 100644 index 0000000..45c72fd --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/in.test @@ -0,0 +1,48 @@ +--TEST-- +Twig supports the in operator +--TEMPLATE-- +{% if bar in foo %} +TRUE +{% endif %} +{% if not (bar in foo) %} +{% else %} +TRUE +{% endif %} +{% if bar not in foo %} +{% else %} +TRUE +{% endif %} +{% if 'a' in bar %} +TRUE +{% endif %} +{% if 'c' not in bar %} +TRUE +{% endif %} +{% if '' not in bar %} +TRUE +{% endif %} +{% if '' in '' %} +TRUE +{% endif %} +{% if '0' not in '' %} +TRUE +{% endif %} +{% if 'a' not in '0' %} +TRUE +{% endif %} +{% if '0' in '0' %} +TRUE +{% endif %} +--DATA-- +return array('bar' => 'bar', 'foo' => array('bar' => 'bar')) +--EXPECT-- +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE +TRUE diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test new file mode 100644 index 0000000..ec52550 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/iterable.test @@ -0,0 +1,19 @@ +--TEST-- +"iterable" test +--TEMPLATE-- +{{ foo is iterable ? 'ok' : 'ko' }} +{{ traversable is iterable ? 'ok' : 'ko' }} +{{ obj is iterable ? 'ok' : 'ko' }} +{{ val is iterable ? 'ok' : 'ko' }} +--DATA-- +return array( + 'foo' => array(), + 'traversable' => new ArrayIterator(array()), + 'obj' => new stdClass(), + 'val' => 'test', +); +--EXPECT-- +ok +ok +ko +ko \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test new file mode 100644 index 0000000..1b8311e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/odd.test @@ -0,0 +1,10 @@ +--TEST-- +"odd" test +--TEMPLATE-- +{{ 1 is odd ? 'ok' : 'ko' }} +{{ 2 is odd ? 'ko' : 'ok' }} +--DATA-- +return array() +--EXPECT-- +ok +ok \ No newline at end of file diff --git a/vendor/twig/twig/test/Twig/Tests/LexerTest.php b/vendor/twig/twig/test/Twig/Tests/LexerTest.php new file mode 100644 index 0000000..ce87898 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/LexerTest.php @@ -0,0 +1,249 @@ +tokenize($template); + + $stream->expect(Twig_Token::BLOCK_START_TYPE); + $this->assertSame('☃', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); + } + + public function testNameLabelForFunction() + { + $template = '{{ ☃() }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + + $stream->expect(Twig_Token::VAR_START_TYPE); + $this->assertSame('☃', $stream->expect(Twig_Token::NAME_TYPE)->getValue()); + } + + public function testBracketsNesting() + { + $template = '{{ {"a":{"b":"c"}} }}'; + + $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '{')); + $this->assertEquals(2, $this->countToken($template, Twig_Token::PUNCTUATION_TYPE, '}')); + } + + protected function countToken($template, $type, $value = null) + { + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + + $count = 0; + $tokens = array(); + while (!$stream->isEOF()) { + $token = $stream->next(); + if ($type === $token->getType()) { + if (null === $value || $value === $token->getValue()) { + ++$count; + } + } + } + + return $count; + } + + public function testLineDirective() + { + $template = "foo\n" + . "bar\n" + . "{% line 10 %}\n" + . "{{\n" + . "baz\n" + . "}}\n"; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + + // foo\nbar\n + $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // \n (after {% line %}) + $this->assertSame(10, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // {{ + $this->assertSame(11, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); + // baz + $this->assertSame(12, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); + } + + public function testLineDirectiveInline() + { + $template = "foo\n" + . "bar{% line 10 %}{{\n" + . "baz\n" + . "}}\n"; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + + // foo\nbar + $this->assertSame(1, $stream->expect(Twig_Token::TEXT_TYPE)->getLine()); + // {{ + $this->assertSame(10, $stream->expect(Twig_Token::VAR_START_TYPE)->getLine()); + // baz + $this->assertSame(11, $stream->expect(Twig_Token::NAME_TYPE)->getLine()); + } + + public function testLongComments() + { + $template = '{# '.str_repeat('*', 100000).' #}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $lexer->tokenize($template); + + // should not throw an exception + } + + public function testLongRaw() + { + $template = '{% raw %}'.str_repeat('*', 100000).'{% endraw %}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + + // should not throw an exception + } + + public function testLongVar() + { + $template = '{{ '.str_repeat('x', 100000).' }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + + // should not throw an exception + } + + public function testLongBlock() + { + $template = '{% '.str_repeat('x', 100000).' %}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + + // should not throw an exception + } + + public function testBigNumbers() + { + $template = '{{ 922337203685477580700 }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $node = $stream->next(); + $node = $stream->next(); + $this->assertEquals(922337203685477580700, $node->getValue()); + } + + public function testString() + { + $template = 'foo {{ "bar #{ baz + 1 }" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::TEXT_TYPE, 'foo '); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'baz'); + $stream->expect(Twig_Token::OPERATOR_TYPE, '+'); + $stream->expect(Twig_Token::NUMBER_TYPE, '1'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::VAR_END_TYPE); + } + + public function testStringWithEscapedInterpolation() + { + $template = '{{ "bar \#{baz+1}" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar #{baz+1}'); + $stream->expect(Twig_Token::VAR_END_TYPE); + } + + public function testStringWithHash() + { + $template = '{{ "bar # baz" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar # baz'); + $stream->expect(Twig_Token::VAR_END_TYPE); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unclosed """ + */ + public function testStringWithUnterminatedInterpolation() + { + $template = '{{ "bar #{x" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + } + + public function testStringWithNestedInterpolations() + { + $template = '{{ "bar #{ "foo#{bar}" }" }}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'foo'); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'bar'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::VAR_END_TYPE); + } + + public function testStringWithNestedInterpolationsInBlock() + { + $template = '{% foo "bar #{ "foo#{bar}" }" %}'; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::BLOCK_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'foo'); + $stream->expect(Twig_Token::STRING_TYPE, 'bar '); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::STRING_TYPE, 'foo'); + $stream->expect(Twig_Token::INTERPOLATION_START_TYPE); + $stream->expect(Twig_Token::NAME_TYPE, 'bar'); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::INTERPOLATION_END_TYPE); + $stream->expect(Twig_Token::BLOCK_END_TYPE); + } + + public function testOperatorEndingWithALetterAtTheEndOfALine() + { + $template = "{{ 1 and\n0}}"; + + $lexer = new Twig_Lexer(new Twig_Environment()); + $stream = $lexer->tokenize($template); + $stream->expect(Twig_Token::VAR_START_TYPE); + $stream->expect(Twig_Token::NUMBER_TYPE, 1); + $stream->expect(Twig_Token::OPERATOR_TYPE, 'and'); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php new file mode 100644 index 0000000..1369a6b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Loader/ArrayTest.php @@ -0,0 +1,97 @@ + 'bar')); + + $this->assertEquals('bar', $loader->getSource('foo')); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testGetSourceWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Array(array()); + + $loader->getSource('foo'); + } + + public function testGetCacheKey() + { + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + + $this->assertEquals('bar', $loader->getCacheKey('foo')); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testGetCacheKeyWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Array(array()); + + $loader->getCacheKey('foo'); + } + + public function testSetTemplate() + { + $loader = new Twig_Loader_Array(array()); + $loader->setTemplate('foo', 'bar'); + + $this->assertEquals('bar', $loader->getSource('foo')); + } + + public function testIsFresh() + { + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + $this->assertTrue($loader->isFresh('foo', time())); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testIsFreshWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Array(array()); + + $loader->isFresh('foo', time()); + } + + public function testTemplateReference() + { + $name = new Twig_Test_Loader_TemplateReference('foo'); + $loader = new Twig_Loader_Array(array('foo' => 'bar')); + + $loader->getCacheKey($name); + $loader->getSource($name); + $loader->isFresh($name, time()); + $loader->setTemplate($name, 'foobar'); + } +} + +class Twig_Test_Loader_TemplateReference +{ + private $name; + + public function __construct($name) + { + $this->name = $name; + } + + public function __toString() + { + return $this->name; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php new file mode 100644 index 0000000..580ae10 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Loader/ChainTest.php @@ -0,0 +1,63 @@ + 'bar')), + new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), + )); + + $this->assertEquals('bar', $loader->getSource('foo')); + $this->assertEquals('foo', $loader->getSource('bar')); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testGetSourceWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Chain(array()); + + $loader->getSource('foo'); + } + + public function testGetCacheKey() + { + $loader = new Twig_Loader_Chain(array( + new Twig_Loader_Array(array('foo' => 'bar')), + new Twig_Loader_Array(array('foo' => 'foobar', 'bar' => 'foo')), + )); + + $this->assertEquals('bar', $loader->getCacheKey('foo')); + $this->assertEquals('foo', $loader->getCacheKey('bar')); + } + + /** + * @expectedException Twig_Error_Loader + */ + public function testGetCacheKeyWhenTemplateDoesNotExist() + { + $loader = new Twig_Loader_Chain(array()); + + $loader->getCacheKey('foo'); + } + + public function testAddLoader() + { + $loader = new Twig_Loader_Chain(); + $loader->addLoader(new Twig_Loader_Array(array('foo' => 'bar'))); + + $this->assertEquals('bar', $loader->getSource('foo')); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php b/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php new file mode 100644 index 0000000..22ae5aa --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Loader/FilesystemTest.php @@ -0,0 +1,52 @@ +getCacheKey($template); + $this->fail(); + } catch (Twig_Error_Loader $e) { + $this->assertNotContains('Unable to find template', $e->getMessage()); + } + } + + public function getSecurityTests() + { + return array( + array("AutoloaderTest\0.php"), + array('..\\AutoloaderTest.php'), + array('..\\\\\\AutoloaderTest.php'), + array('../AutoloaderTest.php'), + array('..////AutoloaderTest.php'), + array('./../AutoloaderTest.php'), + array('.\\..\\AutoloaderTest.php'), + array('././././././../AutoloaderTest.php'), + array('.\\./.\\./.\\./../AutoloaderTest.php'), + array('foo/../../AutoloaderTest.php'), + array('foo\\..\\..\\AutoloaderTest.php'), + array('foo/../bar/../../AutoloaderTest.php'), + array('foo/bar/../../../AutoloaderTest.php'), + array('filters/../../AutoloaderTest.php'), + array('filters//..//..//AutoloaderTest.php'), + array('filters\\..\\..\\AutoloaderTest.php'), + array('filters\\\\..\\\\..\\\\AutoloaderTest.php'), + array('filters\\//../\\/\\..\\AutoloaderTest.php'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php b/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php new file mode 100644 index 0000000..ebfcb48 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/AutoEscapeTest.php @@ -0,0 +1,46 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals(true, $node->getAttribute('value')); + } + + /** + * @covers Twig_Node_AutoEscape::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $body = new Twig_Node(array(new Twig_Node_Text('foo', 0))); + $node = new Twig_Node_AutoEscape(true, $body, 0); + + return array( + array($node, 'echo "foo";'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php b/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php new file mode 100644 index 0000000..f1c5ab1 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/BlockReferenceTest.php @@ -0,0 +1,41 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + /** + * @covers Twig_Node_BlockReference::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + return array( + array(new Twig_Node_BlockReference('foo', 0), '$this->displayBlock(\'foo\', $context, $blocks);'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php b/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php new file mode 100644 index 0000000..6bc5e79 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/BlockTest.php @@ -0,0 +1,52 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals('foo', $node->getAttribute('name')); + } + + /** + * @covers Twig_Node_Block::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $body = new Twig_Node_Text('foo', 0); + $node = new Twig_Node_Block('foo', $body, 0); + + return array( + array($node, <<assertEquals($expr, $node->getNode('expr')); + } + + /** + * @covers Twig_Node_Do::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = new Twig_Node_Do($expr, 0); + $tests[] = array($node, '"foo";'); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php new file mode 100644 index 0000000..06b30e9 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ArrayTest.php @@ -0,0 +1,51 @@ +assertEquals($foo, $node->getNode(1)); + } + + /** + * @covers Twig_Node_Expression_Array::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $elements = array( + new Twig_Node_Expression_Constant('foo', 0), + new Twig_Node_Expression_Constant('bar', 0), + + new Twig_Node_Expression_Constant('bar', 0), + new Twig_Node_Expression_Constant('foo', 0), + ); + $node = new Twig_Node_Expression_Array($elements, 0); + + return array( + array($node, 'array("foo" => "bar", "bar" => "foo")'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php new file mode 100644 index 0000000..fc92b0d --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/AssignNameTest.php @@ -0,0 +1,43 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + /** + * @covers Twig_Node_Expression_AssignName::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_AssignName('foo', 0); + + return array( + array($node, '$context["foo"]'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php new file mode 100644 index 0000000..80d318f --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AddTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_Add::compile + * @covers Twig_Node_Expression_Binary_Add::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Add($left, $right, 0); + + return array( + array($node, '(1 + 2)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php new file mode 100644 index 0000000..a6ed4f2 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/AndTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_And::compile + * @covers Twig_Node_Expression_Binary_And::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_And($left, $right, 0); + + return array( + array($node, '(1 && 2)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php new file mode 100644 index 0000000..a04edc9 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ConcatTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_Concat::compile + * @covers Twig_Node_Expression_Binary_Concat::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Concat($left, $right, 0); + + return array( + array($node, '(1 . 2)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php new file mode 100644 index 0000000..42002fc --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/DivTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_Div::compile + * @covers Twig_Node_Expression_Binary_Div::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Div($left, $right, 0); + + return array( + array($node, '(1 / 2)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php new file mode 100644 index 0000000..94ff2f6 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/FloorDivTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_FloorDiv::compile + * @covers Twig_Node_Expression_Binary_FloorDiv::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_FloorDiv($left, $right, 0); + + return array( + array($node, 'intval(floor((1 / 2)))'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php new file mode 100644 index 0000000..67612a5 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/ModTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_Mod::compile + * @covers Twig_Node_Expression_Binary_Mod::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Mod($left, $right, 0); + + return array( + array($node, '(1 % 2)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php new file mode 100644 index 0000000..c817d02 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/MulTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_Mul::compile + * @covers Twig_Node_Expression_Binary_Mul::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Mul($left, $right, 0); + + return array( + array($node, '(1 * 2)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php new file mode 100644 index 0000000..d8e2f8d --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/OrTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_Or::compile + * @covers Twig_Node_Expression_Binary_Or::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Or($left, $right, 0); + + return array( + array($node, '(1 || 2)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php new file mode 100644 index 0000000..6583d09 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Binary/SubTest.php @@ -0,0 +1,49 @@ +assertEquals($left, $node->getNode('left')); + $this->assertEquals($right, $node->getNode('right')); + } + + /** + * @covers Twig_Node_Expression_Binary_Sub::compile + * @covers Twig_Node_Expression_Binary_Sub::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $left = new Twig_Node_Expression_Constant(1, 0); + $right = new Twig_Node_Expression_Constant(2, 0); + $node = new Twig_Node_Expression_Binary_Sub($left, $right, 0); + + return array( + array($node, '(1 - 2)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php new file mode 100644 index 0000000..4a05e4e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConditionalTest.php @@ -0,0 +1,52 @@ +assertEquals($expr1, $node->getNode('expr1')); + $this->assertEquals($expr2, $node->getNode('expr2')); + $this->assertEquals($expr3, $node->getNode('expr3')); + } + + /** + * @covers Twig_Node_Expression_Conditional::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $expr1 = new Twig_Node_Expression_Constant(1, 0); + $expr2 = new Twig_Node_Expression_Constant(2, 0); + $expr3 = new Twig_Node_Expression_Constant(3, 0); + $node = new Twig_Node_Expression_Conditional($expr1, $expr2, $expr3, 0); + $tests[] = array($node, '((1) ? (2) : (3))'); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php new file mode 100644 index 0000000..0cf3867 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ConstantTest.php @@ -0,0 +1,44 @@ +assertEquals('foo', $node->getAttribute('value')); + } + + /** + * @covers Twig_Node_Expression_Constant::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $node = new Twig_Node_Expression_Constant('foo', 0); + $tests[] = array($node, '"foo"'); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php new file mode 100644 index 0000000..2c52482 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FilterTest.php @@ -0,0 +1,85 @@ +assertEquals($expr, $node->getNode('node')); + $this->assertEquals($name, $node->getNode('filter')); + $this->assertEquals($args, $node->getNode('arguments')); + } + + /** + * @covers Twig_Node_Expression_Filter::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = $this->createFilter($expr, 'foobar', array(new Twig_Node_Expression_Constant('bar', 0), new Twig_Node_Expression_Constant('foobar', 0))); + + try { + $node->compile($this->getCompiler()); + $this->fail(); + } catch (Exception $e) { + $this->assertEquals('Twig_Error_Syntax', get_class($e)); + } + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = $this->createFilter($expr, 'upper'); + $node = $this->createFilter($node, 'lower', array(new Twig_Node_Expression_Constant('bar', 0), new Twig_Node_Expression_Constant('foobar', 0))); + + if (function_exists('mb_get_info')) { + $tests[] = array($node, 'twig_lower_filter($this->env, twig_upper_filter($this->env, "foo"), "bar", "foobar")'); + } else { + $tests[] = array($node, 'strtolower(strtoupper("foo"), "bar", "foobar")'); + } + + return $tests; + } + + /** + * @covers Twig_Node_Expression_Filter::compile + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage The filter "uppe" does not exist. Did you mean "upper" at line 0 + */ + public function testUnknownFilter() + { + $node = $this->createFilter(new Twig_Node_Expression_Constant('foo', 0), 'uppe'); + $node->compile($this->getCompiler()); + } + + protected function createFilter($node, $name, array $arguments = array()) + { + $name = new Twig_Node_Expression_Constant($name, 0); + $arguments = new Twig_Node($arguments); + + return new Twig_Node_Expression_Filter($node, $name, $arguments, 0); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php new file mode 100644 index 0000000..68c5c61 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/FunctionTest.php @@ -0,0 +1,90 @@ +assertEquals($name, $node->getAttribute('name')); + $this->assertEquals($args, $node->getNode('arguments')); + } + + /** + * @covers Twig_Node_Expression_Function::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + /** + * @covers Twig_Node_Expression_Filter::compile + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage The function "cycl" does not exist. Did you mean "cycle" at line 0 + */ + public function testUnknownFunction() + { + $node = $this->createFunction('cycl', array()); + $node->compile($this->getCompiler()); + } + + public function getTests() + { + $environment = new Twig_Environment(); + $environment->addFunction('foo', new Twig_Function_Function('foo', array())); + $environment->addFunction('bar', new Twig_Function_Function('bar', array('needs_environment' => true))); + $environment->addFunction('foofoo', new Twig_Function_Function('foofoo', array('needs_context' => true))); + $environment->addFunction('foobar', new Twig_Function_Function('foobar', array('needs_environment' => true, 'needs_context' => true))); + + $tests = array(); + + $node = $this->createFunction('foo'); + $tests[] = array($node, 'foo()', $environment); + + $node = $this->createFunction('foo', array(new Twig_Node_Expression_Constant('bar', 0), new Twig_Node_Expression_Constant('foobar', 0))); + $tests[] = array($node, 'foo("bar", "foobar")', $environment); + + $node = $this->createFunction('bar'); + $tests[] = array($node, 'bar($this->env)', $environment); + + $node = $this->createFunction('bar', array(new Twig_Node_Expression_Constant('bar', 0))); + $tests[] = array($node, 'bar($this->env, "bar")', $environment); + + $node = $this->createFunction('foofoo'); + $tests[] = array($node, 'foofoo($context)', $environment); + + $node = $this->createFunction('foofoo', array(new Twig_Node_Expression_Constant('bar', 0))); + $tests[] = array($node, 'foofoo($context, "bar")', $environment); + + $node = $this->createFunction('foobar'); + $tests[] = array($node, 'foobar($this->env, $context)', $environment); + + $node = $this->createFunction('foobar', array(new Twig_Node_Expression_Constant('bar', 0))); + $tests[] = array($node, 'foobar($this->env, $context, "bar")', $environment); + + return $tests; + } + + protected function createFunction($name, array $arguments = array()) + { + return new Twig_Node_Expression_Function($name, new Twig_Node($arguments), 0); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php new file mode 100644 index 0000000..6df143d --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/GetAttrTest.php @@ -0,0 +1,64 @@ +addElement(new Twig_Node_Expression_Name('foo', 0)); + $args->addElement(new Twig_Node_Expression_Constant('bar', 0)); + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_TemplateInterface::ARRAY_CALL, 0); + + $this->assertEquals($expr, $node->getNode('node')); + $this->assertEquals($attr, $node->getNode('attribute')); + $this->assertEquals($args, $node->getNode('arguments')); + $this->assertEquals(Twig_TemplateInterface::ARRAY_CALL, $node->getAttribute('type')); + } + + /** + * @covers Twig_Node_Expression_GetAttr::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Name('foo', 0); + $attr = new Twig_Node_Expression_Constant('bar', 0); + $args = new Twig_Node_Expression_Array(array(), 0); + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_TemplateInterface::ANY_CALL, 0); + $tests[] = array($node, sprintf('%s%s, "bar")', $this->getAttributeGetter(), $this->getVariableGetter('foo'))); + + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_TemplateInterface::ARRAY_CALL, 0); + $tests[] = array($node, sprintf('%s%s, "bar", array(), "array")', $this->getAttributeGetter(), $this->getVariableGetter('foo'))); + + $args = new Twig_Node_Expression_Array(array(), 0); + $args->addElement(new Twig_Node_Expression_Name('foo', 0)); + $args->addElement(new Twig_Node_Expression_Constant('bar', 0)); + $node = new Twig_Node_Expression_GetAttr($expr, $attr, $args, Twig_TemplateInterface::METHOD_CALL, 0); + $tests[] = array($node, sprintf('%s%s, "bar", array(0 => %s, 1 => "bar"), "method")', $this->getAttributeGetter(), $this->getVariableGetter('foo'), $this->getVariableGetter('foo'))); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php new file mode 100644 index 0000000..e77b432 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/NameTest.php @@ -0,0 +1,51 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + /** + * @covers Twig_Node_Expression_Name::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Name('foo', 0); + $self = new Twig_Node_Expression_Name('_self', 0); + $context = new Twig_Node_Expression_Name('_context', 0); + + $env = new Twig_Environment(null, array('strict_variables' => true)); + $env1 = new Twig_Environment(null, array('strict_variables' => false)); + + return array( + array($node, '$this->getContext($context, "foo")', $env), + array($node, $this->getVariableGetter('foo'), $env1), + array($self, '$this'), + array($context, '$context'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php new file mode 100644 index 0000000..7efbe03 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/ParentTest.php @@ -0,0 +1,42 @@ +assertEquals('foo', $node->getAttribute('name')); + } + + /** + * @covers Twig_Node_Expression_Parent::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Expression_Parent('foo', 0), '$this->renderParentBlock("foo", $context, $blocks)'); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php new file mode 100644 index 0000000..08668c0 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/TestTest.php @@ -0,0 +1,67 @@ +assertEquals($expr, $node->getNode('node')); + $this->assertEquals($args, $node->getNode('arguments')); + $this->assertEquals($name, $node->getAttribute('name')); + } + + /** + * @covers Twig_Node_Expression_Test::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo', 0); + $node = new Twig_Node_Expression_Test_Null($expr, 'null', new Twig_Node(array()), 0); + + $tests[] = array($node, '(null === "foo")'); + + return $tests; + } + + /** + * @covers Twig_Node_Expression_Filter::compile + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage The test "nul" does not exist. Did you mean "null" at line 0 + */ + public function testUnknownTest() + { + $node = $this->createTest(new Twig_Node_Expression_Constant('foo', 0), 'nul'); + $node->compile($this->getCompiler()); + } + + protected function createTest($node, $name, array $arguments = array()) + { + return new Twig_Node_Expression_Test($node, $name, new Twig_Node($arguments), 0); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php new file mode 100644 index 0000000..218de6e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NegTest.php @@ -0,0 +1,46 @@ +assertEquals($expr, $node->getNode('node')); + } + + /** + * @covers Twig_Node_Expression_Unary_Neg::compile + * @covers Twig_Node_Expression_Unary_Neg::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Neg($node, 0); + + return array( + array($node, '(-1)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php new file mode 100644 index 0000000..ed6349c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/NotTest.php @@ -0,0 +1,46 @@ +assertEquals($expr, $node->getNode('node')); + } + + /** + * @covers Twig_Node_Expression_Unary_Not::compile + * @covers Twig_Node_Expression_Unary_Not::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Not($node, 0); + + return array( + array($node, '(!1)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php new file mode 100644 index 0000000..6a414bc --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/Expression/Unary/PosTest.php @@ -0,0 +1,46 @@ +assertEquals($expr, $node->getNode('node')); + } + + /** + * @covers Twig_Node_Expression_Unary_Pos::compile + * @covers Twig_Node_Expression_Unary_Pos::operator + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $node = new Twig_Node_Expression_Constant(1, 0); + $node = new Twig_Node_Expression_Unary_Pos($node, 0); + + return array( + array($node, '(+1)'), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php new file mode 100644 index 0000000..ef3be82 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/ForTest.php @@ -0,0 +1,201 @@ +setAttribute('with_loop', false); + + $this->assertEquals($keyTarget, $node->getNode('key_target')); + $this->assertEquals($valueTarget, $node->getNode('value_target')); + $this->assertEquals($seq, $node->getNode('seq')); + $this->assertTrue($node->getAttribute('ifexpr')); + $this->assertEquals('Twig_Node_If', get_class($node->getNode('body'))); + $this->assertEquals($body, $node->getNode('body')->getNode('tests')->getNode(1)->getNode(0)); + $this->assertEquals(null, $node->getNode('else')); + + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0); + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', false); + $this->assertEquals($else, $node->getNode('else')); + } + + /** + * @covers Twig_Node_For::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $keyTarget = new Twig_Node_Expression_AssignName('key', 0); + $valueTarget = new Twig_Node_Expression_AssignName('item', 0); + $seq = new Twig_Node_Expression_Name('items', 0); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0)), array(), 0); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', false); + + $tests[] = array($node, <<getVariableGetter('items')}); +foreach (\$context['_seq'] as \$context["key"] => \$context["item"]) { + echo {$this->getVariableGetter('foo')}; +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['key'], \$context['item'], \$context['_parent'], \$context['loop']); +\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent)); +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 0); + $valueTarget = new Twig_Node_Expression_AssignName('v', 0); + $seq = new Twig_Node_Expression_Name('values', 0); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0)), array(), 0); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { + \$length = count(\$context['_seq']); + \$context['loop']['revindex0'] = \$length - 1; + \$context['loop']['revindex'] = \$length; + \$context['loop']['length'] = \$length; + \$context['loop']['last'] = 1 === \$length; +} +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + echo {$this->getVariableGetter('foo')}; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + if (isset(\$context['loop']['length'])) { + --\$context['loop']['revindex0']; + --\$context['loop']['revindex']; + \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; + } +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent)); +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 0); + $valueTarget = new Twig_Node_Expression_AssignName('v', 0); + $seq = new Twig_Node_Expression_Name('values', 0); + $ifexpr = new Twig_Node_Expression_Constant(true, 0); + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0)), array(), 0); + $else = null; + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + if (true) { + echo {$this->getVariableGetter('foo')}; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + } +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent)); +EOF + ); + + $keyTarget = new Twig_Node_Expression_AssignName('k', 0); + $valueTarget = new Twig_Node_Expression_AssignName('v', 0); + $seq = new Twig_Node_Expression_Name('values', 0); + $ifexpr = null; + $body = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0)), array(), 0); + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0); + $node = new Twig_Node_For($keyTarget, $valueTarget, $seq, $ifexpr, $body, $else, 0); + $node->setAttribute('with_loop', true); + + $tests[] = array($node, <<getVariableGetter('values')}); +\$context['_iterated'] = false; +\$context['loop'] = array( + 'parent' => \$context['_parent'], + 'index0' => 0, + 'index' => 1, + 'first' => true, +); +if (is_array(\$context['_seq']) || (is_object(\$context['_seq']) && \$context['_seq'] instanceof Countable)) { + \$length = count(\$context['_seq']); + \$context['loop']['revindex0'] = \$length - 1; + \$context['loop']['revindex'] = \$length; + \$context['loop']['length'] = \$length; + \$context['loop']['last'] = 1 === \$length; +} +foreach (\$context['_seq'] as \$context["k"] => \$context["v"]) { + echo {$this->getVariableGetter('foo')}; + \$context['_iterated'] = true; + ++\$context['loop']['index0']; + ++\$context['loop']['index']; + \$context['loop']['first'] = false; + if (isset(\$context['loop']['length'])) { + --\$context['loop']['revindex0']; + --\$context['loop']['revindex']; + \$context['loop']['last'] = 0 === \$context['loop']['revindex0']; + } +} +if (!\$context['_iterated']) { + echo {$this->getVariableGetter('foo')}; +} +\$_parent = \$context['_parent']; +unset(\$context['_seq'], \$context['_iterated'], \$context['k'], \$context['v'], \$context['_parent'], \$context['loop']); +\$context = array_merge(\$_parent, array_intersect_key(\$context, \$_parent)); +EOF + ); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php b/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php new file mode 100644 index 0000000..04b92e7 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/IfTest.php @@ -0,0 +1,99 @@ +assertEquals($t, $node->getNode('tests')); + $this->assertEquals(null, $node->getNode('else')); + + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 0), 0); + $node = new Twig_Node_If($t, $else, 0); + $this->assertEquals($else, $node->getNode('else')); + } + + /** + * @covers Twig_Node_If::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0), + ), array(), 0); + $else = null; + $node = new Twig_Node_If($t, $else, 0); + + $tests[] = array($node, <<getVariableGetter('foo')}; +} +EOF + ); + + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0), + new Twig_Node_Expression_Constant(false, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 0), 0), + ), array(), 0); + $else = null; + $node = new Twig_Node_If($t, $else, 0); + + $tests[] = array($node, <<getVariableGetter('foo')}; +} elseif (false) { + echo {$this->getVariableGetter('bar')}; +} +EOF + ); + + $t = new Twig_Node(array( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Print(new Twig_Node_Expression_Name('foo', 0), 0), + ), array(), 0); + $else = new Twig_Node_Print(new Twig_Node_Expression_Name('bar', 0), 0); + $node = new Twig_Node_If($t, $else, 0); + + $tests[] = array($node, <<getVariableGetter('foo')}; +} else { + echo {$this->getVariableGetter('bar')}; +} +EOF + ); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php new file mode 100644 index 0000000..6a89195 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/ImportTest.php @@ -0,0 +1,50 @@ +assertEquals($macro, $node->getNode('expr')); + $this->assertEquals($var, $node->getNode('var')); + } + + /** + * @covers Twig_Node_Import::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $macro = new Twig_Node_Expression_Constant('foo.twig', 0); + $var = new Twig_Node_Expression_AssignName('macro', 0); + $node = new Twig_Node_Import($macro, $var, 0); + + $tests[] = array($node, '$context["macro"] = $this->env->loadTemplate("foo.twig");'); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php b/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php new file mode 100644 index 0000000..d068392 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/IncludeTest.php @@ -0,0 +1,84 @@ +assertEquals(null, $node->getNode('variables')); + $this->assertEquals($expr, $node->getNode('expr')); + $this->assertFalse($node->getAttribute('only')); + + $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 0), new Twig_Node_Expression_Constant(true, 0)), 0); + $node = new Twig_Node_Include($expr, $vars, true, false, 0); + $this->assertEquals($vars, $node->getNode('variables')); + $this->assertTrue($node->getAttribute('only')); + } + + /** + * @covers Twig_Node_Include::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $expr = new Twig_Node_Expression_Constant('foo.twig', 0); + $node = new Twig_Node_Include($expr, null, false, false, 0); + $tests[] = array($node, '$this->env->loadTemplate("foo.twig")->display($context);'); + + $expr = new Twig_Node_Expression_Conditional( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Expression_Constant('foo', 0), + new Twig_Node_Expression_Constant('foo', 0), + 0 + ); + $node = new Twig_Node_Include($expr, null, false, false, 0); + $tests[] = array($node, <<env->resolveTemplate(((true) ? ("foo") : ("foo"))); +\$template->display(\$context); +EOF + ); + + $expr = new Twig_Node_Expression_Constant('foo.twig', 0); + $vars = new Twig_Node_Expression_Array(array(new Twig_Node_Expression_Constant('foo', 0), new Twig_Node_Expression_Constant(true, 0)), 0); + $node = new Twig_Node_Include($expr, $vars, false, false, 0); + $tests[] = array($node, '$this->env->loadTemplate("foo.twig")->display(array_merge($context, array("foo" => true)));'); + + $node = new Twig_Node_Include($expr, $vars, true, false, 0); + $tests[] = array($node, '$this->env->loadTemplate("foo.twig")->display(array("foo" => true));'); + + $node = new Twig_Node_Include($expr, $vars, true, true, 0); + $tests[] = array($node, <<env->loadTemplate("foo.twig")->display(array("foo" => true)); +} catch (Twig_Error_Loader \$e) { + // ignore missing template +} +EOF + ); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php b/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php new file mode 100644 index 0000000..3dd57a6 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/MacroTest.php @@ -0,0 +1,70 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals($arguments, $node->getNode('arguments')); + $this->assertEquals('foo', $node->getAttribute('name')); + } + + /** + * @covers Twig_Node_Macro::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $body = new Twig_Node_Text('foo', 0); + $arguments = new Twig_Node(array(new Twig_Node_Expression_Name('foo', 0)), array(), 0); + $node = new Twig_Node_Macro('foo', $body, $arguments, 0); + + return array( + array($node, <<env->mergeGlobals(array( + "foo" => \$foo, + )); + + \$blocks = array(); + + ob_start(); + try { + echo "foo"; + } catch(Exception \$e) { + ob_end_clean(); + + throw \$e; + } + + return ob_get_clean(); +} +EOF + ), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php b/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php new file mode 100644 index 0000000..592949b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/ModuleTest.php @@ -0,0 +1,196 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals($blocks, $node->getNode('blocks')); + $this->assertEquals($macros, $node->getNode('macros')); + $this->assertEquals($parent, $node->getNode('parent')); + $this->assertEquals($filename, $node->getAttribute('filename')); + } + + /** + * @covers Twig_Node_Module::compile + * @covers Twig_Node_Module::compileTemplate + * @covers Twig_Node_Module::compileMacros + * @covers Twig_Node_Module::compileClassHeader + * @covers Twig_Node_Module::compileDisplayHeader + * @covers Twig_Node_Module::compileDisplayBody + * @covers Twig_Node_Module::compileDisplayFooter + * @covers Twig_Node_Module::compileClassFooter + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $twig = new Twig_Environment(new Twig_Loader_String()); + + $tests = array(); + + $body = new Twig_Node_Text('foo', 0); + $extends = null; + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<parent = false; + + \$this->blocks = array( + ); + } + + protected function doDisplay(array \$context, array \$blocks = array()) + { + echo "foo"; + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function getDebugInfo() + { + return array (); + } +} +EOF + , $twig); + + $import = new Twig_Node_Import(new Twig_Node_Expression_Constant('foo.twig', 0), new Twig_Node_Expression_AssignName('macro', 0), 0); + + $body = new Twig_Node(array($import)); + $extends = new Twig_Node_Expression_Constant('layout.twig', 0); + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<parent = \$this->env->loadTemplate("layout.twig"); + + \$this->blocks = array( + ); + } + + protected function doGetParent(array \$context) + { + return "layout.twig"; + } + + protected function doDisplay(array \$context, array \$blocks = array()) + { + \$context["macro"] = \$this->env->loadTemplate("foo.twig"); + \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array (); + } +} +EOF + , $twig); + + $body = new Twig_Node(); + $extends = new Twig_Node_Expression_Conditional( + new Twig_Node_Expression_Constant(true, 0), + new Twig_Node_Expression_Constant('foo', 0), + new Twig_Node_Expression_Constant('foo', 0), + 0 + ); + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $tests[] = array($node, <<env->resolveTemplate(((true) ? ("foo") : ("foo"))); + } + + protected function doDisplay(array \$context, array \$blocks = array()) + { + \$this->getParent(\$context)->display(\$context, array_merge(\$this->blocks, \$blocks)); + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array (); + } +} +EOF + , $twig); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php b/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php new file mode 100644 index 0000000..168663c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/PrintTest.php @@ -0,0 +1,43 @@ +assertEquals($expr, $node->getNode('expr')); + } + + /** + * @covers Twig_Node_Print::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 0), 0), 'echo "foo";'); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php new file mode 100644 index 0000000..1610873 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/SandboxTest.php @@ -0,0 +1,57 @@ +assertEquals($body, $node->getNode('body')); + } + + /** + * @covers Twig_Node_Sandbox::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $body = new Twig_Node_Text('foo', 0); + $node = new Twig_Node_Sandbox($body, 0); + + $tests[] = array($node, <<env->getExtension('sandbox'); +if (!\$alreadySandboxed = \$sandbox->isSandboxed()) { + \$sandbox->enableSandbox(); +} +echo "foo"; +if (!\$alreadySandboxed) { + \$sandbox->disableSandbox(); +} +EOF + ); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php new file mode 100644 index 0000000..2ce0584 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/SandboxedModuleTest.php @@ -0,0 +1,172 @@ +assertEquals($body, $node->getNode('body')); + $this->assertEquals($blocks, $node->getNode('blocks')); + $this->assertEquals($macros, $node->getNode('macros')); + $this->assertEquals($parent, $node->getNode('parent')); + $this->assertEquals($filename, $node->getAttribute('filename')); + } + + /** + * @covers Twig_Node_SandboxedModule::compile + * @covers Twig_Node_SandboxedModule::compileDisplayBody + * @covers Twig_Node_SandboxedModule::compileDisplayFooter + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $twig = new Twig_Environment(new Twig_Loader_String()); + + $tests = array(); + + $body = new Twig_Node_Text('foo', 0); + $extends = null; + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $node = new Twig_Node_SandboxedModule($node, array('for'), array('upper'), array('cycle')); + + $tests[] = array($node, <<parent = false; + + \$this->blocks = array( + ); + } + + protected function doDisplay(array \$context, array \$blocks = array()) + { + \$this->checkSecurity(); + echo "foo"; + } + + protected function checkSecurity() { + \$this->env->getExtension('sandbox')->checkSecurity( + array('upper'), + array('for'), + array('cycle') + ); + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function getDebugInfo() + { + return array (); + } +} +EOF + , $twig); + + $body = new Twig_Node(); + $extends = new Twig_Node_Expression_Constant('layout.twig', 0); + $blocks = new Twig_Node(); + $macros = new Twig_Node(); + $traits = new Twig_Node(); + $filename = 'foo.twig'; + + $node = new Twig_Node_Module($body, $extends, $blocks, $macros, $traits, new Twig_Node(array()), $filename); + $node = new Twig_Node_SandboxedModule($node, array('for'), array('upper'), array('cycle')); + + $tests[] = array($node, <<parent = \$this->env->loadTemplate("layout.twig"); + + \$this->blocks = array( + ); + } + + protected function doGetParent(array \$context) + { + return "layout.twig"; + } + + protected function doDisplay(array \$context, array \$blocks = array()) + { + \$this->checkSecurity(); + \$this->parent->display(\$context, array_merge(\$this->blocks, \$blocks)); + } + + protected function checkSecurity() { + \$this->env->getExtension('sandbox')->checkSecurity( + array('upper'), + array('for'), + array('cycle') + ); + } + + public function getTemplateName() + { + return "foo.twig"; + } + + public function isTraitable() + { + return false; + } + + public function getDebugInfo() + { + return array (); + } +} +EOF + , $twig); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php new file mode 100644 index 0000000..85adddf --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/SandboxedPrintTest.php @@ -0,0 +1,46 @@ +assertEquals($expr, $node->getNode('expr')); + } + + /** + * @covers Twig_Node_SandboxedPrint::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $tests[] = array(new Twig_Node_SandboxedPrint(new Twig_Node_Expression_Constant('foo', 0), 0), <<env->getExtension('sandbox')->ensureToStringAllowed("foo"); +EOF + ); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php new file mode 100644 index 0000000..6319fb6 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/SetTest.php @@ -0,0 +1,73 @@ +assertEquals($names, $node->getNode('names')); + $this->assertEquals($values, $node->getNode('values')); + $this->assertEquals(false, $node->getAttribute('capture')); + } + + /** + * @covers Twig_Node_Set::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); + $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 0)), array(), 0); + $node = new Twig_Node_Set(false, $names, $values, 0); + $tests[] = array($node, '$context["foo"] = "foo";'); + + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); + $values = new Twig_Node(array(new Twig_Node_Print(new Twig_Node_Expression_Constant('foo', 0), 0)), array(), 0); + $node = new Twig_Node_Set(true, $names, $values, 0); + $tests[] = array($node, <<env->getCharset()); +EOF + ); + + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0)), array(), 0); + $values = new Twig_Node_Text('foo', 0); + $node = new Twig_Node_Set(true, $names, $values, 0); + $tests[] = array($node, '$context["foo"] = (\'\' === $tmp = "foo") ? \'\' : new Twig_Markup($tmp, $this->env->getCharset());'); + + $names = new Twig_Node(array(new Twig_Node_Expression_AssignName('foo', 0), new Twig_Node_Expression_AssignName('bar', 0)), array(), 0); + $values = new Twig_Node(array(new Twig_Node_Expression_Constant('foo', 0), new Twig_Node_Expression_Name('bar', 0)), array(), 0); + $node = new Twig_Node_Set(false, $names, $values, 0); + $tests[] = array($node, <<getVariableGetter('bar')}); +EOF + ); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php b/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php new file mode 100644 index 0000000..55892f4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/SpacelessTest.php @@ -0,0 +1,50 @@ +
    foo
    ', 0))); + $node = new Twig_Node_Spaceless($body, 0); + + $this->assertEquals($body, $node->getNode('body')); + } + + /** + * @covers Twig_Node_Spaceless::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $body = new Twig_Node(array(new Twig_Node_Text('
    foo
    ', 0))); + $node = new Twig_Node_Spaceless($body, 0); + + return array( + array($node, <<
    foo
    "; +echo trim(preg_replace('/>\s+<', ob_get_clean())); +EOF + ), + ); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/TestCase.php b/vendor/twig/twig/test/Twig/Tests/Node/TestCase.php new file mode 100644 index 0000000..f142529 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/TestCase.php @@ -0,0 +1,58 @@ +assertNodeCompilation($source, $node, $environment); + } + + public function assertNodeCompilation($source, Twig_Node $node, Twig_Environment $environment = null) + { + $compiler = $this->getCompiler($environment); + $compiler->compile($node); + + $this->assertEquals($source, trim($compiler->getSource())); + } + + protected function getCompiler(Twig_Environment $environment = null) + { + return new Twig_Compiler(null === $environment ? $this->getEnvironment() : $environment); + } + + protected function getEnvironment() + { + return new Twig_Environment(); + } + + protected function getVariableGetter($name) + { + if (version_compare(phpversion(), '5.4.0RC1', '>=')) { + return sprintf('(isset($context["%s"]) ? $context["%s"] : null)', $name, $name); + } + + return sprintf('$this->getContext($context, "%s")', $name); + } + + protected function getAttributeGetter() + { + if (function_exists('twig_template_get_attributes')) { + return 'twig_template_get_attributes($this, '; + } + + return '$this->getAttribute('; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php b/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php new file mode 100644 index 0000000..87e0337 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Node/TextTest.php @@ -0,0 +1,42 @@ +assertEquals('foo', $node->getAttribute('data')); + } + + /** + * @covers Twig_Node_Text::compile + * @dataProvider getTests + */ + public function testCompile($node, $source, $environment = null) + { + parent::testCompile($node, $source, $environment); + } + + public function getTests() + { + $tests = array(); + $tests[] = array(new Twig_Node_Text('foo', 0), 'echo "foo";'); + + return $tests; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php b/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php new file mode 100644 index 0000000..a55d98e --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/NodeVisitor/OptimizerTest.php @@ -0,0 +1,118 @@ + false, 'autoescape' => false)); + $env->addExtension(new Twig_Extension_Optimizer()); + + $stream = $env->parse($env->tokenize('{{ block("foo") }}', 'index')); + + $node = $stream->getNode('body')->getNode(0); + + $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); + $this->assertTrue($node->getAttribute('output')); + } + + public function testRenderParentBlockOptimizer() + { + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $env->addExtension(new Twig_Extension_Optimizer()); + + $stream = $env->parse($env->tokenize('{% extends "foo" %}{% block content %}{{ parent() }}{% endblock %}', 'index')); + + $node = $stream->getNode('blocks')->getNode('content')->getNode(0)->getNode('body'); + + $this->assertEquals('Twig_Node_Expression_Parent', get_class($node)); + $this->assertTrue($node->getAttribute('output')); + } + + public function testRenderVariableBlockOptimizer() + { + if (version_compare(phpversion(), '5.4.0RC1', '>=')) { + return; + } + + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false, 'autoescape' => false)); + $env->addExtension(new Twig_Extension_Optimizer()); + $stream = $env->parse($env->tokenize('{{ block(name|lower) }}', 'index')); + + $node = $stream->getNode('body')->getNode(0)->getNode(1); + + $this->assertEquals('Twig_Node_Expression_BlockReference', get_class($node)); + $this->assertTrue($node->getAttribute('output')); + } + + /** + * @dataProvider getTestsForForOptimizer + */ + public function testForOptimizer($template, $expected) + { + $env = new Twig_Environment(new Twig_Loader_String(), array('cache' => false)); + $env->addExtension(new Twig_Extension_Optimizer()); + + $stream = $env->parse($env->tokenize($template, 'index')); + + foreach ($expected as $target => $withLoop) { + $this->assertTrue($this->checkForConfiguration($stream, $target, $withLoop), sprintf('variable %s is %soptimized', $target, $withLoop ? 'not ' : '')); + } + } + + public function getTestsForForOptimizer() + { + return array( + array('{% for i in foo %}{% endfor %}', array('i' => false)), + + array('{% for i in foo %}{{ loop.index }}{% endfor %}', array('i' => true)), + + array('{% for i in foo %}{% for j in foo %}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), + + array('{% for i in foo %}{% include "foo" %}{% endfor %}', array('i' => true)), + + array('{% for i in foo %}{% include "foo" only %}{% endfor %}', array('i' => false)), + + array('{% for i in foo %}{% include "foo" with { "foo": "bar" } only %}{% endfor %}', array('i' => false)), + + array('{% for i in foo %}{% include "foo" with { "foo": loop.index } only %}{% endfor %}', array('i' => true)), + + array('{% for i in foo %}{% for j in foo %}{{ loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => true)), + + array('{% for i in foo %}{% for j in foo %}{{ loop.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), + + array('{% for i in foo %}{% set l = loop %}{% for j in foo %}{{ l.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => false)), + + array('{% for i in foo %}{% for j in foo %}{{ foo.parent.loop.index }}{% endfor %}{% endfor %}', array('i' => false, 'j' => false)), + + array('{% for i in foo %}{% for j in foo %}{{ loop["parent"].loop.index }}{% endfor %}{% endfor %}', array('i' => true, 'j' => true)), + ); + } + + public function checkForConfiguration(Twig_NodeInterface $node = null, $target, $withLoop) + { + if (null === $node) { + return; + } + + foreach ($node as $n) { + if ($n instanceof Twig_Node_For) { + if ($target === $n->getNode('value_target')->getAttribute('name')) { + return $withLoop == $n->getAttribute('with_loop'); + } + } + + $ret = $this->checkForConfiguration($n, $target, $withLoop); + if (null !== $ret) { + return $ret; + } + } + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/ParserTest.php b/vendor/twig/twig/test/Twig/Tests/ParserTest.php new file mode 100644 index 0000000..1e773a6 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/ParserTest.php @@ -0,0 +1,180 @@ +setMacro('display', $this->getMock('Twig_Node_Macro', array(), array(), '', null)); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage Unknown tag name "foo". Did you mean "for" at line 0 + */ + public function testUnkownTag() + { + $stream = new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 0), + new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 0), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 0), + new Twig_Token(Twig_Token::EOF_TYPE, '', 0), + )); + $parser = new Twig_Parser(new Twig_Environment()); + $parser->parse($stream); + } + + /** + * @dataProvider getFilterBodyNodesData + */ + public function testFilterBodyNodes($input, $expected) + { + $parser = $this->getParserForFilterBodyNodes(); + + $this->assertEquals($expected, $parser->filterBodyNodes($input)); + } + + public function getFilterBodyNodesData() + { + return array( + array( + new Twig_Node(array(new Twig_Node_Text(' ', 0))), + new Twig_Node(array()), + ), + array( + $input = new Twig_Node(array(new Twig_Node_Set(false, new Twig_Node(), new Twig_Node(), 0))), + $input, + ), + array( + $input = new Twig_Node(array(new Twig_Node_Set(true, new Twig_Node(), new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 0))))), 0))), + $input, + ), + ); + } + + /** + * @dataProvider getFilterBodyNodesDataThrowsException + * @expectedException Twig_Error_Syntax + */ + public function testFilterBodyNodesThrowsException($input) + { + $parser = $this->getParserForFilterBodyNodes(); + + $parser->filterBodyNodes($input); + } + + public function getFilterBodyNodesDataThrowsException() + { + return array( + array(new Twig_Node_Text('foo', 0)), + array(new Twig_Node(array(new Twig_Node(array(new Twig_Node_Text('foo', 0)))))), + ); + } + + /** + * @expectedException Twig_Error_Syntax + * @expectedExceptionMessage A template that extends another one cannot have a body but a byte order mark (BOM) has been detected; it must be removed at line 0. + */ + public function testFilterBodyNodesWithBOM() + { + $parser = $this->getParserForFilterBodyNodes(); + $parser->filterBodyNodes(new Twig_Node_Text(chr(0xEF).chr(0xBB).chr(0xBF), 0)); + } + + public function testParseIsReentrant() + { + $twig = new Twig_Environment(null, array( + 'autoescape' => false, + 'optimizations' => 0, + )); + $twig->addTokenParser(new TestTokenParser()); + + $parser = new Twig_Parser($twig); + + $parser->parse(new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 0), + new Twig_Token(Twig_Token::NAME_TYPE, 'test', 0), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 0), + new Twig_Token(Twig_Token::VAR_START_TYPE, '', 0), + new Twig_Token(Twig_Token::NAME_TYPE, 'foo', 0), + new Twig_Token(Twig_Token::VAR_END_TYPE, '', 0), + new Twig_Token(Twig_Token::EOF_TYPE, '', 0), + ))); + + $this->assertEquals(null, $parser->getParent()); + } + + // The getVarName() must not depend on the template loaders, + // If this test does not throw any exception, that's good. + // see https://github.com/symfony/symfony/issues/4218 + public function testGetVarName() + { + $twig = new Twig_Environment(null, array( + 'autoescape' => false, + 'optimizations' => 0, + )); + + $twig->parse($twig->tokenize(<<setParent(new Twig_Node()); + $parser->stream = $this->getMockBuilder('Twig_TokenStream')->disableOriginalConstructor()->getMock(); + + return $parser; + } +} + +class TestParser extends Twig_Parser +{ + public $stream; + + public function filterBodyNodes(Twig_NodeInterface $node) + { + return parent::filterBodyNodes($node); + } +} + +class TestTokenParser extends Twig_TokenParser +{ + public function parse(Twig_Token $token) + { + // simulate the parsing of another template right in the middle of the parsing of the current template + $this->parser->parse(new Twig_TokenStream(array( + new Twig_Token(Twig_Token::BLOCK_START_TYPE, '', 0), + new Twig_Token(Twig_Token::NAME_TYPE, 'extends', 0), + new Twig_Token(Twig_Token::STRING_TYPE, 'base', 0), + new Twig_Token(Twig_Token::BLOCK_END_TYPE, '', 0), + new Twig_Token(Twig_Token::EOF_TYPE, '', 0), + ))); + + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node(array()); + } + + public function getTag() + { + return 'test'; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/TemplateTest.php b/vendor/twig/twig/test/Twig/Tests/TemplateTest.php new file mode 100644 index 0000000..4213e2b --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/TemplateTest.php @@ -0,0 +1,377 @@ + true)), + false + ); + + $template->getAttribute('string', 'a', array(), Twig_TemplateInterface::ARRAY_CALL, false); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttribute($defined, $value, $object, $item, $arguments, $type, $useExt = false) + { + $template = new Twig_TemplateTest( + new Twig_Environment(), + $useExt + ); + + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false, $exceptionMessage = null) + { + $template = new Twig_TemplateTest( + new Twig_Environment(null, array('strict_variables' => true)), + $useExt + ); + + if ($defined) { + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + } else { + try { + $this->assertEquals($value, $template->getAttribute($object, $item, $arguments, $type)); + + throw new Exception('Expected Twig_Error_Runtime exception.'); + } catch (Twig_Error_Runtime $e) { + if (null !== $exceptionMessage) { + $this->assertSame($exceptionMessage, $e->getMessage()); + } + } + } + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeDefined($defined, $value, $object, $item, $arguments, $type, $useExt = false) + { + $template = new Twig_TemplateTest( + new Twig_Environment(), + $useExt + ); + + $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); + } + + /** + * @dataProvider getGetAttributeTests + */ + public function testGetAttributeDefinedStrict($defined, $value, $object, $item, $arguments, $type, $useExt = false) + { + $template = new Twig_TemplateTest( + new Twig_Environment(null, array('strict_variables' => true)), + $useExt + ); + + $this->assertEquals($defined, $template->getAttribute($object, $item, $arguments, $type, true)); + } + + public function getGetAttributeTests() + { + $array = array( + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + '1' => 1, + ); + + $objectArray = new Twig_TemplateArrayAccessObject(); + $stdObject = (object) $array; + $magicPropertyObject = new Twig_TemplateMagicPropertyObject(); + $propertyObject = new Twig_TemplatePropertyObject(); + $propertyObject1 = new Twig_TemplatePropertyObjectAndIterator(); + $methodObject = new Twig_TemplateMethodObject(); + $magicMethodObject = new Twig_TemplateMagicMethodObject(); + + $anyType = Twig_TemplateInterface::ANY_CALL; + $methodType = Twig_TemplateInterface::METHOD_CALL; + $arrayType = Twig_TemplateInterface::ARRAY_CALL; + + $basicTests = array( + // array(defined, value, property to fetch) + array(true, 'defined', 'defined'), + array(false, null, 'undefined'), + array(false, null, 'protected'), + array(true, 0, 'zero'), + array(true, 1, 1), + array(true, 1, 1.0), + array(true, null, 'null'), + ); + $testObjects = array( + // array(object, type of fetch) + array($array, $arrayType), + array($objectArray, $arrayType), + array($stdObject, $anyType), + array($magicPropertyObject, $anyType), + array($methodObject, $methodType), + array($methodObject, $anyType), + array($propertyObject, $anyType), + array($propertyObject1, $anyType), + ); + + $tests = array(); + foreach ($testObjects as $testObject) { + foreach ($basicTests as $test) { + // properties cannot be numbers + if (($testObject[0] instanceof stdClass || $testObject[0] instanceof Twig_TemplatePropertyObject) && is_numeric($test[2])) { + continue; + } + + $tests[] = array($test[0], $test[1], $testObject[0], $test[2], array(), $testObject[1]); + } + } + + // additional method tests + $tests = array_merge($tests, array( + array(true, 'defined', $methodObject, 'defined', array(), $methodType), + array(true, 'defined', $methodObject, 'DEFINED', array(), $methodType), + array(true, 'defined', $methodObject, 'getDefined', array(), $methodType), + array(true, 'defined', $methodObject, 'GETDEFINED', array(), $methodType), + array(true, 'static', $methodObject, 'static', array(), $methodType), + array(true, 'static', $methodObject, 'getStatic', array(), $methodType), + + array(true, '__call_undefined', $magicMethodObject, 'undefined', array(), $methodType), + array(true, '__call_UNDEFINED', $magicMethodObject, 'UNDEFINED', array(), $methodType), + )); + + // add the same tests for the any type + foreach ($tests as $test) { + if ($anyType !== $test[5]) { + $test[5] = $anyType; + $tests[] = $test; + } + } + + $methodAndPropObject = new Twig_TemplateMethodAndPropObject; + + // additional method tests + $tests = array_merge($tests, array( + array(true, 'a', $methodAndPropObject, 'a', array(), $anyType), + array(true, 'a', $methodAndPropObject, 'a', array(), $methodType), + array(false, null, $methodAndPropObject, 'a', array(), $arrayType), + + array(true, 'b_prop', $methodAndPropObject, 'b', array(), $anyType), + array(true, 'b', $methodAndPropObject, 'B', array(), $anyType), + array(true, 'b', $methodAndPropObject, 'b', array(), $methodType), + array(true, 'b', $methodAndPropObject, 'B', array(), $methodType), + array(false, null, $methodAndPropObject, 'b', array(), $arrayType), + + array(false, null, $methodAndPropObject, 'c', array(), $anyType), + array(false, null, $methodAndPropObject, 'c', array(), $methodType), + array(false, null, $methodAndPropObject, 'c', array(), $arrayType), + + )); + + // tests when input is not an array or object + $tests = array_merge($tests, array( + array(false, null, 42, 'a', array(), $anyType, false, 'Item "a" for "42" does not exist'), + array(false, null, "string", 'a', array(), $anyType, false, 'Item "a" for "string" does not exist'), + array(false, null, array(), 'a', array(), $anyType, false, 'Item "a" for "Array" does not exist'), + )); + + // add twig_template_get_attributes tests + + if (function_exists('twig_template_get_attributes')) { + foreach(array_slice($tests, 0) as $test) { + $test = array_pad($test, 7, null); + $test[6] = true; + $tests[] = $test; + } + } + + return $tests; + } + + public function useExtGetAttribute() + { + return false; + } +} + +class Twig_TemplateTest extends Twig_Template +{ + protected $useExtGetAttribute = false; + + public function __construct(Twig_Environment $env, $useExtGetAttribute = false) + { + parent::__construct($env); + $this->useExtGetAttribute = $useExtGetAttribute; + Twig_Template::clearCache(); + } + + public function getTemplateName() + { + } + + public function getDebugInfo() + { + return array(); + } + + protected function doGetParent(array $context) + { + } + + protected function doDisplay(array $context, array $blocks = array()) + { + } + + public function getAttribute($object, $item, array $arguments = array(), $type = Twig_TemplateInterface::ANY_CALL, $isDefinedTest = false, $ignoreStrictCheck = false) + { + if ($this->useExtGetAttribute) { + return twig_template_get_attributes($this, $object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); + } else { + return parent::getAttribute($object, $item, $arguments, $type, $isDefinedTest, $ignoreStrictCheck); + } + } +} + +class Twig_TemplateArrayAccessObject implements ArrayAccess +{ + protected $protected = 'protected'; + + public $attributes = array( + 'defined' => 'defined', + 'zero' => 0, + 'null' => null, + '1' => 1, + ); + + public function offsetExists($name) + { + return array_key_exists($name, $this->attributes); + } + + public function offsetGet($name) + { + return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; + } + + public function offsetSet($name, $value) + { + } + + public function offsetUnset($name) + { + } +} + +class Twig_TemplateMagicPropertyObject +{ + public $defined = 'defined'; + + public $attributes = array( + 'zero' => 0, + 'null' => null, + '1' => 1, + ); + + protected $protected = 'protected'; + + public function __isset($name) + { + return array_key_exists($name, $this->attributes); + } + + public function __get($name) + { + return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : null; + } +} + +class Twig_TemplatePropertyObject +{ + public $defined = 'defined'; + public $zero = 0; + public $null = null; + + protected $protected = 'protected'; +} + +class Twig_TemplatePropertyObjectAndIterator extends Twig_TemplatePropertyObject implements IteratorAggregate +{ + public function getIterator() + { + return new ArrayIterator(array('foo', 'bar')); + } +} + +class Twig_TemplateMethodObject +{ + public function getDefined() + { + return 'defined'; + } + + public function get1() + { + return 1; + } + + public function getZero() + { + return 0; + } + + public function getNull() + { + return null; + } + + protected function getProtected() + { + return 'protected'; + } + + static public function getStatic() + { + return 'static'; + } +} + +class Twig_TemplateMethodAndPropObject +{ + private $a = 'a_prop'; + public function getA() { + return 'a'; + } + + public $b = 'b_prop'; + public function getB() { + return 'b'; + } + + private $c = 'c_prop'; + private function getC() { + return 'c'; + } +} + +class Twig_TemplateMagicMethodObject +{ + public function __call($method, $arguments) { + return '__call_'.$method; + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php b/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php new file mode 100644 index 0000000..794a037 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/TokenStreamTest.php @@ -0,0 +1,41 @@ +isEOF()) { + $token = $stream->next(); + + $repr[] = $token->getValue(); + } + $this->assertEquals('1, 2, 3, 4, 5, 6, 7', implode(', ', $repr), '->next() advances the pointer and returns the current token'); + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/escapingTest.php b/vendor/twig/twig/test/Twig/Tests/escapingTest.php new file mode 100644 index 0000000..65c38ab --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/escapingTest.php @@ -0,0 +1,324 @@ + ''', + '"' => '"', + '<' => '<', + '>' => '>', + '&' => '&' + ); + + protected $htmlAttrSpecialChars = array( + '\'' => ''', + '"' => '"', + '<' => '<', + '>' => '>', + '&' => '&', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => 'Ā', + /* Immune chars excluded */ + ',' => ',', + '.' => '.', + '-' => '-', + '_' => '_', + /* Basic alnums exluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => ' ', + "\n" => ' ', + "\t" => ' ', + "\0" => '�', // should use Unicode replacement char + /* Encode chars as named entities where possible */ + '<' => '<', + '>' => '>', + '&' => '&', + '"' => '"', + /* Encode spaces for quoteless attribute protection */ + ' ' => ' ', + ); + + protected $jsSpecialChars = array( + /* HTML special chars - escape without exception to hex */ + '<' => '\\x3C', + '>' => '\\x3E', + '\'' => '\\x27', + '"' => '\\x22', + '&' => '\\x26', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => '\\u0100', + /* Immune chars excluded */ + ',' => ',', + '.' => '.', + '_' => '_', + /* Basic alnums exluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '\\x0D', + "\n" => '\\x0A', + "\t" => '\\x09', + "\0" => '\\x00', + /* Encode spaces for quoteless attribute protection */ + ' ' => '\\x20', + ); + + protected $urlSpecialChars = array( + /* HTML special chars - escape without exception to percent encoding */ + '<' => '%3C', + '>' => '%3E', + '\'' => '%27', + '"' => '%22', + '&' => '%26', + /* Characters beyond ASCII value 255 to hex sequence */ + 'Ā' => '%C4%80', + /* Punctuation and unreserved check */ + ',' => '%2C', + '.' => '.', + '_' => '_', + '-' => '-', + ':' => '%3A', + ';' => '%3B', + '!' => '%21', + /* Basic alnums excluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '%0D', + "\n" => '%0A', + "\t" => '%09', + "\0" => '%00', + /* PHP quirks from the past */ + ' ' => '%20', + '~' => '~', + '+' => '%2B', + ); + + protected $cssSpecialChars = array( + /* HTML special chars - escape without exception to hex */ + '<' => '\\3C ', + '>' => '\\3E ', + '\'' => '\\27 ', + '"' => '\\22 ', + '&' => '\\26 ', + /* Characters beyond ASCII value 255 to unicode escape */ + 'Ā' => '\\100 ', + /* Immune chars excluded */ + ',' => '\\2C ', + '.' => '\\2E ', + '_' => '\\5F ', + /* Basic alnums exluded */ + 'a' => 'a', + 'A' => 'A', + 'z' => 'z', + 'Z' => 'Z', + '0' => '0', + '9' => '9', + /* Basic control characters and null */ + "\r" => '\\D ', + "\n" => '\\A ', + "\t" => '\\9 ', + "\0" => '\\0 ', + /* Encode spaces for quoteless attribute protection */ + ' ' => '\\20 ', + ); + + protected $env; + + public function setUp() + { + $this->env = new Twig_Environment(); + } + + public function testHtmlEscapingConvertsSpecialChars() + { + foreach ($this->htmlSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html'), 'Failed to escape: '.$key); + } + } + + public function testHtmlAttributeEscapingConvertsSpecialChars() + { + foreach ($this->htmlAttrSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'html_attr'), 'Failed to escape: '.$key); + } + } + + public function testJavascriptEscapingConvertsSpecialChars() + { + foreach ($this->jsSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'js'), 'Failed to escape: '.$key); + } + } + + public function testJavascriptEscapingReturnsStringIfZeroLength() + { + $this->assertEquals('', twig_escape_filter($this->env, '', 'js')); + } + + public function testJavascriptEscapingReturnsStringIfContainsOnlyDigits() + { + $this->assertEquals('123', twig_escape_filter($this->env, '123', 'js')); + } + + public function testCssEscapingConvertsSpecialChars() + { + foreach ($this->cssSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'css'), 'Failed to escape: '.$key); + } + } + + public function testCssEscapingReturnsStringIfZeroLength() + { + $this->assertEquals('', twig_escape_filter($this->env, '', 'css')); + } + + public function testCssEscapingReturnsStringIfContainsOnlyDigits() + { + $this->assertEquals('123', twig_escape_filter($this->env, '123', 'css')); + } + + public function testUrlEscapingConvertsSpecialChars() + { + foreach ($this->urlSpecialChars as $key => $value) { + $this->assertEquals($value, twig_escape_filter($this->env, $key, 'url'), 'Failed to escape: '.$key); + } + } + + /** + * Range tests to confirm escaped range of characters is within OWASP recommendation + */ + + /** + * Only testing the first few 2 ranges on this prot. function as that's all these + * other range tests require + */ + public function testUnicodeCodepointConversionToUtf8() + { + $expected = " ~ޙ"; + $codepoints = array(0x20, 0x7e, 0x799); + $result = ''; + foreach ($codepoints as $value) { + $result .= $this->codepointToUtf8($value); + } + $this->assertEquals($expected, $result); + } + + /** + * Convert a Unicode Codepoint to a literal UTF-8 character. + * + * @param int Unicode codepoint in hex notation + * @return string UTF-8 literal string + */ + protected function codepointToUtf8($codepoint) + { + if ($codepoint < 0x80) { + return chr($codepoint); + } + if ($codepoint < 0x800) { + return chr($codepoint >> 6 & 0x3f | 0xc0) + . chr($codepoint & 0x3f | 0x80); + } + if ($codepoint < 0x10000) { + return chr($codepoint >> 12 & 0x0f | 0xe0) + . chr($codepoint >> 6 & 0x3f | 0x80) + . chr($codepoint & 0x3f | 0x80); + } + if ($codepoint < 0x110000) { + return chr($codepoint >> 18 & 0x07 | 0xf0) + . chr($codepoint >> 12 & 0x3f | 0x80) + . chr($codepoint >> 6 & 0x3f | 0x80) + . chr($codepoint & 0x3f | 0x80); + } + throw new Exception('Codepoint requested outside of Unicode range'); + } + + public function testJavascriptEscapingEscapesOwaspRecommendedRanges() + { + $immune = array(',', '.', '_'); // Exceptions to escaping ranges + for ($chr=0; $chr < 0xFF; $chr++) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); + } else { + $literal = $this->codepointToUtf8($chr); + if (in_array($literal, $immune)) { + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'js')); + } else { + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'js'), + "$literal should be escaped!"); + } + } + } + } + + public function testHtmlAttributeEscapingEscapesOwaspRecommendedRanges() + { + $immune = array(',', '.', '-', '_'); // Exceptions to escaping ranges + for ($chr=0; $chr < 0xFF; $chr++) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); + } else { + $literal = $this->codepointToUtf8($chr); + if (in_array($literal, $immune)) { + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'html_attr')); + } else { + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'html_attr'), + "$literal should be escaped!"); + } + } + } + } + + public function testCssEscapingEscapesOwaspRecommendedRanges() + { + $immune = array(); // CSS has no exceptions to escaping ranges + for ($chr=0; $chr < 0xFF; $chr++) { + if ($chr >= 0x30 && $chr <= 0x39 + || $chr >= 0x41 && $chr <= 0x5A + || $chr >= 0x61 && $chr <= 0x7A) { + $literal = $this->codepointToUtf8($chr); + $this->assertEquals($literal, twig_escape_filter($this->env, $literal, 'css')); + } else { + $literal = $this->codepointToUtf8($chr); + $this->assertNotEquals( + $literal, + twig_escape_filter($this->env, $literal, 'css'), + "$literal should be escaped!"); + } + } + } +} diff --git a/vendor/twig/twig/test/Twig/Tests/integrationTest.php b/vendor/twig/twig/test/Twig/Tests/integrationTest.php new file mode 100644 index 0000000..b905b56 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/integrationTest.php @@ -0,0 +1,322 @@ +getRealpath()); + + if (preg_match('/ + --TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*))+)\s*--EXCEPTION--\s*(.*)/sx', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $templates = $this->parseTemplates($match[3]); + $exception = $match[4]; + $outputs = array(null, array(), null, ''); + } elseif (preg_match('/--TEST--\s*(.*?)\s*(?:--CONDITION--\s*(.*))?\s*((?:--TEMPLATE(?:\(.*?\))?--(?:.*?))+)--DATA--.*?--EXPECT--.*/s', $test, $match)) { + $message = $match[1]; + $condition = $match[2]; + $templates = $this->parseTemplates($match[3]); + $exception = false; + preg_match_all('/--DATA--(.*?)(?:--CONFIG--(.*?))?--EXPECT--(.*?)(?=\-\-DATA\-\-|$)/s', $test, $outputs, PREG_SET_ORDER); + } else { + throw new InvalidArgumentException(sprintf('Test "%s" is not valid.', str_replace($fixturesDir.'/', '', $file))); + } + + $tests[] = array(str_replace($fixturesDir.'/', '', $file), $message, $condition, $templates, $exception, $outputs); + } + + return $tests; + } + + /** + * @dataProvider getTests + */ + public function testIntegration($file, $message, $condition, $templates, $exception, $outputs) + { + if ($condition) { + eval('$ret = '.$condition.';'); + if (!$ret) { + $this->markTestSkipped($condition); + } + } + + $loader = new Twig_Loader_Array($templates); + + foreach ($outputs as $match) { + $config = array_merge(array( + 'cache' => false, + 'strict_variables' => true, + ), $match[2] ? eval($match[2].';') : array()); + $twig = new Twig_Environment($loader, $config); + $twig->addExtension(new TestExtension()); + $twig->addExtension(new Twig_Extension_Debug()); + $policy = new Twig_Sandbox_SecurityPolicy(array(), array(), array(), array(), array()); + $twig->addExtension(new Twig_Extension_Sandbox($policy, false)); + $twig->addGlobal('global', 'global'); + + try { + $template = $twig->loadTemplate('index.twig'); + } catch (Exception $e) { + if (false !== $exception) { + $this->assertEquals(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); + + return; + } + + if ($e instanceof Twig_Error_Syntax) { + $e->setTemplateFile($file); + + throw $e; + } + + throw new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); + } + + try { + $output = trim($template->render(eval($match[1].';')), "\n "); + } catch (Exception $e) { + if (false !== $exception) { + $this->assertEquals(trim($exception), trim(sprintf('%s: %s', get_class($e), $e->getMessage()))); + + return; + } + + if ($e instanceof Twig_Error_Syntax) { + $e->setTemplateFile($file); + } else { + $e = new Twig_Error(sprintf('%s: %s', get_class($e), $e->getMessage()), -1, $file, $e); + } + + $output = trim(sprintf('%s: %s', get_class($e), $e->getMessage())); + } + $expected = trim($match[3], "\n "); + + if ($expected != $output) { + echo 'Compiled template that failed:'; + + foreach (array_keys($templates) as $name) { + echo "Template: $name\n"; + $source = $loader->getSource($name); + echo $twig->compile($twig->parse($twig->tokenize($source, $name))); + } + } + $this->assertEquals($expected, $output, $message.' (in '.$file.')'); + } + } + + protected function parseTemplates($test) + { + $templates = array(); + preg_match_all('/--TEMPLATE(?:\((.*?)\))?--(.*?)(?=\-\-TEMPLATE|$)/s', $test, $matches, PREG_SET_ORDER); + foreach ($matches as $match) { + $templates[($match[1] ? $match[1] : 'index.twig')] = $match[2]; + } + + return $templates; + } +} + +function test_foo($value = 'foo') +{ + return $value; +} + +class Foo implements Iterator +{ + const BAR_NAME = 'bar'; + + public $position = 0; + public $array = array(1, 2); + + public function bar($param1 = null, $param2 = null) + { + return 'bar'.($param1 ? '_'.$param1 : '').($param2 ? '-'.$param2 : ''); + } + + public function getFoo() + { + return 'foo'; + } + + public function getSelf() + { + return $this; + } + + public function is() + { + return 'is'; + } + + public function in() + { + return 'in'; + } + + public function not() + { + return 'not'; + } + + public function strToLower($value) + { + return strtolower($value); + } + + public function rewind() + { + $this->position = 0; + } + + public function current() + { + return $this->array[$this->position]; + } + + public function key() + { + return 'a'; + } + + public function next() + { + ++$this->position; + } + + public function valid() + { + return isset($this->array[$this->position]); + } +} + +class TestTokenParser_☃ extends Twig_TokenParser +{ + public function parse(Twig_Token $token) + { + $this->parser->getStream()->expect(Twig_Token::BLOCK_END_TYPE); + + return new Twig_Node_Print(new Twig_Node_Expression_Constant('☃', -1), -1); + } + + public function getTag() + { + return '☃'; + } +} + +class TestExtension extends Twig_Extension +{ + public function getTokenParsers() + { + return array( + new TestTokenParser_☃(), + ); + } + + public function getFilters() + { + return array( + '☃' => new Twig_Filter_Method($this, '☃Filter'), + 'escape_and_nl2br' => new Twig_Filter_Method($this, 'escape_and_nl2br', array('needs_environment' => true, 'is_safe' => array('html'))), + 'nl2br' => new Twig_Filter_Method($this, 'nl2br', array('pre_escape' => 'html', 'is_safe' => array('html'))), + 'escape_something' => new Twig_Filter_Method($this, 'escape_something', array('is_safe' => array('something'))), + 'preserves_safety' => new Twig_Filter_Method($this, 'preserves_safety', array('preserves_safety' => array('html'))), + '*_path' => new Twig_Filter_Method($this, 'dynamic_path'), + '*_foo_*_bar' => new Twig_Filter_Method($this, 'dynamic_foo'), + ); + } + + public function getFunctions() + { + return array( + '☃' => new Twig_Function_Method($this, '☃Function'), + 'safe_br' => new Twig_Function_Method($this, 'br', array('is_safe' => array('html'))), + 'unsafe_br' => new Twig_Function_Method($this, 'br'), + '*_path' => new Twig_Function_Method($this, 'dynamic_path'), + '*_foo_*_bar' => new Twig_Function_Method($this, 'dynamic_foo'), + ); + } + + public function ☃Filter($value) + { + return "☃{$value}☃"; + } + + public function ☃Function($value) + { + return "☃{$value}☃"; + } + + /** + * nl2br which also escapes, for testing escaper filters + */ + public function escape_and_nl2br($env, $value, $sep = '
    ') + { + return $this->nl2br(twig_escape_filter($env, $value, 'html'), $sep); + } + + /** + * nl2br only, for testing filters with pre_escape + */ + public function nl2br($value, $sep = '
    ') + { + // not secure if $value contains html tags (not only entities) + // don't use + return str_replace("\n", "$sep\n", $value); + } + + public function dynamic_path($element, $item) + { + return $element.'/'.$item; + } + + public function dynamic_foo($foo, $bar, $item) + { + return $foo.'/'.$bar.'/'.$item; + } + + public function escape_something($value) + { + return strtoupper($value); + } + + public function preserves_safety($value) + { + return strtoupper($value); + } + + public function br() + { + return '
    '; + } + + public function getName() + { + return 'test'; + } +} diff --git a/vendor/twig/twig/test/bootstrap.php b/vendor/twig/twig/test/bootstrap.php new file mode 100644 index 0000000..36eb46a --- /dev/null +++ b/vendor/twig/twig/test/bootstrap.php @@ -0,0 +1,13 @@ +
    +
    + +
    +
    + +

    + SimpleTest 1.0.1 has been + + released. + This is the last PHP 4 compatible release. + From now on, compatibility extends from PHP 5.0.5+. +

    +
    +
    + +

    + Familiar with unit testing ? Just dive directly into SimpleTest with + the one-page starter and + the complete API. +
    + Otherwise see the ongoing + documentation. +
    + And for example test cases check out the + tutorial. +

    +
    +
    + +

    + Need help on your testing strategy ? + Feel free to join the + SimpleTest support mailing-list. +

    +

    + If you need some new functionnality in SimpleTest, you may want to look at + the features tracker. + Also the bug and + patches trackers can be useful. +

    +
    +
    + +

    + And if you feel like giving a hand, feel free to look around the + current TODO list... +

    +
    +
    + + SourceForge.net Logo + +
    +
    +
    +
    +

    + [2008/04/08] + + SimpleTest 1.0.1 is released. + The last release that supports PHP4.2 up to PHP5.3 inclusive. + Compared to the last stable release, the main significant change + is the switch to autorun. +

    +

    + The SimpleTest PHP unit tester + is available for download from your nearest + SourceForge. + It is a PHP unit test and web test framework. + Users of JUnit will be + familiar with most of the interface. + The JWebUnit + style functionality is more complete now. + It has support for SSL, forms, frames, proxies and basic authentication. + The idea is that common but fiddly PHP tasks, such as logging into a site, + can be tested easily. +

    +

    Screenshots

    +

    + Here's what the result of your first test would look like : +

    +

    + test with 1 pass +

    +

    + Well not quite. In true TDD fashion, you should see a failing test case : +

    +

    + test with 1 fail +

    +

    + You may also prefer doing your testing with the command-line : +

    +

    + test in cli +

    +

    Documentation

    +

    + While (still) very scattered around different sites, + the SimpleTest documentation is quite dense and thorough. +

    + +

    + Other type of interesting stuff while starting out + with Test Driven Development and SimpleTest include : +

    + +

    + A couple of books do use SimpleTest quite extensively : +

    + +

    Contributing

    +

    + For translators the documentation is available in XML format : + we're always please to add new languages to our code base. +

    +

    + And while we do try our best keeping this tool bug-free, detecting defects and + submitting failing test cases and/or patches can come very handy ! Interested ? + Drop by the mailing-list, + most things tend to happen there... +

    +
    +