Closed (fixed)
Project:
Drupal core
Version:
8.0.x-dev
Component:
base system
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
31 Aug 2013 at 00:27 UTC
Updated:
29 Jul 2014 at 22:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
pwolanin commentedComment #2
pwolanin commentedclosed as duplicate: #2051813: Reuse the link generator to provide a Drupal::link() function
Comment #3
pwolanin commentedmissing text for the link...
Comment #4
dawehner+++ b/core/lib/Drupal.php
@@ -381,6 +381,17 @@ public static function urlGenerator() {
+ public static function url($route_name, $rotue_parameters = array(), $options = array()) {
+ return static::$container->get('url_generator')->generateFromRoute($route_name, $route_parameters, $options);
@@ -390,6 +401,17 @@ public static function linkGenerator() {
+ public static function l($route_name, $rotue_parameters = array(), $options = array()) {
+ return static::$container->get('link_generator')->generate($route_name, $route_parameters, $options);
I tried to find funny images of rotue but I couldn't find one :(
Let's do the url() bits into #2073813: Add a UrlGenerator helper to FormBase and ControllerBase and concentrate on the link generator here.
Yes this unit test is kind of pointless, but nevertheless I want to show people that they should use unit tests where possible.
Comment #5
pwolanin commentedSince Drupal::url() doesn't' seem to be in the FormBase patch, adding it back here plus more doxygen and oxygen fixes.
I thin a DX question here is whether we want to catch some or all of the possible exceptions - e.g. in the way url() does if the generator is not initialized.
Comment #6
dawehnerPlease copy the docs from the other issue, they are alligned properly.
Comment #7
pwolanin commented@dawehner - ha, indeed - when I looked at your other patch I figured we'd need to copy that version to here.
Comment #8
dawehnerWell we don't test the url() methods but I don't really care.
Comment #9
webchickI'm guessing
return static::$container->get('url_generator')->generateFromRoute($route_name, $route_parameters, $options);is already tested elsewhere. If so, I don't see an overly compelling reason to test a wrapper function. Especially only one of them and not both.That fills my soul with happiness tho.
Comment #10
webchickActually, I can just commit it without that hunk.
Committed and pushed to 8.x. Thanks!
Comment #11
pwolanin commentedupdated these 2 change notices:
https://drupal.org/node/2078263
https://drupal.org/node/2072005
Comment #12
tim.plunkettThis is broken.
Comment #13
tim.plunkettComment #14
brianV commentedRTBC, perfect
Comment #15
alexpottCommitted 21eaf37 and pushed to 8.x. Thanks!
Comment #16
damiankloip commentedIn light of that, I opened #2089787: Unit test the \Drupal class.