Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop PHPUnit 9 and limits Laravel supported versions to 10 and 11 #174

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
matrix:
php: [8.1, 8.2, 8.3]
laravel: [10, 11]
exclude:
- php: 8.1
laravel: 11
exclude:
- php: 8.1
laravel: 11

name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"illuminate/support": "^10.0|^11.0",
"illuminate/testing": "^10.0|^11.0",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^10.0.7",
"phpunit/phpunit": "^10.1|^11.0",
"symfony/console": "^6.2|^7.0",
"symfony/css-selector": "^6.2|^7.0",
"symfony/dom-crawler": "^6.2|^7.0",
Expand Down
14 changes: 3 additions & 11 deletions src/Constraints/FormFieldConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,14 @@

use Symfony\Component\DomCrawler\Crawler;

abstract class FormFieldConstraint extends PageConstraint
abstract readonly class FormFieldConstraint extends PageConstraint
{
/**
* The name or ID of the element.
*
* @var string
*/
protected $selector;

/**
* The expected value.
*
* @var string
*/
protected $value;
protected string $value;

/**
* Create a new constraint instance.
Expand All @@ -27,9 +20,8 @@ abstract class FormFieldConstraint extends PageConstraint
* @param mixed $value
* @return void
*/
public function __construct($selector, $value)
public function __construct(protected string $selector, $value)
{
$this->selector = $selector;
$this->value = (string) $value;
}

Expand Down
25 changes: 6 additions & 19 deletions src/Constraints/HasElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,20 @@

use Symfony\Component\DomCrawler\Crawler;

class HasElement extends PageConstraint
readonly class HasElement extends PageConstraint
{
/**
* The name or ID of the element.
*
* @var string
*/
protected $selector;

/**
* The attributes the element should have.
*
* @var array
*/
protected $attributes;

/**
* Create a new constraint instance.
*
* @param string $selector
* @param array $attributes
* @return void
*/
public function __construct($selector, array $attributes = [])
{
$this->selector = $selector;
$this->attributes = $attributes;
public function __construct(
protected string $selector,
protected array $attributes = []
) {
//
}

/**
Expand Down
25 changes: 6 additions & 19 deletions src/Constraints/HasInElement.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,20 @@

use Symfony\Component\DomCrawler\Crawler;

class HasInElement extends PageConstraint
readonly class HasInElement extends PageConstraint
{
/**
* The name or ID of the element.
*
* @var string
*/
protected $element;

/**
* The text expected to be found.
*
* @var string
*/
protected $text;

/**
* Create a new constraint instance.
*
* @param string $element
* @param string $text
* @return void
*/
public function __construct($element, $text)
{
$this->text = $text;
$this->element = $element;
public function __construct(
protected string $element,
protected string $text
) {
//
}

/**
Expand Down
25 changes: 6 additions & 19 deletions src/Constraints/HasLink.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,20 @@
use Illuminate\Support\Facades\URL;
use Illuminate\Support\Str;

class HasLink extends PageConstraint
readonly class HasLink extends PageConstraint
{
/**
* The text expected to be found.
*
* @var string
*/
protected $text;

/**
* The URL expected to be linked in the <a> tag.
*
* @var string|null
*/
protected $url;

/**
* Create a new constraint instance.
*
* @param string $text
* @param string|null $url
* @return void
*/
public function __construct($text, $url = null)
{
$this->url = $url;
$this->text = $text;
public function __construct(
protected string $text,
protected ?string $url = null
) {
//
}

/**
Expand Down
16 changes: 5 additions & 11 deletions src/Constraints/HasSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@

namespace Laravel\BrowserKitTesting\Constraints;

class HasSource extends PageConstraint
readonly class HasSource extends PageConstraint
{
/**
* The expected HTML source.
*
* @var string
*/
protected $source;

/**
* Create a new constraint instance.
*
* @param string $source
* @return void
*/
public function __construct($source)
{
$this->source = $source;
public function __construct(
protected string $source
) {
//
}

/**
Expand Down
16 changes: 5 additions & 11 deletions src/Constraints/HasText.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@

namespace Laravel\BrowserKitTesting\Constraints;

class HasText extends PageConstraint
readonly class HasText extends PageConstraint
{
/**
* The expected text.
*
* @var string
*/
protected $text;

/**
* Create a new constraint instance.
*
* @param string $text
* @return void
*/
public function __construct($text)
{
$this->text = $text;
public function __construct(
protected string $text
) {
//
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Constraints/HasValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Symfony\Component\DomCrawler\Crawler;

class HasValue extends FormFieldConstraint
readonly class HasValue extends FormFieldConstraint
{
/**
* Get the valid elements.
Expand Down
9 changes: 5 additions & 4 deletions src/Constraints/IsChecked.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@

namespace Laravel\BrowserKitTesting\Constraints;

class IsChecked extends FormFieldConstraint
readonly class IsChecked extends FormFieldConstraint
{
/**
* Create a new constraint instance.
*
* @param string $selector
* @return void
*/
public function __construct($selector)
{
$this->selector = $selector;
public function __construct(
protected string $selector
) {
//
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Constraints/IsSelected.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use DOMElement;
use Symfony\Component\DomCrawler\Crawler;

class IsSelected extends FormFieldConstraint
readonly class IsSelected extends FormFieldConstraint
{
/**
* Get the valid elements.
Expand Down
2 changes: 1 addition & 1 deletion src/Constraints/PageConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use SebastianBergmann\Comparator\ComparisonFailure;
use Symfony\Component\DomCrawler\Crawler;

abstract class PageConstraint extends Constraint
abstract readonly class PageConstraint extends Constraint
{
/**
* Make sure we obtain the HTML from the crawler or the response.
Expand Down
16 changes: 5 additions & 11 deletions src/Constraints/ReversePageConstraint.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,18 @@

namespace Laravel\BrowserKitTesting\Constraints;

class ReversePageConstraint extends PageConstraint
readonly class ReversePageConstraint extends PageConstraint
{
/**
* The page constraint instance.
*
* @var \Laravel\BrowserKitTesting\Constraints\PageConstraint
*/
protected $pageConstraint;

/**
* Create a new reverse page constraint instance.
*
* @param \Laravel\BrowserKitTesting\Constraints\PageConstraint $pageConstraint
* @return void
*/
public function __construct(PageConstraint $pageConstraint)
{
$this->pageConstraint = $pageConstraint;
public function __construct(
protected PageConstraint $pageConstraint
) {
//
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/TestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public function createApplication()
return new Application();
}

#[Test]
public function test_refresh_application()
{
$this->refreshApplication();
Expand Down
5 changes: 2 additions & 3 deletions tests/Unit/ImpersonatesUsersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
use Illuminate\Contracts\Auth\Authenticatable;
use Laravel\BrowserKitTesting\Concerns\ImpersonatesUsers;
use Laravel\BrowserKitTesting\Tests\TestCase;
use PHPUnit\Framework\Attributes\Test;

class ImpersonatesUsersTest extends TestCase
{
use ImpersonatesUsers;

protected $app;

/**
* @test
*/
#[Test]
public function set_currently_logged_in_user_for_app()
{
$user = new class implements Authenticatable
Expand Down
Loading
Loading