vd/app/Domains/Welcome/Tests/Services/TestServiceTest.php
2018-11-05 09:26:30 +08:00

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);
}
}