-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
500 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,45 @@ | ||
APP_NAME=Laravel | ||
APP_ENV=local | ||
APP_NAME=ClipZoneTest | ||
APP_ENV=testing | ||
APP_KEY=base64:QikAJAlo0evYLq2RYFxGv/PRrSIfJcNDj2qFiRp1oUs= | ||
APP_DEBUG=true | ||
APP_URL=http://localhost:8080 | ||
BCRYPT_ROUNDS=4 | ||
|
||
LOG_CHANNEL=stack | ||
LOG_LEVEL=debug | ||
|
||
DB_CONNECTION=sqlite | ||
DB_HOST=127.0.0.1 | ||
DB_CONNECTION=mysql | ||
DB_HOST=mariadb | ||
DB_PORT=3306 | ||
DB_DATABASE=:memory: | ||
DB_DATABASE=clipzone_test | ||
DB_USERNAME=root | ||
DB_PASSWORD= | ||
|
||
BROADCAST_DRIVER=log | ||
CACHE_DRIVER=file | ||
|
||
CACHE_DRIVER=array | ||
|
||
FILESYSTEM_DISK=local | ||
|
||
QUEUE_CONNECTION=sync | ||
SESSION_DRIVER=file | ||
|
||
SESSION_DRIVER=array | ||
SESSION_LIFETIME=120 | ||
SESSION_DOMAIN=localhost | ||
SESSION_CONNECTION=session | ||
|
||
# MEMCACHED_HOST=127.0.0.1 | ||
MEMCACHED_HOST=memcached | ||
|
||
# REDIS_HOST=127.0.0.1 | ||
REDIS_HOST=redis | ||
REDIS_PASSWORD=null | ||
REDIS_PORT=6379 | ||
|
||
MAIL_MAILER=smtp | ||
MAIL_HOST=smtp.mailtrap.io | ||
MAIL_PORT=25 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null | ||
MAIL_ENCRYPTION=null | ||
MAIL_FROM_ADDRESS=[email protected] | ||
MAIL_MAILER=array | ||
MAIL_FROM_ADDRESS=[email protected] | ||
MAIL_FROM_NAME="${APP_NAME}" | ||
|
||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_DEFAULT_REGION=us-east-1 | ||
AWS_BUCKET= | ||
DEBUGBAR_ENABLED=false | ||
|
||
SUPPORT_EMAIL=[email protected] | ||
SERVER_EMAIL=[email protected] | ||
|
||
PUSHER_APP_ID= | ||
PUSHER_APP_KEY= | ||
PUSHER_APP_SECRET= | ||
PUSHER_APP_CLUSTER=mt1 | ||
CASHIER_CURRENCY=eur | ||
CASHIER_LOGGER=stack | ||
|
||
MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}" | ||
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" | ||
SCOUT_DRIVER=null | ||
|
||
SCOUT_DRIVER=database | ||
TELESCOPE_ENABLED=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?php | ||
|
||
namespace Feature\Api; | ||
|
||
use App\Enums\VideoStatus; | ||
use App\Models\Comment; | ||
use App\Models\Video; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Testing\Fluent\AssertableJson; | ||
use Tests\TestCase; | ||
|
||
class CommentTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
/** | ||
* A basic feature test example. | ||
* | ||
* @return void | ||
*/ | ||
public function test_comments_list(): void | ||
{ | ||
$video = Video::factory()->withStatus(VideoStatus::PUBLIC->value)->forUser()->create(); | ||
|
||
Comment::factory()->forUser()->for($video)->count(3)->createQuietly(); | ||
|
||
$response = $this->get(route('comments.index', $video->uuid)); | ||
|
||
$response | ||
->assertStatus(200) | ||
->assertJson(fn (AssertableJson $json) => | ||
$json | ||
->has('data', 3, fn (AssertableJson $json) => | ||
$json | ||
->whereType('id', 'integer') | ||
->whereType('class', 'string') | ||
->whereType('content', 'string') | ||
->whereType('parsed_content', 'string') | ||
->whereType('short_content', 'string') | ||
->whereType('is_long', 'boolean') | ||
->has('user', fn (AssertableJson $json) => | ||
$json->whereType('id', 'integer') | ||
->whereType('username', 'string') | ||
->whereType('avatar', 'string') | ||
->whereType('route', 'string') | ||
->whereType('is_video_author', 'boolean') | ||
) | ||
->whereType('video_uuid', 'string') | ||
->whereType('created_at', 'string') | ||
->whereType('is_updated', 'boolean') | ||
->whereType('likes_count', 'integer') | ||
->whereType('dislikes_count', 'integer') | ||
->whereType('is_reply', 'boolean') | ||
->whereType('is_pinned', 'boolean') | ||
->whereType('has_replies', 'boolean') | ||
->whereType('replies_count', 'integer') | ||
->whereType('is_video_author_reply', 'boolean') | ||
->whereType('is_video_author_like', 'boolean') | ||
->etc() | ||
) | ||
->has('links') | ||
->has('meta') | ||
->has('count') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
|
||
namespace Feature\Api; | ||
|
||
use App\Models\User; | ||
use Illuminate\Foundation\Testing\RefreshDatabase; | ||
use Illuminate\Testing\Fluent\AssertableJson; | ||
use Tests\TestCase; | ||
|
||
class UserTest extends TestCase | ||
{ | ||
use RefreshDatabase; | ||
|
||
/** | ||
* A basic feature test example. | ||
* | ||
* @return void | ||
*/ | ||
public function test_user_show(): void | ||
{ | ||
$user = User::factory()->create(); | ||
|
||
$response = $this->get(route('users.show', $user->id)); | ||
|
||
$response | ||
->assertStatus(200) | ||
->assertJson(fn (AssertableJson $json) => | ||
$json | ||
->whereType('id', 'integer') | ||
->whereType('username', 'string') | ||
->whereType('slug', 'string') | ||
->whereType('avatar', 'string') | ||
->whereType('banner', 'string') | ||
->whereType('show_subscribers', 'boolean') | ||
->when($user->show_subscribers, fn() => | ||
$json->whereType('subscribers', 'integer') | ||
) | ||
->whereType('videos_count', 'integer') | ||
->whereType('short_description', 'string') | ||
->whereType('description', 'string') | ||
->whereType('website', 'string') | ||
->whereType('country_code', 'string') | ||
->whereType('country', 'string') | ||
->whereType('views', 'integer') | ||
->whereType('created_at', 'string') | ||
->whereType('pinned_video', 'array|null') | ||
->whereType('videos', 'array') | ||
->whereType('playlists', 'array') | ||
); | ||
} | ||
} |
Oops, something went wrong.