mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-26 20:22:18 +00:00
Fixed faulty text rendering calls and LDAP tests
This commit is contained in:
parent
2704962277
commit
33642c20ec
@ -571,7 +571,7 @@ class EntityRepo
|
|||||||
|
|
||||||
$draftPage->slug = $this->findSuitableSlug('page', $draftPage->name, false, $draftPage->book->id);
|
$draftPage->slug = $this->findSuitableSlug('page', $draftPage->name, false, $draftPage->book->id);
|
||||||
$draftPage->html = $this->formatHtml($input['html']);
|
$draftPage->html = $this->formatHtml($input['html']);
|
||||||
$draftPage->text = $this->pageToPlainText($draftPage->html);
|
$draftPage->text = $this->pageToPlainText($draftPage);
|
||||||
$draftPage->draft = false;
|
$draftPage->draft = false;
|
||||||
$draftPage->revision_count = 1;
|
$draftPage->revision_count = 1;
|
||||||
|
|
||||||
@ -944,7 +944,7 @@ class EntityRepo
|
|||||||
$revision = $page->revisions()->where('id', '=', $revisionId)->first();
|
$revision = $page->revisions()->where('id', '=', $revisionId)->first();
|
||||||
$page->fill($revision->toArray());
|
$page->fill($revision->toArray());
|
||||||
$page->slug = $this->findSuitableSlug('page', $page->name, $page->id, $book->id);
|
$page->slug = $this->findSuitableSlug('page', $page->name, $page->id, $book->id);
|
||||||
$page->text = $this->pageToPlainText($page->html);
|
$page->text = $this->pageToPlainText($page);
|
||||||
$page->updated_by = user()->id;
|
$page->updated_by = user()->id;
|
||||||
$page->save();
|
$page->save();
|
||||||
$this->searchService->indexEntity($page);
|
$this->searchService->indexEntity($page);
|
||||||
@ -964,7 +964,7 @@ class EntityRepo
|
|||||||
if ($page->draft) {
|
if ($page->draft) {
|
||||||
$page->fill($data);
|
$page->fill($data);
|
||||||
if (isset($data['html'])) {
|
if (isset($data['html'])) {
|
||||||
$page->text = $this->pageToPlainText($data['html']);
|
$page->text = $this->pageToPlainText($page);
|
||||||
}
|
}
|
||||||
$page->save();
|
$page->save();
|
||||||
return $page;
|
return $page;
|
||||||
|
@ -21,6 +21,7 @@ class LdapTest extends BrowserKitTest
|
|||||||
{
|
{
|
||||||
$this->mockLdap->shouldReceive('connect')->once()->andReturn($this->resourceId);
|
$this->mockLdap->shouldReceive('connect')->once()->andReturn($this->resourceId);
|
||||||
$this->mockLdap->shouldReceive('setVersion')->once();
|
$this->mockLdap->shouldReceive('setVersion')->once();
|
||||||
|
$this->mockLdap->shouldReceive('setOption')->times(4);
|
||||||
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(4)
|
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(4)
|
||||||
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array'))
|
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array'))
|
||||||
->andReturn(['count' => 1, 0 => [
|
->andReturn(['count' => 1, 0 => [
|
||||||
@ -49,6 +50,7 @@ class LdapTest extends BrowserKitTest
|
|||||||
$this->mockLdap->shouldReceive('connect')->once()->andReturn($this->resourceId);
|
$this->mockLdap->shouldReceive('connect')->once()->andReturn($this->resourceId);
|
||||||
$this->mockLdap->shouldReceive('setVersion')->once();
|
$this->mockLdap->shouldReceive('setVersion')->once();
|
||||||
$ldapDn = 'cn=test-user,dc=test' . config('services.ldap.base_dn');
|
$ldapDn = 'cn=test-user,dc=test' . config('services.ldap.base_dn');
|
||||||
|
$this->mockLdap->shouldReceive('setOption')->times(2);
|
||||||
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(2)
|
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(2)
|
||||||
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array'))
|
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array'))
|
||||||
->andReturn(['count' => 1, 0 => [
|
->andReturn(['count' => 1, 0 => [
|
||||||
@ -72,6 +74,7 @@ class LdapTest extends BrowserKitTest
|
|||||||
{
|
{
|
||||||
$this->mockLdap->shouldReceive('connect')->once()->andReturn($this->resourceId);
|
$this->mockLdap->shouldReceive('connect')->once()->andReturn($this->resourceId);
|
||||||
$this->mockLdap->shouldReceive('setVersion')->once();
|
$this->mockLdap->shouldReceive('setVersion')->once();
|
||||||
|
$this->mockLdap->shouldReceive('setOption')->times(2);
|
||||||
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(2)
|
$this->mockLdap->shouldReceive('searchAndGetEntries')->times(2)
|
||||||
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array'))
|
->with($this->resourceId, config('services.ldap.base_dn'), \Mockery::type('string'), \Mockery::type('array'))
|
||||||
->andReturn(['count' => 1, 0 => [
|
->andReturn(['count' => 1, 0 => [
|
||||||
|
Loading…
Reference in New Issue
Block a user