Commit Graph

48 Commits

Author SHA1 Message Date
Carsten Brandt
c19b2f7dc8 release version 2.0.11 2017-02-01 17:46:29 +01:00
Alexander Makarov
2c5ab1e07b Used non-regex solution for trimming slashes 2017-01-31 13:42:38 +01:00
Alexander Makarov
f9e83008f4 Prefer strpos to substr 2017-01-31 13:42:37 +01:00
ErickSkrauch
c641513583 Implementation of support UrlRule with relative host definition
close #12697
fixes #12691
2017-01-31 13:42:31 +01:00
Carsten Brandt
8faedcbd7c Refactored UrlManagerTest to cover more use cases
UrlManager is a complex class with a large bunch of options that needs
to be tested
and we had a few regressions in the past even though there are already a
lot of tests
covering it. Test coverage measured by lines does not help us determine
how good it is tested,
we need test coverage for every major path through the code.

I have refactored the UrlManager tests to reflect the different options
and cases to
have a better overview of which cases are covered and which are not.

UrlManager has two main operation modes:

- "default" url format, which is the simple case. These are covered by
  methods in `UrlManagerTest`.

- "pretty" url format. This is the complex case, which involves UrlRules
  and url parsing.
  I have created two separate classes for this case:
  Url creation for "pretty" url format is covered by
`UrlManagerCreateUrlTest`.
  Url parsing for "pretty" url format is covered by
`UrlManagerParseUrlTest`.

Each of the test classes have a `getUrlManager` method that creates a
UrlManager instance
with a specific configuration and certain variations in options.
It is also tested that options that are not relevant in a certain
operation mode have no effect on the result.

To make sure to not remove tests that have existed before, here is a map
of where code has been moved.
The following test methods existed in the [old test
class](4187718c14/tests/framework/web/UrlManagerTest.php):

- `testCreateUrl()` split between UrlManagerTest and
  UrlManagerCreateUrlTest variations should all be covered by
`variationsProvider()`.
- `testCreateUrlWithNullParams()` covered by UrlManagerCreateUrlTest by
  `testWithNullParams()`
- `testCreateUrlWithEmptyPattern()`
- `testCreateAbsoluteUrl()` covered in UrlManagerCreateUrlTest by new
  tests via `variationsProvider()`.
- `testCreateAbsoluteUrlWithSuffix()` covered in UrlManagerCreateUrlTest
  by `testAbsolutePatterns`.

- `testParseRequest()` covered by UrlManagerParseUrlTest, UrlNormalizer
  related parts moved to UrlNormalizerTest.
- `testParseRESTRequest()` moved to UrlManagerParseUrlTest
- `testHash()` covered in different tests in UrlManagerCreateUrlTest.
- `testMultipleHostsRules($host)` kept as is.

Before:

    $ vendor/bin/phpunit tests/framework/web/UrlManagerTest.php
    ...
    OK (12 tests, 89 assertions)

After:

    $ vendor/bin/phpunit tests/framework/web/UrlManager*.php
    ...
    OK (72 tests, 648 assertions)
2017-01-31 02:38:35 +01:00
Dmitriy Bashkarev
be4ebdd049 Fixes #13134: Added logging URL rules (bashkarev) 2017-01-27 19:03:45 +03:00
Robert Korulczyk
507cc52658 Allow omit default params on URL creation
Fixes #10970
2017-01-22 22:19:13 +02:00
Robert Korulczyk
4aa935e69e Fixes #12055: Changed boolean to bool and integer to int in phpdoc 2016-11-07 02:51:39 +03:00
Robert Korulczyk
8142de23d4 Improve normalizer for URL manager 2016-08-30 21:25:23 +02:00
Cronfy
a7f63b6da3 Add normalizer for URL manager. 2016-08-30 21:22:58 +02:00
Nikola Kovacs
9d327baa8b coding style fixes 2016-05-26 11:19:32 +02:00
Carsten Brandt
3d719d057e review yii\web namespaces docs 2016-02-12 16:21:32 +01:00
Carsten Brandt
f620f4de90 phpdoc fixes 2016-02-07 19:48:13 +01:00
SilverFire - Dmitry Naumenko
cd87d67f34 Global DOCS update: ~~~ replaced with ``` 2015-12-02 23:15:28 +02:00
SilverFire - Dima Naumenko
e3c49f243c UrlRule::placeholders, UrlRule::substitutePlaceholderNames are now protected. Updated PHPDoc and UPDATE.md 2015-11-09 19:22:51 +02:00
SilverFire - Dima Naumenko
289b051c4a Bug #9999: Fixed yii\web\UrlRule to allow route parameter names with -, _, .characters 2015-10-31 09:45:53 +02:00
Chris Harris
26e5b021a8 Fixes #9246: Added yii\web\UrlRule::getParamRules() 2015-07-29 17:10:51 +03:00
Qiang Xue
72c34cda1e Fixes #6871: Fixed the bug that using defaults and hostnames in URL rules may cause an out-of-range index issue 2015-03-27 22:52:01 -04:00
Carsten Brandt
792746883e urlManager: ensure route is trimmed by / on empty pattern
fixes #6717
2015-01-01 17:06:12 +01:00
Alexander Mohorev
899b778994 Correct type declarations 2014-10-25 16:35:50 +03:00
Alexander Makarov
50fd1f586c Bug: yii\web\UrlRule was unable to create URLs for rules containing unicode characters 2014-10-24 05:06:37 +04:00
Qiang Xue
be2828d593 Fixes #5484: Fixed potential string suffix detection failure on 5.5.11 2014-10-11 09:35:55 -04:00
Tadas Z
f010fb57b4 Enh #4581: Added ability to disable url encoding in UrlRule. 2014-08-04 00:07:36 +03:00
Alexander Makarov
07f01bcf2b Used substr_compare instead of substr when we don't care about result 2014-07-23 16:37:49 +04:00
Carsten Brandt
435747cf98 apidoc and codestyle fixes 2014-03-26 23:03:18 +01:00
Carsten Brandt
bf3c75147d reverted breaking PHPdoc codestyle changes
issue #2852
2014-03-23 20:51:09 +01:00
SonicGD
b5f8a4dc22 Reformat code te be PSR-2 compatible 2014-03-16 10:46:21 +06:00
Qiang Xue
21f2f38b35 Fixes #2691: Null parameters will not be included in the generated URLs by UrlManager 2014-03-12 20:26:20 -04:00
Qiang Xue
65bfd1633b Fixes #2646: Added support for specifying hostinfo in the pattern of a URL rule 2014-03-07 09:53:55 -05:00
Qiang Xue
48a12559b2 rest api WIP 2014-03-01 23:14:16 -05:00
Qiang Xue
24e086deaf Added yii\web\UrlRuleInterface and yii\web\CompositeUrlRule 2014-02-28 14:40:25 -05:00
Alexander Makarov
462c50031a Fixes #1930: Fixed domain based URL matching for website root 2014-01-17 21:06:13 +04:00
Qiang Xue
0c38655217 psr-4 move 2014-01-10 21:41:43 -05:00
Qiang Xue
0d814fa523 Moved "framework" to "iii". 2013-05-09 12:00:15 -04:00
LAV45
57e175552a The first rule of a template can not start with a "/", even if it has a default value 2013-05-08 18:10:02 +03:00
Alexander Kochetov
48d04fbb8c !== array() => !empty() 2013-05-07 19:57:27 +04:00
Qiang Xue
4fdaab3560 updated file header. 2013-03-04 08:03:46 -05:00
Qiang Xue
a095d383e2 refactored url management. 2013-02-27 11:19:24 -05:00
Qiang Xue
a5fe4a6af2 Fixed URLManager bugs. 2013-02-20 08:25:06 -05:00
Qiang Xue
c08c2e8b72 url wip 2013-02-17 12:50:03 -05:00
Qiang Xue
12fbb0f71d url WIP 2013-02-11 19:51:18 -05:00
Qiang Xue
f65a0bd9ac url wip 2013-02-11 16:34:02 -05:00
Qiang Xue
e25ad4bc88 URL wip. 2013-02-11 13:29:53 -05:00
Qiang Xue
a946a86386 fixed parseUrl. 2013-02-11 08:49:44 -05:00
Qiang Xue
f31369e7c1 url wip 2013-02-10 21:55:15 -05:00
Qiang Xue
712f4dae0d url wip 2013-02-10 14:53:35 -05:00
Qiang Xue
ab42ab2d52 url wip 2013-02-08 16:32:43 -05:00
Qiang Xue
379fddfec3 URL manager WIP 2013-02-08 08:41:22 -05:00