1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* This file is part of the Axstrad library. |
5
|
|
|
* |
6
|
|
|
* (c) Dan Kempster <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
* |
11
|
|
|
* @copyright 2014-2015 Dan Kempster <[email protected]> |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Axstrad\Component\Content\Tests\Unit\Traits; |
15
|
|
|
|
16
|
|
|
use Axstrad\Component\Content\Tests\Stubs\Traits\CopyBasedIntroductionTraitStub; |
17
|
|
|
use Axstrad\Component\Content\Traits\CopyBasedIntroduction; |
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Axstrad\Component\Content\Tests\Unit\Model\CopyIntroductionTest |
21
|
|
|
* |
22
|
|
|
* @author Dan Kempster <[email protected]> |
23
|
|
|
* @license MIT |
24
|
|
|
* @package Axstrad/Content |
25
|
|
|
* @subpackage Tests |
26
|
|
|
* @group unit |
27
|
|
|
*/ |
28
|
|
|
class CopyIntroductionTest extends \PHPUnit_Framework_TestCase |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @var CopyBasedIntroduction |
32
|
|
|
*/ |
33
|
|
|
protected $fixture; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @return void |
37
|
|
|
*/ |
38
|
|
|
public function setUp() |
39
|
|
|
{ |
40
|
|
|
$this->fixture = new CopyBasedIntroductionTraitStub; |
|
|
|
|
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
public function testCopyIsUsedWhenIntroIsNotSet() |
44
|
|
|
{ |
45
|
|
|
$this->fixture->setCopy( |
46
|
|
|
"Lorem ipsum Eu nostrud dolor reprehenderit consectetur Duis dolore labore incididunt enim ut aliqua enim ut Duis occaecat nulla in sit qui quis laboris commodo cillum officia reprehenderit ex minim consequat cillum sit veniam aliqua magna sint officia ullamco pariatur.". |
47
|
|
|
"Sed do in pariatur Ut labore ut sint Excepteur quis eu consectetur veniam sed exercitation fugiat quis sit exercitation ex ut et mollit magna in dolor aute in ut amet aute enim aute minim aute magna enim amet eu." |
48
|
|
|
); |
49
|
|
|
|
50
|
|
|
$this->assertEquals( |
51
|
|
|
"Lorem ipsum Eu nostrud dolor reprehenderit consectetur Duis dolore labore incididunt enim ut aliqua enim ut Duis occaecat nulla in sit qui quis laboris commodo cillum officia reprehenderit ex minim...", |
52
|
|
|
$this->fixture->getIntroduction() |
53
|
|
|
); |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function testIntroducitonEllipseCanBeSet() |
57
|
|
|
{ |
58
|
|
|
$this->fixture->setCopy( |
59
|
|
|
"Lorem ipsum Eu nostrud dolor reprehenderit consectetur Duis dolore labore incididunt enim ut aliqua enim ut Duis occaecat nulla in sit qui quis laboris commodo cillum officia reprehenderit ex minim consequat cillum sit veniam aliqua magna sint officia ullamco pariatur.". |
60
|
|
|
"Sed do in pariatur Ut labore ut sint Excepteur quis eu consectetur veniam sed exercitation fugiat quis sit exercitation ex ut et mollit magna in dolor aute in ut amet aute enim aute minim aute magna enim amet eu." |
61
|
|
|
); |
62
|
|
|
|
63
|
|
|
$this->assertEquals( |
64
|
|
|
"Lorem ipsum Eu nostrud dolor reprehenderit consectetur Duis dolore labore incididunt enim ut aliqua enim ut Duis occaecat nulla in sit qui quis laboris commodo cillum officia reprehenderit ex minim!!!", |
65
|
|
|
$this->fixture->getIntroduction('!!!') |
|
|
|
|
66
|
|
|
); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function testCopyIsReturnedWhenShorterThenIntroWordCount() |
70
|
|
|
{ |
71
|
|
|
$this->fixture->setCopy( |
72
|
|
|
"Lorem ipsum Deserunt sit ullamco proident dolor qui ex cillum adipisicing sunt deserunt ullamco in magna exercitation mollit." |
73
|
|
|
); |
74
|
|
|
|
75
|
|
|
$this->assertEquals( |
76
|
|
|
"Lorem ipsum Deserunt sit ullamco proident dolor qui ex cillum adipisicing sunt deserunt ullamco in magna exercitation mollit.", |
77
|
|
|
$this->fixture->getIntroduction() |
78
|
|
|
); |
79
|
|
|
} |
80
|
|
|
} |
81
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..