Skip to content

Commit

Permalink
Merge pull request #65 from lcobucci/simplify-coverage-annotations
Browse files Browse the repository at this point in the history
Simplify coverage annotations
  • Loading branch information
lcobucci authored Oct 1, 2020
2 parents aa54fc8 + de4b20f commit 361f703
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 162 deletions.
13 changes: 7 additions & 6 deletions test/Compiler/DumpXmlContainerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag as Parameters;

/** @coversDefaultClass \Lcobucci\DependencyInjection\Compiler\DumpXmlContainer */
final class DumpXmlContainerTest extends TestCase
{
/** @var ConfigCacheInterface&MockObject */
Expand All @@ -24,8 +25,8 @@ public function createConfig(): void
/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler\DumpXmlContainer::__construct
* @covers \Lcobucci\DependencyInjection\Compiler\DumpXmlContainer::process
* @covers ::__construct
* @covers ::process
*/
public function processShouldBeSkippedWhenDevModeIsNotEnabled(): void
{
Expand All @@ -42,8 +43,8 @@ public function processShouldBeSkippedWhenDevModeIsNotEnabled(): void
/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler\DumpXmlContainer::__construct
* @covers \Lcobucci\DependencyInjection\Compiler\DumpXmlContainer::process
* @covers ::__construct
* @covers ::process
*/
public function processShouldBeSkippedWhenCacheIsFresh(): void
{
Expand All @@ -60,8 +61,8 @@ public function processShouldBeSkippedWhenCacheIsFresh(): void
/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler\DumpXmlContainer::__construct
* @covers \Lcobucci\DependencyInjection\Compiler\DumpXmlContainer::process
* @covers ::__construct
* @covers ::process
*/
public function processShouldDumpTheContainerUsingTheXmlDumper(): void
{
Expand Down
19 changes: 10 additions & 9 deletions test/Compiler/ParameterBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;

/** @coversDefaultClass \Lcobucci\DependencyInjection\Compiler\ParameterBag */
final class ParameterBagTest extends TestCase
{
/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler\ParameterBag::__construct
* @covers \Lcobucci\DependencyInjection\Compiler\ParameterBag::set
* @covers ::__construct
* @covers ::set
*/
public function setShouldConfigureAParameter(): void
{
Expand All @@ -25,34 +26,34 @@ public function setShouldConfigureAParameter(): void
/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler\ParameterBag::__construct
* @covers \Lcobucci\DependencyInjection\Compiler\ParameterBag::get
* @covers ::__construct
* @covers ::get
*/
public function getShouldReturnTheValueOfTheParameter(): void
{
$pass = new ParameterBag(['test' => 1]);

self::assertEquals(1, $pass->get('test'));
self::assertSame(1, $pass->get('test'));
}

/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler\ParameterBag::get
* @covers ::get
*
* @uses \Lcobucci\DependencyInjection\Compiler\ParameterBag::__construct
*/
public function getShouldReturnTheDefaultValueWhenParameterDoesNotExist(): void
{
$pass = new ParameterBag();

self::assertEquals(1, $pass->get('test', 1));
self::assertSame(1, $pass->get('test', 1));
}

/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler\ParameterBag::process
* @covers ::process
*
* @uses \Lcobucci\DependencyInjection\Compiler\ParameterBag::__construct
*/
Expand All @@ -62,6 +63,6 @@ public function invokeShouldAppendAllConfiguredParametersOnTheBuilder(): void
$pass = new ParameterBag(['test' => 1]);

$pass->process($builder);
self::assertEquals(1, $builder->getParameter('test'));
self::assertSame(1, $builder->getParameter('test'));
}
}
55 changes: 13 additions & 42 deletions test/CompilerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
use function random_bytes;
use function realpath;

/**
* @covers \Lcobucci\DependencyInjection\Compiler
*
* @uses \Lcobucci\DependencyInjection\Compiler\ParameterBag
* @uses \Lcobucci\DependencyInjection\Config\ContainerConfiguration
* @uses \Lcobucci\DependencyInjection\Generator
* @uses \Lcobucci\DependencyInjection\Generators\Yaml
* @uses \Lcobucci\DependencyInjection\Testing\MakeServicesPublic
*/
final class CompilerTest extends TestCase
{
private const EXPECTED_FILES = [
Expand Down Expand Up @@ -81,17 +90,7 @@ public function cleanUpDumpDirectory(): void
exec('rm -rf ' . realpath($this->dumpDir . '/../../'));
}

/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler
*
* @uses \Lcobucci\DependencyInjection\Compiler\ParameterBag
* @uses \Lcobucci\DependencyInjection\Config\ContainerConfiguration
* @uses \Lcobucci\DependencyInjection\Generator
* @uses \Lcobucci\DependencyInjection\Generators\Yaml
* @uses \Lcobucci\DependencyInjection\Testing\MakeServicesPublic
*/
/** @test */
public function compileShouldCreateMultipleFiles(): void
{
$compiler = new Compiler();
Expand All @@ -107,17 +106,7 @@ public function compileShouldCreateMultipleFiles(): void
}
}

/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler
*
* @uses \Lcobucci\DependencyInjection\Compiler\ParameterBag
* @uses \Lcobucci\DependencyInjection\Config\ContainerConfiguration
* @uses \Lcobucci\DependencyInjection\Generator
* @uses \Lcobucci\DependencyInjection\Generators\Yaml
* @uses \Lcobucci\DependencyInjection\Testing\MakeServicesPublic
*/
/** @test */
public function compileShouldTrackChangesOnTheConfigurationFile(): void
{
$compiler = new Compiler();
Expand All @@ -129,17 +118,7 @@ public function compileShouldTrackChangesOnTheConfigurationFile(): void
);
}

/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler
*
* @uses \Lcobucci\DependencyInjection\Compiler\ParameterBag
* @uses \Lcobucci\DependencyInjection\Config\ContainerConfiguration
* @uses \Lcobucci\DependencyInjection\Generator
* @uses \Lcobucci\DependencyInjection\Generators\Yaml
* @uses \Lcobucci\DependencyInjection\Testing\MakeServicesPublic
*/
/** @test */
public function compileShouldAllowForLazyServices(): void
{
file_put_contents(
Expand All @@ -156,15 +135,7 @@ public function compileShouldAllowForLazyServices(): void
self::assertCount(count($expectedFiles) + 1, $generatedFiles);
}

/**
* @test
*
* @covers \Lcobucci\DependencyInjection\Compiler
*
* @uses \Lcobucci\DependencyInjection\Compiler\ParameterBag
* @uses \Lcobucci\DependencyInjection\Config\ContainerConfiguration
* @uses \Lcobucci\DependencyInjection\Generator
*/
/** @test */
public function compilationShouldBeSkippedWhenFileAlreadyExists(): void
{
file_put_contents($this->dumpDir . '/AppContainer.php', 'testing');
Expand Down
Loading

0 comments on commit 361f703

Please sign in to comment.