-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathPackagesControllerTest.php
More file actions
73 lines (62 loc) · 1.76 KB
/
PackagesControllerTest.php
File metadata and controls
73 lines (62 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
declare(strict_types=1);
namespace App\Test\TestCase\Controller;
use Cake\Core\Configure;
use Cake\TestSuite\IntegrationTestTrait;
use Cake\TestSuite\TestCase;
/**
* App\Controller\PackagesController Test Case
*
* @link \App\Controller\PackagesController
*/
class PackagesControllerTest extends TestCase
{
use IntegrationTestTrait;
/**
* Fixtures
*
* @var list<string>
*/
protected array $fixtures = [
'app.Packages',
];
/**
* @return void
*/
protected function setUp(): void
{
parent::setUp();
Configure::write('Packages.featured', ['markstory/asset_compress']);
}
/**
* @return void
*/
public function testIndexShowsFeaturedSliderOnFirstPageWithoutFilters(): void
{
$this->get('/?sort=downloads&direction=desc');
$this->assertResponseOk();
$this->assertResponseContains('Featured');
$this->assertResponseContains('data-featured-packages-slider');
$this->assertResponseContains('Latest Release');
}
/**
* @return void
*/
public function testIndexHidesFeaturedSliderOnSubsequentPages(): void
{
$this->get('/?sort=downloads&direction=desc&page=2');
$this->assertResponseOk();
$this->assertResponseNotContains('data-featured-packages-slider');
$this->assertResponseNotContains('Previous featured package');
}
/**
* @return void
*/
public function testIndexHidesFeaturedSliderWhenSearching(): void
{
$this->get('/?sort=downloads&direction=desc&search=package-02');
$this->assertResponseOk();
$this->assertResponseNotContains('data-featured-packages-slider');
$this->assertResponseContains('vendor/package-02');
}
}