-
-
Notifications
You must be signed in to change notification settings - Fork 0
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 * Add tests for 100% coverage. --------- Co-authored-by: david_smith <david_smith@sweetwater.com>
- Loading branch information
1 parent
773c779
commit d0d34db
Showing
7 changed files
with
77 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,23 @@ | ||
FROM php:7.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-2.9.8 && \ | ||
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,13 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="vendor/autoload.php" colors="true"> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd" | ||
bootstrap="vendor/autoload.php" | ||
beStrictAboutOutputDuringTests="true" | ||
beStrictAboutTodoAnnotatedTests="true" | ||
verbose="true"> | ||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory suffix="Test.php">./tests</directory> | ||
<testsuite name="default"> | ||
<directory>tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<whitelist processUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">src</directory> | ||
</whitelist> | ||
</filter> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Make; | ||
|
||
use Tests\TestCase; | ||
|
||
class FactoryTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* | ||
* @see Factory | ||
*/ | ||
public function from(): void | ||
{ | ||
$User = User::factory()->make(); | ||
|
||
self::assertEquals('John', $User->first_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,18 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Make; | ||
|
||
use Tests\Unit\DataModel; | ||
|
||
class User | ||
{ | ||
use DataModel; | ||
|
||
public const first_name = 'first_name'; | ||
public $first_name; | ||
|
||
public static function factory(array $states = []): UserFactory | ||
{ | ||
return new UserFactory($states); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
namespace Tests\Unit\Make; | ||
|
||
use Zerotoprod\DataModelFactory\Factory; | ||
|
||
class UserFactory | ||
{ | ||
use Factory; | ||
|
||
protected $model = User::class; | ||
|
||
protected function definition(): array | ||
{ | ||
return [ | ||
User::first_name => 'John' | ||
]; | ||
} | ||
} |