mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Namespaced tests to align with new laravel default
This commit is contained in:
parent
076693efc9
commit
33a2999a57
@ -36,10 +36,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload-dev": {
|
"autoload-dev": {
|
||||||
"classmap": [
|
"psr-4": {
|
||||||
"tests/TestCase.php",
|
"Tests\\": "tests/"
|
||||||
"tests/BrowserKitTest.php"
|
}
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-root-package-install": [
|
"post-root-package-install": [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
|
|
||||||
class ActivityTrackingTest extends BrowserKitTest
|
class ActivityTrackingTest extends BrowserKitTest
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class AttachmentTest extends BrowserKitTest
|
class AttachmentTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
@ -75,7 +75,6 @@ class AttachmentTest extends BrowserKitTest
|
|||||||
{
|
{
|
||||||
$page = \BookStack\Page::first();
|
$page = \BookStack\Page::first();
|
||||||
$this->asAdmin();
|
$this->asAdmin();
|
||||||
$admin = $this->getAdmin();
|
|
||||||
$fileName = 'upload_test_file.txt';
|
$fileName = 'upload_test_file.txt';
|
||||||
|
|
||||||
$this->uploadFile($fileName, $page->id);
|
$this->uploadFile($fileName, $page->id);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
use BookStack\Notifications\ConfirmEmail;
|
use BookStack\Notifications\ConfirmEmail;
|
||||||
use Illuminate\Support\Facades\Notification;
|
use Illuminate\Support\Facades\Notification;
|
||||||
@ -88,7 +88,7 @@ class AuthTest extends BrowserKitTest
|
|||||||
->press('Resend Confirmation Email');
|
->press('Resend Confirmation Email');
|
||||||
|
|
||||||
// Get confirmation and confirm notification matches
|
// Get confirmation and confirm notification matches
|
||||||
$emailConfirmation = DB::table('email_confirmations')->where('user_id', '=', $dbUser->id)->first();
|
$emailConfirmation = \DB::table('email_confirmations')->where('user_id', '=', $dbUser->id)->first();
|
||||||
Notification::assertSentTo($dbUser, ConfirmEmail::class, function($notification, $channels) use ($emailConfirmation) {
|
Notification::assertSentTo($dbUser, ConfirmEmail::class, function($notification, $channels) use ($emailConfirmation) {
|
||||||
return $notification->token === $emailConfirmation->token;
|
return $notification->token === $emailConfirmation->token;
|
||||||
});
|
});
|
||||||
@ -177,7 +177,7 @@ class AuthTest extends BrowserKitTest
|
|||||||
->seePageIs('/settings/users');
|
->seePageIs('/settings/users');
|
||||||
|
|
||||||
$userPassword = \BookStack\User::find($user->id)->password;
|
$userPassword = \BookStack\User::find($user->id)->password;
|
||||||
$this->assertTrue(Hash::check('newpassword', $userPassword));
|
$this->assertTrue(\Hash::check('newpassword', $userPassword));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function test_user_deletion()
|
public function test_user_deletion()
|
||||||
@ -238,7 +238,6 @@ class AuthTest extends BrowserKitTest
|
|||||||
Notification::assertSentTo($user, \BookStack\Notifications\ResetPassword::class);
|
Notification::assertSentTo($user, \BookStack\Notifications\ResetPassword::class);
|
||||||
$n = Notification::sent($user, \BookStack\Notifications\ResetPassword::class);
|
$n = Notification::sent($user, \BookStack\Notifications\ResetPassword::class);
|
||||||
|
|
||||||
$reset = DB::table('password_resets')->where('email', '=', 'admin@admin.com')->first();
|
|
||||||
$this->visit('/password/reset/' . $n->first()->token)
|
$this->visit('/password/reset/' . $n->first()->token)
|
||||||
->see('Reset Password')
|
->see('Reset Password')
|
||||||
->submitForm('Reset Password', [
|
->submitForm('Reset Password', [
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
use BookStack\User;
|
use BookStack\User;
|
||||||
|
|
||||||
class LdapTest extends BrowserKitTest
|
class LdapTest extends BrowserKitTest
|
||||||
@ -12,7 +12,7 @@ class LdapTest extends BrowserKitTest
|
|||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
app('config')->set(['auth.method' => 'ldap', 'services.ldap.base_dn' => 'dc=ldap,dc=local', 'auth.providers.users.driver' => 'ldap']);
|
app('config')->set(['auth.method' => 'ldap', 'services.ldap.base_dn' => 'dc=ldap,dc=local', 'auth.providers.users.driver' => 'ldap']);
|
||||||
$this->mockLdap = Mockery::mock(BookStack\Services\Ldap::class);
|
$this->mockLdap = \Mockery::mock(\BookStack\Services\Ldap::class);
|
||||||
$this->app['BookStack\Services\Ldap'] = $this->mockLdap;
|
$this->app['BookStack\Services\Ldap'] = $this->mockLdap;
|
||||||
$this->mockUser = factory(User::class)->make();
|
$this->mockUser = factory(User::class)->make();
|
||||||
}
|
}
|
||||||
@ -22,7 +22,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('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 => [
|
||||||
'uid' => [$this->mockUser->name],
|
'uid' => [$this->mockUser->name],
|
||||||
'cn' => [$this->mockUser->name],
|
'cn' => [$this->mockUser->name],
|
||||||
@ -50,7 +50,7 @@ class LdapTest extends BrowserKitTest
|
|||||||
$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('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 => [
|
||||||
'cn' => [$this->mockUser->name],
|
'cn' => [$this->mockUser->name],
|
||||||
'dn' => $ldapDn,
|
'dn' => $ldapDn,
|
||||||
@ -73,7 +73,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('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 => [
|
||||||
'uid' => [$this->mockUser->name],
|
'uid' => [$this->mockUser->name],
|
||||||
'cn' => [$this->mockUser->name],
|
'cn' => [$this->mockUser->name],
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class SocialAuthTest extends BrowserKitTest
|
class SocialAuthTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
@ -11,10 +11,10 @@ class SocialAuthTest extends BrowserKitTest
|
|||||||
$this->setSettings(['registration-enabled' => 'true']);
|
$this->setSettings(['registration-enabled' => 'true']);
|
||||||
config(['GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
|
config(['GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc', 'APP_URL' => 'http://localhost']);
|
||||||
|
|
||||||
$mockSocialite = Mockery::mock('Laravel\Socialite\Contracts\Factory');
|
$mockSocialite = \Mockery::mock('Laravel\Socialite\Contracts\Factory');
|
||||||
$this->app['Laravel\Socialite\Contracts\Factory'] = $mockSocialite;
|
$this->app['Laravel\Socialite\Contracts\Factory'] = $mockSocialite;
|
||||||
$mockSocialDriver = Mockery::mock('Laravel\Socialite\Contracts\Provider');
|
$mockSocialDriver = \Mockery::mock('Laravel\Socialite\Contracts\Provider');
|
||||||
$mockSocialUser = Mockery::mock('\Laravel\Socialite\Contracts\User');
|
$mockSocialUser = \Mockery::mock('\Laravel\Socialite\Contracts\User');
|
||||||
|
|
||||||
$mockSocialite->shouldReceive('driver')->twice()->with('google')->andReturn($mockSocialDriver);
|
$mockSocialite->shouldReceive('driver')->twice()->with('google')->andReturn($mockSocialDriver);
|
||||||
$mockSocialDriver->shouldReceive('redirect')->once()->andReturn(redirect('/'));
|
$mockSocialDriver->shouldReceive('redirect')->once()->andReturn(redirect('/'));
|
||||||
@ -34,18 +34,16 @@ class SocialAuthTest extends BrowserKitTest
|
|||||||
|
|
||||||
public function test_social_login()
|
public function test_social_login()
|
||||||
{
|
{
|
||||||
$user = factory(\BookStack\User::class)->make();
|
|
||||||
|
|
||||||
config([
|
config([
|
||||||
'GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc',
|
'GOOGLE_APP_ID' => 'abc123', 'GOOGLE_APP_SECRET' => '123abc',
|
||||||
'GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc',
|
'GITHUB_APP_ID' => 'abc123', 'GITHUB_APP_SECRET' => '123abc',
|
||||||
'APP_URL' => 'http://localhost'
|
'APP_URL' => 'http://localhost'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$mockSocialite = Mockery::mock('Laravel\Socialite\Contracts\Factory');
|
$mockSocialite = \Mockery::mock('Laravel\Socialite\Contracts\Factory');
|
||||||
$this->app['Laravel\Socialite\Contracts\Factory'] = $mockSocialite;
|
$this->app['Laravel\Socialite\Contracts\Factory'] = $mockSocialite;
|
||||||
$mockSocialDriver = Mockery::mock('Laravel\Socialite\Contracts\Provider');
|
$mockSocialDriver = \Mockery::mock('Laravel\Socialite\Contracts\Provider');
|
||||||
$mockSocialUser = Mockery::mock('\Laravel\Socialite\Contracts\User');
|
$mockSocialUser = \Mockery::mock('\Laravel\Socialite\Contracts\User');
|
||||||
|
|
||||||
$mockSocialUser->shouldReceive('getId')->twice()->andReturn('logintest123');
|
$mockSocialUser->shouldReceive('getId')->twice()->andReturn('logintest123');
|
||||||
|
|
||||||
@ -68,7 +66,7 @@ class SocialAuthTest extends BrowserKitTest
|
|||||||
->seePageIs('/login');
|
->seePageIs('/login');
|
||||||
|
|
||||||
// Test social callback with matching social account
|
// Test social callback with matching social account
|
||||||
DB::table('social_accounts')->insert([
|
\DB::table('social_accounts')->insert([
|
||||||
'user_id' => $this->getAdmin()->id,
|
'user_id' => $this->getAdmin()->id,
|
||||||
'driver' => 'github',
|
'driver' => 'github',
|
||||||
'driver_id' => 'logintest123'
|
'driver_id' => 'logintest123'
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
|
use BookStack\Role;
|
||||||
|
use Illuminate\Contracts\Console\Kernel;
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
||||||
|
use Laravel\BrowserKitTesting\TestCase;
|
||||||
use Symfony\Component\DomCrawler\Crawler;
|
use Symfony\Component\DomCrawler\Crawler;
|
||||||
|
|
||||||
abstract class BrowserKitTest extends \Laravel\BrowserKitTesting\TestCase
|
abstract class BrowserKitTest extends TestCase
|
||||||
{
|
{
|
||||||
|
|
||||||
use DatabaseTransactions;
|
use DatabaseTransactions;
|
||||||
@ -28,7 +31,7 @@ abstract class BrowserKitTest extends \Laravel\BrowserKitTesting\TestCase
|
|||||||
{
|
{
|
||||||
$app = require __DIR__.'/../bootstrap/app.php';
|
$app = require __DIR__.'/../bootstrap/app.php';
|
||||||
|
|
||||||
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
|
$app->make(Kernel::class)->bootstrap();
|
||||||
|
|
||||||
return $app;
|
return $app;
|
||||||
}
|
}
|
||||||
@ -48,7 +51,7 @@ abstract class BrowserKitTest extends \Laravel\BrowserKitTesting\TestCase
|
|||||||
*/
|
*/
|
||||||
public function getAdmin() {
|
public function getAdmin() {
|
||||||
if($this->admin === null) {
|
if($this->admin === null) {
|
||||||
$adminRole = \BookStack\Role::getRole('admin');
|
$adminRole = Role::getRole('admin');
|
||||||
$this->admin = $adminRole->users->first();
|
$this->admin = $adminRole->users->first();
|
||||||
}
|
}
|
||||||
return $this->admin;
|
return $this->admin;
|
||||||
@ -95,9 +98,9 @@ abstract class BrowserKitTest extends \Laravel\BrowserKitTesting\TestCase
|
|||||||
protected function createEntityChainBelongingToUser($creatorUser, $updaterUser = false)
|
protected function createEntityChainBelongingToUser($creatorUser, $updaterUser = false)
|
||||||
{
|
{
|
||||||
if ($updaterUser === false) $updaterUser = $creatorUser;
|
if ($updaterUser === false) $updaterUser = $creatorUser;
|
||||||
$book = factory(BookStack\Book::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id]);
|
$book = factory(\BookStack\Book::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id]);
|
||||||
$chapter = factory(BookStack\Chapter::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id]);
|
$chapter = factory(\BookStack\Chapter::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id]);
|
||||||
$page = factory(BookStack\Page::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id, 'book_id' => $book->id]);
|
$page = factory(\BookStack\Page::class)->create(['created_by' => $creatorUser->id, 'updated_by' => $updaterUser->id, 'book_id' => $book->id]);
|
||||||
$book->chapters()->saveMany([$chapter]);
|
$book->chapters()->saveMany([$chapter]);
|
||||||
$chapter->pages()->saveMany([$page]);
|
$chapter->pages()->saveMany([$page]);
|
||||||
$restrictionService = $this->app[\BookStack\Services\PermissionService::class];
|
$restrictionService = $this->app[\BookStack\Services\PermissionService::class];
|
||||||
@ -117,7 +120,7 @@ abstract class BrowserKitTest extends \Laravel\BrowserKitTesting\TestCase
|
|||||||
protected function getEditor($attributes = [])
|
protected function getEditor($attributes = [])
|
||||||
{
|
{
|
||||||
$user = factory(\BookStack\User::class)->create($attributes);
|
$user = factory(\BookStack\User::class)->create($attributes);
|
||||||
$role = \BookStack\Role::getRole('editor');
|
$role = Role::getRole('editor');
|
||||||
$user->attachRole($role);;
|
$user->attachRole($role);;
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
@ -211,7 +214,6 @@ abstract class BrowserKitTest extends \Laravel\BrowserKitTesting\TestCase
|
|||||||
/**
|
/**
|
||||||
* Check if the page contains the given element.
|
* Check if the page contains the given element.
|
||||||
* @param string $selector
|
* @param string $selector
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function pageHasElement($selector)
|
protected function pageHasElement($selector)
|
||||||
{
|
{
|
||||||
@ -223,7 +225,6 @@ abstract class BrowserKitTest extends \Laravel\BrowserKitTesting\TestCase
|
|||||||
/**
|
/**
|
||||||
* Check if the page contains the given element.
|
* Check if the page contains the given element.
|
||||||
* @param string $selector
|
* @param string $selector
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
protected function pageNotHasElement($selector)
|
protected function pageNotHasElement($selector)
|
||||||
{
|
{
|
||||||
|
18
tests/CreatesApplication.php
Normal file
18
tests/CreatesApplication.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php namespace Tests;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Console\Kernel;
|
||||||
|
|
||||||
|
trait CreatesApplication
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Creates the application.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Foundation\Application
|
||||||
|
*/
|
||||||
|
public function createApplication()
|
||||||
|
{
|
||||||
|
$app = require __DIR__.'/../bootstrap/app.php';
|
||||||
|
$app->make(Kernel::class)->bootstrap();
|
||||||
|
return $app;
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class EntitySearchTest extends BrowserKitTest
|
class EntitySearchTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class EntityTest extends BrowserKitTest
|
class EntityTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class MarkdownTest extends BrowserKitTest
|
class MarkdownTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class PageContentTest extends BrowserKitTest
|
class PageContentTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
|
|
||||||
class PageDraftTest extends BrowserKitTest
|
class PageDraftTest extends BrowserKitTest
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class SortTest extends BrowserKitTest
|
class SortTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
use BookStack\Tag;
|
use BookStack\Tag;
|
||||||
use BookStack\Page;
|
use BookStack\Page;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class ImageTest extends BrowserKitTest
|
class ImageTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class RestrictionsTest extends BrowserKitTest
|
class RestrictionsTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class RolesTest extends BrowserKitTest
|
class RolesTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class PublicActionTest extends BrowserKitTest
|
class PublicActionTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
|
@ -1,31 +1,8 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
use Illuminate\Foundation\Testing\DatabaseTransactions;
|
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
|
||||||
use Symfony\Component\DomCrawler\Crawler;
|
|
||||||
|
|
||||||
class TestCase extends Illuminate\Foundation\Testing\TestCase
|
abstract class TestCase extends BaseTestCase
|
||||||
{
|
{
|
||||||
|
use CreatesApplication;
|
||||||
use DatabaseTransactions;
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The base URL of the application.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
public $baseUrl = 'http://localhost';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the application.
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Foundation\Application
|
|
||||||
*/
|
|
||||||
public function createApplication()
|
|
||||||
{
|
|
||||||
$app = require __DIR__.'/../bootstrap/app.php';
|
|
||||||
|
|
||||||
$app->make(Kernel::class)->bootstrap();
|
|
||||||
|
|
||||||
return $app;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
<?php
|
<?php namespace Tests;
|
||||||
|
|
||||||
class UserProfileTest extends BrowserKitTest
|
class UserProfileTest extends BrowserKitTest
|
||||||
{
|
{
|
||||||
@ -55,8 +55,8 @@ class UserProfileTest extends BrowserKitTest
|
|||||||
$newUser = $this->getEditor();
|
$newUser = $this->getEditor();
|
||||||
$this->actingAs($newUser);
|
$this->actingAs($newUser);
|
||||||
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
|
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
|
||||||
Activity::add($entities['book'], 'book_update', $entities['book']->id);
|
\Activity::add($entities['book'], 'book_update', $entities['book']->id);
|
||||||
Activity::add($entities['page'], 'page_create', $entities['book']->id);
|
\Activity::add($entities['page'], 'page_create', $entities['book']->id);
|
||||||
|
|
||||||
$this->asAdmin()->visit('/user/' . $newUser->id)
|
$this->asAdmin()->visit('/user/' . $newUser->id)
|
||||||
->seeInElement('#recent-activity', 'updated book')
|
->seeInElement('#recent-activity', 'updated book')
|
||||||
@ -69,8 +69,8 @@ class UserProfileTest extends BrowserKitTest
|
|||||||
$newUser = $this->getEditor();
|
$newUser = $this->getEditor();
|
||||||
$this->actingAs($newUser);
|
$this->actingAs($newUser);
|
||||||
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
|
$entities = $this->createEntityChainBelongingToUser($newUser, $newUser);
|
||||||
Activity::add($entities['book'], 'book_update', $entities['book']->id);
|
\Activity::add($entities['book'], 'book_update', $entities['book']->id);
|
||||||
Activity::add($entities['page'], 'page_create', $entities['book']->id);
|
\Activity::add($entities['page'], 'page_create', $entities['book']->id);
|
||||||
|
|
||||||
$this->asAdmin()->visit('/')->clickInElement('#recent-activity', $newUser->name)
|
$this->asAdmin()->visit('/')->clickInElement('#recent-activity', $newUser->name)
|
||||||
->seePageIs('/user/' . $newUser->id)
|
->seePageIs('/user/' . $newUser->id)
|
||||||
|
Loading…
Reference in New Issue
Block a user