{"id":350912,"date":"2023-07-28T15:01:04","date_gmt":"2023-07-28T15:01:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=350912"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=350912","title":{"rendered":"<span>ChatGPT \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0433\u0440\u0443\u0437\u0438\u0442\u044c Middle \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430: \u043a\u0430\u043a \u0437\u0430 5 \u043c\u0438\u043d\u0443\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c 1-2 \u0447\u0430\u0441\u043e\u0432\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e8f\/9c7\/653\/e8f9c765362ebc0d8a14076850e97e0f.gif\" alt=\"\u042d\u0442\u043e \u0410\u0440\u0442\u0451\u043c \u043f\u044c\u0435\u0442 \u043a\u043e\u0444\u0435 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043f\u043e\u0434\u043a\u0430\u0441\u0442 \u043f\u043e\u043a\u0430 ChatGPT \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 \u043d\u0435\u0433\u043e \" title=\"\u042d\u0442\u043e \u0410\u0440\u0442\u0451\u043c \u043f\u044c\u0435\u0442 \u043a\u043e\u0444\u0435 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043f\u043e\u0434\u043a\u0430\u0441\u0442 \u043f\u043e\u043a\u0430 ChatGPT \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 \u043d\u0435\u0433\u043e \" width=\"800\" height=\"432\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e8f\/9c7\/653\/e8f9c765362ebc0d8a14076850e97e0f.gif\"\/><\/p>\n<div><figcaption>\u042d\u0442\u043e \u0410\u0440\u0442\u0451\u043c \u043f\u044c\u0435\u0442 \u043a\u043e\u0444\u0435 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043f\u043e\u0434\u043a\u0430\u0441\u0442 \u043f\u043e\u043a\u0430 ChatGPT \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 \u043d\u0435\u0433\u043e <\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u0440\u0442\u0435\u043c \u0420\u044b\u0431\u0438\u043d, \u0438 \u044f team lead backend developer \u0432 KOTELOV. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0430\u0441\u0430. \u0411\u0443\u0434\u0435\u043c \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0442\u044c unit \u0442\u0435\u0441\u0442\u0430\u043c\u0438 DTO \u043a\u043b\u0430\u0441\u0441 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 Laravel<\/p>\n<p>\u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0442\u0435\u043b\u0435\u0433\u0443 kotelov_love, \u0447\u0442\u043e\u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c. <\/p>\n<p>\u0420\u0430\u0431\u043e\u0447\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u201c\u043a\u0430\u043a \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 chat openai\u201d \u044f \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0438\u0445 \u0438\u0442\u0430\u043a \u043f\u043e\u043b\u043d\u043e \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u201c\u0432\u0441\u0435\u043c\u0438\u0440\u043d\u043e\u0439\u201d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043d\u0430\u0439\u0442\u0438 \u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f.<\/p>\n<h2>\u041a\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043b\u0438\u0434\u0443 \u043f\u0440\u0438\u0448\u043b\u0430 \u0442\u0430\u043a\u0430\u044f \u0438\u0434\u0435\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0443?<\/h2>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0441\u044c \u0445\u0430\u0439\u043f \u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u043a\u0430\u043c\u0438 \u0443\u0442\u0438\u0445, \u0430 \u043c\u0435\u043c\u0430\u0441\u0438\u043a\u0438 \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0440\u0435\u0436\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d ChatGPT.<\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u043d\u0430 \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0430, \u2014\u00a0\u044d\u0442\u043e \u0440\u0443\u0442\u0438\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043d\u0435 \u043b\u0435\u043d\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438. \u0410 \u0447\u0442\u043e \u0432\u0441\u0435\u043c \u043d\u0430\u043c \u043b\u0435\u043d\u044c \u0434\u0435\u043b\u0430\u0442\u044c? \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u0435\u0441\u0442\u044b \u043f\u0438\u0441\u0430\u0442\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f5a\/c1f\/e82\/f5ac1fe82c4fb829b4203ec707962bf7.png\" width=\"604\" height=\"599\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/f5a\/c1f\/e82\/f5ac1fe82c4fb829b4203ec707962bf7.png\"\/><\/figure>\n<p>\u0412\u0441\u0435 \u043f\u0430\u0434\u0430\u0432\u0430\u043d\u044b \u0437\u0430\u043d\u044f\u0442\u044b \u0441\u0432\u043e\u0438\u043c\u0438 \u0437\u0430\u0431\u043e\u0442\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0437\u0430 \u043c\u0435\u043d\u044f, \u0430 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043d\u0430\u0434\u043e\u2026<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e? \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0441\u0430\u0436\u0443\u0441\u044c \u0438 \u043f\u0438\u0448\u0443 \u0441\u0430\u043c \u0438\u0434\u0443 \u0432 \u0447\u0430\u0442 \u0438 \u043f\u0440\u043e\u0448\u0443 \u0418\u0418 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0437\u0430 \u043c\u0435\u043d\u044f.<\/p>\n<p>\u0412\u0437\u044f\u043b \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0430\u043c \u0431\u044b \u043f\u0438\u0441\u0430\u043b \u0440\u0443\u043a\u0430\u043c\u0438 \u0447\u0430\u0441.<\/p>\n<p><strong>\u0414\u0430\u043d\u043e:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 laravel<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 DTO, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0434\u043e \u043f\u043e\u043a\u0440\u044b\u0442\u044c unit \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041b\u0435\u043d\u044c<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0434\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044f\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f unit \u0442\u0435\u0441\u0442\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u0437\u044f\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 DTO \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0447\u0430\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u043d\u0435\u0433\u043e.\u00a0<\/p>\n<pre><code class=\"php\">class UserCrmDto { public function __construct( private readonly array $data, ) { }   public function getPhone(): string { return Arr::get($this->data, 'clnt_MobPhone'); }   public function getExternalGuid(): string { return Arr::get($this->data, 'clnt_ID'); }   public function getPassword(): string { return Arr::get($this->data, 'clnt_Pwd'); }   public function getEmail(): string { return Arr::get($this->data, 'clnt_EMail'); }   public function getSurname(): string { return Arr::get($this->data, 'clnt_Surname'); }   public function getName(): string { return Arr::get($this->data, 'clnt_Name'); }   public function getPatronymic(): string { return Arr::get($this->data, 'clnt_Patronymic'); } } <\/code><\/pre>\n<p><em><sup>\u041a\u043b\u0430\u0441\u0441, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442<\/sup><\/em><\/p>\n<p>\u041d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0434\u0435\u043b\u0430\u044e \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u043c. \u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u0443\u0434\u0443 \u0434\u0430\u0432\u0430\u0442\u044c \u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u0430\u043a \u043c\u0438\u0434\u043b\u0443, \u0430 \u043f\u043e\u0434 \u043a\u043e\u043d\u0435\u0446 \u043d\u0430\u0447\u043d\u0443 \u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u044d\u0442\u043e \u0434\u0436\u0443\u043d. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.<\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0436\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043d\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0443\u0442\u044c \u0432\u0435\u0440\u043d\u044b\u0439. \u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c (\u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438):<\/p>\n<p><em>>> \u041d\u0430\u043f\u0438\u0448\u0438 unit \u0442\u0435\u0441\u0442\u044b \u043d\u0430 phpunit \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u00a0<\/em><\/p>\n<pre><code class=\"php\">use PHPUnit\\Framework\\TestCase;   class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ]; $this->userCrmDto = new UserCrmDto($this->data); }   public function testGetPhone(): void { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); }   public function testGetExternalGuid(): void { $expected = 'abc123'; $actual = $this->userCrmDto->getExternalGuid(); $this->assertEquals($expected, $actual); }  \/\/ \u0418 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435\u2026 } <\/code><\/pre>\n<p><em><sup>\u041f\u0435\u0440\u0432\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f<\/sup><\/em><\/p>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0418\u0418 \u043e\u0442\u0434\u0430\u0435\u0442 \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c: <strong>\u00ab\/\/ \u2026 \u0414\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb<\/strong>.<\/p>\n<p>\u041a\u0430\u043a \u0431\u044b \u0433\u043e\u0432\u043e\u0440\u044f: \u201d\u0418\u0434\u0438 \u0434\u043e\u043f\u0438\u0448\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435\u201d. \u0415\u0441\u043b\u0438 \u0431\u044b \u044f \u0445\u043e\u0442\u0435\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0430\u043c, \u044f \u0431\u044b \u043a \u0442\u0435\u0431\u0435 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0441\u044f\u2026<\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0443\u043c\u043d\u0435\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0434\u043e 100%. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0441 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u043f\u043e\u0434 100% \u2014 \u0448\u0438\u043a\u0430\u0440\u043d\u043e. \u0412\u043e\u0442 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<p><em>>> \u0421\u0434\u0435\u043b\u0430\u0439 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 100%<\/em><\/p>\n<pre><code class=\"php\">class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function testGetPhone(): void { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); } \/\/ \u0418 \u0442\u0430\u043a \u0434\u043e 100% \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f\u2026 } <\/code><\/pre>\n<p><em><sup>\u0412\u0442\u043e\u0440\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043e 100% \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435\u043c<\/sup><\/em><\/p>\n<p>\u0412\u0441\u0451 \u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e, \u043d\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0443 \u043d\u0430\u0441 laravel, \u0438 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438, \u044f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0434 \u043d\u0435\u0433\u043e.<\/p>\n<p><em>>> \u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c laravel<\/em><\/p>\n<pre><code class=\"php\">use Illuminate\\Foundation\\Testing\\TestCase;   class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { parent::setUp();   $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function createApplication() { $app = require __DIR__.'\/..\/bootstrap\/app.php'; $app->make(\\Illuminate\\Contracts\\Console\\Kernel::class)->bootstrap();   return $app; }   public function testGetPhone() { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); } \/\/ \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.. } <\/code><\/pre>\n<p><sup>\u0422\u0440\u0435\u0442\u044c\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f, \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u043e\u0434 laravel<\/sup>  <\/p>\n<p>\u0422\u0443\u0442 \u0443\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b:<\/p>\n<pre><code class=\"php\">$app = require __DIR__.'\/..\/bootstrap\/app.php'; $app->make(\\Illuminate\\Contracts\\Console\\Kernel::class)->bootstrap();<\/code><\/pre>\n<p>\u042f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u044f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0438\u0445, \u043d\u043e \u0438 \u044d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0432\u0441\u0435. \u041d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p><em>>> \u0420\u0430\u0437\u0432\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d createApplication ? \u041c\u044b \u0436\u0435 \u043f\u0438\u0448\u0435\u043c unit\u00a0<\/em><\/p>\n<p><em>>> \u041c\u043e\u0436\u0435\u0448\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f?<\/em><\/p>\n<pre><code class=\"php\">use PHPUnit\\Framework\\TestCase;   class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function testGetPhone(): void { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); }   \/\/ \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b\u2026   public function testInvalidPhoneValue(): void { $invalidData = ['clnt_MobPhone' => 123456789]; $userCrmDto = new UserCrmDto($invalidData);   $this->expectException(\\TypeError::class); $userCrmDto->getPhone(); } \/\/ \u0422\u0435\u0441\u0442\u044b \u043d\u0430 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u2026 } <\/code><\/pre>\n<p><sup>\u0427\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/sup>  <\/p>\n<p>\u0412\u0441\u0451 \u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e, \u043d\u043e \u0442\u0443\u0442 \u043e\u043d \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u043e laravel\u2026 \u041d\u0443 \u043d\u0438\u0447\u0435\u0433\u043e, \u043c\u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0435\u043c\u0443 \u043e\u0431 \u044d\u0442\u043e\u043c.<\/p>\n<p><em>>> \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0442\u044b \u0437\u0430\u0431\u044b\u043b, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 laravel<\/em><\/p>\n<pre><code class=\"php\">use Illuminate\\Foundation\\Testing\\TestCase; use Illuminate\\Support\\Arr;   class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { parent::setUp();   $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function createApplication() { $app = require __DIR__.'\/..\/bootstrap\/app.php'; $app->make(\\Illuminate\\Contracts\\Console\\Kernel::class)->bootstrap();   return $app; }   public function testGetPhone() { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); }   \/\/ \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b\u2026 } <\/code><\/pre>\n<p><sup>\u041f\u044f\u0442\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f, \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043f\u0440\u043e laravel<\/sup><\/p>\n<p>\u0418 \u0441\u043d\u043e\u0432\u0430 bootstrap. \u041d\u0435 \u0437\u043d\u0430\u044e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0437\u0430\u0431\u044b\u043b, \u0447\u0442\u043e \u043c\u044b \u043f\u0438\u0448\u0435\u043c unit, \u0438 \u043a\u0443\u0434\u0430 \u043f\u043e\u0442\u0435\u0440\u044f\u043b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 php 8.1, \u043d\u043e \u043d\u0435 \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u0435\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u044e \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0442\u044c. \u042d\u0442\u043e, \u043a\u0441\u0442\u0430\u0442\u0438, \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u0433\u0443 \u0432 pull request.<\/p>\n<p><em>>> \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 php 8.1 \u0438 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0443\u0431\u0435\u0440\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 bootstrap, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 unit\u00a0<\/em><\/p>\n<pre><code class=\"php\">class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function testGetPhone(): void { $this->assertSame('123456789', $this->userCrmDto->getPhone()); }   public function testGetExternalGuid(): void { $this->assertSame('abc123', $this->userCrmDto->getExternalGuid()); }   public function testGetPassword(): void { $this->assertSame('password123', $this->userCrmDto->getPassword()); }   public function testGetEmail(): void { $this->assertSame('test@example.com', $this->userCrmDto->getEmail()); }   public function testGetSurname(): void { $this->assertSame('Doe', $this->userCrmDto->getSurname()); }   public function testGetName(): void { $this->assertSame('John', $this->userCrmDto->getName()); }   public function testGetPatronymic(): void { $this->assertSame('Smith', $this->userCrmDto->getPatronymic()); }   public function testInvalidPhoneValue(): void { $invalidData = ['clnt_MobPhone' => 123456789]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingPhoneValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); }   public function testInvalidExternalGuidValue(): void { $invalidData = ['clnt_ID' => 123]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingExternalGuidValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); }   public function testInvalidPasswordValue(): void { $invalidData = ['clnt_Pwd' => 123]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingPasswordValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); }   public function testInvalidEmailValue(): void { $invalidData = ['clnt_EMail' => 123]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingEmailValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); }   public function testInvalidSurnameValue(): void { $invalidData = ['clnt_Surname' => 123]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingSurnameValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); }   public function testInvalidNameValue(): void { $invalidData = ['clnt_Name' => 123]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingNameValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); }   public function testInvalidPatronymicValue(): void { $invalidData = ['clnt_Patronymic' => 123]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingPatronymicValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); } } <\/code><\/pre>\n<p><sup>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441<\/sup>  <\/p>\n<p>\u0412\u043e\u0442 \u043e\u043d\u0430, \u0434\u043e\u043b\u0433\u043e\u0436\u0434\u0430\u043d\u043d\u0430\u044f \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0442\u0435\u0441\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0442\u0430\u0449\u0438\u0442\u044c \u043a \u0441\u0435\u0431\u0435 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442, \u0438 <u>\u043e\u0442\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0437\u0430\u0434\u0430\u0447\u0435, \u0447\u0442\u043e \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u043b\u0438 \u043d\u0430 \u044d\u0442\u043e 2 \u0447\u0430\u0441\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/u> \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u043a \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u043d\u043e\u0432\u044b\u0445 \u0444\u0438\u0447.\u00a0<\/p>\n<p>\u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441 \u043c\u043e\u0433 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043a\u0443\u0434\u0430 \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e \u0438 \u043f\u0440\u0438\u043d\u0435\u0441 \u0431\u044b \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041d\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u043f\u043e\u043d\u044f\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043e\u043d \u043c\u043e\u0436\u0435\u0442 \u0440\u0435\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0435\u0437 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<p><strong>\u0412\u043e\u0442 \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u043c\u043f\u0442:<\/strong><\/p>\n<p><em>>> \u041d\u0430\u043f\u0438\u0448\u0438 \u043c\u043d\u0435 \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0441\u043e 100% \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430\u043c\u0438 \u043d\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 php 8.1 \u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u043f\u043e\u0434 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a laravel<\/em><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/328\/59f\/70e\/32859f70ef7ee2946a8405f9dfeb978f.gif\" width=\"690\" height=\"388\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/328\/59f\/70e\/32859f70ef7ee2946a8405f9dfeb978f.gif\"\/><\/figure>\n<p>\u042f \u0431\u044b \u043c\u043e\u0433 \u043f\u0440\u043e\u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043e\u0442\u0432\u0435\u0442\u0430 \u043e\u0442 \u0418\u0418, \u043d\u043e \u043f\u043e\u0432\u0435\u0440\u044c\u0442\u0435 \u043d\u0430 \u0441\u043b\u043e\u0432\u043e, \u043e\u043d \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043e\u0442\u043b\u0438\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u0447\u0435\u043c\u0443 \u043c\u044b \u0435\u0433\u043e \u0443\u0447\u0438\u043b\u0438.<\/p>\n<p>\u0427\u0442\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u0432 \u0441\u0443\u0445\u043e\u043c \u043e\u0441\u0442\u0430\u0442\u043a\u0435: \u0447\u0430\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0435\u043f\u043b\u043e\u0445\u043e \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441 \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447, \u043a\u0430\u043a \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0438\u043b\u0438 \u043d\u0435\u0442 &#8212; \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0448\u0435 \u0434\u0435\u043b\u043e, \u043d\u043e \u043b\u0438\u0447\u043d\u043e \u044f \u0434\u0443\u043c\u0430\u044e, \u0447\u0442\u043e \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0442\u044c \u0435\u0433\u043e \u0432 \u0441\u0432\u043e\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u0435 \u0434\u043b\u044f \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0447\u0438\u0442\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0442\u0430\u043a\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439 \u2014 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c-\u043a\u0430\u043d\u0430\u043b kotelov_love. \u0410 \u044f \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430 \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442\u044c \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u0443 \u0432 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/751100\/\"> https:\/\/habr.com\/ru\/articles\/751100\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\">\n<div><figcaption>\u042d\u0442\u043e \u0410\u0440\u0442\u0451\u043c \u043f\u044c\u0435\u0442 \u043a\u043e\u0444\u0435 \u0438 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043f\u043e\u0434\u043a\u0430\u0441\u0442 \u043f\u043e\u043a\u0430 ChatGPT \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0437\u0430 \u043d\u0435\u0433\u043e <\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438\u0432\u0435\u0442, \u043c\u0435\u043d\u044f \u0437\u043e\u0432\u0443\u0442 \u0410\u0440\u0442\u0435\u043c \u0420\u044b\u0431\u0438\u043d, \u0438 \u044f team lead backend developer \u0432 KOTELOV. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u044f \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0438 \u0438 \u0441\u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0430\u0441\u0430. \u0411\u0443\u0434\u0435\u043c \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u0442\u044c unit \u0442\u0435\u0441\u0442\u0430\u043c\u0438 DTO \u043a\u043b\u0430\u0441\u0441 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043d\u0430 Laravel<\/p>\n<p>\u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0442\u0435\u043b\u0435\u0433\u0443 kotelov_love, \u0447\u0442\u043e\u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c. <\/p>\n<p>\u0420\u0430\u0431\u043e\u0447\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u201c\u043a\u0430\u043a \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 chat openai\u201d \u044f \u0440\u0430\u0441\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u0443\u0434\u0443, \u0438\u0445 \u0438\u0442\u0430\u043a \u043f\u043e\u043b\u043d\u043e \u043d\u0430 \u043f\u0440\u043e\u0441\u0442\u043e\u0440\u0430\u0445 \u201c\u0432\u0441\u0435\u043c\u0438\u0440\u043d\u043e\u0439\u201d, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0432\u0435\u0442\u0443\u044e \u043d\u0430\u0439\u0442\u0438 \u0442\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u0441\u044f.<\/p>\n<h2>\u041a\u0430\u043a \u0432\u043e\u043e\u0431\u0449\u0435 \u043b\u0438\u0434\u0443 \u043f\u0440\u0438\u0448\u043b\u0430 \u0442\u0430\u043a\u0430\u044f \u0438\u0434\u0435\u044f \u0432 \u0433\u043e\u043b\u043e\u0432\u0443?<\/h2>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u0435\u0441\u044c \u0445\u0430\u0439\u043f \u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u043a\u0430\u043c\u0438 \u0443\u0442\u0438\u0445, \u0430 \u043c\u0435\u043c\u0430\u0441\u0438\u043a\u0438 \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u0440\u0435\u0436\u0435, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c, \u0447\u0435\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d ChatGPT.<\/p>\n<p>\u041f\u0435\u0440\u0432\u043e\u0435, \u043d\u0430 \u0447\u0442\u043e \u043e\u0431\u0440\u0430\u0442\u0438\u043b \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u043b\u043b\u0435\u043a\u0442\u0430, \u2014\u00a0\u044d\u0442\u043e \u0440\u0443\u0442\u0438\u043d\u0430, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u043d\u0435 \u043b\u0435\u043d\u044c \u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438. \u0410 \u0447\u0442\u043e \u0432\u0441\u0435\u043c \u043d\u0430\u043c \u043b\u0435\u043d\u044c \u0434\u0435\u043b\u0430\u0442\u044c? \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u0435\u0441\u0442\u044b \u043f\u0438\u0441\u0430\u0442\u044c.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0441\u0435 \u043f\u0430\u0434\u0430\u0432\u0430\u043d\u044b \u0437\u0430\u043d\u044f\u0442\u044b \u0441\u0432\u043e\u0438\u043c\u0438 \u0437\u0430\u0431\u043e\u0442\u0430\u043c\u0438, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0437\u0430 \u043c\u0435\u043d\u044f, \u0430 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u043d\u0430\u0434\u043e\u2026<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e? \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0441\u0430\u0436\u0443\u0441\u044c \u0438 \u043f\u0438\u0448\u0443 \u0441\u0430\u043c \u0438\u0434\u0443 \u0432 \u0447\u0430\u0442 \u0438 \u043f\u0440\u043e\u0448\u0443 \u0418\u0418 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0437\u0430 \u043c\u0435\u043d\u044f.<\/p>\n<p>\u0412\u0437\u044f\u043b \u0434\u043b\u044f \u0437\u0430\u0434\u0430\u0447\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0430\u043c \u0431\u044b \u043f\u0438\u0441\u0430\u043b \u0440\u0443\u043a\u0430\u043c\u0438 \u0447\u0430\u0441.<\/p>\n<p><strong>\u0414\u0430\u043d\u043e:<\/strong><\/p>\n<ul>\n<li>\n<p>\u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 laravel<\/p>\n<\/li>\n<li>\n<p>\u041a\u043b\u0430\u0441\u0441 DTO, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0434\u043e \u043f\u043e\u043a\u0440\u044b\u0442\u044c unit \u0442\u0435\u0441\u0442\u0430\u043c\u0438<\/p>\n<\/li>\n<li>\n<p>\u041b\u0435\u043d\u044c<\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0434\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044f\u043c\u0438.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f unit \u0442\u0435\u0441\u0442\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043a\u0430\u0440\u043c\u043b\u0438\u0432\u0430\u0442\u044c \u0432\u0441\u0451 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u0437\u044f\u043b \u043f\u0440\u043e\u0441\u0442\u0435\u043d\u044c\u043a\u0438\u0439 DTO \u043a\u043b\u0430\u0441\u0441 \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0447\u0430\u0442 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u043d\u0430 \u043d\u0435\u0433\u043e.\u00a0<\/p>\n<pre><code class=\"php\">class UserCrmDto { public function __construct( private readonly array $data, ) { }   public function getPhone(): string { return Arr::get($this->data, 'clnt_MobPhone'); }   public function getExternalGuid(): string { return Arr::get($this->data, 'clnt_ID'); }   public function getPassword(): string { return Arr::get($this->data, 'clnt_Pwd'); }   public function getEmail(): string { return Arr::get($this->data, 'clnt_EMail'); }   public function getSurname(): string { return Arr::get($this->data, 'clnt_Surname'); }   public function getName(): string { return Arr::get($this->data, 'clnt_Name'); }   public function getPatronymic(): string { return Arr::get($this->data, 'clnt_Patronymic'); } } <\/code><\/pre>\n<p><em><sup>\u041a\u043b\u0430\u0441\u0441, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043c \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442<\/sup><\/em><\/p>\n<p>\u041d\u0430\u043c\u0435\u0440\u0435\u043d\u043d\u043e \u0434\u0435\u043b\u0430\u044e \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043f\u0440\u043e\u043c\u043f\u0442\u043e\u043c. \u0414\u043b\u044f \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u0443\u0434\u0443 \u0434\u0430\u0432\u0430\u0442\u044c \u0435\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043a\u0430\u043a \u043c\u0438\u0434\u043b\u0443, \u0430 \u043f\u043e\u0434 \u043a\u043e\u043d\u0435\u0446 \u043d\u0430\u0447\u043d\u0443 \u0434\u0430\u0432\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u044d\u0442\u043e \u0434\u0436\u0443\u043d. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.<\/p>\n<p>\u041f\u0435\u0440\u0432\u0430\u044f \u0436\u0435 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u043f\u0440\u0438\u043d\u043e\u0441\u0438\u0442 \u043d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043d\u043e \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e. \u041e\u0434\u043d\u0430\u043a\u043e, \u043f\u0443\u0442\u044c \u0432\u0435\u0440\u043d\u044b\u0439. \u0412\u043e\u0442 \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c (\u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0430\u043a\u0442\u043d\u043e\u0441\u0442\u0438):<\/p>\n<p><em>>> \u041d\u0430\u043f\u0438\u0448\u0438 unit \u0442\u0435\u0441\u0442\u044b \u043d\u0430 phpunit \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430\u00a0<\/em><\/p>\n<pre><code class=\"php\">use PHPUnit\\Framework\\TestCase;   class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ]; $this->userCrmDto = new UserCrmDto($this->data); }   public function testGetPhone(): void { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); }   public function testGetExternalGuid(): void { $expected = 'abc123'; $actual = $this->userCrmDto->getExternalGuid(); $this->assertEquals($expected, $actual); }  \/\/ \u0418 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435\u2026 } <\/code><\/pre>\n<p><em><sup>\u041f\u0435\u0440\u0432\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f<\/sup><\/em><\/p>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0418\u0418 \u043e\u0442\u0434\u0430\u0435\u0442 \u043d\u0435\u043f\u043e\u043b\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u043c: <strong>\u00ab\/\/ \u2026 \u0414\u0440\u0443\u0433\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u00bb<\/strong>.<\/p>\n<p>\u041a\u0430\u043a \u0431\u044b \u0433\u043e\u0432\u043e\u0440\u044f: \u201d\u0418\u0434\u0438 \u0434\u043e\u043f\u0438\u0448\u0438 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435\u201d. \u0415\u0441\u043b\u0438 \u0431\u044b \u044f \u0445\u043e\u0442\u0435\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0441\u0430\u043c, \u044f \u0431\u044b \u043a \u0442\u0435\u0431\u0435 \u0434\u0430\u0436\u0435 \u043d\u0435 \u043e\u0431\u0440\u0430\u0449\u0430\u043b\u0441\u044f\u2026<\/p>\n<p>\u0411\u0443\u0434\u0435\u043c \u0443\u043c\u043d\u0435\u0435 \u043c\u0430\u0448\u0438\u043d\u044b \u0438 \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043c \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0434\u043e 100%. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0438\u043c\u0435\u0435\u043c \u043a\u043b\u0430\u0441\u0441 \u0441 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u043f\u043e\u0434 100% \u2014 \u0448\u0438\u043a\u0430\u0440\u043d\u043e. \u0412\u043e\u0442 \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c:<\/p>\n<p><em>>> \u0421\u0434\u0435\u043b\u0430\u0439 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0442\u0435\u0441\u0442\u0430\u043c\u0438 100%<\/em><\/p>\n<pre><code class=\"php\">class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function testGetPhone(): void { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); } \/\/ \u0418 \u0442\u0430\u043a \u0434\u043e 100% \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u044f\u2026 } <\/code><\/pre>\n<p><em><sup>\u0412\u0442\u043e\u0440\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0441\u043e 100% \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435\u043c<\/sup><\/em><\/p>\n<p>\u0412\u0441\u0451 \u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e, \u043d\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0443 \u043d\u0430\u0441 laravel, \u0438 \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0440\u0443\u043a\u0430\u043c\u0438, \u044f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0442\u044c \u043a\u043e\u0434 \u043f\u043e\u0434 \u043d\u0435\u0433\u043e.<\/p>\n<p><em>>> \u041f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0439 \u0442\u0435\u0441\u0442 \u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u043c laravel<\/em><\/p>\n<pre><code class=\"php\">use Illuminate\\Foundation\\Testing\\TestCase;   class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { parent::setUp();   $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function createApplication() { $app = require __DIR__.'\/..\/bootstrap\/app.php'; $app->make(\\Illuminate\\Contracts\\Console\\Kernel::class)->bootstrap();   return $app; }   public function testGetPhone() { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); } \/\/ \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b.. } <\/code><\/pre>\n<p><sup>\u0422\u0440\u0435\u0442\u044c\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f, \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u043f\u043e\u0434 laravel<\/sup>  <\/p>\n<p>\u0422\u0443\u0442 \u0443\u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435, \u0437\u0430\u043c\u0435\u0447\u0430\u0435\u043c, \u0447\u0442\u043e \u043e\u043d \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b:<\/p>\n<pre><code class=\"php\">$app = require __DIR__.'\/..\/bootstrap\/app.php'; $app->make(\\Illuminate\\Contracts\\Console\\Kernel::class)->bootstrap();<\/code><\/pre>\n<p>\u042f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0432\u043f\u043e\u043b\u043d\u0435 \u043f\u0440\u0438\u0435\u043c\u043b\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b, \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u044f \u043f\u043e\u043f\u0440\u043e\u0441\u0438\u043b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043d\u0438\u0445, \u043d\u043e \u0438 \u044d\u0442\u043e \u0435\u0449\u0435 \u043d\u0435 \u0432\u0441\u0435. \u041d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p><em>>> \u0420\u0430\u0437\u0432\u0435 \u043d\u0430\u043c \u043d\u0443\u0436\u0435\u043d createApplication ? \u041c\u044b \u0436\u0435 \u043f\u0438\u0448\u0435\u043c unit\u00a0<\/em><\/p>\n<p><em>>> \u041c\u043e\u0436\u0435\u0448\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f?<\/em><\/p>\n<pre><code class=\"php\">use PHPUnit\\Framework\\TestCase;   class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function testGetPhone(): void { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); }   \/\/ \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b\u2026   public function testInvalidPhoneValue(): void { $invalidData = ['clnt_MobPhone' => 123456789]; $userCrmDto = new UserCrmDto($invalidData);   $this->expectException(\\TypeError::class); $userCrmDto->getPhone(); } \/\/ \u0422\u0435\u0441\u0442\u044b \u043d\u0430 \u043d\u0435\u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u2026 } <\/code><\/pre>\n<p><sup>\u0427\u0435\u0442\u0432\u0435\u0440\u0442\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f, \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435\u0432\u0430\u043b\u0438\u0434\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439<\/sup>  <\/p>\n<p>\u0412\u0441\u0451 \u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e, \u043d\u043e \u0442\u0443\u0442 \u043e\u043d \u0437\u0430\u0431\u044b\u043b \u043f\u0440\u043e laravel\u2026 \u041d\u0443 \u043d\u0438\u0447\u0435\u0433\u043e, \u043c\u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0435\u043c\u0443 \u043e\u0431 \u044d\u0442\u043e\u043c.<\/p>\n<p><em>>> \u041c\u043d\u0435 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0442\u044b \u0437\u0430\u0431\u044b\u043b, \u0447\u0442\u043e \u043c\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u043c \u0441 laravel<\/em><\/p>\n<pre><code class=\"php\">use Illuminate\\Foundation\\Testing\\TestCase; use Illuminate\\Support\\Arr;   class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { parent::setUp();   $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function createApplication() { $app = require __DIR__.'\/..\/bootstrap\/app.php'; $app->make(\\Illuminate\\Contracts\\Console\\Kernel::class)->bootstrap();   return $app; }   public function testGetPhone() { $expected = '123456789'; $actual = $this->userCrmDto->getPhone(); $this->assertEquals($expected, $actual); }   \/\/ \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b\u2026 } <\/code><\/pre>\n<p><sup>\u041f\u044f\u0442\u0430\u044f \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f, \u0432\u0441\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u043f\u0440\u043e laravel<\/sup><\/p>\n<p>\u0418 \u0441\u043d\u043e\u0432\u0430 bootstrap. \u041d\u0435 \u0437\u043d\u0430\u044e, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0437\u0430\u0431\u044b\u043b, \u0447\u0442\u043e \u043c\u044b \u043f\u0438\u0448\u0435\u043c unit, \u0438 \u043a\u0443\u0434\u0430 \u043f\u043e\u0442\u0435\u0440\u044f\u043b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 php 8.1, \u043d\u043e \u043d\u0435 \u043f\u044b\u0442\u0430\u044f\u0441\u044c \u0435\u0433\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u044e \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u0430\u0442\u044c. \u042d\u0442\u043e, \u043a\u0441\u0442\u0430\u0442\u0438, \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043f\u0440\u043e\u0441\u0438\u0442\u044c \u043a\u043e\u043b\u043b\u0435\u0433\u0443 \u0432 pull request.<\/p>\n<p><em>>> \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0432 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 php 8.1 \u0438 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0443\u0431\u0435\u0440\u0435\u043c \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 bootstrap, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 unit\u00a0<\/em><\/p>\n<pre><code class=\"php\">class UserCrmDtoTest extends TestCase { private array $data; private UserCrmDto $userCrmDto;   protected function setUp(): void { $this->data = [ 'clnt_MobPhone' => '123456789', 'clnt_ID' => 'abc123', 'clnt_Pwd' => 'password123', 'clnt_EMail' => 'test@example.com', 'clnt_Surname' => 'Doe', 'clnt_Name' => 'John', 'clnt_Patronymic' => 'Smith', ];   $this->userCrmDto = new UserCrmDto($this->data); }   public function testGetPhone(): void { $this->assertSame('123456789', $this->userCrmDto->getPhone()); }   public function testGetExternalGuid(): void { $this->assertSame('abc123', $this->userCrmDto->getExternalGuid()); }   public function testGetPassword(): void { $this->assertSame('password123', $this->userCrmDto->getPassword()); }   public function testGetEmail(): void { $this->assertSame('test@example.com', $this->userCrmDto->getEmail()); }   public function testGetSurname(): void { $this->assertSame('Doe', $this->userCrmDto->getSurname()); }   public function testGetName(): void { $this->assertSame('John', $this->userCrmDto->getName()); }   public function testGetPatronymic(): void { $this->assertSame('Smith', $this->userCrmDto->getPatronymic()); }   public function testInvalidPhoneValue(): void { $invalidData = ['clnt_MobPhone' => 123456789]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingPhoneValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); }   public function testInvalidExternalGuidValue(): void { $invalidData = ['clnt_ID' => 123]; $this->expectException(\\TypeError::class); new UserCrmDto($invalidData); }   public function testMissingExternalGuidValue(): void { $missingData = []; $this->expectException(\\InvalidArgumentException::class); new UserCrmDto($missingData); }   public function testInvalidPasswordValue(): void { $invalidData =<\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-350912","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350912"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350912\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}