Skip to content

Commit

Permalink
Merge Kyslik#53 & add test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyslik committed Mar 14, 2017
1 parent 017d3ff commit bbda0dd
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kyslik/column-sortable",
"description": "Package for handling column sorting in Laravel 5",
"description": "Package for handling column sorting in Laravel 5.4",
"keywords": [
"sortable",
"sorting",
Expand Down Expand Up @@ -32,5 +32,6 @@
"Kyslik\\ColumnSortable\\": "src/ColumnSortable/"
}
},
"minimum-stability": "dev"
"minimum-stability": "dev",
"prefer-stable": true
}
2 changes: 1 addition & 1 deletion src/ColumnSortable/SortableLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public static function render(array $parameters)
list($sortColumn, $sortParameter, $title, $queryParameters) = self::parseParameters($parameters);

$title = self::applyFormatting($title);

if ($mergeTitleAs = Config::get('columnsortable.inject_title_as', null)) {
Request::merge([$mergeTitleAs => $title]);
}
Expand Down
8 changes: 7 additions & 1 deletion tests/SortableLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\Request;
use Kyslik\ColumnSortable\Exceptions\ColumnSortableException;
use Kyslik\ColumnSortable\SortableLink;

/**
Expand All @@ -11,6 +10,13 @@
class SortableLinkTest extends \Orchestra\Testbench\TestCase
{

public function testSomething()
{
Request::replace(['key' => 0, 'another-key' => null, 'another-one' => 1]);
$link = SortableLink::render(['column']);
$this->assertTrue(str_contains($link, ['key=0', 'another-key=null', 'another-one=1']));
}

public function testInjectTitleInQueryStrings()
{
Config::set('columnsortable.inject_title_as', 'title');
Expand Down

0 comments on commit bbda0dd

Please sign in to comment.