Skip to content

Commit 7ddbc3e

Browse files
committed
Merge branch 'main' into assert-reordering
2 parents 4d08d68 + 5dd5030 commit 7ddbc3e

19 files changed

+102
-60
lines changed

src/Asserts/AssertElement.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Sinnbeck\DomAssertions\Asserts;
44

5+
/**
6+
* @internal
7+
*/
58
class AssertElement extends BaseAssert
69
{
710
}

src/Asserts/AssertForm.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Illuminate\Testing\Assert as PHPUnit;
99
use PHPUnit\Framework\Assert;
1010

11+
/**
12+
* @internal
13+
*/
1114
class AssertForm extends BaseAssert
1215
{
1316
public function hasAction(string $action): self

src/Asserts/AssertSelect.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
use PHPUnit\Framework\Assert;
88

9+
/**
10+
* @internal
11+
*/
912
class AssertSelect extends BaseAssert
1013
{
1114
public function containsOption(mixed $attributes): self

src/Asserts/BaseAssert.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Sinnbeck\DomAssertions\Asserts;
44

5-
use Carbon\Exceptions\UnknownMethodException;
5+
use BadMethodCallException;
66
use Illuminate\Support\Str;
77
use Illuminate\Support\Traits\Macroable;
88
use Sinnbeck\DomAssertions\Asserts\Traits\CanGatherAttributes;
@@ -11,6 +11,9 @@
1111
use Sinnbeck\DomAssertions\Asserts\Traits\UsesElementAsserts;
1212
use Sinnbeck\DomAssertions\Support\DomParser;
1313

14+
/**
15+
* @internal
16+
*/
1417
abstract class BaseAssert
1518
{
1619
use UsesElementAsserts;
@@ -67,6 +70,6 @@ public function __call($method, $arguments)
6770
return $this->doesntContain($elementName, ...$arguments);
6871
}
6972

70-
throw new UnknownMethodException($method);
73+
throw new BadMethodCallException(sprintf('Call to undefined method %s::%s()', static::class, $method));
7174
}
7275
}

src/Asserts/Traits/CanGatherAttributes.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Sinnbeck\DomAssertions\Asserts\Traits;
44

5+
/**
6+
* @internal
7+
*/
58
trait CanGatherAttributes
69
{
710
public function gatherAttributes($type): void

src/Asserts/Traits/Debugging.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
namespace Sinnbeck\DomAssertions\Asserts\Traits;
44

5+
/**
6+
* @internal
7+
*/
58
trait Debugging
69
{
710
public function dump(): self

src/Asserts/Traits/InteractsWithParser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use Sinnbeck\DomAssertions\Support\DomParser;
66

7+
/**
8+
* @internal
9+
*/
710
trait InteractsWithParser
811
{
912
/**

src/Asserts/Traits/UsesElementAsserts.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
use Sinnbeck\DomAssertions\Asserts\AssertElement;
88
use Sinnbeck\DomAssertions\Support\CompareAttributes;
99

10+
/**
11+
* @internal
12+
*/
1013
trait UsesElementAsserts
1114
{
1215
public function has(string $attribute, mixed $value = null): self

src/DomAssertionsServiceProvider.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,16 @@
44

55
use Illuminate\Support\ServiceProvider;
66
use Illuminate\Testing\TestResponse;
7-
use Sinnbeck\DomAssertions\Macros\AssertElementMacro;
8-
use Sinnbeck\DomAssertions\Macros\AssertFormMacro;
97

8+
/**
9+
* @internal
10+
*/
1011
class DomAssertionsServiceProvider extends ServiceProvider
1112
{
12-
public function register()
13+
public function boot()
1314
{
14-
TestResponse::macro('assertForm', app()->call(AssertFormMacro::class));
15-
TestResponse::macro('assertElement', app()->call(AssertElementMacro::class));
15+
if ($this->app->runningUnitTests()) {
16+
TestResponse::mixin(new TestResponseMacros());
17+
}
1618
}
1719
}

src/Macros/AssertElementMacro.php

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)