File Pest.php
<?php
use IlluminateFoundationTestingRefreshDatabase;
uses(TestsTestCase::class, RefreshDatabase::class)->in('Feature', 'Unit');
File Unit/Repositories/PersonalDataRepository
File Unit/Repositories/PersonalDataRepositoryTest.php
<?php
use TestsHelpersApiResponseApi;
use AppServicesExternalApiBigBoostPeopleService;
use AppServicesRepositoriesPersonalDataRepository;
uses(ResponseApi::class);
test('should register data in the personal data table with the bigbooster api data ',
function () {
$dataApi = $this->responseBigboostPeople();
$placeEmail = AppModelsPlaceEmail::factory()->make();
$peopleService = mock(PeopleService::class);
$peopleService
->expects($this->once())
->method('make')
->willReturn($dataApi);
$personalDataRepository = new PersonalDataRepository();
$response = $personalDataRepository->create($placeEmail, $peopleService);
$this->assertEquals($placeEmail->email, $response->email);
$this->assertEquals('TESTE DA SILVA', $response->name);
$this->assertEquals('LEAO', $response->zodiac_sign);
$this->assertEquals('Mother user', $response->mother_name);
$this->assertEquals('Father user', $response->father_name);
$this->assertEquals('11111111111', $response->cpf);
$this->assertEquals('1991-08-04', $response->birth_date);
});
when using the $ this-> createMock method I get the error, Member has protected access, because the TestCase class is not being extended
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…