Skip to content

Commit

Permalink
Тесты.
Browse files Browse the repository at this point in the history
  • Loading branch information
ProklUng committed Apr 23, 2021
1 parent f5c8629 commit 1e72d07
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 452 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
<?php

namespace Prokl\BitrixOgGraphBundle\Tests;
namespace Prokl\BitrixOgGraphBundle\Tests\Cases;

use CFile;
use CIBlockElement;
use Faker\Factory;
use Faker\Generator;
use Prokl\BitrixOgGraphBundle\Services\DetailPageProcessor;
use Prokl\BitrixOgGraphBundle\Services\Utils\CFileWrapper;
use Prokl\BitrixOgGraphBundle\Tests\Tools\MockerBitrixBlocks;
use Prokl\BitrixOgGraphBundle\Tests\Tools\MockerBitrixSeo;
use Mockery;
use PHPUnit\Framework\TestCase;
use Prokl\BitrixTestingTools\Base\BitrixableTestCase;
use Prokl\BitrixTestingTools\Mockers\MockerBitrixBlocks;
use Prokl\BitrixTestingTools\Mockers\MockerBitrixSeo;
use Psr\Cache\InvalidArgumentException;
use WebArch\BitrixCache\AntiStampedeCacheAdapter;

Expand All @@ -25,26 +22,27 @@
*
* @since 20.02.20201
*/
class DetailPageProcessorTest extends TestCase
class DetailPageProcessorTest extends BitrixableTestCase
{
/**
* @var DetailPageProcessor $obTestObject
*/
private $obTestObject;

/**
* @var Generator
*/
private $faker;
protected $obTestObject;

/**
* @inheritDoc
*/
protected function setUp(): void
{
Mockery::resetContainer();
parent::setUp();
$this->faker = Factory::create();

// putenv('MYSQL_HOST=localhost');
// putenv('MYSQL_DATABASE=bitrix_ci');
// putenv('MYSQL_USER=root');
// putenv('MYSQL_PASSWORD=');
//
// // \Sheerockoff\BitrixCi\Bootstrap::migrate();
// \Sheerockoff\BitrixCi\Bootstrap::bootstrap();

$mockCIBlockElement = new MockerBitrixBlocks(CIBlockElement::class);
$mockCIBlockElement->setFixture([
Expand All @@ -67,15 +65,6 @@ protected function setUp(): void
);
}

/**
* @inheritDoc
*/
protected function tearDown(): void
{
parent::tearDown();
Mockery::close();
}

/**
* go(). Default values.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php

namespace Prokl\BitrixOgGraphBundle\Tests;
namespace Prokl\BitrixOgGraphBundle\Tests\Cases;

use Prokl\BitrixOgGraphBundle\Services\DetailPageProcessor;
use Prokl\BitrixOgGraphBundle\Services\Facades\FacadeOgGraphDetailPage;
use Prokl\BitrixOgGraphBundle\Services\InjectGraph;
use Prokl\BitrixOgGraphBundle\Services\OgDTO;
use Mockery;
use PHPUnit\Framework\TestCase;
use Prokl\BitrixTestingTools\Base\BitrixableTestCase;
use Psr\Cache\InvalidArgumentException;

/**
* Class FacadeOgGraphDetailPageTest
* @package Prokl\BitrixOgGraphBundle\Tests
* @package Prokl\BitrixOgGraphBundle\Tests\Cases
*
* @since 20.02.2021
*/
class FacadeOgGraphDetailPageTest extends TestCase
class FacadeOgGraphDetailPageTest extends BitrixableTestCase
{
/**
* @var FacadeOgGraphDetailPage $obTestObject
Expand All @@ -28,7 +28,6 @@ class FacadeOgGraphDetailPageTest extends TestCase
*/
protected function setUp(): void
{
Mockery::resetContainer();
parent::setUp();
$dtoOpenGraph = new ogDTO([]);
$this->obTestObject = new FacadeOgGraphDetailPage(
Expand All @@ -38,15 +37,6 @@ protected function setUp(): void
);
}

/**
* @inheritDoc
*/
protected function tearDown(): void
{
parent::tearDown();
Mockery::close();
}

/**
* Проверка на количество вызываемых методов.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?php

namespace Prokl\BitrixOgGraphBundle\Tests;
namespace Prokl\BitrixOgGraphBundle\Tests\Cases;

use Prokl\BitrixOgGraphBundle\Services\Facades\FacadeOgGraphSection;
use Prokl\BitrixOgGraphBundle\Services\InjectGraph;
use Prokl\BitrixOgGraphBundle\Services\OgDTO;
use Prokl\BitrixOgGraphBundle\Services\SectionsProcessor;
use Mockery;
use PHPUnit\Framework\TestCase;
use Prokl\BitrixTestingTools\Base\BitrixableTestCase;
use Psr\Cache\InvalidArgumentException;

/**
* Class FacadeOgGraphDetailPageTest
* @package Prokl\BitrixOgGraphBundle\Tests
* @package Prokl\BitrixOgGraphBundle\Tests\Cases
*
* @since 21.02.2021
*/
class FacadeOgGraphSectionTest extends TestCase
class FacadeOgGraphSectionTest extends BitrixableTestCase
{
/**
* @var FacadeOgGraphSection $obTestObject
Expand All @@ -28,7 +28,6 @@ class FacadeOgGraphSectionTest extends TestCase
*/
protected function setUp(): void
{
Mockery::resetContainer();
parent::setUp();
$dtoOpenGraph = new ogDTO([]);
$this->obTestObject = new FacadeOgGraphSection(
Expand All @@ -38,15 +37,6 @@ protected function setUp(): void
);
}

/**
* @inheritDoc
*/
protected function tearDown(): void
{
parent::tearDown();
Mockery::close();
}

/**
* Проверка на количество вызываемых методов.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php

namespace Prokl\BitrixOgGraphBundle\Tests;
namespace Prokl\BitrixOgGraphBundle\Tests\Cases;

use Prokl\BitrixOgGraphBundle\Services\Facades\FacadeOgGraphStatic;
use Prokl\BitrixOgGraphBundle\Services\InjectGraph;
use Prokl\BitrixOgGraphBundle\Services\OgDTO;
use Prokl\BitrixOgGraphBundle\Services\StaticPageProcessor;
use Mockery;
use PHPUnit\Framework\TestCase;
use Prokl\BitrixTestingTools\Base\BitrixableTestCase;
use Psr\Cache\InvalidArgumentException;

/**
Expand All @@ -16,7 +16,7 @@
*
* @since 21.02.2021
*/
class FacadeOgGraphStaticTest extends TestCase
class FacadeOgGraphStaticTest extends BitrixableTestCase
{
/**
* @var FacadeOgGraphStatic $obTestObject
Expand All @@ -28,7 +28,6 @@ class FacadeOgGraphStaticTest extends TestCase
*/
protected function setUp(): void
{
Mockery::resetContainer();
parent::setUp();
$dtoOpenGraph = new ogDTO([]);
$this->obTestObject = new FacadeOgGraphStatic(
Expand All @@ -38,15 +37,6 @@ protected function setUp(): void
);
}

/**
* @inheritDoc
*/
protected function tearDown(): void
{
parent::tearDown();
Mockery::close();
}

/**
* Проверка на количество вызываемых методов.
*
Expand Down
24 changes: 4 additions & 20 deletions Tests/InjectGraphTest.php → Tests/Cases/InjectGraphTest.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?php

namespace Prokl\BitrixOgGraphBundle\Tests;
namespace Prokl\BitrixOgGraphBundle\Tests\Cases;

use Bitrix\Main\Page\Asset;
use Faker\Factory;
use Faker\Generator;
use Prokl\BitrixOgGraphBundle\Services\InjectGraph;
use Prokl\BitrixOgGraphBundle\Services\OgDTO;
use Prokl\BitrixOgGraphBundle\Services\OpenGraphManager;
use Mockery;
use PHPUnit\Framework\TestCase;
use Prokl\BitrixTestingTools\Base\BitrixableTestCase;

/**
* Class InjectGraphTest
Expand All @@ -18,17 +17,12 @@
*
* @since 19.02.20201
*/
class InjectGraphTest extends TestCase
class InjectGraphTest extends BitrixableTestCase
{
/**
* @var InjectGraph $obTestObject
*/
private $obTestObject;

/**
* @var Generator
*/
private $faker;
protected $obTestObject;

/**
* @var OgDTO $dtoOpenGraph DTO для теста.
Expand All @@ -37,7 +31,6 @@ class InjectGraphTest extends TestCase

protected function setUp(): void
{
Mockery::resetContainer();
parent::setUp();
$this->faker = Factory::create();
$this->dtoOpenGraph = new ogDTO([]);
Expand All @@ -47,15 +40,6 @@ protected function setUp(): void
);
}

/**
* @inheritDoc
*/
protected function tearDown(): void
{
parent::tearDown();
Mockery::close();
}

/**
* inject().
*
Expand Down
19 changes: 4 additions & 15 deletions Tests/OgDtoTest.php → Tests/Cases/OgDtoTest.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<?php

namespace Prokl\BitrixOgGraphBundle\Tests;
namespace Prokl\BitrixOgGraphBundle\Tests\Cases;

use Faker\Factory;
use Prokl\BitrixOgGraphBundle\Services\OgDTO;
use Mockery;
use PHPUnit\Framework\TestCase;
use Prokl\BitrixTestingTools\Base\BitrixableTestCase;

/**
* Class OgDtoTest
* @package Prokl\BitrixOgGraphBundle\Tests
*
* @since 21.02.2021
*/
class OgDtoTest extends TestCase
class OgDtoTest extends BitrixableTestCase
{
/**
* @var ogDTO $obTestObject
*/
private $obTestObject;
protected $obTestObject;

/**
* @var array $fixture
Expand All @@ -30,7 +29,6 @@ class OgDtoTest extends TestCase
*/
protected function setUp(): void
{
Mockery::resetContainer();
parent::setUp();

$faker = Factory::create();
Expand All @@ -49,15 +47,6 @@ protected function setUp(): void
$this->obTestObject = new ogDTO([]);
}

/**
* @inheritDoc
*/
protected function tearDown(): void
{
parent::tearDown();
Mockery::close();
}

/**
* update().
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
<?php

namespace Prokl\BitrixOgGraphBundle\Tests;
namespace Prokl\BitrixOgGraphBundle\Tests\Cases;

use Astrotomic\OpenGraph\OpenGraph;
use Faker\Factory;
use League\FactoryMuffin\Faker\Faker;
use Prokl\BitrixOgGraphBundle\Services\OgDTO;
use Prokl\BitrixOgGraphBundle\Services\OpenGraphManager;
use PHPUnit\Framework\TestCase;
use Prokl\BitrixTestingTools\Base\BitrixableTestCase;

/**
* Class OpenGraphManagerTest
Expand All @@ -16,18 +14,13 @@
*
* @since 13.10.2020
*/
class OpenGraphManagerTest extends TestCase
class OpenGraphManagerTest extends BitrixableTestCase
{
/**
* @var OpenGraphManager $obTestObject
*/
protected $obTestObject;

/**
* @var Faker
*/
private $faker;

/**
* @var OgDTO $dtoOpenGraph DTO для теста.
*/
Expand All @@ -39,7 +32,6 @@ class OpenGraphManagerTest extends TestCase
protected function setUp(): void
{
parent::setUp();
$this->faker = Factory::create();
$this->dtoOpenGraph = new ogDTO([]);
}

Expand Down
Loading

0 comments on commit 1e72d07

Please sign in to comment.