Skip to content

Commit

Permalink
[TASK] Add tests for update scripts (#1388)
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminkott committed Jun 22, 2023
1 parent d08447a commit 2fbfd0c
Show file tree
Hide file tree
Showing 60 changed files with 1,287 additions and 0 deletions.
51 changes: 51 additions & 0 deletions Tests/Functional/Updates/AccordionContentElementUpdateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use BK2K\BootstrapPackage\Updates\AccordionContentElementUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* @extensionScannerIgnoreFile
*/
final class AccordionContentElementUpdateTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/bootstrap_package'
];

/**
* @test
*/
public function noUpdateNecessaryTest(): void
{
$subject = new AccordionContentElementUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
public function updateTest(): void
{
$subject = new AccordionContentElementUpdate();
$this->importCSVDataSet(__DIR__ . '/Fixtures/AccordionContentElementUpdate/Input.csv');
self::assertTrue($subject->updateNecessary());
$subject->executeUpdate();
self::assertFalse($subject->updateNecessary());
$this->assertCSVDataSet(__DIR__ . '/Fixtures/AccordionContentElementUpdate/Result.csv');

// Just ensure that running the upgrade again does not change anything
$subject->executeUpdate();
$this->assertCSVDataSet(__DIR__ . '/Fixtures/AccordionContentElementUpdate/Result.csv');
}
}
51 changes: 51 additions & 0 deletions Tests/Functional/Updates/AccordionMediaOrientUpdateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use BK2K\BootstrapPackage\Updates\AccordionMediaOrientUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* @extensionScannerIgnoreFile
*/
final class AccordionMediaOrientUpdateTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/bootstrap_package'
];

/**
* @test
*/
public function noUpdateNecessaryTest(): void
{
$subject = new AccordionMediaOrientUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
public function updateTest(): void
{
$subject = new AccordionMediaOrientUpdate();
$this->importCSVDataSet(__DIR__ . '/Fixtures/AccordionMediaOrientUpdate/Input.csv');
self::assertTrue($subject->updateNecessary());
$subject->executeUpdate();
self::assertFalse($subject->updateNecessary());
$this->assertCSVDataSet(__DIR__ . '/Fixtures/AccordionMediaOrientUpdate/Result.csv');

// Just ensure that running the upgrade again does not change anything
$subject->executeUpdate();
$this->assertCSVDataSet(__DIR__ . '/Fixtures/AccordionMediaOrientUpdate/Result.csv');
}
}
51 changes: 51 additions & 0 deletions Tests/Functional/Updates/BackendLayoutUpdateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use BK2K\BootstrapPackage\Updates\BackendLayoutUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* @extensionScannerIgnoreFile
*/
final class BackendLayoutUpdateTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/bootstrap_package'
];

/**
* @test
*/
public function noUpdateNecessaryTest(): void
{
$subject = new BackendLayoutUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
public function updateTest(): void
{
$subject = new BackendLayoutUpdate();
$this->importCSVDataSet(__DIR__ . '/Fixtures/BackendLayoutUpdate/Input.csv');
self::assertTrue($subject->updateNecessary());
$subject->executeUpdate();
self::assertFalse($subject->updateNecessary());
$this->assertCSVDataSet(__DIR__ . '/Fixtures/BackendLayoutUpdate/Result.csv');

// Just ensure that running the upgrade again does not change anything
$subject->executeUpdate();
$this->assertCSVDataSet(__DIR__ . '/Fixtures/BackendLayoutUpdate/Result.csv');
}
}
51 changes: 51 additions & 0 deletions Tests/Functional/Updates/BulletContentElementUpdateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use BK2K\BootstrapPackage\Updates\BulletContentElementUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* @extensionScannerIgnoreFile
*/
final class BulletContentElementUpdateTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/bootstrap_package'
];

/**
* @test
*/
public function noUpdateNecessaryTest(): void
{
$subject = new BulletContentElementUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
public function updateTest(): void
{
$subject = new BulletContentElementUpdate();
$this->importCSVDataSet(__DIR__ . '/Fixtures/BulletContentElementUpdate/Input.csv');
self::assertTrue($subject->updateNecessary());
$subject->executeUpdate();
self::assertFalse($subject->updateNecessary());
$this->assertCSVDataSet(__DIR__ . '/Fixtures/BulletContentElementUpdate/Result.csv');

// Just ensure that running the upgrade again does not change anything
$subject->executeUpdate();
$this->assertCSVDataSet(__DIR__ . '/Fixtures/BulletContentElementUpdate/Result.csv');
}
}
51 changes: 51 additions & 0 deletions Tests/Functional/Updates/CarouselContentElementUpdateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use BK2K\BootstrapPackage\Updates\CarouselContentElementUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* @extensionScannerIgnoreFile
*/
final class CarouselContentElementUpdateTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/bootstrap_package'
];

/**
* @test
*/
public function noUpdateNecessaryTest(): void
{
$subject = new CarouselContentElementUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
public function updateTest(): void
{
$subject = new CarouselContentElementUpdate();
$this->importCSVDataSet(__DIR__ . '/Fixtures/CarouselContentElementUpdate/Input.csv');
self::assertTrue($subject->updateNecessary());
$subject->executeUpdate();
self::assertFalse($subject->updateNecessary());
$this->assertCSVDataSet(__DIR__ . '/Fixtures/CarouselContentElementUpdate/Result.csv');

// Just ensure that running the upgrade again does not change anything
$subject->executeUpdate();
$this->assertCSVDataSet(__DIR__ . '/Fixtures/CarouselContentElementUpdate/Result.csv');
}
}
51 changes: 51 additions & 0 deletions Tests/Functional/Updates/CarouselItemLayoutUpdateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use BK2K\BootstrapPackage\Updates\CarouselItemLayoutUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* @extensionScannerIgnoreFile
*/
final class CarouselItemLayoutUpdateTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/bootstrap_package'
];

/**
* @test
*/
public function noUpdateNecessaryTest(): void
{
$subject = new CarouselItemLayoutUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
public function updateTest(): void
{
$subject = new CarouselItemLayoutUpdate();
$this->importCSVDataSet(__DIR__ . '/Fixtures/CarouselItemLayoutUpdate/Input.csv');
self::assertTrue($subject->updateNecessary());
$subject->executeUpdate();
self::assertFalse($subject->updateNecessary());
$this->assertCSVDataSet(__DIR__ . '/Fixtures/CarouselItemLayoutUpdate/Result.csv');

// Just ensure that running the upgrade again does not change anything
$subject->executeUpdate();
$this->assertCSVDataSet(__DIR__ . '/Fixtures/CarouselItemLayoutUpdate/Result.csv');
}
}
51 changes: 51 additions & 0 deletions Tests/Functional/Updates/CarouselItemTypeUpdateTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use BK2K\BootstrapPackage\Updates\CarouselItemTypeUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* @extensionScannerIgnoreFile
*/
final class CarouselItemTypeUpdateTest extends FunctionalTestCase
{
protected array $testExtensionsToLoad = [
'typo3conf/ext/bootstrap_package'
];

/**
* @test
*/
public function noUpdateNecessaryTest(): void
{
$subject = new CarouselItemTypeUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
public function updateTest(): void
{
$subject = new CarouselItemTypeUpdate();
$this->importCSVDataSet(__DIR__ . '/Fixtures/CarouselItemTypeUpdate/Input.csv');
self::assertTrue($subject->updateNecessary());
$subject->executeUpdate();
self::assertFalse($subject->updateNecessary());
$this->assertCSVDataSet(__DIR__ . '/Fixtures/CarouselItemTypeUpdate/Result.csv');

// Just ensure that running the upgrade again does not change anything
$subject->executeUpdate();
$this->assertCSVDataSet(__DIR__ . '/Fixtures/CarouselItemTypeUpdate/Result.csv');
}
}
Loading

0 comments on commit 2fbfd0c

Please sign in to comment.