Fix issue#1
This commit is contained in:
parent
4797da562b
commit
0504555774
2 changed files with 13 additions and 2 deletions
|
@ -155,6 +155,15 @@ class NotesController extends Controller
|
||||||
*/
|
*/
|
||||||
public function taggedNotes($tag)
|
public function taggedNotes($tag)
|
||||||
{
|
{
|
||||||
|
$tag = mb_strtolower(
|
||||||
|
preg_replace(
|
||||||
|
'/&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml|caron);/i',
|
||||||
|
'$1',
|
||||||
|
htmlentities($tag)
|
||||||
|
),
|
||||||
|
'UTF-8'
|
||||||
|
);
|
||||||
|
|
||||||
$tagId = Tag::where('tag', $tag)->pluck('id');
|
$tagId = Tag::where('tag', $tag)->pluck('id');
|
||||||
$notes = Tag::find($tagId)->notes()->orderBy('updated_at', 'desc')->get();
|
$notes = Tag::find($tagId)->notes()->orderBy('updated_at', 'desc')->get();
|
||||||
foreach ($notes as $note) {
|
foreach ($notes as $note) {
|
||||||
|
|
|
@ -43,10 +43,10 @@ class MicropubClientTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* This currently creates a new note that stays in the database.
|
* This currently creates a new note that stays in the database.
|
||||||
*/
|
*/
|
||||||
public function testClientCreatesNewNote()
|
public function testClientCreatesNewNoteWithTag()
|
||||||
{
|
{
|
||||||
$faker = \Faker\Factory::create();
|
$faker = \Faker\Factory::create();
|
||||||
$note = 'Fake note from PHPUnit: ' . $faker->text;
|
$note = 'Fake note from #PHPUnit: ' . $faker->text;
|
||||||
$this->withSession([
|
$this->withSession([
|
||||||
'me' => $this->appurl,
|
'me' => $this->appurl,
|
||||||
'token' => $this->getToken()
|
'token' => $this->getToken()
|
||||||
|
@ -54,6 +54,8 @@ class MicropubClientTest extends TestCase
|
||||||
->type($note, 'content')
|
->type($note, 'content')
|
||||||
->press('Submit');
|
->press('Submit');
|
||||||
$this->seeInDatabase('notes', ['note' => $note]);
|
$this->seeInDatabase('notes', ['note' => $note]);
|
||||||
|
$this->visit($this->appurl . '/notes/tagged/PHPUnit')
|
||||||
|
->see('PHPUnit');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue