Skip to content
Permalink
Browse files

Presenter: "query" link syntax is deprecated (BC break)

  • Loading branch information...
dg committed Jan 18, 2015
1 parent 4a2824c commit 695158d60fa443e1e65c0e1edebc3af9de1d39b6
Showing with 4 additions and 6 deletions.
  1. +1 −0 src/Application/UI/Presenter.php
  2. +3 −6 tests/Application/Presenter.link().phpt
@@ -792,6 +792,7 @@ protected function createRequest($component, $destination, array $args, $mode)
// 2) ?query syntax
$a = strpos($destination, '?');
if ($a !== FALSE) {
trigger_error('Query syntax is deprecated.', E_USER_DEPRECATED);
parse_str(substr($destination, $a + 1), $args); // requires disabled magic quotes
$destination = substr($destination, 0, $a);
}
@@ -88,9 +88,8 @@ class TestPresenter extends Application\UI\Presenter
Assert::same( '/index.php?x=1&y=2&action=product&presenter=Test', $this->link('product', array('x' => 1, 'y' => 2)) );
Assert::same( '/index.php?action=product&presenter=Test', $this->link('product') );
Assert::same( '#error: Destination must be non-empty string.', $this->link('') );
Assert::same( '/index.php?x=1&y=2&action=product&presenter=Test', $this->link('product?x=1&y=2') );
Assert::same( '/index.php?x=1&y=2&action=product&presenter=Test#fragment', $this->link('product?x=1&y=2#fragment') );
Assert::same( 'http://localhost/index.php?x=1&y=2&action=product&presenter=Test#fragment', $this->link('//product?x=1&y=2#fragment') );
Assert::same( '/index.php?action=product&presenter=Test#fragment', $this->link('product#fragment') );
Assert::same( 'http://localhost/index.php?action=product&presenter=Test#fragment', $this->link('//product#fragment') );
// Other presenter & action link
Assert::same( '/index.php?var1=10&action=product&presenter=Other', $this->link('Other:product', array('var1' => $this->var1)) );
@@ -126,9 +125,7 @@ class TestPresenter extends Application\UI\Presenter
Assert::same( '/index.php?mycontrol-x=1&mycontrol-y=2&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click!', array('x' => 1, 'y' => 2, 'round' => 0)) );
Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&do=mycontrol-click&presenter=Test', $this['mycontrol']->link('click', array('x' => 1, 'round' => 1)) );
Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test', $this['mycontrol']->link('this', array('x' => 1, 'round' => 1)) );
Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test', $this['mycontrol']->link('this?x=1&round=1') );
Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test#frag', $this['mycontrol']->link('this?x=1&round=1#frag') );
Assert::same( 'http://localhost/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test#frag', $this['mycontrol']->link('//this?x=1&round=1#frag') );
Assert::same( '/index.php?mycontrol-x=1&mycontrol-round=1&action=default&presenter=Test#frag', $this['mycontrol']->link('this#frag', array('x' => 1, 'round' => 1)) );
// Component link type checking
Assert::same( "#error: Invalid value for persistent parameter 'order' in 'mycontrol', expected array.", $this['mycontrol']->link('click', array('order' => 1)) );

5 comments on commit 695158d

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

JanTvrdik replied Jan 18, 2015

👍 I was planning to propose this. I just hope you are not going to rewrite too much stuff related to creating links before posobota.

@dg

This comment has been minimized.

Copy link
Member Author

dg replied Jan 18, 2015

;-)

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

JanTvrdik replied Jan 18, 2015

On the other hand I hope that after posobota we rewrite the entire thing.

@dg

This comment has been minimized.

Copy link
Member Author

dg replied Jan 18, 2015

Why after posobota?

@JanTvrdik

This comment has been minimized.

Copy link
Contributor

JanTvrdik replied Jan 18, 2015

Because if we rewrite it before posobota, I would have to update my slides.

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.