mirror of
https://github.com/pestphp/pest.git
synced 2026-03-12 02:37:22 +01:00
feat: onlyOn* methods now use the private onlyOn method
This commit is contained in:
@ -223,30 +223,6 @@ final class TestCall
|
|||||||
return $this->skipOn('Linux', 'This test is skipped on [Linux].');
|
return $this->skipOn('Linux', 'This test is skipped on [Linux].');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the current test only if the given test is running on Windows.
|
|
||||||
*/
|
|
||||||
public function onlyOnWindows(): self
|
|
||||||
{
|
|
||||||
return $this->skipOnLinux()->skipOnMac();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Runs the current test only if the given test is running on Mac.
|
|
||||||
*/
|
|
||||||
public function onlyOnMac(): self
|
|
||||||
{
|
|
||||||
return $this->skipOnWindows()->skipOnLinux();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Run the current test only if the given test is running on Linux.
|
|
||||||
*/
|
|
||||||
public function onlyOnLinux(): self
|
|
||||||
{
|
|
||||||
return $this->skipOnWindows()->skipOnMac();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skips the current test if the given test is running on the given operating systems.
|
* Skips the current test if the given test is running on the given operating systems.
|
||||||
*/
|
*/
|
||||||
@ -257,6 +233,40 @@ final class TestCall
|
|||||||
: $this;
|
: $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skips the current test unless the given test is running on Windows.
|
||||||
|
*/
|
||||||
|
public function onlyOnWindows(): self
|
||||||
|
{
|
||||||
|
return $this->onlyOn('Windows', 'This test is skipped unless on [Windows].');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skips the current test unless the given test is running on Mac.
|
||||||
|
*/
|
||||||
|
public function onlyOnMac(): self
|
||||||
|
{
|
||||||
|
return $this->onlyOn('Darwin', 'This test is skipped unless on [Mac].');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skips the current test unless the given test is running on Linux.
|
||||||
|
*/
|
||||||
|
public function onlyOnLinux(): self
|
||||||
|
{
|
||||||
|
return $this->onlyOn('Linux', 'This test is skipped unless on [Linux].');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skips the current test unless the given test is running on the given operating system.
|
||||||
|
*/
|
||||||
|
private function onlyOn(string $osFamily, string $message): self
|
||||||
|
{
|
||||||
|
return $osFamily !== PHP_OS_FAMILY
|
||||||
|
? $this->skip($message)
|
||||||
|
: $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Repeats the current test the given number of times.
|
* Repeats the current test the given number of times.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user