php-censor/tests/src/Helper/BuildInterpolatorTest.php

49 lines
1.2 KiB
PHP
Raw Permalink Normal View History

<?php
2018-03-04 12:04:15 +01:00
namespace Tests\PHPCensor\Helper;
2016-07-19 20:28:11 +02:00
use PHPCensor\Helper\BuildInterpolator;
class BuildInterpolatorTest extends \PHPUnit\Framework\TestCase
{
/**
* @var BuildInterpolator
*/
protected $testedInterpolator;
protected function setUp()
{
parent::setup();
$this->testedInterpolator = new BuildInterpolator();
}
public function testInterpolate_LeavesStringsUnchangedByDefault()
{
$string = "Hello World";
$expectedOutput = "Hello World";
$actualOutput = $this->testedInterpolator->interpolate($string);
2018-02-16 10:41:56 +01:00
self::assertEquals($expectedOutput, $actualOutput);
}
public function testInterpolate_LeavesStringsUnchangedWhenBuildIsSet()
{
2016-07-19 20:28:11 +02:00
$build = $this->prophesize('PHPCensor\\Model\\Build')->reveal();
2016-07-22 08:14:10 +02:00
$string = "Hello World";
$expectedOutput = "Hello World";
$this->testedInterpolator->setupInterpolationVars(
$build,
"/buildpath/",
2016-07-22 08:14:10 +02:00
"php-censor.local"
);
$actualOutput = $this->testedInterpolator->interpolate($string);
2018-02-16 10:41:56 +01:00
self::assertEquals($expectedOutput, $actualOutput);
}
}