---
title: Advanced Testing With PHPUnit and PHPStan | Shopware Community Hub
description: >-
  Learn how to test Shopware plugins effectively using PHPUnit and static
  analysis with PHPStan.
canonical_url: 'https://hub.shopware.com/learn/course/advanced-testing-phpunit-phpstan'
---

# Advanced Testing With PHPUnit and PHPStan

<LearningObjectives>

- Understand how advanced testing improves code quality and confidence.
- Learn how unit and integration tests are applied in Shopware plugins.
- Apply static analysis with PHPStan to detect issues before runtime.
- Integrate testing and static analysis into CI/CD pipelines for fast feedback.
  
</LearningObjectives>

# Advanced Testing With PHPUnit and PHPStan

Testing is more than just verifying that code works. It is a key tool for maintaining quality, enabling safe refactoring, and preventing regressions.

In this course, you'll take your testing discipline to the next level. We'll cover PHPUnit test types aligned with Shopware's testing tools and how static analysis with PHPStan prevents entire classes of bugs before runtime.

## Learning Approach

This is a hands-on learning experience. We'll start with test design concepts and move to real code examples, including configuring PHPUnit, writing maintainable tests, and enforcing static analysis with PHPStan.

Ready to start? In the exercises, you'll create a small suite for a plugin service and add PHPStan checks to your CI.

## Learning Units

## Units
- [PHPUnit Foundations](/learn/unit/phpunit-foundations): Learn how to configure PHPUnit and write fast, isolated, and maintainable unit tests for Shopware plugins.
- [Integration Testing With the Shopware Test Kernel](/learn/unit/integration-testing-with-kernel): Learn how to write reliable integration tests by booting the Shopware test kernel to verify persistence logic, service wiring, and application behavior.
- [Static Analysis With PHPStan](/learn/unit/phpstan-static-analysis): Learn how to configure PHPStan for Shopware plugins, fix common issues, and integrate PHPStan into your CI/CD pipeline.
