Commit edcba27d by Евгений

Добавил тесты

1 parent 299db702
Showing with 133 additions and 0 deletions
<?php
namespace Tests\Unit;
use App\Models\Account;
use App\Models\Tokens;
use App\Models\User;
use App\Service\Requests\Direct\GetAds;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Queue;
use Tests\TestCase;
class AdsLoadTest extends TestCase
{
use RefreshDatabase;
private $request;
private $params;
private $user;
private $token;
private $token_main;
private $campaign;
private $dictionary;
protected function setUp(): void
{
parent::setUp();
$account = Account::create(['name' => 'Acme Corporation']);
$this->user = factory(User::class)->create([
'account_id' => $account->id,
'first_name' => 'John',
'last_name' => 'Doe',
'email' => 'johndoe@example.com',
'owner' => true,
]);
$this->token = factory(Tokens::class)->create([
'created_by' => $this->user->getKey()
]);
$this->token_main = factory(Tokens::class)->create([
'type' => Tokens::MAIN,
]);
}
function testHandleApi(){
$response = Array
(
'result' => Array
(
'Ads' => Array
(
Array
(
'Id' => 10889276453,
'CampaignId' => 62707029,
'AdGroupId' => 4596250160,
'Status' => 'REJECTED',
'State' => 'SUSPENDED',
'StatusClarification' => 'Stopped.
Rejected at moderation.
Рекламные материалы не могут быть размещены в Директе. Подробнее о причине отклонения вы можете прочитать здесь: https://yandex.ru/support/direct-tooltips/moderation/no-comments.html
Рекламные материалы не могут быть размещены в Директе. Подробнее о причине отклонения вы можете прочитать здесь: https://yandex.ru/support/direct-tooltips/moderation/no-comments.html
Рекламные материалы не могут быть размещены в Директе. Подробнее о причине отклонения вы можете прочитать здесь: https://yandex.ru/support/direct-tooltips/moderation/no-comments.html',
'AdCategories' => '',
'AgeLabel' => '',
'Type' => 'TEXT_AD',
'Subtype' => 'NONE',
'TextAd' => Array
(
'Text' => 'test test test',
'Title' => 'test',
'Title2' => 'test',
'Href' => 'http://yourroom.ru',
'Mobile' => 'NO',
'DisplayDomain' => 'yourroom.ru',
'DisplayUrlPath' => 'test',
'DisplayUrlPathModeration' => Array
(
'Status' => 'ACCEPTED',
'StatusClarification' => 'Display link accepted by moderation.'
),
'VideoExtension' => '',
'PriceExtension' =>'',
'TurboPageId' =>'',
'TurboPageModeration' =>'',
'BusinessId' => 1691840535,
'PreferVCardOverBusiness' => 'NO',
'VCardId' => '',
'AdImageHash' => '',
'SitelinkSetId' => '',
'VCardModeration' => '',
'SitelinksModeration' => '',
'AdImageModeration' => '',
'AdExtensions' => Array
(
Array
(
'AdExtensionId' => 17604596,
'Type' => 'CALLOUT'
),
Array
(
'AdExtensionId' => 17604597,
'Type' => 'CALLOUT'
)
)
)
)
)
)
);
Queue::fake();
$request = new GetAds();
$request->setToken($this->token_main)
->call([
'CampaignIds' => [],
]);
$request->handle($response);
//TODO добавить проверку что нужные данные добавляются
$this->assertTrue(true);
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!