These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * This file is a part of Sculpin. |
||
7 | * |
||
8 | * (c) Dragonfly Development Inc. |
||
9 | * |
||
10 | * For the full copyright and license information, please view the LICENSE |
||
11 | * file that was distributed with this source code. |
||
12 | */ |
||
13 | |||
14 | namespace Sculpin\Core\Tests\Converter; |
||
15 | |||
16 | use PHPUnit\Framework\TestCase; |
||
17 | use Sculpin\Core\Converter\SourceConverterContext; |
||
18 | use Sculpin\Core\Source\SourceInterface; |
||
19 | |||
20 | class SourceConverterContextTest extends TestCase |
||
21 | { |
||
22 | public function testContent() |
||
23 | { |
||
24 | $source = $this->createMock(SourceInterface::class); |
||
25 | $source |
||
26 | ->expects($this->once()) |
||
27 | ->method('content') |
||
28 | ->will($this->returnValue('hello world')); |
||
29 | |||
30 | $sourceConverterContext = new SourceConverterContext($source); |
||
31 | |||
32 | $this->assertEquals('hello world', $sourceConverterContext->content()); |
||
33 | } |
||
34 | |||
35 | View Code Duplication | public function testSetContent() |
|
0 ignored issues
–
show
|
|||
36 | { |
||
37 | $source = $this->createMock(SourceInterface::class); |
||
38 | $source |
||
39 | ->expects($this->once()) |
||
40 | ->method('setContent') |
||
41 | ->with($this->equalTo('hello world')); |
||
42 | |||
43 | $sourceConverterContext = new SourceConverterContext($source); |
||
44 | $sourceConverterContext->setContent('hello world'); |
||
45 | } |
||
46 | } |
||
47 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.