Completed
Pull Request — master (#1)
by Nic
03:25
created

testProductWishListForm()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/**
4
 * Class ProductWishListControllerExtensionTest
5
 */
6
class ProductWishListControllerExtensionTest extends FunctionalTest
7
{
8
9
    /**
10
     * @var string
11
     */
12
    public static $fixture_file = 'product-wishlist/tests/fixtures.yml';
13
14
    /**
15
     * @var array
16
     */
17
    protected $extraDataObjects = [
18
        'TestWishListPage',
19
        'TestProductWishList',
20
    ];
21
22
    /**
23
     *
24
     */
25
    public function setUp()
26
    {
27
        parent::setUp();
28
        // Suppress themes
29
        Config::inst()->remove('SSViewer', 'theme');
30
        Config::inst()->update('Director', 'rules', ['test-wishlist-page-path' => 'TestWishListPage_Controller']);
31
    }
32
33
    /**
34
     *
35
     */
36
    public function testProductWishListForm()
37
    {
38
        $controller = new TestWishListPage_Controller($this->objFromFixture('TestWishListPage', 'one'));
39
        $this->assertInstanceOf('Form', $controller->ProductWishListForm());
40
    }
41
42
    /**
43
     *
44
     */
45
    public function testProductWishListFormPorcessing()
46
    {
47
        /*$controller = TestWishListPage_Controller::create($this->objFromFixture('TestWishListPage', 'one'));
0 ignored issues
show
Unused Code Comprehensibility introduced by
61% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
48
        $form = ProductWishListForm::create($controller, 'ProductWishListForm');
49
50
        $response = $this->get('/test-wishlist-page-path');
51
        $this->assertEquals(200, $response->getStatusCode(), 'Submission successful');
52
53
        $member = $this->objFromFixture('Member', 'cancreate');
54
        $data = ['Title' => 'abc123', 'Private' => true, 'MemberID' => $member->ID];
55
        $response = $this->submitForm('ProductWishListForm_ProductWishListForm', 'action_doProcessWishList', $data);
56
57
        $record = ProductWishList::get()->filter($data)->first();
58
        $this->assertInstanceOf('ProductWishList', $record);
59
        $this->assertTrue($record->exists());//*/
60
    }
61
62
}