Skip to content
Snippets Groups Projects
Commit 0c01a280 authored by Daniel Hürtgen's avatar Daniel Hürtgen
Browse files

Merge branch 'feature/migrate-phpunit' into 'develop'

TASK: Migrate deprecated phpunit calls

See merge request !41
parents be915d46 fa4c405d
Branches
1 merge request!41TASK: Migrate deprecated phpunit calls
Pipeline #328 passed with stage
in 6 minutes and 19 seconds
......@@ -42,13 +42,11 @@ class FinderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
parent::setUp();
$this->standardsFactoryMock = $this->getMock(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory',
array(),
array(),
'',
false
);
$this->standardsFactoryMock = $this->getMockBuilder(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory'
)
->disableOriginalConstructor()
->getMock();
$this->fixture = new Finder(null, $this->standardsFactoryMock);
}
......
......@@ -54,20 +54,18 @@ class FinderTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
parent::setUp();
$this->symfonyFinderFactoryMock = $this->getMock(
$this->symfonyFinderFactoryMock = $this->getMockBuilder(
'Higidi\ComposerPhpCSStandardsPlugin\Symfony\Finder\Factory'
);
$this->symfonyFinderMock = $this->getMock('Symfony\Component\Finder\Finder');
)->getMock();
$this->symfonyFinderMock = $this->getMockBuilder('Symfony\Component\Finder\Finder')->getMock();
$this->symfonyFinderFactoryMock
->method('create')
->willReturn($this->symfonyFinderMock);
$this->standardsFactoryMock = $this->getMock(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory',
array(),
array(),
'',
false
);
$this->standardsFactoryMock = $this->getMockBuilder(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory'
)
->disableOriginalConstructor()
->getMock();
$this->classUnderTesting = new Finder($this->symfonyFinderFactoryMock, $this->standardsFactoryMock);
}
......@@ -91,11 +89,9 @@ class FinderTest extends \PHPUnit_Framework_TestCase
->willReturn($this->symfonyFinderMock);
}
$splFileInfoMock = $this->getMock(
'Symfony\Component\Finder\SplFileInfo',
array(),
array(null, null, null)
);
$splFileInfoMock = $this->getMockBuilder('Symfony\Component\Finder\SplFileInfo')
->setConstructorArgs(array(null, null, null))
->getMock();
$splFileInfoMock
->expects($this->once())
->method('getPath')
......
......@@ -23,6 +23,7 @@ namespace Higidi\ComposerPhpCSStandardsPlugin\Tests\Unit\PHPCodeSniffer\Standard
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Factory;
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Factory as StandardFactory;
use Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard;
/**
* Test case for class \Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\StandardsFactory
......@@ -42,19 +43,15 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
parent::setUp();
$this->standardFactoryMock = $this->getMock(
$this->standardFactoryMock = $this->getMockBuilder(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Factory'
);
)->getMock();
$this->standardFactoryMock
->method('create')
->willReturn(
$this->getMock(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard',
array(),
array(),
'',
false
)
$this->getMockBuilder('Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard')
->disableOriginalConstructor()
->getMock()
);
$this->classUnderTesting = new Factory($this->standardFactoryMock);
......
......@@ -53,6 +53,9 @@ class FactoryTest extends \PHPUnit_Framework_TestCase
);
$standard = $this->classUnderTesting->create($path);
$this->assertInstanceOf('Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard', $standard);
$this->assertInstanceOf(
'Higidi\ComposerPhpCSStandardsPlugin\PHPCodeSniffer\Standards\Standard\Standard',
$standard
);
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment