34 lines
858 B
PHP
34 lines
858 B
PHP
<?php
|
|
namespace App\Domains\Welcome\Tests\Services;
|
|
|
|
use Carbon\Carbon;
|
|
use Dipper\Foundation\Core\TestCase;
|
|
use App\Domains\Welcome\Services\TestService;
|
|
use App\Domains\Welcome\Repositories\TestRepository;
|
|
|
|
class TestServiceTest extends TestCase
|
|
{
|
|
public function testTestService()
|
|
{
|
|
$news = [];
|
|
|
|
for ($i=0; $i < 5; $i++) {
|
|
$status = [0 , 1];
|
|
$status = $status[array_rand($status)];
|
|
$news[] = [
|
|
'name' => $this->faker->name,
|
|
'status' => $status,
|
|
'created_at' => Carbon::now(),
|
|
'updated_at' => Carbon::now(),
|
|
];
|
|
}
|
|
|
|
app(TestRepository::class)->insert($news);
|
|
|
|
$testService = app(TestService::class);
|
|
$result = $testService->index();
|
|
|
|
$this->assertNotEmpty($result);
|
|
}
|
|
}
|