netresearch/typo3-testing-skill / skills/typo3-testing
typo3-testing
FlaggedUse when reproducing defects as failing tests, testing template or rendered output changes, confirming changes on a running TYPO3 instance, or setting up TYPO3 extension tests: unit/functional/E2E, PHPUnit 11-13, mutation testing, final-class mocks (v14), CI matrix across TYPO3 12/13/14.3 LTS, typo3-ci-workflows meta-package, CI failures. Also: transaction rollback, worker crashes, competing requests, testing-framework setup, test matrix, integration/e2e testing, coverage, test generation.
assets/example-tests/ExampleFunctionalTest.php
View on GitHub<?php
declare(strict_types=1);
namespace Vendor\Extension\Tests\Functional\Domain\Repository;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
use Vendor\Extension\Domain\Model\Product;
use Vendor\Extension\Domain\Repository\ProductRepository;
/**
* Example functional test demonstrating TYPO3 testing patterns
*
* Functional tests use a real database and full TYPO3 instance.
* They test repositories, controllers, and integration scenarios.
*/
final class ProductRepositoryTest extends FunctionalTestCase
{
protected ProductRepository $subject;
/**
* Extensions to load for this test
*/
protected array $testExtensionsToLoad = [
'typo3conf/ext/my_extension',
];
protected function setUp(): void
{
parent::setUp();
// Get repository from dependency injection container
$this->subject = $this->get(ProductRepository::class);
}
/**
* @test
*/
public function findsProductsByCategory(): void
{
// Import test data from CSV fixture
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Products.csv');
// Execute repository method
$products = $this->subject->findByCategory(1);
// Assert results
self::assertCount(3, $products);
self::assertInstanceOf(Product::class, $products[0]);
}
/**
* @test
*/
public function findsVisibleProductsOnly(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/ProductsWithHidden.csv');
$products = $this->subject->findAll();
// Only visible products should be returned
self::assertCount(2, $products);
foreach ($products as $product) {
self::assertFalse($product->isHidden());
}
}
/**
* @test
*/
public function persistsNewProduct(): void
{
$this->importCSVDataSet(__DIR__ . '/../Fixtures/Pages.csv');
$product = new Product();
$product->setTitle('New Product');
$product->setPrice(19.99);
$product->setPid(1);
$this->subject->add($product);
// Persist to database
$this->persistenceManager->persistAll();
// Verify product was saved
$savedProducts = $this->subject->findAll();
self::assertCount(1, $savedProducts);
self::assertSame('New Product', $savedProducts[0]->getTitle());
}
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |