Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/atoum' into develop
- Loading branch information
Showing
18 changed files
with
258 additions
and
236 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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
|
||
$runner->addTestsFromDirectory(__DIR__ . '/test/units'); |
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,4 @@ | ||
<?php | ||
|
||
require_once __DIR__.'/vendor/autoload.php'; | ||
require_once __DIR__.'/test/units/Adapters/AbstractAdapterTest.php'; |
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 was deleted.
Oops, something went wrong.
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,36 +1,42 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="BeeBOT"> | ||
<description>Specific BeeBOT standard</description> | ||
<description>Specific BeeBOT standard</description> | ||
|
||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
<file>src</file> | ||
<file>test</file> | ||
<exclude-pattern>*/vendor/*</exclude-pattern> | ||
|
||
<rule ref="PSR1"/> | ||
<rule ref="PSR2"/> | ||
<rule ref="PSR1"/> | ||
<rule ref="PSR2"/> | ||
|
||
<rule ref="Generic.CodeAnalysis.EmptyStatement" /> | ||
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" /> | ||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" /> | ||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" /> | ||
<rule ref="Generic.CodeAnalysis.EmptyStatement" /> | ||
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement" /> | ||
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier" /> | ||
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod" /> | ||
|
||
<rule ref="Generic.ControlStructures.InlineControlStructure" /> | ||
<rule ref="Generic.ControlStructures.InlineControlStructure" /> | ||
|
||
<rule ref="Generic.Files.OneClassPerFile" /> | ||
<rule ref="Generic.Files.OneInterfacePerFile" /> | ||
<rule ref="Generic.Files.OneTraitPerFile" /> | ||
<rule ref="Generic.Files.EndFileNewline" /> | ||
<rule ref="Generic.Files.LineLength" /> | ||
<rule ref="Generic.Files.OneClassPerFile" /> | ||
<rule ref="Generic.Files.OneInterfacePerFile" /> | ||
<rule ref="Generic.Files.OneTraitPerFile" /> | ||
<rule ref="Generic.Files.EndFileNewline" /> | ||
<rule ref="Generic.Files.LineLength" /> | ||
|
||
<rule ref="Generic.NamingConventions.ConstructorName" /> | ||
<rule ref="Generic.NamingConventions.UpperCaseConstantName" /> | ||
<rule ref="Generic.NamingConventions.ConstructorName" /> | ||
<rule ref="Generic.NamingConventions.UpperCaseConstantName" /> | ||
|
||
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" /> | ||
<rule ref="Generic.PHP.DeprecatedFunctions" /> | ||
<rule ref="Generic.PHP.ForbiddenFunctions" /> | ||
<rule ref="Generic.PHP.LowerCaseConstant" /> | ||
<rule ref="Generic.PHP.NoSilencedErrors" /> | ||
<rule ref="Generic.PHP.SAPIUsage" /> | ||
<rule ref="Generic.PHP.CharacterBeforePHPOpeningTag" /> | ||
<rule ref="Generic.PHP.DeprecatedFunctions" /> | ||
<rule ref="Generic.PHP.ForbiddenFunctions" /> | ||
<rule ref="Generic.PHP.LowerCaseConstant" /> | ||
<rule ref="Generic.PHP.NoSilencedErrors" /> | ||
<rule ref="Generic.PHP.SAPIUsage" /> | ||
|
||
<rule ref="Generic.Strings.UnnecessaryStringConcat" /> | ||
<rule ref="Generic.Strings.UnnecessaryStringConcat"> | ||
<properties> | ||
<property name="allowMultiline" value="true"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="Generic.WhiteSpace.DisallowTabIndent" /> | ||
<rule ref="Generic.WhiteSpace.DisallowTabIndent" /> | ||
</ruleset> |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,70 @@ | ||
<?php | ||
/** | ||
* This file is part of the bee4/events package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @copyright Bee4 2014 | ||
* @author Stephane HULARD <s.hulard@chstudio.fr> | ||
*/ | ||
|
||
namespace Bee4\Events\Test\Units\Adapters; | ||
|
||
/** | ||
* Check behaviour of an adapter | ||
*/ | ||
abstract class AbstractAdapterTest extends \atoum | ||
{ | ||
|
||
protected $adapter; | ||
|
||
public function testAdapter() | ||
{ | ||
$this | ||
->given( | ||
$handler = function () { | ||
echo "Youpi!"; | ||
}, | ||
$event = new \mock\Bee4\Events\EventInterface | ||
) | ||
->when($this->adapter->add('name', $handler)) | ||
->output(function () use ($event) { | ||
$this->adapter->dispatch('name', $event); | ||
}) | ||
->isEqualTo("Youpi!"); | ||
} | ||
|
||
public function testAdd() | ||
{ | ||
$this | ||
->given($handler = function () { | ||
echo "Youpi!"; | ||
}) | ||
->then | ||
->array($this->adapter->get('name')) | ||
->hasSize(0) | ||
->when($this->adapter->add('name', $handler)) | ||
->then | ||
->array($this->adapter->get('name')) | ||
->hasSize(1); | ||
} | ||
|
||
|
||
public function testRemove() | ||
{ | ||
$this | ||
->given( | ||
$handler = function () { | ||
echo "Youpi!"; | ||
}, | ||
$this->adapter->add('name', $handler) | ||
) | ||
->then | ||
->array($this->adapter->get('name')) | ||
->hasSize(1) | ||
->when($this->adapter->remove('name', $handler)) | ||
->then | ||
->array($this->adapter->get('name')) | ||
->hasSize(0); | ||
} | ||
} |
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 | ||
/** | ||
* This file is part of the bee4/events package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @copyright Bee4 2014 | ||
* @author Stephane HULARD <s.hulard@chstudio.fr> | ||
*/ | ||
|
||
namespace Bee4\Events\Test\Units\Adapters; | ||
|
||
use Bee4\Events\Adapters\EvenementEventEmitterAdapter as SUT; | ||
|
||
/** | ||
* Check behaviour Événement EventEmitter adapter | ||
*/ | ||
class EvenementEventEmitterAdapter extends AbstractAdapterTest | ||
{ | ||
public function beforeTestMethod($method) | ||
{ | ||
$this->adapter = new SUT( | ||
new \Evenement\EventEmitter() | ||
); | ||
} | ||
} |
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 | ||
/** | ||
* This file is part of the bee4/events package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @copyright Bee4 2014 | ||
* @author Stephane HULARD <s.hulard@chstudio.fr> | ||
*/ | ||
|
||
namespace Bee4\Events\Test\Units\Adapters; | ||
|
||
use Bee4\Events\Adapters\SymfonyEventDispatcherAdapter as SUT; | ||
|
||
/** | ||
* Check behaviour SF2 EventDispatcher adapter | ||
*/ | ||
class SymfonyEventDispatcherAdapter extends AbstractAdapterTest | ||
{ | ||
public function beforeTestMethod($method) | ||
{ | ||
$this->adapter = new SUT( | ||
new \Symfony\Component\EventDispatcher\EventDispatcher() | ||
); | ||
} | ||
} |
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 | ||
/** | ||
* This file is part of the bee4/events package. | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @copyright Bee4 2016 | ||
* @author Stephane HULARD <s.hulard@chstudio.fr> | ||
*/ | ||
|
||
namespace Bee4\Events\Test\Units; | ||
|
||
/** | ||
* Check behaviour of the DispatcherAwareInterface | ||
*/ | ||
class DispatcherAwareInterface extends \atoum | ||
{ | ||
public function testInterface() | ||
{ | ||
$this | ||
->given($event = new \Mock\Bee4\Events\DispatcherAwareInterface) | ||
->then | ||
->object($event) | ||
->isInstanceOf('Bee4\Events\DispatcherAwareInterface'); | ||
} | ||
} |
Oops, something went wrong.