assertIsAtolable( new CorrectionInfo(CorrectionType::SELF, '01.01.2021', $number = Helpers::randomStr()), [ 'type' => CorrectionType::SELF, 'base_date' => '01.01.2021', 'base_number' => $number, ] ); $this->assertIsAtolable( new CorrectionInfo(CorrectionType::SELF, new DateTime('02.02.2022'), $number = Helpers::randomStr()), [ 'type' => CorrectionType::SELF, 'base_date' => '02.02.2022', 'base_number' => $number, ] ); $this->assertIsAtolable( new CorrectionInfo( CorrectionType::SELF, new DateTimeImmutable('03.03.2023'), $number = Helpers::randomStr() ), [ 'type' => CorrectionType::SELF, 'base_date' => '03.03.2023', 'base_number' => $number, ] ); } /** * Тестирует исключение при некорректной дате * * @covers \AtolOnline\Entities\CorrectionInfo * @covers \AtolOnline\Entities\CorrectionInfo::setDate * @covers \AtolOnline\Exceptions\InvalidCorrectionDateException * @return void * @throws EmptyCorrectionNumberException * @throws InvalidCorrectionDateException */ public function testInvalidCorrectionDateException(): void { $this->expectException(InvalidCorrectionDateException::class); new CorrectionInfo(CorrectionType::SELF, Helpers::randomStr(), Helpers::randomStr()); } /** * Тестирует исключение при некорректной дате * * @covers \AtolOnline\Entities\CorrectionInfo * @covers \AtolOnline\Entities\CorrectionInfo::setNumber * @covers \AtolOnline\Exceptions\EmptyCorrectionNumberException * @return void */ public function testEmptyCorrectionNumberException(): void { $this->expectException(EmptyCorrectionNumberException::class); new CorrectionInfo(CorrectionType::SELF, '01.01.2021', "\n\r\t\0"); } }