-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add coverage to project. * Update `Describe.php`. * Fix `describe` not working. * Fix `describe` not working. * Add coverage to `test.yml`. * Update `phpunit.xml`. * revert. * Update `phpunit.xml`. --------- Co-authored-by: david_smith <david_smith@sweetwater.com>
- Loading branch information
1 parent
759b38b
commit 6dc210d
Showing
15 changed files
with
150 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ vendor | |
.idea | ||
composer.lock | ||
.phpunit.result.cache | ||
.php-cs-fixer.cache | ||
.php-cs-fixer.cache | ||
/.phpunit.cache/ |
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 |
---|---|---|
@@ -1,18 +1,22 @@ | ||
FROM php:8.1-cli AS base | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
FROM base AS composer | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
FROM base AS debug | ||
|
||
RUN pecl channel-update pecl.php.net && \ | ||
pecl install xdebug && \ | ||
docker-php-ext-enable xdebug && \ | ||
echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
docker-php-ext-enable xdebug | ||
|
||
WORKDIR /app | ||
|
||
CMD ["bash"] |
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,2 @@ | ||
zend_extension=xdebug.so | ||
xdebug.mode=coverage |
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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
FROM php:8.2-cli AS base | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
FROM base AS composer | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
FROM base AS debug | ||
|
||
RUN pecl channel-update pecl.php.net && \ | ||
pecl install xdebug && \ | ||
docker-php-ext-enable xdebug && \ | ||
echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
|
||
WORKDIR /app | ||
|
||
CMD ["bash"] |
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,2 @@ | ||
zend_extension=xdebug.so | ||
xdebug.mode=coverage |
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 |
---|---|---|
@@ -1,18 +1,23 @@ | ||
FROM php:8.3-cli AS base | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
unzip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
FROM base AS composer | ||
|
||
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer | ||
|
||
FROM base AS debug | ||
|
||
RUN pecl channel-update pecl.php.net && \ | ||
pecl install xdebug && \ | ||
docker-php-ext-enable xdebug && \ | ||
echo "xdebug.mode=coverage" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini | ||
|
||
WORKDIR /app | ||
|
||
CMD ["bash"] |
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,2 @@ | ||
zend_extension=xdebug.so | ||
xdebug.mode=coverage |
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 |
---|---|---|
@@ -1,21 +1,31 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" | ||
displayDetailsOnTestsThatTriggerDeprecations="true" | ||
displayDetailsOnTestsThatTriggerErrors="true" | ||
displayDetailsOnTestsThatTriggerNotices="true" | ||
displayDetailsOnTestsThatTriggerWarnings="true" | ||
colors="true" | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
cacheDirectory=".phpunit.cache" | ||
executionOrder="depends,defects" | ||
displayDetailsOnPhpunitDeprecations="true" | ||
failOnPhpunitDeprecation="true" | ||
failOnRisky="true" | ||
failOnWarning="true" | ||
displayDetailsOnTestsThatTriggerDeprecations="true" | ||
displayDetailsOnTestsThatTriggerErrors="true" | ||
displayDetailsOnTestsThatTriggerNotices="true" | ||
displayDetailsOnTestsThatTriggerWarnings="true" | ||
colors="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Unit"> | ||
<directory>./tests/Unit</directory> | ||
<testsuite name="default"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
<source> | ||
|
||
<source restrictDeprecations="true" | ||
restrictNotices="true" | ||
restrictWarnings="true" | ||
> | ||
<include> | ||
<directory>./app</directory> | ||
<directory>src</directory> | ||
</include> | ||
</source> | ||
</phpunit> | ||
</phpunit> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Describe\DefaultPost; | ||
|
||
use PHPUnit\Framework\Attributes\Test; | ||
use RuntimeException; | ||
use Tests\TestCase; | ||
|
||
class DefaultTest extends TestCase | ||
{ | ||
#[Test] public function from(): void | ||
{ | ||
$this->expectException(RuntimeException::class); | ||
$this->expectExceptionMessage('James'); | ||
User::from(); | ||
} | ||
|
||
#[Test] public function does_not_override(): void | ||
{ | ||
$this->expectException(RuntimeException::class); | ||
$this->expectExceptionMessage('John'); | ||
User::from([ | ||
'name' => 'John' | ||
]); | ||
} | ||
} |
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,25 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Describe\DefaultPost; | ||
|
||
use RuntimeException; | ||
use Tests\Unit\Examples\ExtendsTrait\DataModel; | ||
use Zerotoprod\DataModel\Describe; | ||
|
||
class User | ||
{ | ||
use DataModel; | ||
|
||
public string $age; | ||
|
||
#[Describe([ | ||
'default' => 'James', | ||
'post' => [self::class, 'post'] | ||
])] | ||
public string $name; | ||
|
||
public static function post($value): string | ||
{ | ||
throw new RuntimeException($value); | ||
} | ||
} |
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,16 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Examples\Default; | ||
|
||
use PHPUnit\Framework\Attributes\Test; | ||
use Tests\TestCase; | ||
|
||
class DefaultTest extends TestCase | ||
{ | ||
#[Test] public function from(): void | ||
{ | ||
$user = User::from(); | ||
|
||
$this->assertEquals('James', $user->name); | ||
} | ||
} |
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,14 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Examples\Default; | ||
|
||
use Tests\Unit\Examples\ExtendsTrait\DataModel; | ||
use Zerotoprod\DataModel\Describe; | ||
|
||
class User | ||
{ | ||
use DataModel; | ||
|
||
#[Describe(['default' => 'James'])] | ||
public string $name; | ||
} |