Skip to content

Commit

Permalink
Fix namespaces in tests & exclude from exports (#47)
Browse files Browse the repository at this point in the history
* Fix namespaces in tests

* Exclude test & dev files from exports
  • Loading branch information
HypeMC authored Oct 10, 2022
1 parent 86ef757 commit cafedbc
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 30 deletions.
7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/.github export-ignore
/dev export-ignore
/tests export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"autoload-dev": {
"psr-4": {
"": "tests/"
"SofaScore\\Purgatory\\Tests\\": "tests/"
}
},
"require": {
Expand Down
6 changes: 3 additions & 3 deletions tests/AnnotationReader/AttributeReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

declare(strict_types=1);

namespace AnnotationReader;
namespace SofaScore\Purgatory\Tests\AnnotationReader;

use AnnotationReader\Fixtures\DualClass;
use AnnotationReader\Fixtures\SillyLittleAnnotation;
use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\AnnotationReader\AttributeReader;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\DualClass;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\SillyLittleAnnotation;

/**
* @coversDefaultClass \SofaScore\Purgatory\AnnotationReader\AttributeReader
Expand Down
6 changes: 3 additions & 3 deletions tests/AnnotationReader/Driver/DoctrineDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
declare(strict_types=1);


namespace AnnotationReader\Driver;
namespace SofaScore\Purgatory\Tests\AnnotationReader\Driver;


use AnnotationReader\Fixtures\Entity1;
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Entity;
Expand All @@ -14,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\AnnotationReader\Driver\DoctrineDriver;
use SofaScore\Purgatory\AnnotationReader\DriverInterface;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\Entity1;
use Symfony\Component\Serializer\Annotation\Groups;

/**
Expand Down Expand Up @@ -96,4 +96,4 @@ public function testGetPropertyAnnotation(): void
$id = $this->driver->getPropertyAnnotation($idProperty, Id::class);
self::assertInstanceOf(Id::class, $id);
}
}
}
6 changes: 3 additions & 3 deletions tests/AnnotationReader/Driver/DualDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace AnnotationReader\Driver;
namespace SofaScore\Purgatory\Tests\AnnotationReader\Driver;

use AnnotationReader\Fixtures\DualClass;
use AnnotationReader\Fixtures\SillyLittleAnnotation;
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\AnnotationReader\AttributeReader;
use SofaScore\Purgatory\AnnotationReader\Driver\DualDriver;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\DualClass;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\SillyLittleAnnotation;

/**
* @coversDefaultClass \SofaScore\Purgatory\AnnotationReader\Driver\DualDriver
Expand Down
2 changes: 1 addition & 1 deletion tests/AnnotationReader/Fixtures/DualClass.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace AnnotationReader\Fixtures;
namespace SofaScore\Purgatory\Tests\AnnotationReader\Fixtures;

/**
* @SillyLittleAnnotation("annotation")
Expand Down
2 changes: 1 addition & 1 deletion tests/AnnotationReader/Fixtures/Entity1.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
declare(strict_types=1);


namespace AnnotationReader\Fixtures;
namespace SofaScore\Purgatory\Tests\AnnotationReader\Fixtures;


use Doctrine\ORM\Mapping as ORM;
Expand Down
2 changes: 1 addition & 1 deletion tests/AnnotationReader/Fixtures/Entity2.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);


namespace AnnotationReader\Fixtures;
namespace SofaScore\Purgatory\Tests\AnnotationReader\Fixtures;


use Doctrine\ORM\Mapping as ORM;
Expand Down
4 changes: 2 additions & 2 deletions tests/AnnotationReader/Fixtures/ExtendedEntity1.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
declare(strict_types=1);


namespace AnnotationReader\Fixtures;
namespace SofaScore\Purgatory\Tests\AnnotationReader\Fixtures;


use Doctrine\ORM\Mapping as ORM;
Expand All @@ -23,4 +23,4 @@ class ExtendedEntity1 extends Entity1
* @ORM\Column(type="string", nullable=false)
*/
protected string $email;
}
}
2 changes: 1 addition & 1 deletion tests/AnnotationReader/Fixtures/SillyLittleAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace AnnotationReader\Fixtures;
namespace SofaScore\Purgatory\Tests\AnnotationReader\Fixtures;

/**
* @Annotation
Expand Down
8 changes: 4 additions & 4 deletions tests/AnnotationReader/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
declare(strict_types=1);


namespace AnnotationReader;
namespace SofaScore\Purgatory\Tests\AnnotationReader;


use AnnotationReader\Fixtures\Entity1;
use AnnotationReader\Fixtures\ExtendedEntity1;
use Doctrine\Common\Annotations\AnnotationReader;
use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\AnnotationReader\Driver\DoctrineDriver;
use SofaScore\Purgatory\AnnotationReader\Reader;
use SofaScore\Purgatory\AnnotationReader\ReaderException;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\Entity1;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\ExtendedEntity1;


/**
Expand Down Expand Up @@ -94,4 +94,4 @@ public function testGetItemClass(): void
$this->expectException(ReaderException::class);
$this->reader->getItemClass(new \stdClass());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace Command\DebugCommand;
namespace SofaScore\Purgatory\Tests\Command;


use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace DependencyInjection\CompilerPass;
namespace SofaScore\Purgatory\Tests\DependencyInjection\CompilerPass;

use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\DependencyInjection\CompilerPass\RegisterPurgerImplementationCompilerPass;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace DependencyInjection\CompilerPass;
namespace SofaScore\Purgatory\Tests\DependencyInjection\CompilerPass;

use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\DependencyInjection\CompilerPass\SymfonyPurgerRemovalCompilerPass;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<?php

namespace SofaScore\Purgatory\Mapping\Loader;
namespace SofaScore\Purgatory\Tests\Mapping\Loader;

use AnnotationReader\Fixtures\Entity1;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\Persistence\ObjectManager;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\Annotation\PurgeOn;
use SofaScore\Purgatory\AnnotationReader\Reader;
use SofaScore\Purgatory\Mapping\Loader\AnnotationsLoader;
use SofaScore\Purgatory\Mapping\Loader\Configuration;
use SofaScore\Purgatory\Mapping\MappingCollection;
use SofaScore\Purgatory\Mapping\PropertySubscription;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\Entity1;
use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RouteCollection;
Expand Down Expand Up @@ -80,7 +82,7 @@ public function testLoadOnConfiguredCacheDirSavesMappingsToCacheNoPropertySubscr
$result = require './purgatory/mappings/collection.php';
self::assertNotEmpty($result);
assertCount(1, $result);
assertEquals('app_api_v1_sport_list', $result->get('\AnnotationReader\Fixtures\Entity1')[0]->getRouteName());
assertEquals('app_api_v1_sport_list', $result->get('\\'.Entity1::class)[0]->getRouteName());
}

public function testLoadOnConfiguredCacheDirSavesMappingsToCache()
Expand Down Expand Up @@ -115,7 +117,7 @@ public function testLoadOnConfiguredCacheDirSavesMappingsToCache()
$result = require './purgatory/mappings/collection.php';
self::assertNotEmpty($result);
assertCount(1, $result);
assertEquals('app_api_v1_sport_list', $result->get('\AnnotationReader\Fixtures\Entity1::name')[0]->getRouteName());
assertEquals('app_api_v1_sport_list', $result->get(sprintf('\\%s::name', Entity1::class))[0]->getRouteName());
}

public function testCreatingSubscriptionFromAnnotation(): void
Expand Down
6 changes: 4 additions & 2 deletions tests/PurgatoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

declare(strict_types=1);

use AnnotationReader\Fixtures\Entity1;
use AnnotationReader\Fixtures\Entity2;
namespace SofaScore\Purgatory\Tests;

use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\Mapping\Loader\AnnotationsLoader;
use SofaScore\Purgatory\Mapping\MappingCollection;
use SofaScore\Purgatory\Mapping\MappingValue;
use SofaScore\Purgatory\Purgatory;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\Entity1;
use SofaScore\Purgatory\Tests\AnnotationReader\Fixtures\Entity2;
use Symfony\Component\PropertyAccess\PropertyAccessor;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?php

namespace SofaScore\Purgatory\Purger;
namespace SofaScore\Purgatory\Tests\Purger;

use PHPUnit\Framework\TestCase;
use SofaScore\Purgatory\Purger\SymfonyPurger;
use Symfony\Component\HttpKernel\HttpCache\Store;

/**
Expand Down

0 comments on commit cafedbc

Please sign in to comment.