1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
/* |
6
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
7
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
8
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
9
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
10
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
11
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
12
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
13
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
14
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
15
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
16
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
17
|
|
|
* |
18
|
|
|
* This software consists of voluntary contributions made by many individuals |
19
|
|
|
* and is licensed under the MIT license. |
20
|
|
|
*/ |
21
|
|
|
namespace DocHeaderTest\Filter; |
22
|
|
|
|
23
|
|
|
use DocHeader\Filter\Filter; |
24
|
|
|
use DocHeader\Filter\ReplaceCurrentYearPlaceholder; |
25
|
|
|
use PHPUnit\Framework\TestCase; |
26
|
|
|
use function date; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* Tests for {@see \DocHeader\Filter\CurrentYear}. |
30
|
|
|
* |
31
|
|
|
* @group Unitary |
32
|
|
|
* @covers \DocHeader\Filter\ReplaceCurrentYearPlaceholder |
33
|
|
|
*/ |
34
|
|
|
final class ReplaceCurrentYearPlaceholderTest extends TestCase |
35
|
|
|
{ |
36
|
|
|
/** |
37
|
|
|
* @test |
38
|
|
|
*/ |
39
|
|
|
public function it_should_replace_the_year_tag_by_current_year() : void |
40
|
|
|
{ |
41
|
|
|
$filter = new ReplaceCurrentYearPlaceholder(); |
42
|
|
|
$docheader = 'Current Year -> %year%'; |
43
|
|
|
|
44
|
|
|
$this->assertInstanceOf(Filter::class, $filter); |
45
|
|
|
|
46
|
|
|
$this->assertSame('Current Year -> ' . date('Y'), $filter->__invoke($docheader)); |
47
|
|
|
$this->assertSame(date('Y'), $filter->__invoke('%year%')); |
48
|
|
|
} |
49
|
|
|
} |
50
|
|
|
|