|
19 | 19 | <p>Paragraph10</p>
|
20 | 20 | <p>Paragraph11</p>
|
21 | 21 | <p>Paragraph12</p>
|
| 22 | + <p>Paragraph13</p> |
| 23 | + <p>Paragraph15</p> |
| 24 | + <p>Paragraph16</p> |
| 25 | + <p>Paragraph17</p> |
| 26 | + <p>Paragraph18</p> |
| 27 | + <p>Paragraph19</p> |
| 28 | + <p>Paragraph20</p> |
22 | 29 | HTML;
|
| 30 | + |
| 31 | + $this->smallContent = <<<'HTML' |
| 32 | + <p>Paragraph1</p> |
| 33 | + <p>Paragraph2</p> |
| 34 | + <p>Paragraph3</p> |
| 35 | + <img src="https://example.com/image.jpg" alt="Image"> |
| 36 | + <p>Paragraph4</p> |
| 37 | + <p>Paragraph5</p> |
| 38 | + HTML; |
| 39 | + |
| 40 | + $this->contentOnlyParagraphs = <<<'HTML' |
| 41 | + <p>Paragraph1</p> |
| 42 | + <p>Paragraph2</p> |
| 43 | + <p>Paragraph3</p> |
| 44 | + <p>Paragraph4</p> |
| 45 | + <p>Paragraph5</p> |
| 46 | + <p>Paragraph6</p> |
| 47 | + <p>Paragraph7</p> |
| 48 | + <p>Paragraph8</p> |
| 49 | + <p>Paragraph9</p> |
| 50 | + <p>Paragraph10</p> |
| 51 | + <p>Paragraph11</p> |
| 52 | + <p>Paragraph12</p> |
| 53 | + <p>Paragraph13</p> |
| 54 | + <p>Paragraph14</p> |
| 55 | + <p>Paragraph15</p> |
| 56 | + <p>Paragraph16</p> |
| 57 | + <p>Paragraph17</p> |
| 58 | + <p>Paragraph18</p> |
| 59 | + <p>Paragraph19</p> |
| 60 | + <p>Paragraph20</p> |
| 61 | + HTML; |
| 62 | + |
| 63 | +}); |
| 64 | + |
| 65 | +it('can append first and second advertising only paragraphs', function () { |
| 66 | + $content = (new AdsPostParser($this->contentOnlyParagraphs))->appendAdvertising(); |
| 67 | + |
| 68 | + expect($content) |
| 69 | + ->toContain('<p>Paragraph1</p><div>--- YOUR AD1 HERE ---</div>') |
| 70 | + ->toContain('<p>Paragraph4</p><div>--- YOUR AD2 HERE ---</div>'); |
| 71 | +}); |
| 72 | + |
| 73 | +it('can append first and second advertising', function () { |
| 74 | + $content = (new AdsPostParser($this->content))->appendAdvertising(); |
| 75 | + |
| 76 | + expect($content) |
| 77 | + ->toContain("<p>Paragraph1</p>\n<div>--- YOUR AD1 HERE ---</div>") |
| 78 | + ->toContain("<p>Paragraph7</p>\n<div>--- YOUR AD2 HERE ---</div>"); |
| 79 | +}); |
| 80 | + |
| 81 | +it('can append advertising in small content with specific position', function () { |
| 82 | + $content = (new AdsPostParser($this->smallContent))->appendAdvertising(); |
| 83 | + |
| 84 | + expect($content) |
| 85 | + ->toContain("<p>Paragraph1</p>\n<div>--- YOUR AD1 HERE ---</div>") |
| 86 | + ->toContain("<p>Paragraph4</p>\n<div>--- YOUR AD2 HERE ---</div>"); |
23 | 87 | });
|
24 | 88 |
|
25 | 89 | it('can append advertising', function () {
|
|
32 | 96 | ->toContain('YOUR AD4 HERE');
|
33 | 97 | });
|
34 | 98 |
|
| 99 | +it('can append advertising in small content', function () { |
| 100 | + $content = (new AdsPostParser($this->smallContent))->appendAdvertising(); |
| 101 | + |
| 102 | + expect($content) |
| 103 | + ->toContain('YOUR AD1 HERE') |
| 104 | + ->toContain('YOUR AD2 HERE'); |
| 105 | +}); |
| 106 | + |
| 107 | +it('can append advertising only paragraphs', function () { |
| 108 | + $content = (new AdsPostParser($this->content))->appendAdvertising(); |
| 109 | + |
| 110 | + expect($content) |
| 111 | + ->toContain('YOUR AD1 HERE') |
| 112 | + ->toContain('YOUR AD2 HERE') |
| 113 | + ->toContain('YOUR AD3 HERE') |
| 114 | + ->toContain('YOUR AD4 HERE'); |
| 115 | +}); |
| 116 | + |
35 | 117 | it('can append single advertising', function () {
|
36 | 118 | $content = (new AdsPostParser($this->content))
|
37 | 119 | ->appendSingleAdvertising(2, 1);
|
|
0 commit comments