ViewableCartExtensionTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 7
rs 10
1
<?php
2
3
namespace SilverShop\Tests\Extension;
4
5
use PageController;
0 ignored issues
show
Bug introduced by
The type PageController was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use SilverShop\Cart\ShoppingCart;
7
use SilverShop\Model\Order;
8
use SilverShop\Page\Product;
9
use SilverShop\Tests\ShopTest;
10
use SilverStripe\Dev\FunctionalTest;
11
use SilverStripe\Dev\SapphireTest;
12
13
class ViewableCartExtensionTest extends FunctionalTest
14
{
15
    public static $fixture_file  = __DIR__ . '/../Fixtures/shop.yml';
16
    public static $disable_theme = true;
17
18
    public function setUp(): void
19
    {
20
        parent::setUp();
21
        ShoppingCart::singleton()->clear();
22
        ShopTest::setConfiguration();
23
        $this->logInWithPermission('ADMIN');
24
        $this->objFromFixture(Product::class, "socks")->publishSingle();
25
    }
26
27
    function testCart()
28
    {
29
        $cart = $this->objFromFixture(Order::class, "cart");
30
        ShoppingCart::singleton()->setCurrent($cart);
31
        $page = new PageController();
32
        $this->assertEquals("$8.00", (string)$page->renderWith("CartTestTemplate"));
33
    }
34
}
35