From 85122cce5a1c8de79c82c40ee87265f235d9939a Mon Sep 17 00:00:00 2001 From: Jessica Mauerhan Date: Sun, 27 Mar 2016 15:23:35 -0400 Subject: [PATCH] Test File Cleanup - Added coverage annotations - Fixed one test that didn't extend library's base test case - Removed tear downs that are duplicated by test case default - Added Mockery::close into test case default tear down --- tests/src/Builder/DefaultUuidBuilderTest.php | 5 +++++ tests/src/Builder/DegradedUuidBuilderTest.php | 5 +++++ .../Converter/Number/DegradedNumberConverterTest.php | 5 +++++ tests/src/Converter/Time/PhpTimeConverterTest.php | 5 +++++ tests/src/Generator/CombGeneratorTest.php | 9 +++++++-- tests/src/Generator/MtRandGeneratorTest.php | 5 +++++ tests/src/Generator/OpenSslGeneratorTest.php | 12 +++++------- tests/src/Generator/PeclUuidRandomGeneratorTest.php | 5 +++++ tests/src/Generator/PeclUuidTestCase.php | 7 ------- tests/src/Generator/PeclUuidTimeGeneratorTest.php | 5 +++++ tests/src/Generator/RandomBytesGeneratorTest.php | 11 +++++------ tests/src/Generator/RandomLibAdapterTest.php | 11 +++++------ tests/src/Generator/TimeGeneratorFactoryTest.php | 5 +++++ tests/src/TestCase.php | 2 ++ 14 files changed, 64 insertions(+), 28 deletions(-) diff --git a/tests/src/Builder/DefaultUuidBuilderTest.php b/tests/src/Builder/DefaultUuidBuilderTest.php index 10db9b2..199186a 100644 --- a/tests/src/Builder/DefaultUuidBuilderTest.php +++ b/tests/src/Builder/DefaultUuidBuilderTest.php @@ -4,6 +4,11 @@ namespace Ramsey\Uuid\Test\Builder; use Ramsey\Uuid\Builder\DefaultUuidBuilder; +/** + * Class DefaultUuidBuilderTest + * @package Ramsey\Uuid\Test\Builder + * @covers Ramsey\Uuid\Builder\DefaultUuidBuilder + */ class DefaultUuidBuilderTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/src/Builder/DegradedUuidBuilderTest.php b/tests/src/Builder/DegradedUuidBuilderTest.php index 584ff02..b4d6076 100644 --- a/tests/src/Builder/DegradedUuidBuilderTest.php +++ b/tests/src/Builder/DegradedUuidBuilderTest.php @@ -4,6 +4,11 @@ namespace Ramsey\Uuid\Test\Builder; use Ramsey\Uuid\Builder\DegradedUuidBuilder; +/** + * Class DegradedUuidBuilderTest + * @package Ramsey\Uuid\Test\Builder + * @covers Ramsey\Uuid\Builder\DegradedUuidBuilder + */ class DegradedUuidBuilderTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/src/Converter/Number/DegradedNumberConverterTest.php b/tests/src/Converter/Number/DegradedNumberConverterTest.php index a9a2a44..02a9b2d 100644 --- a/tests/src/Converter/Number/DegradedNumberConverterTest.php +++ b/tests/src/Converter/Number/DegradedNumberConverterTest.php @@ -5,6 +5,11 @@ namespace Ramsey\Uuid\Test\Converter\Number; use Ramsey\Uuid\Test\TestCase; use Ramsey\Uuid\Converter\Number\DegradedNumberConverter; +/** + * Class DegradedNumberConverterTest + * @package Ramsey\Uuid\Test\Converter\Number + * @covers Ramsey\Uuid\Converter\Number\DegradedNumberConverter + */ class DegradedNumberConverterTest extends TestCase { /** diff --git a/tests/src/Converter/Time/PhpTimeConverterTest.php b/tests/src/Converter/Time/PhpTimeConverterTest.php index 80cfa9e..5492956 100644 --- a/tests/src/Converter/Time/PhpTimeConverterTest.php +++ b/tests/src/Converter/Time/PhpTimeConverterTest.php @@ -4,6 +4,11 @@ namespace Ramsey\Uuid\Test\Converter; use Ramsey\Uuid\Converter\Time\PhpTimeConverter; +/** + * Class PhpTimeConverterTest + * @package Ramsey\Uuid\Test\Converter + * @covers Ramsey\Uuid\Converter\Time\PhpTimeConverter + */ class PhpTimeConverterTest extends \PHPUnit_Framework_TestCase { diff --git a/tests/src/Generator/CombGeneratorTest.php b/tests/src/Generator/CombGeneratorTest.php index b8ca802..23f98ab 100644 --- a/tests/src/Generator/CombGeneratorTest.php +++ b/tests/src/Generator/CombGeneratorTest.php @@ -3,10 +3,15 @@ namespace Ramsey\Uuid\Test\Generator; use Ramsey\Uuid\Generator\CombGenerator; +use Ramsey\Uuid\Test\TestCase; -class CombGeneratorTest extends \PHPUnit_Framework_TestCase +/** + * Class CombGeneratorTest + * @package Ramsey\Uuid\Test\Generator + * @covers Ramsey\Uuid\Generator\CombGenerator + */ +class CombGeneratorTest extends TestCase { - private $timestampBytes = 6; public function testGenerateUsesRandomGeneratorWithLengthMinusTimestampBytes() diff --git a/tests/src/Generator/MtRandGeneratorTest.php b/tests/src/Generator/MtRandGeneratorTest.php index bd916c8..b670ccd 100644 --- a/tests/src/Generator/MtRandGeneratorTest.php +++ b/tests/src/Generator/MtRandGeneratorTest.php @@ -5,6 +5,11 @@ namespace Ramsey\Uuid\Test\Generator; use Ramsey\Uuid\Generator\MtRandGenerator; use Ramsey\Uuid\Test\TestCase; +/** + * Class MtRandGeneratorTest + * @package Ramsey\Uuid\Test\Generator + * @covers Ramsey\Uuid\Generator\MtRandGenerator + */ class MtRandGeneratorTest extends TestCase { public function lengthDataProvider() diff --git a/tests/src/Generator/OpenSslGeneratorTest.php b/tests/src/Generator/OpenSslGeneratorTest.php index 4ab3e1c..7e224b5 100644 --- a/tests/src/Generator/OpenSslGeneratorTest.php +++ b/tests/src/Generator/OpenSslGeneratorTest.php @@ -4,8 +4,12 @@ namespace Ramsey\Uuid\Test\Generator; use Ramsey\Uuid\Generator\OpenSslGenerator; use Ramsey\Uuid\Test\TestCase; -use AspectMock\Test as AspectMock; +/** + * Class OpenSslGeneratorTest + * @package Ramsey\Uuid\Test\Generator + * @covers Ramsey\Uuid\Generator\OpenSslGenerator + */ class OpenSslGeneratorTest extends TestCase { public function setUp() @@ -14,12 +18,6 @@ class OpenSslGeneratorTest extends TestCase parent::setUp(); } - public function tearDown() - { - parent::tearDown(); - AspectMock::clean(); - } - public function lengthAndHexDataProvider() { return [ diff --git a/tests/src/Generator/PeclUuidRandomGeneratorTest.php b/tests/src/Generator/PeclUuidRandomGeneratorTest.php index f508f91..24fec2d 100644 --- a/tests/src/Generator/PeclUuidRandomGeneratorTest.php +++ b/tests/src/Generator/PeclUuidRandomGeneratorTest.php @@ -4,6 +4,11 @@ namespace Ramsey\Uuid\Test\Generator; use Ramsey\Uuid\Generator\PeclUuidRandomGenerator; use AspectMock\Test as AspectMock; +/** + * Class PeclUuidRandomGeneratorTest + * @package Ramsey\Uuid\Test\Generator + * @covers Ramsey\Uuid\Generator\PeclUuidRandomGenerator + */ class PeclUuidRandomGeneratorTest extends PeclUuidTestCase { private $length = 10; //Doesn't matter, it isn't used diff --git a/tests/src/Generator/PeclUuidTestCase.php b/tests/src/Generator/PeclUuidTestCase.php index 83c6058..313281c 100644 --- a/tests/src/Generator/PeclUuidTestCase.php +++ b/tests/src/Generator/PeclUuidTestCase.php @@ -3,7 +3,6 @@ namespace Ramsey\Uuid\Test\Generator; use Ramsey\Uuid\Test\TestCase; -use AspectMock\Test as AspectMock; if (!defined('UUID_TYPE_TIME')) { define('UUID_TYPE_TIME', 1); @@ -22,10 +21,4 @@ class PeclUuidTestCase extends TestCase $this->skipIfHhvm(); parent::setUp(); } - - public function tearDown() - { - AspectMock::clean(); - parent::tearDown(); - } } diff --git a/tests/src/Generator/PeclUuidTimeGeneratorTest.php b/tests/src/Generator/PeclUuidTimeGeneratorTest.php index ce813fb..f497e47 100644 --- a/tests/src/Generator/PeclUuidTimeGeneratorTest.php +++ b/tests/src/Generator/PeclUuidTimeGeneratorTest.php @@ -4,6 +4,11 @@ namespace Ramsey\Uuid\Test\Generator; use Ramsey\Uuid\Generator\PeclUuidTimeGenerator; use AspectMock\Test as AspectMock; +/** + * Class PeclUuidTimeGeneratorTest + * @package Ramsey\Uuid\Test\Generator + * @covers Ramsey\Uuid\Generator\PeclUuidTimeGenerator + */ class PeclUuidTimeGeneratorTest extends PeclUuidTestCase { diff --git a/tests/src/Generator/RandomBytesGeneratorTest.php b/tests/src/Generator/RandomBytesGeneratorTest.php index 2a01fd5..c44ed1c 100644 --- a/tests/src/Generator/RandomBytesGeneratorTest.php +++ b/tests/src/Generator/RandomBytesGeneratorTest.php @@ -6,6 +6,11 @@ use Ramsey\Uuid\Generator\RandomBytesGenerator; use Ramsey\Uuid\Test\TestCase; use AspectMock\Test as AspectMock; +/** + * Class RandomBytesGeneratorTest + * @package Ramsey\Uuid\Test\Generator + * @covers Ramsey\Uuid\Generator\RandomBytesGenerator + */ class RandomBytesGeneratorTest extends TestCase { public function setUp() @@ -14,12 +19,6 @@ class RandomBytesGeneratorTest extends TestCase parent::setUp(); } - public function tearDown() - { - parent::tearDown(); - AspectMock::clean(); - } - public function lengthAndHexDataProvider() { return [ diff --git a/tests/src/Generator/RandomLibAdapterTest.php b/tests/src/Generator/RandomLibAdapterTest.php index b91ed12..1fd8dd0 100644 --- a/tests/src/Generator/RandomLibAdapterTest.php +++ b/tests/src/Generator/RandomLibAdapterTest.php @@ -6,14 +6,13 @@ use Ramsey\Uuid\Generator\RandomLibAdapter; use Ramsey\Uuid\Test\TestCase; use Mockery; +/** + * Class RandomLibAdapterTest + * @package Ramsey\Uuid\Test\Generator + * @covers Ramsey\Uuid\Generator\SodiumRandomGenerator + */ class RandomLibAdapterTest extends TestCase { - public function tearDown() - { - parent::tearDown(); - Mockery::close(); - } - /** * @runInSeparateProcess * @preserveGlobalState disabled diff --git a/tests/src/Generator/TimeGeneratorFactoryTest.php b/tests/src/Generator/TimeGeneratorFactoryTest.php index f229384..7ec9abd 100644 --- a/tests/src/Generator/TimeGeneratorFactoryTest.php +++ b/tests/src/Generator/TimeGeneratorFactoryTest.php @@ -5,6 +5,11 @@ namespace Ramsey\Uuid\Test\Generator; use Ramsey\Uuid\Generator\TimeGeneratorFactory; use Ramsey\Uuid\Test\TestCase; +/** + * Class TimeGeneratorFactoryTest + * @package Ramsey\Uuid\Test\Generator + * @covers Ramsey\Uuid\Generator\TimeGeneratorFactory + */ class TimeGeneratorFactoryTest extends TestCase { public function testGeneratorReturnsNewGenerator() diff --git a/tests/src/TestCase.php b/tests/src/TestCase.php index 919b936..886d8e1 100644 --- a/tests/src/TestCase.php +++ b/tests/src/TestCase.php @@ -2,6 +2,7 @@ namespace Ramsey\Uuid\Test; use AspectMock\Test as AspectMock; +use Mockery; class TestCase extends \PHPUnit_Framework_TestCase { @@ -11,6 +12,7 @@ class TestCase extends \PHPUnit_Framework_TestCase if (!self::isHhvm()) { AspectMock::clean(); } + Mockery::close(); } protected function skip64BitTest()