Completed
Pull Request — master (#287)
by Nic
08:29
created

FoxyStripeProductTest::testProductCreation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
/**
4
 * Class FoxyStripeProductTest
5
 */
6
class FoxyStripeProductTest extends SapphireTest
7
{
8
9
    /**
10
     * @var string
11
     */
12
    protected static $fixture_file = 'foxystripe/tests/FoxyStripeTest.yml';
13
14
    /**
15
     *
16
     */
17 View Code Duplication
    function setUp()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
    {
19
        parent::setUp();
20
21
        $groupForItem = OptionGroup::create();
22
        $groupForItem->Title = 'Sample-Group';
0 ignored issues
show
Documentation introduced by
The property Title does not exist on object<OptionGroup>. Since you implemented __set, maybe consider adding a @property annotation.

Since your code implements the magic setter _set, this function will be called for any write access on an undefined variable. You can add the @property annotation to your class or interface to document the existence of this variable.

<?php

/**
 * @property int $x
 * @property int $y
 * @property string $text
 */
class MyLabel
{
    private $properties;

    private $allowedProperties = array('x', 'y', 'text');

    public function __get($name)
    {
        if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
            return $properties[$name];
        } else {
            return null;
        }
    }

    public function __set($name, $value)
    {
        if (in_array($name, $this->allowedProperties)) {
            $properties[$name] = $value;
        } else {
            throw new \LogicException("Property $name is not defined.");
        }
    }

}

Since the property has write access only, you can use the @property-write annotation instead.

Of course, you may also just have mistyped another name, in which case you should fix the error.

See also the PhpDoc documentation for @property.

Loading history...
23
        $groupForItem->write();
24
25
        $productHolder = ProductHolder::create();
26
        $productHolder->Title = 'Product Holder';
27
        $productHolder->write();
28
    }
29
30
    /**
31
     *
32
     */
33
    function testProductCreation()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
34
    {
35
36
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
37
        $default = $this->objFromFixture('FoxyCartProductCategory', 'default');
38
        $default->write();
39
40
    }
41
42
    /**
43
     *
44
     */
45
    function testProductDeletion()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
46
    {
47
48
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
49
        $product2 = $this->objFromFixture('ShippableProduct', 'product2');
50
        $product2->ParentID = ProductHolder::get()->first()->ID;
51
        $productID = $product2->ID;
52
53
        $product2->doPublish();
54
        $this->assertTrue($product2->isPublished());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
55
56
        $versions = DB::query('Select * FROM "ShippableProduct_versions" WHERE "RecordID" = ' . $productID);
57
        $versionsPostPublish = array();
58
        foreach ($versions as $versionRow) $versionsPostPublish[] = $versionRow;
59
60
        $product2->delete();
61
        $this->assertTrue(!$product2->isPublished());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
62
63
        $versions = DB::query('Select * FROM "ShippableProduct_versions" WHERE "RecordID" = ' . $productID);
64
        $versionsPostDelete = array();
65
        foreach ($versions as $versionRow) $versionsPostDelete[] = $versionRow;
66
67
        $this->assertEquals($versionsPostPublish, $versionsPostDelete);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
68
69
    }
70
71
    /**
72
     *
73
     */
74 View Code Duplication
    function testProductTitleLeadingWhiteSpace()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
75
    {
76
77
        //$this->logInWithPermission('ADMIN');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
78
        $product = $this->objFromFixture('ShippableProduct', 'product1');
79
        $product->Title = " Test with leading space";
80
        $product->ParentID = ProductHolder::get()->first()->ID;
81
        $product->write();
82
83
        $this->assertEquals($product->Title, 'Test with leading space');
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
84
85
    }
86
87
    /**
88
     *
89
     */
90 View Code Duplication
    function testProductTitleTrailingWhiteSpace()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
91
    {
92
93
        //$this->logInWithPermission('ADMIN');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
94
        $product = $this->objFromFixture('ShippableProduct', 'product1');
95
        $product->Title = "Test with trailing space ";
96
        $product->ParentID = ProductHolder::get()->first()->ID;
97
        $product->write();
98
99
        $this->assertEquals($product->Title, 'Test with trailing space');
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
100
101
    }
102
103
    /**
104
     *
105
     */
106
    function testFoxyCartProductCategoryCreation()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
107
    {
108
109
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
110
        $category = $this->objFromFixture('FoxyCartProductCategory', 'apparel');
111
        $category->write();
112
        $categoryID = $category->ID;
113
114
        $FoxyCartProductCategory = FoxyCartProductCategory::get()->filter(array('Code' => 'APPAREL'))->first();
115
116
        $this->assertEquals($categoryID, $FoxyCartProductCategory->ID);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
117
118
    }
119
120
    /**
121
     *
122
     */
123
    function testFoxyCartProductCategoryDeletion()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
124
    {
125
126
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
127
        $category = $this->objFromFixture('FoxyCartProductCategory', 'default');
128
        $category->write();
129
130
        $this->assertFalse($category->canDelete());
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
131
132
        $category2 = $this->objFromFixture('FoxyCartProductCategory', 'apparel');
133
        $category2->write();
134
        $category2ID = $category2->ID;
135
136
        $this->assertTrue($category2->canDelete());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
137
138
        //$this->logOut();
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% 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...
139
140
        //$this->logInWithPermission('ADMIN');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
141
142
        $this->assertFalse($category->canDelete());
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
143
        $this->assertTrue($category2->canDelete());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
144
145
        //$this->logOut();
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% 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...
146
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
147
148
        $category2->delete();
149
150
        $this->assertFalse(in_array($category2ID, FoxyCartProductCategory::get()->column('ID')));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
151
152
    }
153
154
    /**
155
     *
156
     */
157
    function testOptionGroupCreation()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
158
    {
159
160
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
161
        $group = $this->objFromFixture('OptionGroup', 'size');
162
        $group->write();
163
164
        $this->assertNotNull(OptionGroup::get()->first());
0 ignored issues
show
Bug introduced by
The method assertNotNull() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
165
166
    }
167
168
    /**
169
     *
170
     */
171
    function testOptionGroupDeletion()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
172
    {
173
174
        //$this->logInWithPermission('ADMIN');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
175
        $group = $this->objFromFixture('OptionGroup', 'color');
176
        $group->write();
177
        $groupID = $group->ID;
178
179
        $this->assertTrue($group->canDelete());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
180
181
        //$this->logOut();
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% 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...
182
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
183
184
        $this->assertTrue($group->canDelete());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
185
        $group->delete();
186
187
        $this->assertFalse(in_array($groupID, OptionGroup::get()->column('ID')));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
188
189
    }
190
191
    /**
192
     *
193
     */
194
    function testOptionItemCreation()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
195
    {
196
197
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
198
        $optionGroup = OptionGroup::get()->filter(array('Title' => 'Sample-Group'))->first();
199
        $option = $this->objFromFixture('OptionItem', 'large');
200
        $option->ProductOptionGroupID = $optionGroup->ID;
201
        $option->write();
202
        $optionID = $option->ID;
203
204
        $optionItem = OptionItem::get()->filter(array('ProductOptionGroupID' => $optionGroup->ID))->first();
205
206
        $this->assertEquals($optionID, $optionItem->ID);
0 ignored issues
show
Bug introduced by
The method assertEquals() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
207
208
    }
209
210
    /**
211
     *
212
     */
213
    function testOptionItemDeletion()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
214
    {
215
216
        //$this->logInWithPermission('ADMIN');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
217
        $optionGroup = (OptionGroup::get()->first())
218
            ? OptionGroup::get()->first()
219
            : OptionGroup::create();
220
        if ($optionGroup->ID == 0) {
221
            $optionGroup->Title = 'Size';
222
            $optionGroup->write();
223
        }
224
        $option = $this->objFromFixture('OptionItem', 'small');
225
        $option->ProductOptionGroupID = $optionGroup->ID;
226
        $option->write();
227
        $optionID = $option->ID;
228
229
        $this->assertTrue($option->canDelete());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
230
231
        //$this->logOut();
0 ignored issues
show
Unused Code Comprehensibility introduced by
84% 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...
232
        //$this->logInWithPermission('Product_CANCRUD');
0 ignored issues
show
Unused Code Comprehensibility introduced by
86% 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...
233
234
        $this->assertTrue($option->canDelete());
0 ignored issues
show
Bug introduced by
The method assertTrue() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
235
        $option->delete();
236
237
        $this->assertFalse(in_array($optionID, OptionItem::get()->column('ID')));
0 ignored issues
show
Bug introduced by
The method assertFalse() does not seem to exist on object<FoxyStripeProductTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
238
239
    }
240
241
}
242