Merge pull request #796 from dawnbreak/QA_testing

Testing HTML 2 Markdown conversion.
This commit is contained in:
git-marijus 2017-05-28 18:00:58 +02:00 committed by GitHub
commit 98fe474276
7 changed files with 538 additions and 142 deletions

View File

@ -37,7 +37,7 @@
}, },
"require-dev" : { "require-dev" : {
"php" : ">=7.0", "php" : ">=7.0",
"phpunit/phpunit" : "^6.0", "phpunit/phpunit" : "^6.1",
"behat/behat" : "@stable", "behat/behat" : "@stable",
"behat/mink-extension": "@stable", "behat/mink-extension": "@stable",
"behat/mink-goutte-driver": "@stable", "behat/mink-goutte-driver": "@stable",

459
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "527df9ff589187351b62bffb0c38e3a6", "content-hash": "4a78983d966b7641fd532909d625c21a",
"packages": [ "packages": [
{ {
"name": "bshaffer/oauth2-server-php", "name": "bshaffer/oauth2-server-php",
@ -744,21 +744,21 @@
"packages-dev": [ "packages-dev": [
{ {
"name": "behat/behat", "name": "behat/behat",
"version": "v3.3.0", "version": "v3.3.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Behat/Behat.git", "url": "https://github.com/Behat/Behat.git",
"reference": "15a3a1857457eaa29cdf41564a5e421effb09526" "reference": "44a58c1480d6144b2dc2c2bf02b9cef73c83840d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Behat/Behat/zipball/15a3a1857457eaa29cdf41564a5e421effb09526", "url": "https://api.github.com/repos/Behat/Behat/zipball/44a58c1480d6144b2dc2c2bf02b9cef73c83840d",
"reference": "15a3a1857457eaa29cdf41564a5e421effb09526", "reference": "44a58c1480d6144b2dc2c2bf02b9cef73c83840d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"behat/gherkin": "^4.4.4", "behat/gherkin": "^4.4.4",
"behat/transliterator": "~1.0", "behat/transliterator": "^1.2",
"container-interop/container-interop": "^1.1", "container-interop/container-interop": "^1.1",
"ext-mbstring": "*", "ext-mbstring": "*",
"php": ">=5.3.3", "php": ">=5.3.3",
@ -822,7 +822,7 @@
"symfony", "symfony",
"testing" "testing"
], ],
"time": "2016-12-25T13:43:52+00:00" "time": "2017-05-15T16:49:16+00:00"
}, },
{ {
"name": "behat/gherkin", "name": "behat/gherkin",
@ -1113,25 +1113,29 @@
}, },
{ {
"name": "behat/transliterator", "name": "behat/transliterator",
"version": "v1.1.0", "version": "v1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/Behat/Transliterator.git", "url": "https://github.com/Behat/Transliterator.git",
"reference": "868e05be3a9f25ba6424c2dd4849567f50715003" "reference": "826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/Behat/Transliterator/zipball/868e05be3a9f25ba6424c2dd4849567f50715003", "url": "https://api.github.com/repos/Behat/Transliterator/zipball/826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c",
"reference": "868e05be3a9f25ba6424c2dd4849567f50715003", "reference": "826ce7e9c2a6664c0d1f381cbb38b1fb80a7ee2c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": ">=5.3.3"
}, },
"require-dev": {
"chuyskywalker/rolling-curl": "^3.1",
"php-yaoi/php-yaoi": "^1.0"
},
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.1-dev" "dev-master": "1.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -1149,7 +1153,7 @@
"slug", "slug",
"transliterator" "transliterator"
], ],
"time": "2015-09-28T16:26:35+00:00" "time": "2017-04-04T11:38:05+00:00"
}, },
{ {
"name": "container-interop/container-interop", "name": "container-interop/container-interop",
@ -1400,16 +1404,16 @@
}, },
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "1.4.1", "version": "1.4.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855" "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/0d6c7ca039329247e4f0f8f8f6506810e8248855", "url": "https://api.github.com/repos/guzzle/psr7/zipball/f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"reference": "0d6c7ca039329247e4f0f8f8f6506810e8248855", "reference": "f5b8a8512e2b58b0071a7280e39f14f72e05d87c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1461,20 +1465,20 @@
"uri", "uri",
"url" "url"
], ],
"time": "2017-02-27T10:51:17+00:00" "time": "2017-03-20T17:10:46+00:00"
}, },
{ {
"name": "myclabs/deep-copy", "name": "myclabs/deep-copy",
"version": "1.6.0", "version": "1.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/myclabs/DeepCopy.git", "url": "https://github.com/myclabs/DeepCopy.git",
"reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe" "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/5a5a9fc8025a08d8919be87d6884d5a92520cefe", "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"reference": "5a5a9fc8025a08d8919be87d6884d5a92520cefe", "reference": "8e6e04167378abf1ddb4d3522d8755c5fd90d102",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1503,7 +1507,109 @@
"object", "object",
"object graph" "object graph"
], ],
"time": "2017-01-26T22:05:40+00:00" "time": "2017-04-12T18:52:22+00:00"
},
{
"name": "phar-io/manifest",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/manifest.git",
"reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0",
"reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-phar": "*",
"phar-io/version": "^1.0.1",
"php": "^5.6 || ^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
},
{
"name": "Sebastian Heuer",
"email": "sebastian@phpeople.de",
"role": "Developer"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "Developer"
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"time": "2017-03-05T18:14:27+00:00"
},
{
"name": "phar-io/version",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/version.git",
"reference": "a70c0ced4be299a63d32fa96d9281d03e94041df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df",
"reference": "a70c0ced4be299a63d32fa96d9281d03e94041df",
"shasum": ""
},
"require": {
"php": "^5.6 || ^7.0"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
},
{
"name": "Sebastian Heuer",
"email": "sebastian@phpeople.de",
"role": "Developer"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "Developer"
}
],
"description": "Library for handling version information and constraints",
"time": "2017-03-05T17:38:23+00:00"
}, },
{ {
"name": "php-mock/php-mock", "name": "php-mock/php-mock",
@ -1881,16 +1987,16 @@
}, },
{ {
"name": "phpunit/php-code-coverage", "name": "phpunit/php-code-coverage",
"version": "5.0.2", "version": "5.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "531553c4795a1df54114342d68ca337d5d81c8a0" "reference": "dc421f9ca5082a0c0cb04afb171c765f79add85b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/531553c4795a1df54114342d68ca337d5d81c8a0", "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/dc421f9ca5082a0c0cb04afb171c765f79add85b",
"reference": "531553c4795a1df54114342d68ca337d5d81c8a0", "reference": "dc421f9ca5082a0c0cb04afb171c765f79add85b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1901,20 +2007,21 @@
"phpunit/php-text-template": "^1.2", "phpunit/php-text-template": "^1.2",
"phpunit/php-token-stream": "^1.4.11 || ^2.0", "phpunit/php-token-stream": "^1.4.11 || ^2.0",
"sebastian/code-unit-reverse-lookup": "^1.0", "sebastian/code-unit-reverse-lookup": "^1.0",
"sebastian/environment": "^2.0", "sebastian/environment": "^3.0",
"sebastian/version": "^2.0" "sebastian/version": "^2.0",
"theseer/tokenizer": "^1.1"
}, },
"require-dev": { "require-dev": {
"ext-xdebug": "^2.5", "ext-xdebug": "^2.5",
"phpunit/phpunit": "^6.0" "phpunit/phpunit": "^6.0"
}, },
"suggest": { "suggest": {
"ext-xdebug": "^2.5.1" "ext-xdebug": "^2.5.3"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "5.0.x-dev" "dev-master": "5.2.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -1940,7 +2047,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2017-03-01T09:14:18+00:00" "time": "2017-04-21T08:03:57+00:00"
}, },
{ {
"name": "phpunit/php-file-iterator", "name": "phpunit/php-file-iterator",
@ -2130,16 +2237,16 @@
}, },
{ {
"name": "phpunit/phpunit", "name": "phpunit/phpunit",
"version": "6.0.8", "version": "6.1.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git", "url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "47ee3fa1bca5c50f1d25105201eb20df777bd7b6" "reference": "824d02024916525a36b2db21847a5ef91db9e4a8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/47ee3fa1bca5c50f1d25105201eb20df777bd7b6", "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/824d02024916525a36b2db21847a5ef91db9e4a8",
"reference": "47ee3fa1bca5c50f1d25105201eb20df777bd7b6", "reference": "824d02024916525a36b2db21847a5ef91db9e4a8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2149,19 +2256,21 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"ext-xml": "*", "ext-xml": "*",
"myclabs/deep-copy": "^1.3", "myclabs/deep-copy": "^1.3",
"phar-io/manifest": "^1.0.1",
"phar-io/version": "^1.0",
"php": "^7.0", "php": "^7.0",
"phpspec/prophecy": "^1.6.2", "phpspec/prophecy": "^1.7",
"phpunit/php-code-coverage": "^5.0", "phpunit/php-code-coverage": "^5.2",
"phpunit/php-file-iterator": "^1.4", "phpunit/php-file-iterator": "^1.4",
"phpunit/php-text-template": "^1.2", "phpunit/php-text-template": "^1.2",
"phpunit/php-timer": "^1.0.6", "phpunit/php-timer": "^1.0.6",
"phpunit/phpunit-mock-objects": "^4.0", "phpunit/phpunit-mock-objects": "^4.0",
"sebastian/comparator": "^1.2.4 || ^2.0", "sebastian/comparator": "^2.0",
"sebastian/diff": "^1.2", "sebastian/diff": "^1.2",
"sebastian/environment": "^2.0", "sebastian/environment": "^3.0.1",
"sebastian/exporter": "^2.0 || ^3.0", "sebastian/exporter": "^3.1",
"sebastian/global-state": "^1.1 || ^2.0", "sebastian/global-state": "^1.1 || ^2.0",
"sebastian/object-enumerator": "^2.0 || ^3.0", "sebastian/object-enumerator": "^3.0.2",
"sebastian/resource-operations": "^1.0", "sebastian/resource-operations": "^1.0",
"sebastian/version": "^2.0" "sebastian/version": "^2.0"
}, },
@ -2182,7 +2291,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "6.0.x-dev" "dev-master": "6.1.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -2208,7 +2317,7 @@
"testing", "testing",
"xunit" "xunit"
], ],
"time": "2017-03-02T15:24:03+00:00" "time": "2017-04-29T10:40:17+00:00"
}, },
{ {
"name": "phpunit/phpunit-mock-objects", "name": "phpunit/phpunit-mock-objects",
@ -2531,28 +2640,28 @@
}, },
{ {
"name": "sebastian/environment", "name": "sebastian/environment",
"version": "2.0.0", "version": "3.0.3",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/environment.git", "url": "https://github.com/sebastianbergmann/environment.git",
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac" "reference": "02b6b2c7aefe2cdb1185b8dbf8718b0bcedf3ab3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/02b6b2c7aefe2cdb1185b8dbf8718b0bcedf3ab3",
"reference": "5795ffe5dc5b02460c3e34222fee8cbe245d8fac", "reference": "02b6b2c7aefe2cdb1185b8dbf8718b0bcedf3ab3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^5.6 || ^7.0" "php": "^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^5.0" "phpunit/phpunit": "^6.1"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "2.0.x-dev" "dev-master": "3.0.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -2577,20 +2686,20 @@
"environment", "environment",
"hhvm" "hhvm"
], ],
"time": "2016-11-26T07:53:53+00:00" "time": "2017-05-18T10:10:00+00:00"
}, },
{ {
"name": "sebastian/exporter", "name": "sebastian/exporter",
"version": "3.0.0", "version": "3.1.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git", "url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "b82d077cb3459e393abcf4867ae8f7230dcb51f6" "reference": "234199f4528de6d12aaa58b612e98f7d36adb937"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/b82d077cb3459e393abcf4867ae8f7230dcb51f6", "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937",
"reference": "b82d077cb3459e393abcf4867ae8f7230dcb51f6", "reference": "234199f4528de6d12aaa58b612e98f7d36adb937",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2604,7 +2713,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0.x-dev" "dev-master": "3.1.x-dev"
} }
}, },
"autoload": { "autoload": {
@ -2644,27 +2753,27 @@
"export", "export",
"exporter" "exporter"
], ],
"time": "2017-03-03T06:25:06+00:00" "time": "2017-04-03T13:19:02+00:00"
}, },
{ {
"name": "sebastian/global-state", "name": "sebastian/global-state",
"version": "1.1.1", "version": "2.0.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git", "url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4",
"reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.3.3" "php": "^7.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "~4.2" "phpunit/phpunit": "^6.0"
}, },
"suggest": { "suggest": {
"ext-uopz": "*" "ext-uopz": "*"
@ -2672,7 +2781,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.0-dev" "dev-master": "2.0-dev"
} }
}, },
"autoload": { "autoload": {
@ -2695,24 +2804,25 @@
"keywords": [ "keywords": [
"global state" "global state"
], ],
"time": "2015-10-12T03:26:01+00:00" "time": "2017-04-27T15:39:26+00:00"
}, },
{ {
"name": "sebastian/object-enumerator", "name": "sebastian/object-enumerator",
"version": "3.0.0", "version": "3.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git", "url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "de6e32f7192dfea2e4bedc892434f4830b5c5794" "reference": "31dd3379d16446c5d86dec32ab1ad1f378581ad8"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/de6e32f7192dfea2e4bedc892434f4830b5c5794", "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/31dd3379d16446c5d86dec32ab1ad1f378581ad8",
"reference": "de6e32f7192dfea2e4bedc892434f4830b5c5794", "reference": "31dd3379d16446c5d86dec32ab1ad1f378581ad8",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.0", "php": "^7.0",
"sebastian/object-reflector": "^1.0",
"sebastian/recursion-context": "^3.0" "sebastian/recursion-context": "^3.0"
}, },
"require-dev": { "require-dev": {
@ -2741,7 +2851,52 @@
], ],
"description": "Traverses array structures and object graphs to enumerate all referenced objects", "description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/", "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"time": "2017-03-03T06:21:01+00:00" "time": "2017-03-12T15:17:29+00:00"
},
{
"name": "sebastian/object-reflector",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-reflector.git",
"reference": "773f97c67f28de00d397be301821b06708fca0be"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be",
"reference": "773f97c67f28de00d397be301821b06708fca0be",
"shasum": ""
},
"require": {
"php": "^7.0"
},
"require-dev": {
"phpunit/phpunit": "^6.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
"time": "2017-03-29T09:07:27+00:00"
}, },
{ {
"name": "sebastian/recursion-context", "name": "sebastian/recursion-context",
@ -2883,16 +3038,16 @@
}, },
{ {
"name": "symfony/browser-kit", "name": "symfony/browser-kit",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/browser-kit.git", "url": "https://github.com/symfony/browser-kit.git",
"reference": "394a2475a3a89089353fde5714a7f402fbb83880" "reference": "9fab1ab6f77b77f3df5fc5250fc6956811699b57"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/browser-kit/zipball/394a2475a3a89089353fde5714a7f402fbb83880", "url": "https://api.github.com/repos/symfony/browser-kit/zipball/9fab1ab6f77b77f3df5fc5250fc6956811699b57",
"reference": "394a2475a3a89089353fde5714a7f402fbb83880", "reference": "9fab1ab6f77b77f3df5fc5250fc6956811699b57",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2936,20 +3091,20 @@
], ],
"description": "Symfony BrowserKit Component", "description": "Symfony BrowserKit Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-31T21:49:23+00:00" "time": "2017-04-12T14:13:17+00:00"
}, },
{ {
"name": "symfony/class-loader", "name": "symfony/class-loader",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/class-loader.git", "url": "https://github.com/symfony/class-loader.git",
"reference": "2847d56f518ad5721bf85aa9174b3aa3fd12aa03" "reference": "fc4c04bfd17130a9dccfded9578353f311967da7"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/class-loader/zipball/2847d56f518ad5721bf85aa9174b3aa3fd12aa03", "url": "https://api.github.com/repos/symfony/class-loader/zipball/fc4c04bfd17130a9dccfded9578353f311967da7",
"reference": "2847d56f518ad5721bf85aa9174b3aa3fd12aa03", "reference": "fc4c04bfd17130a9dccfded9578353f311967da7",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2992,20 +3147,20 @@
], ],
"description": "Symfony ClassLoader Component", "description": "Symfony ClassLoader Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-21T17:06:35+00:00" "time": "2017-04-12T14:13:17+00:00"
}, },
{ {
"name": "symfony/config", "name": "symfony/config",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/config.git", "url": "https://github.com/symfony/config.git",
"reference": "9f99453e77771e629af8a25eeb0a6c4ed1e19da2" "reference": "e5533fcc0b3dd377626153b2852707878f363728"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/config/zipball/9f99453e77771e629af8a25eeb0a6c4ed1e19da2", "url": "https://api.github.com/repos/symfony/config/zipball/e5533fcc0b3dd377626153b2852707878f363728",
"reference": "9f99453e77771e629af8a25eeb0a6c4ed1e19da2", "reference": "e5533fcc0b3dd377626153b2852707878f363728",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3048,20 +3203,20 @@
], ],
"description": "Symfony Config Component", "description": "Symfony Config Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-14T16:27:43+00:00" "time": "2017-04-12T14:13:17+00:00"
}, },
{ {
"name": "symfony/console", "name": "symfony/console",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/symfony/console.git",
"reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870" "reference": "a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/0e5e6899f82230fcb1153bcaf0e106ffaa44b870", "url": "https://api.github.com/repos/symfony/console/zipball/a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38",
"reference": "0e5e6899f82230fcb1153bcaf0e106ffaa44b870", "reference": "a7a17e0c6c3c4d70a211f80782e4b90ddadeaa38",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3111,20 +3266,20 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T14:07:22+00:00" "time": "2017-04-26T01:39:17+00:00"
}, },
{ {
"name": "symfony/css-selector", "name": "symfony/css-selector",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/css-selector.git", "url": "https://github.com/symfony/css-selector.git",
"reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa" "reference": "02983c144038e697c959e6b06ef6666de759ccbc"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/css-selector/zipball/f0e628f04fc055c934b3211cfabdb1c59eefbfaa", "url": "https://api.github.com/repos/symfony/css-selector/zipball/02983c144038e697c959e6b06ef6666de759ccbc",
"reference": "f0e628f04fc055c934b3211cfabdb1c59eefbfaa", "reference": "02983c144038e697c959e6b06ef6666de759ccbc",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3164,20 +3319,20 @@
], ],
"description": "Symfony CssSelector Component", "description": "Symfony CssSelector Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00" "time": "2017-05-01T14:55:58+00:00"
}, },
{ {
"name": "symfony/debug", "name": "symfony/debug",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/debug.git", "url": "https://github.com/symfony/debug.git",
"reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9" "reference": "fd6eeee656a5a7b384d56f1072243fe1c0e81686"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/debug/zipball/9b98854cb45bc59d100b7d4cc4cf9e05f21026b9", "url": "https://api.github.com/repos/symfony/debug/zipball/fd6eeee656a5a7b384d56f1072243fe1c0e81686",
"reference": "9b98854cb45bc59d100b7d4cc4cf9e05f21026b9", "reference": "fd6eeee656a5a7b384d56f1072243fe1c0e81686",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3221,20 +3376,20 @@
], ],
"description": "Symfony Debug Component", "description": "Symfony Debug Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T16:34:18+00:00" "time": "2017-04-19T20:17:50+00:00"
}, },
{ {
"name": "symfony/dependency-injection", "name": "symfony/dependency-injection",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dependency-injection.git", "url": "https://github.com/symfony/dependency-injection.git",
"reference": "130aa55b8ed7e6d0d75b0ed37256cec687a22f41" "reference": "5e00857475b6d1fa31ff4c76f1fddf1cfa9e8d59"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dependency-injection/zipball/130aa55b8ed7e6d0d75b0ed37256cec687a22f41", "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/5e00857475b6d1fa31ff4c76f1fddf1cfa9e8d59",
"reference": "130aa55b8ed7e6d0d75b0ed37256cec687a22f41", "reference": "5e00857475b6d1fa31ff4c76f1fddf1cfa9e8d59",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3284,20 +3439,20 @@
], ],
"description": "Symfony DependencyInjection Component", "description": "Symfony DependencyInjection Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T22:46:52+00:00" "time": "2017-04-26T01:39:17+00:00"
}, },
{ {
"name": "symfony/dom-crawler", "name": "symfony/dom-crawler",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/dom-crawler.git", "url": "https://github.com/symfony/dom-crawler.git",
"reference": "b814b41373fc4e535aff8c765abe39545216f391" "reference": "f1ad34e8af09ed17570e027cf0c58a12eddec286"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/dom-crawler/zipball/b814b41373fc4e535aff8c765abe39545216f391", "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/f1ad34e8af09ed17570e027cf0c58a12eddec286",
"reference": "b814b41373fc4e535aff8c765abe39545216f391", "reference": "f1ad34e8af09ed17570e027cf0c58a12eddec286",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3340,20 +3495,20 @@
], ],
"description": "Symfony DomCrawler Component", "description": "Symfony DomCrawler Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-21T17:14:11+00:00" "time": "2017-04-12T14:13:17+00:00"
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
"reference": "9137eb3a3328e413212826d63eeeb0217836e2b6" "reference": "b8a401f733b43251e1d088c589368b2a94155e40"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9137eb3a3328e413212826d63eeeb0217836e2b6", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/b8a401f733b43251e1d088c589368b2a94155e40",
"reference": "9137eb3a3328e413212826d63eeeb0217836e2b6", "reference": "b8a401f733b43251e1d088c589368b2a94155e40",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3400,20 +3555,20 @@
], ],
"description": "Symfony EventDispatcher Component", "description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-02T20:32:22+00:00" "time": "2017-05-01T14:58:48+00:00"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4" "reference": "040651db13cf061827a460cc10f6e36a445c45b4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", "url": "https://api.github.com/repos/symfony/filesystem/zipball/040651db13cf061827a460cc10f6e36a445c45b4",
"reference": "a0c6ef2dc78d33b58d91d3a49f49797a184d06f4", "reference": "040651db13cf061827a460cc10f6e36a445c45b4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3449,7 +3604,7 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-01-08T20:47:33+00:00" "time": "2017-04-12T14:13:17+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
@ -3512,16 +3667,16 @@
}, },
{ {
"name": "symfony/translation", "name": "symfony/translation",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/translation.git", "url": "https://github.com/symfony/translation.git",
"reference": "d6825c6bb2f1da13f564678f9f236fe8242c0029" "reference": "f4a04d2df710f81515df576b2de06bdeee518b83"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/translation/zipball/d6825c6bb2f1da13f564678f9f236fe8242c0029", "url": "https://api.github.com/repos/symfony/translation/zipball/f4a04d2df710f81515df576b2de06bdeee518b83",
"reference": "d6825c6bb2f1da13f564678f9f236fe8242c0029", "reference": "f4a04d2df710f81515df576b2de06bdeee518b83",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3534,7 +3689,7 @@
"require-dev": { "require-dev": {
"psr/log": "~1.0", "psr/log": "~1.0",
"symfony/config": "~2.8|~3.0", "symfony/config": "~2.8|~3.0",
"symfony/intl": "~2.8|~3.0", "symfony/intl": "^2.8.18|^3.2.5",
"symfony/yaml": "~2.8|~3.0" "symfony/yaml": "~2.8|~3.0"
}, },
"suggest": { "suggest": {
@ -3572,20 +3727,20 @@
], ],
"description": "Symfony Translation Component", "description": "Symfony Translation Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T22:46:52+00:00" "time": "2017-04-12T14:13:17+00:00"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.2.4", "version": "v3.2.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8" "reference": "acec26fcf7f3031e094e910b94b002fa53d4e4d6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/9724c684646fcb5387d579b4bfaa63ee0b0c64c8", "url": "https://api.github.com/repos/symfony/yaml/zipball/acec26fcf7f3031e094e910b94b002fa53d4e4d6",
"reference": "9724c684646fcb5387d579b4bfaa63ee0b0c64c8", "reference": "acec26fcf7f3031e094e910b94b002fa53d4e4d6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3627,7 +3782,47 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2017-02-16T22:46:52+00:00" "time": "2017-05-01T14:55:58+00:00"
},
{
"name": "theseer/tokenizer",
"version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b",
"reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": "^7.0"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"time": "2017-04-07T12:08:54+00:00"
}, },
{ {
"name": "webmozart/assert", "name": "webmozart/assert",

View File

@ -453,15 +453,24 @@ function bb2diaspora_itembody($item, $force_update = false, $have_channel = fals
return html_entity_decode($body); return html_entity_decode($body);
} }
/**
* @brief Prepare bbcode for Diaspora.
*
* @hooks bb2diaspora
* * \e string The prepared text for diaspora.
*
* @param string $Text bbcode
* @param boolean $preserve_nl (default false) preserve new lines
* @param boolean $fordiaspora (default true, but unused)
* @return string
*/
function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) { function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
// Re-enabling the converter again. // Re-enabling the converter again.
// The bbcode parser now handles youtube-links (and the other stuff) correctly. // The bbcode parser now handles youtube-links (and the other stuff) correctly.
// Additionally the html code is now fixed so that lists are now working. // Additionally the html code is now fixed so that lists are now working.
/* // Transform #tags, strip off the [url] and replace spaces with underscore
* Transform #tags, strip off the [url] and replace spaces with underscore
*/
$Text = preg_replace_callback('/#\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/[(zu)]rl\]/i', create_function('$match', $Text = preg_replace_callback('/#\[([zu])rl\=(\w+.*?)\](\w+.*?)\[\/[(zu)]rl\]/i', create_function('$match',
'return \'#\'. str_replace(\' \', \'_\', $match[3]);' 'return \'#\'. str_replace(\' \', \'_\', $match[3]);'
), $Text); ), $Text);
@ -473,7 +482,6 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
// strip map tags, as the rendering is performed in bbcode() and the resulting output // strip map tags, as the rendering is performed in bbcode() and the resulting output
// is not compatible with Diaspora (at least in the case of openstreetmap and probably // is not compatible with Diaspora (at least in the case of openstreetmap and probably
// due to the inclusion of an html iframe) // due to the inclusion of an html iframe)
$Text = preg_replace("/\[map\=(.*?)\]/ism", '$1', $Text); $Text = preg_replace("/\[map\=(.*?)\]/ism", '$1', $Text);
$Text = preg_replace("/\[map\](.*?)\[\/map\]/ism", '$1', $Text); $Text = preg_replace("/\[map\](.*?)\[\/map\]/ism", '$1', $Text);
@ -491,15 +499,12 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
$Text = bbcode($Text, $preserve_nl, false); $Text = bbcode($Text, $preserve_nl, false);
// Markdownify does not preserve previously escaped html entities such as <> and &. // Markdownify does not preserve previously escaped html entities such as <> and &.
$Text = str_replace(array('&lt;','&gt;','&amp;'),array('&_lt_;','&_gt_;','&_amp_;'),$Text); $Text = str_replace(array('&lt;','&gt;','&amp;'),array('&_lt_;','&_gt_;','&_amp_;'),$Text);
// Now convert HTML to Markdown // Now convert HTML to Markdown
$md = new HtmlConverter(); $Text = html2markdown($Text);
$Text = $md->convert($Text);
// It also adds backslashes to our attempt at getting around the html entity preservation for some weird reason. // It also adds backslashes to our attempt at getting around the html entity preservation for some weird reason.
$Text = str_replace(array('&\\_lt\\_;','&\\_gt\\_;','&\\_amp\\_;'),array('&lt;','&gt;','&amp;'),$Text); $Text = str_replace(array('&\\_lt\\_;','&\\_gt\\_;','&\\_amp\\_;'),array('&lt;','&gt;','&amp;'),$Text);
// If the text going into bbcode() has a plain URL in it, i.e. // If the text going into bbcode() has a plain URL in it, i.e.
@ -516,7 +521,6 @@ function bb2diaspora($Text, $preserve_nl = false, $fordiaspora = true) {
// Remove any leading or trailing whitespace, as this will mess up // Remove any leading or trailing whitespace, as this will mess up
// the Diaspora signature verification and cause the item to disappear // the Diaspora signature verification and cause the item to disappear
$Text = trim($Text); $Text = trim($Text);
call_hooks('bb2diaspora', $Text); call_hooks('bb2diaspora', $Text);
@ -563,3 +567,31 @@ function format_event_diaspora($ev) {
return $o; return $o;
} }
/**
* @brief Convert a HTML text into Markdown.
*
* This function uses the library league/html-to-markdown for this task.
*
* If the HTML text can not get parsed it will return an empty string.
*
* @see HTMLToMarkdown
*
* @param string $html The HTML code to convert
* @return string Markdown representation of the given HTML text, empty on error
*/
function html2markdown($html) {
$markdown = '';
$converter = new HtmlConverter();
try {
$markdown = $converter->convert($html);
} catch (InvalidArgumentException $e) {
logger("Invalid HTML. HTMLToMarkdown library threw an exception.");
}
// The old html 2 markdown library "pixel418/markdownify": "^2.2",
//$md = new HtmlConverter();
//$markdown = $md->convert($Text);
return $markdown;
}

View File

@ -0,0 +1,149 @@
<?php
/*
* Copyright (c) 2017 Hubzilla
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
namespace Zotlabs\Tests\Unit\includes;
use Zotlabs\Tests\Unit\UnitTestCase;
use phpmock\phpunit\PHPMock;
require_once 'include/markdown.php';
/**
* @brief Unit Test case for markdown functions.
*/
class MarkdownTest extends UnitTestCase {
use PHPMock;
/**
* @covers ::html2markdown
* @dataProvider html2markdownProvider
*/
public function testHtml2markdown($html, $markdown) {
$this->assertEquals($markdown, html2markdown($html));
}
public function html2markdownProvider() {
return [
'empty text' => [
'',
''
],
'space and nbsp only' => [
' &nbsp;',
''
],
'strong, b, em, i, bib' => [
'<strong>strong</strong> <b>bold</b> <em>em</em> <i>italic</i> <b>bo<i>italic</i>ld</b>',
'**strong** **bold** _em_ _italic_ **bo_italic_ld**'
],
'empty tags' => [
'text1 <b></b> text2 <i></i>',
'text1 text2'
],
'HTML entities, lt does not work' => [
'& gt > lt <',
'& gt > lt'
],
'escaped HTML entities' => [
'&amp; lt &lt; gt &gt;',
'& lt < gt >'
],
'our escaped HTML entities' => [
'&_lt_; &_gt_; &_amp_;',
'&\_lt\_; &\_gt\_; &\_amp\_;'
],
'linebreak' => [
"line1<br>line2\nline3",
"line1 \nline2 line3"
],
'headlines' => [
'<h1>header1</h1><h3>Header 3</h3>',
"header1\n=======\n\n### Header 3"
],
'unordered list' => [
'<ul><li>Item 1</li><li>Item 2</li><li>Item <b>3</b></li></ul>',
"- Item 1\n- Item 2\n- Item **3**"
],
'ordered list' => [
'<ol><li>Item 1</li><li>Item 2</li><li>Item <b>3</b></li></ol>',
"1. Item 1\n2. Item 2\n3. Item **3**"
],
'nested lists' => [
'<ul><li>Item 1<ol><li>Item 1a</li><li>Item <b>1b</b></ol></li><li>Item 2</li></ul>',
"- Item 1\n 1. Item 1a\n 2. Item **1b**\n- Item 2"
],
'img' => [
'<img src="/path/to/img.png" alt="alt text" title="title text">',
'![alt text](/path/to/img.png "title text")'
],
'link' => [
'<a href="http://hubzilla.org" title="Hubzilla">link</a>',
'[link](http://hubzilla.org "Hubzilla")'
],
'img link' => [
'<a href="http://hubzilla.org" title="Hubzilla"><img src="/img/hubzilla.png" alt="alt img text" title="img title"></a>',
'[![alt img text](/img/hubzilla.png "img title")](http://hubzilla.org "Hubzilla")'
],
'script' => [
"<script>alert('test');</script>",
"<script>alert('test');</script>"
],
'blockquote, issue #793' => [
'<blockquote>something</blockquote>blah',
"> something\n\nblah"
],
'code' => [
'<code>&lt;p&gt;HTML text&lt;/p&gt;</code>',
'`<p>HTML text</p>`'
],
'pre' => [
'<pre> line with spaces </pre>',
'` line with spaces `'
],
'div p' => [
'<div>div</div><div><p>p</p></div>',
"<div>div</div><div>p\n\n</div>"
]
];
}
/*public function testHtml2markdownException() {
//$this->expectException(\InvalidArgumentException::class);
// need to stub logger() for this to work
$this->assertEquals('', html2markdown('<<invalid'));
}*/
/* public function testBB2diasporaMardown() {
//stub bbcode() and return our HTML, we just need to test the HTML2Markdown library.
$html1 = 'test<b>bold</b><br><i>i</i><ul><li>li1</li><li>li2</li></ul><br>';
$bb1 = 'test';
// php-mock can not mock global functions which is called by a global function.
// If the calling function is in a namespace it does work.
$bbc = $this->getFunctionMock(__NAMESPACE__, "bbcode");
$bbc->expects($this->once())->willReturn('test<b>bold</b><br><i>i</i><ul><li>li1</li><li>li2</li></ul><br>');
$this->assertEquals($bb1, bb2diaspora($html1));
}
*/
}

View File

@ -11,6 +11,9 @@ use Zotlabs\Tests\Unit\UnitTestCase;
*/ */
class TextTest extends UnitTestCase { class TextTest extends UnitTestCase {
/**
* @covers ::valid_email_regex
*/
public function testGoodEmail() { public function testGoodEmail() {
$this->assertTrue(valid_email_regex('ken@spaz.org')); $this->assertTrue(valid_email_regex('ken@spaz.org'));
$this->assertTrue(valid_email_regex('ken@restivo.org')); $this->assertTrue(valid_email_regex('ken@restivo.org'));
@ -18,11 +21,17 @@ class TextTest extends UnitTestCase {
$this->assertTrue(valid_email_regex('foo+nobody@hubzilla.org')); $this->assertTrue(valid_email_regex('foo+nobody@hubzilla.org'));
} }
/**
* @covers ::valid_email_regex
*/
public function testBadEmail() { public function testBadEmail() {
$this->assertFalse(valid_email_regex('nobody!uses!these!any.more')); $this->assertFalse(valid_email_regex('nobody!uses!these!any.more'));
$this->assertFalse(valid_email_regex('foo@bar@hubzilla.org')); $this->assertFalse(valid_email_regex('foo@bar@hubzilla.org'));
} }
/**
* @covers ::purify_html
*/
public function testPurifyHTML() { public function testPurifyHTML() {
// linebreaks // linebreaks
$htmlbr = 'first line<br /> $htmlbr = 'first line<br />
@ -46,6 +55,9 @@ empty line above';
$this->assertEquals('<ul><li>item1</li></ul>', purify_html('<ul data-accordion-menu-unknown><li>item1</li></ul>')); $this->assertEquals('<ul><li>item1</li></ul>', purify_html('<ul data-accordion-menu-unknown><li>item1</li></ul>'));
} }
/**
* @covers ::purify_html
*/
public function testPurifyHTML_html() { public function testPurifyHTML_html() {
$this->assertEquals('<div id="id01"><p class="class01">ids und classes</p></div>', purify_html('<div id="id01"><p class="class01">ids und classes</p></div>')); $this->assertEquals('<div id="id01"><p class="class01">ids und classes</p></div>', purify_html('<div id="id01"><p class="class01">ids und classes</p></div>'));
$this->assertEquals('<div><p>close missing tags</p></div>', purify_html('<div><p>close missing tags')); $this->assertEquals('<div><p>close missing tags</p></div>', purify_html('<div><p>close missing tags'));
@ -59,6 +71,9 @@ empty line above';
$this->assertEquals('', purify_html('<iframe width="560" height="315" src="https://www.youtube.com/embed/kiNGx5oL7hk" frameborder="0" allowfullscreen></iframe>')); $this->assertEquals('', purify_html('<iframe width="560" height="315" src="https://www.youtube.com/embed/kiNGx5oL7hk" frameborder="0" allowfullscreen></iframe>'));
} }
/**
* @covers ::purify_html
*/
public function testPurifyHTML_js() { public function testPurifyHTML_js() {
$this->assertEquals('<div></div>', purify_html('<div><img src="javascript:evil();" onload="evil();"></div>')); $this->assertEquals('<div></div>', purify_html('<div><img src="javascript:evil();" onload="evil();"></div>'));
$this->assertEquals('<a href="#">link</a>', purify_html('<a href="#" onclick="alert(\'xss\')">link</a>')); $this->assertEquals('<a href="#">link</a>', purify_html('<a href="#" onclick="alert(\'xss\')">link</a>'));
@ -66,6 +81,9 @@ empty line above';
$this->assertEquals('', purify_html('<script>alter("42")</script>')); $this->assertEquals('', purify_html('<script>alter("42")</script>'));
} }
/**
* @covers ::purify_html
*/
public function testPurifyHTML_css() { public function testPurifyHTML_css() {
$this->assertEquals('<p style="color:#FF0000;background-color:#fff;">red</p>', purify_html('<p style="color:red; background-color:#fff">red</p>')); $this->assertEquals('<p style="color:#FF0000;background-color:#fff;">red</p>', purify_html('<p style="color:red; background-color:#fff">red</p>'));
$this->assertEquals('<p>invalid color</p>', purify_html('<p style="color:invalid; background-color:#jjkkmm">invalid color</p>')); $this->assertEquals('<p>invalid color</p>', purify_html('<p style="color:invalid; background-color:#jjkkmm">invalid color</p>'));

View File

@ -787,6 +787,7 @@ return array(
'Zotlabs\\Module\\Admin\\Themes' => $baseDir . '/Zotlabs/Module/Admin/Themes.php', 'Zotlabs\\Module\\Admin\\Themes' => $baseDir . '/Zotlabs/Module/Admin/Themes.php',
'Zotlabs\\Module\\Api' => $baseDir . '/Zotlabs/Module/Api.php', 'Zotlabs\\Module\\Api' => $baseDir . '/Zotlabs/Module/Api.php',
'Zotlabs\\Module\\Appman' => $baseDir . '/Zotlabs/Module/Appman.php', 'Zotlabs\\Module\\Appman' => $baseDir . '/Zotlabs/Module/Appman.php',
'Zotlabs\\Module\\Apporder' => $baseDir . '/Zotlabs/Module/Apporder.php',
'Zotlabs\\Module\\Apps' => $baseDir . '/Zotlabs/Module/Apps.php', 'Zotlabs\\Module\\Apps' => $baseDir . '/Zotlabs/Module/Apps.php',
'Zotlabs\\Module\\Attach' => $baseDir . '/Zotlabs/Module/Attach.php', 'Zotlabs\\Module\\Attach' => $baseDir . '/Zotlabs/Module/Attach.php',
'Zotlabs\\Module\\Authtest' => $baseDir . '/Zotlabs/Module/Authtest.php', 'Zotlabs\\Module\\Authtest' => $baseDir . '/Zotlabs/Module/Authtest.php',

View File

@ -916,6 +916,7 @@ class ComposerStaticInit7b34d7e50a62201ec5d5e526a5b8b35d
'Zotlabs\\Module\\Admin\\Themes' => __DIR__ . '/../..' . '/Zotlabs/Module/Admin/Themes.php', 'Zotlabs\\Module\\Admin\\Themes' => __DIR__ . '/../..' . '/Zotlabs/Module/Admin/Themes.php',
'Zotlabs\\Module\\Api' => __DIR__ . '/../..' . '/Zotlabs/Module/Api.php', 'Zotlabs\\Module\\Api' => __DIR__ . '/../..' . '/Zotlabs/Module/Api.php',
'Zotlabs\\Module\\Appman' => __DIR__ . '/../..' . '/Zotlabs/Module/Appman.php', 'Zotlabs\\Module\\Appman' => __DIR__ . '/../..' . '/Zotlabs/Module/Appman.php',
'Zotlabs\\Module\\Apporder' => __DIR__ . '/../..' . '/Zotlabs/Module/Apporder.php',
'Zotlabs\\Module\\Apps' => __DIR__ . '/../..' . '/Zotlabs/Module/Apps.php', 'Zotlabs\\Module\\Apps' => __DIR__ . '/../..' . '/Zotlabs/Module/Apps.php',
'Zotlabs\\Module\\Attach' => __DIR__ . '/../..' . '/Zotlabs/Module/Attach.php', 'Zotlabs\\Module\\Attach' => __DIR__ . '/../..' . '/Zotlabs/Module/Attach.php',
'Zotlabs\\Module\\Authtest' => __DIR__ . '/../..' . '/Zotlabs/Module/Authtest.php', 'Zotlabs\\Module\\Authtest' => __DIR__ . '/../..' . '/Zotlabs/Module/Authtest.php',