[cs] add and apply psr2

This commit is contained in:
TomasVotruba
2017-11-12 21:23:54 +01:00
committed by Jaap van Otterdijk
parent 0294ce9b70
commit a872e515bb
20 changed files with 43 additions and 41 deletions
@@ -73,8 +73,7 @@ class DescriptionFactoryTest extends \PHPUnit_Framework_TestCase
$tagFactory->shouldReceive('create')
->once()
->with('@link http://phpdoc.org/ description', $context)
->andReturn(new Link('http://phpdoc.org/', new Description('description')))
;
->andReturn(new Link('http://phpdoc.org/', new Description('description')));
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
@@ -99,8 +98,7 @@ class DescriptionFactoryTest extends \PHPUnit_Framework_TestCase
$tagFactory->shouldReceive('create')
->once()
->with('@link http://phpdoc.org/ This', $context)
->andReturn(new Link('http://phpdoc.org/', new Description('This')))
;
->andReturn(new Link('http://phpdoc.org/', new Description('This')));
$factory = new DescriptionFactory($tagFactory);
$description = $factory->create($contents, $context);
+6 -12
View File
@@ -50,8 +50,7 @@ class StandardTagFactoryTest extends \PHPUnit_Framework_TestCase
->shouldReceive('create')
->once()
->with($expectedDescriptionText, $context)
->andReturn($expectedDescription)
;
->andReturn($expectedDescription);
$tagFactory = new StandardTagFactory(m::mock(FqsenResolver::class));
$tagFactory->addService($descriptionFactory, DescriptionFactory::class);
@@ -99,8 +98,7 @@ class StandardTagFactoryTest extends \PHPUnit_Framework_TestCase
->shouldReceive('resolve')
->with('Tag', m::type(Context::class))
->andReturn(new Fqsen($fqsen))
->getMock()
;
->getMock();
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory->shouldIgnoreMissing();
@@ -161,8 +159,7 @@ class StandardTagFactoryTest extends \PHPUnit_Framework_TestCase
[FqsenResolver::class => $resolver, 'myParam' => 'myValue'],
'serviceLocator',
$tagFactory
)
;
);
}
/**
@@ -181,8 +178,7 @@ class StandardTagFactoryTest extends \PHPUnit_Framework_TestCase
[FqsenResolver::class => $resolver, PassthroughFormatter::class => $service],
'serviceLocator',
$tagFactory
)
;
);
}
/**
@@ -202,8 +198,7 @@ class StandardTagFactoryTest extends \PHPUnit_Framework_TestCase
[FqsenResolver::class => $resolver, $interfaceName => $service],
'serviceLocator',
$tagFactory
)
;
);
}
/**
@@ -340,8 +335,7 @@ class StandardTagFactoryTest extends \PHPUnit_Framework_TestCase
->shouldReceive('create')
->once()
->with('', $context)
->andReturn(new Description(''))
;
->andReturn(new Description(''));
$typeResolver = new TypeResolver();
+5 -3
View File
@@ -342,7 +342,8 @@ class MethodTest extends \PHPUnit_Framework_TestCase
$expectedType,
$expectedValueType = null,
$expectedKeyType = null
) { $resolver = new TypeResolver();
) {
$resolver = new TypeResolver();
$descriptionFactory = m::mock(DescriptionFactory::class);
$descriptionFactory->shouldReceive('create')->with('', null)->andReturn(new Description(''));
@@ -540,7 +541,8 @@ class MethodTest extends \PHPUnit_Framework_TestCase
new Compound([
new Array_(new Object_(new Fqsen('\MyClass'))),
new Array_(new Integer()),
])
, $fixture->getReturnType());
]),
$fixture->getReturnType()
);
}
}
@@ -140,8 +140,12 @@ class PropertyReadTest extends \PHPUnit_Framework_TestCase
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
$fixture = PropertyRead::create('string $myProperty My Description', $typeResolver, $descriptionFactory,
$context);
$fixture = PropertyRead::create(
'string $myProperty My Description',
$typeResolver,
$descriptionFactory,
$context
);
$this->assertSame('string $myProperty My Description', (string)$fixture);
$this->assertSame('myProperty', $fixture->getVariableName());
@@ -140,8 +140,12 @@ class PropertyWriteTest extends \PHPUnit_Framework_TestCase
$description = new Description('My Description');
$descriptionFactory->shouldReceive('create')->with('My Description', $context)->andReturn($description);
$fixture = PropertyWrite::create('string $myProperty My Description', $typeResolver, $descriptionFactory,
$context);
$fixture = PropertyWrite::create(
'string $myProperty My Description',
$typeResolver,
$descriptionFactory,
$context
);
$this->assertSame('string $myProperty My Description', (string)$fixture);
$this->assertSame('myProperty', $fixture->getVariableName());
+1 -2
View File
@@ -125,8 +125,7 @@ class UsesTest extends \PHPUnit_Framework_TestCase
$description = new Description('My Description');
$descriptionFactory
->shouldReceive('create')->with('My Description', $context)->andReturn($description)
;
->shouldReceive('create')->with('My Description', $context)->andReturn($description);
$resolver->shouldReceive('resolve')->with('DateTime', $context)->andReturn($fqsen);
$fixture = Uses::create('DateTime My Description', $resolver, $descriptionFactory, $context);