2017 © Pedro Peláez
 

library phpunit-annotation-testcase

Use simple annotation to mock the world

image

yoannrenard/phpunit-annotation-testcase

Use simple annotation to mock the world

  • Friday, May 12, 2017
  • by yoannrenard
  • Repository
  • 1 Watchers
  • 0 Stars
  • 47 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

phpunit-annotation-testcase

Build Status, (*1)

Use simple annotations to mock the world!, (*2)

Installing Dependencies

Use Composer and run :, (*3)

$> composer require --dev yoannrenard/phpunit-annotation-testcase

Requirements

Run tests

$> bin/phpunit

Run using Docker

$> docker build -t pat .
$> docker run --rm -it -v ${PWD}:/app pat sh

Usage

<?php
use Prophecy\Prophecy\ObjectProphecy;
use YoannRenard\PHPUnitAnnotation\TestCase\AnnotationTestCase;

class MyClassTest extends AnnotationTestCase
{
    /**
     * @var  Foo|ObjectProphecy
     *
     * @mock <namespace>\Foo
     */
    protected $fooMock;

    /**
     * @var Bar
     *
     * @factory("\YoannRenard\PHPUnitAnnotation\TestCase\Mock\Bar", params={"fooMock"})
     */
    protected $bar;
}

will replace, (*4)

<?php
use Prophecy\Prophecy\ObjectProphecy;
use PHPUnit\Framework\TestCase;

class MyClassTest extends TestCase
{
    /**
     * @var Foo|ObjectProphecy
     */
    protected $fooMock;

    /** @var Bar */
    protected $bar;

    /**
     * @inheritdoc
     */
    protected function setUp(): void
    {
        parent::setUp();

        $this->fooMock = $this->prophesize(Foo::class);

        $this->bar = new Bar($this->fooMock->reveal());
    }
}

The Versions

12/05 2017

dev-master

9999999-dev

Use simple annotation to mock the world

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Yoann RENARD

12/05 2017

1.0.0

1.0.0.0

Use simple annotation to mock the world

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Yoann RENARD

12/05 2017

0.0.3

0.0.3.0

Use simple annotation to mock the world

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by Yoann RENARD

25/10 2016

0.0.2

0.0.2.0

Use simple annotation to mock the world

  Sources   Download

MIT

The Requires

 

by Yoann RENARD

24/10 2016

0.0.1

0.0.1.0

Use simple annotation to mock the world

  Sources   Download

MIT

The Requires

 

by Yoann RENARD