-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
120 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
|
||
namespace Sinnbeck\DomAssertions\Formatters; | ||
|
||
use Illuminate\Support\Str; | ||
|
||
class Normalize | ||
{ | ||
public static function attributesArray(array $attributes): array | ||
{ | ||
foreach ($attributes as $attribute => $value) { | ||
$attributes[$attribute] = self::attributeValue($attribute, $value); | ||
} | ||
|
||
return $attributes; | ||
} | ||
|
||
public static function attributeValue($attribute, $value): mixed | ||
{ | ||
if ($attribute === 'class') { | ||
return Normalize::className($value); | ||
} | ||
|
||
if ($attribute === 'text') { | ||
return trim($value); | ||
} | ||
|
||
if (in_array($attribute, [ | ||
'readonly', | ||
'required', | ||
]) && ! $value) { | ||
return true; | ||
} | ||
|
||
return $value; | ||
} | ||
|
||
protected static function className(string $class): string | ||
{ | ||
return Str::of($class) | ||
->explode(' ') | ||
->sort() | ||
->implode(' '); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,5 @@ public function __invoke() | |
|
||
return $this; | ||
}; | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace Illuminate\Testing { | ||
class TestResponse | ||
{ | ||
public function assertElement($selector = 'body', $callback = null) | ||
{ | ||
/** @var \Illuminate\Testing\TestResponse $instance */ | ||
return $instance; | ||
} | ||
|
||
public function assertForm($selector = 'form', $callback = null) | ||
{ | ||
/** @var \Illuminate\Testing\TestResponse $instance */ | ||
return $instance; | ||
} | ||
} | ||
} |