Skip to content

Commit

Permalink
Merge pull request #55 from haampie/fix-phpunit-deprecated-methods
Browse files Browse the repository at this point in the history
Fix phpunit deprecated methods
  • Loading branch information
Ocramius committed Jul 20, 2016
2 parents 6b352a6 + d4da3f2 commit 81eda61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions tests/GeneratedHydratorTest/ConfigurationTest.php
Expand Up @@ -109,7 +109,7 @@ public function testSetGetClassNameInflector()
self::assertInstanceOf(ClassNameInflectorInterface::class, $this->configuration->getClassNameInflector());

/* @var $inflector ClassNameInflectorInterface|\PHPUnit_Framework_MockObject_MockObject */
$inflector = $this->getMock(ClassNameInflectorInterface::class);
$inflector = $this->createMock(ClassNameInflectorInterface::class);

$this->configuration->setClassNameInflector($inflector);
self::assertSame($inflector, $this->configuration->getClassNameInflector());
Expand All @@ -125,7 +125,7 @@ public function testSetGetGeneratorStrategy()
self::assertInstanceOf(GeneratorStrategyInterface::class, $this->configuration->getGeneratorStrategy());

/* @var $strategy GeneratorStrategyInterface|\PHPUnit_Framework_MockObject_MockObject */
$strategy = $this->getMock(GeneratorStrategyInterface::class);
$strategy = $this->createMock(GeneratorStrategyInterface::class);

$this->configuration->setGeneratorStrategy($strategy);
self::assertSame($strategy, $this->configuration->getGeneratorStrategy());
Expand All @@ -152,7 +152,7 @@ public function testSetGetGeneratedClassAutoloader()
self::assertInstanceOf(AutoloaderInterface::class, $this->configuration->getGeneratedClassAutoloader());

/* @var $autoloader AutoloaderInterface|\PHPUnit_Framework_MockObject_MockObject */
$autoloader = $this->getMock(AutoloaderInterface::class);
$autoloader = $this->createMock(AutoloaderInterface::class);

$this->configuration->setGeneratedClassAutoloader($autoloader);
self::assertSame($autoloader, $this->configuration->getGeneratedClassAutoloader());
Expand All @@ -167,7 +167,7 @@ public function testSetGetHydratorGenerator()
self::assertInstanceOf(HydratorGeneratorInterface::class, $this->configuration->getHydratorGenerator());

/* @var $generator HydratorGeneratorInterface */
$generator = $this->getMock(HydratorGeneratorInterface::class);
$generator = $this->createMock(HydratorGeneratorInterface::class);

$this->configuration->setHydratorGenerator($generator);
self::assertSame($generator, $this->configuration->getHydratorGenerator());
Expand Down
7 changes: 4 additions & 3 deletions tests/GeneratedHydratorTest/Factory/HydratorFactoryTest.php
Expand Up @@ -22,6 +22,7 @@

use CodeGenerationUtils\Autoloader\AutoloaderInterface;
use CodeGenerationUtils\GeneratorStrategy\GeneratorStrategyInterface;
use CodeGenerationUtils\Inflector\ClassNameInflectorInterface;
use CodeGenerationUtils\Inflector\Util\UniqueIdentifierGenerator;
use GeneratedHydrator\ClassGenerator\HydratorGenerator;
use GeneratedHydrator\Factory\HydratorFactory;
Expand Down Expand Up @@ -50,7 +51,7 @@ class HydratorFactoryTest extends PHPUnit_Framework_TestCase
*/
public function setUp()
{
$this->inflector = $this->getMock('CodeGenerationUtils\\Inflector\\ClassNameInflectorInterface');
$this->inflector = $this->createMock(ClassNameInflectorInterface::class);
$this->config = $this
->getMockBuilder('GeneratedHydrator\\Configuration')
->disableOriginalConstructor()
Expand Down Expand Up @@ -107,8 +108,8 @@ public function testWillTryAutoGeneration()
{
$className = UniqueIdentifierGenerator::getIdentifier('foo');
$generatedClassName = UniqueIdentifierGenerator::getIdentifier('bar');
$generator = $this->getMock(GeneratorStrategyInterface::class);
$autoloader = $this->getMock(AutoloaderInterface::class);
$generator = $this->createMock(GeneratorStrategyInterface::class);
$autoloader = $this->createMock(AutoloaderInterface::class);

$this->config->expects(self::any())->method('getHydratedClassName')->will(self::returnValue($className));
$this->config->expects(self::any())->method('doesAutoGenerateProxies')->will(self::returnValue(true));
Expand Down
Expand Up @@ -100,7 +100,7 @@ public function testDisabledMethod()

$generatedClass = $this->generateHydrator(new HydratedObject());

$this->setExpectedException(DisabledMethodException::class);
$this->expectException(DisabledMethodException::class);
$generatedClass->doFoo();
}

Expand Down Expand Up @@ -135,7 +135,7 @@ private function generateHydrator($instance) : HydratorInterface
$generatedClassName = __NAMESPACE__ . '\\' . UniqueIdentifierGenerator::getIdentifier('Foo');
$config = new Configuration($parentClassName);
/* @var $inflector ClassNameInflectorInterface|\PHPUnit_Framework_MockObject_MockObject */
$inflector = $this->getMock(ClassNameInflectorInterface::class);
$inflector = $this->createMock(ClassNameInflectorInterface::class);

$inflector
->expects(self::any())
Expand Down

0 comments on commit 81eda61

Please sign in to comment.