Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 32 additions & 11 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: searchBundle
name: PHP Symfony CI

on:
push:
Expand All @@ -10,25 +10,46 @@ env:
DATABASE_URL: mysql://root:root@127.0.0.1/search_bundle

jobs:
phpunit:
build:
runs-on: ubuntu-latest

strategy:
matrix:
php: [8.1, 8.2, 8.3]
symfony: [6.4.*, 7.0.*, 7.1.*]
exclude:
- php: 8.1
symfony: 7.1.*
- php: 8.1
symfony: 7.0.*

services:
mysql:
image: mysql:5.7
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: >-
--health-cmd "mysqladmin ping --silent"
--health-interval 10s
--health-timeout 5s
--health-retries 3

steps:
- uses: shivammathur/setup-php@2cb9b829437ee246e9b3cac53555a39208ca6d28
- uses: actions/checkout@v4
- name: Setup PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
- uses: actions/checkout@v2
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Execute tests (Unit and Feature tests) via PHPUnit
php-version: ${{ matrix.php }}
tools: flex
- name: Download dependencies
env:
SYMFONY_REQUIRE: ${{ matrix.symfony }}
uses: ramsey/composer-install@v2
- name: Run test suite on PHP ${{ matrix.php }} and Symfony ${{ matrix.symfony }}
run: vendor/bin/simple-phpunit
- name: Check Code Styles
- name: Run ECS
run: vendor/bin/ecs
- name: Check PHP Stan
- name: Run PHPStan
run: vendor/bin/phpstan analyse src tests
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# CHANGELOG

## v3.2.0
- Removed symfony ^5.4 support

## v3.0.5
- More documentation and better styling of the documentation

Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@
],
"require": {
"php": ">=8.1",
"symfony/framework-bundle": "^5.4|^6.4|^7.0",
"symfony/http-kernel": "^5.4|^6.4|^7.0",
"symfony/framework-bundle": "^6.4|^7.0",
"symfony/http-kernel": "^6.4|^7.0",
"doctrine/annotations": "^1.13.2|^2.0",
"doctrine/orm": "^2.13.3|^3.1",
"araise/core-bundle": "^1.1",
"doctrine/doctrine-migrations-bundle": "^3.2"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.4|^6.4|^7.0",
"symfony/config": "^5.4|^6.4|^7.0",
"symfony/dependency-injection": "^5.4|^6.4|^7.0",
"symfony/yaml": "^5.4|^6.4|^7.0",
"symfony/validator": "^5.4|^6.4|^7.0",
"symfony/phpunit-bridge": "^6.4|^7.0",
"symfony/config": "^6.4|^7.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/yaml": "^6.4|^7.0",
"symfony/validator": "^6.4|^7.0",
"doctrine/doctrine-bundle": "^2.5.5",
"whatwedo/php-coding-standard": "^1.0",
"zenstruck/foundry": "^1.16",
"zenstruck/foundry": "^2.0",
"zenstruck/console-test": "^v1.1.0",
"symfony/translation": "^5.4|^6.4|^7.0",
"symfony/twig-bundle": "^5.4|^6.4|^7.0",
"symfony/translation": "^6.4|^7.0",
"symfony/twig-bundle": "^6.4|^7.0",
"phpstan/phpstan": "^1.7"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/araiseSearchExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use araise\SearchBundle\Manager\IndexManager;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\Extension;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* This is the class that loads and manages your bundle configuration.
Expand Down
22 changes: 11 additions & 11 deletions tests/App/Factory/CompanyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

use araise\SearchBundle\Tests\App\Entity\Company;
use araise\SearchBundle\Tests\App\Repository\CompanyRepository;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
use Zenstruck\Foundry\Persistence\Proxy;
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;

/**
* @method static Company|Proxy createOne(array $attributes = [])
Expand All @@ -23,12 +23,17 @@
* @method static Company[]|Proxy[] findBy(array $attributes)
* @method static Company[]|Proxy[] randomSet(int $number, array $attributes = [])
* @method static Company[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static CompanyRepository|RepositoryProxy repository()
* @method static CompanyRepository|ProxyRepositoryDecorator repository()
* @method Company|Proxy create($attributes = [])
*/
final class CompanyFactory extends ModelFactory
final class CompanyFactory extends PersistentProxyObjectFactory
{
protected function getDefaults(): array
public static function class(): string
{
return Company::class;
}

protected function defaults(): array
{
return [
'name' => self::faker()->company(),
Expand All @@ -37,9 +42,4 @@ protected function getDefaults(): array
'taxIdentificationNumber' => self::faker()->numerify(self::faker()->countryCode().'###.####.###.#.###.##'),
];
}

protected static function getClass(): string
{
return Company::class;
}
}
14 changes: 7 additions & 7 deletions tests/App/Factory/ComputerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
namespace araise\SearchBundle\Tests\App\Factory;

use araise\SearchBundle\Tests\App\Entity\Computer;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
use Zenstruck\Foundry\Persistence\Proxy;
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;

/**
* @method static Computer|Proxy createOne(array $attributes = [])
Expand All @@ -47,17 +47,17 @@
* @method static Computer[]|Proxy[] findBy(array $attributes)
* @method static Computer[]|Proxy[] randomSet(int $number, array $attributes = [])
* @method static Computer[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static RepositoryProxy repository()
* @method static ProxyRepositoryDecorator repository()
* @method Computer|Proxy create($attributes = [])
*/
class ComputerFactory extends ModelFactory
class ComputerFactory extends PersistentProxyObjectFactory
{
protected static function getClass(): string
public static function class(): string
{
return Computer::class;
}

protected function getDefaults(): array
protected function defaults(): array
{
return [
'name' => self::faker()->colorName().'-'.self::faker()->randomNumber(3),
Expand Down
22 changes: 11 additions & 11 deletions tests/App/Factory/ContactFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

use araise\SearchBundle\Tests\App\Entity\Contact;
use araise\SearchBundle\Tests\App\Repository\ContactRepository;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
use Zenstruck\Foundry\Persistence\Proxy;
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;

/**
* @method static Contact|Proxy createOne(array $attributes = [])
Expand All @@ -23,21 +23,21 @@
* @method static Contact[]|Proxy[] findBy(array $attributes)
* @method static Contact[]|Proxy[] randomSet(int $number, array $attributes = [])
* @method static Contact[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static ContactRepository|RepositoryProxy repository()
* @method static ContactRepository|ProxyRepositoryDecorator repository()
* @method Contact|Proxy create($attributes = [])
*/
final class ContactFactory extends ModelFactory
final class ContactFactory extends PersistentProxyObjectFactory
{
protected function getDefaults(): array
public static function class(): string
{
return Contact::class;
}

protected function defaults(): array
{
return [
'name' => self::faker()->name(),
'company' => CompanyFactory::randomOrCreate(),
];
}

protected static function getClass(): string
{
return Contact::class;
}
}
14 changes: 7 additions & 7 deletions tests/App/Factory/DiskFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

use araise\SearchBundle\Tests\App\Entity\Computer;
use araise\SearchBundle\Tests\App\Entity\Disk;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
use Zenstruck\Foundry\Persistence\Proxy;
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;

/**
* @method static Computer|Proxy createOne(array $attributes = [])
Expand All @@ -48,17 +48,17 @@
* @method static Computer[]|Proxy[] findBy(array $attributes)
* @method static Computer[]|Proxy[] randomSet(int $number, array $attributes = [])
* @method static Computer[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static RepositoryProxy repository()
* @method static ProxyRepositoryDecorator repository()
* @method Computer|Proxy create($attributes = [])
*/
class DiskFactory extends ModelFactory
class DiskFactory extends PersistentProxyObjectFactory
{
protected static function getClass(): string
public static function class(): string
{
return Disk::class;
}

protected function getDefaults(): array
protected function defaults(): array
{
$number = self::faker()->numberBetween(1024, 1024 * 1024);
return [
Expand Down
22 changes: 11 additions & 11 deletions tests/App/Factory/PersonFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

use araise\SearchBundle\Tests\App\Entity\Person;
use araise\SearchBundle\Tests\App\Repository\PersonRepository;
use Zenstruck\Foundry\ModelFactory;
use Zenstruck\Foundry\Proxy;
use Zenstruck\Foundry\RepositoryProxy;
use Zenstruck\Foundry\Persistence\PersistentProxyObjectFactory;
use Zenstruck\Foundry\Persistence\Proxy;
use Zenstruck\Foundry\Persistence\ProxyRepositoryDecorator;

/**
* @method static Person|Proxy createOne(array $attributes = [])
Expand All @@ -23,20 +23,20 @@
* @method static Person[]|Proxy[] findBy(array $attributes)
* @method static Person[]|Proxy[] randomSet(int $number, array $attributes = [])
* @method static Person[]|Proxy[] randomRange(int $min, int $max, array $attributes = [])
* @method static PersonRepository|RepositoryProxy repository()
* @method static PersonRepository|ProxyRepositoryDecorator repository()
* @method Person|Proxy create($attributes = [])
*/
final class PersonFactory extends ModelFactory
final class PersonFactory extends PersistentProxyObjectFactory
{
protected function getDefaults(): array
public static function class(): string
{
return [
'name' => self::faker()->name(),
];
return Person::class;
}

protected static function getClass(): string
protected function defaults(): array
{
return Person::class;
return [
'name' => self::faker()->name(),
];
}
}
4 changes: 3 additions & 1 deletion tests/App/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ doctrine:
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
collation: utf8mb4_unicode_ci
url: '%env(resolve:DATABASE_URL)%'
orm:
controller_resolver:
auto_mapping: true
default_entity_manager: default
auto_generate_proxy_classes: true
entity_managers:
Expand Down
1 change: 0 additions & 1 deletion tests/App/config/packages/zenstruck_foundry.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
zenstruck_foundry:
auto_refresh_proxies: true
2 changes: 1 addition & 1 deletion tests/ExceptionOnRemoveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function testDoesNotRemoveFromIndexWhenExceptionWhileDeleting(): void

protected function setUp(): void
{
$this->disk = DiskFactory::createOne()->object();
$this->disk = DiskFactory::createOne()->_real();
self::assertNotNull($this->disk->getId());
self::assertNotNull($this->disk->getComputer()->getId());
$this->computerName = $this->disk->getComputer()->getName();
Expand Down
6 changes: 3 additions & 3 deletions tests/IndexListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function testEntityCreation(): void
'country' => 'Switzerland',
'taxIdentificationNumber' => '12344566',
]),
])->object();
])->_real();

$indexResults = $em->getRepository(Index::class)->findAll();
self::assertCount(6, $indexResults);
Expand Down Expand Up @@ -65,7 +65,7 @@ public function testEntityUpdate(): void
'country' => 'Switzerland',
'taxIdentificationNumber' => '12344566',
]),
])->object();
])->_real();

$contactId = $contact->getId();

Expand Down Expand Up @@ -115,7 +115,7 @@ public function testEntityDelete(): void
'country' => 'country',
'taxIdentificationNumber' => '123456',
]),
])->object();
])->_real();

$contactId = $contact->getId();

Expand Down