tests/Browser/DevicesTest.php
The class DevicesTest has 13 public methods. Consider refactoring DevicesTest to keep number of public methods under 10. Open
Open
class DevicesTest extends DuskTestCase
{
private $user;
public function setUp(): void
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Method testDevices_GivenUserLoggedIn_EditsDevice_DevicesUpdatedOnPage
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function testDevices_GivenUserLoggedIn_EditsDevice_DevicesUpdatedOnPage(): void
{
$this->browse(function (Browser $browser) {
$deviceName = self::$faker->word();
$deviceDescription = self::$faker->sentence();
Method testDevices_GivenUserLoggedIn_ClicksEditDeviceButton_OpensEditDeviceModal
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
public function testDevices_GivenUserLoggedIn_ClicksEditDeviceButton_OpensEditDeviceModal(): void
{
$this->browse(function (Browser $browser) {
$deviceName = self::$faker->word();
$deviceDescription = self::$faker->sentence();
Method loginAndAddDevice
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private function loginAndAddDevice(Browser $browser, string $deviceName, string $deviceDescription, int $onCode, int $offCode, int $pulseLength) : Browser
The method testDevices_GivenUserLoggedIn_EditsDevice_DevicesUpdatedOnPage() has 34 lines of code. Current threshold is set to 25. Avoid really long methods. Open
Open
public function testDevices_GivenUserLoggedIn_EditsDevice_DevicesUpdatedOnPage(): void
{
$this->browse(function (Browser $browser) {
$deviceName = self::$faker->word();
$deviceDescription = self::$faker->sentence();
- Exclude checks
The method testDevices_GivenUserLoggedIn_ClicksEditDeviceButton_OpensEditDeviceModal() has 30 lines of code. Current threshold is set to 25. Avoid really long methods. Open
Open
public function testDevices_GivenUserLoggedIn_ClicksEditDeviceButton_OpensEditDeviceModal(): void
{
$this->browse(function (Browser $browser) {
$deviceName = self::$faker->word();
$deviceDescription = self::$faker->sentence();
- Exclude checks
Line exceeds 120 characters; contains 144 characters Open
Open
->whenAvailable('#edit-device-modal', function ($modal) use ($deviceName, $deviceDescription, $onCode, $offCode, $pulseLength) {
- Exclude checks
Line exceeds 120 characters; contains 159 characters Open
Open
->whenAvailable('#edit-device-modal', function ($modal) use ($newDeviceName, $newDeviceDescription, $newOnCode, $newOffCode, $newPulseLength) {
- Exclude checks
Line exceeds 120 characters; contains 158 characters Open
Open
private function loginAndAddDevice(Browser $browser, string $deviceName, string $deviceDescription, int $onCode, int $offCode, int $pulseLength) : Browser
- Exclude checks
Line exceeds 120 characters; contains 139 characters Open
Open
->whenAvailable('#add-device-modal', function ($modal) use ($deviceName, $deviceDescription, $onCode, $offCode, $pulseLength) {
- Exclude checks