Upgrade to Pro — share decks privately, control downloads, hide ads and more …

you don't know atoum

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

you don't know atoum

Avatar for Julien BIANCHI

Julien BIANCHI

June 04, 2016

More Decks by Julien BIANCHI

Other Decks in Programming

Transcript

  1. YOU

  2. YOU

  3. …

  4. TEST CLASS - #2 use atoum; class foo extends atoum

    {} use mageekguy\atoum; class foo extends atoum\test {} ===
  5. ASSERTIONS (BIS) - #9 !"{‘==’}(/*…*/); !"{‘! =’}(/*…*/); !"{‘===‘}(/*…*/); !"{‘! ==‘}(/*…*/);

    !"{‘>’}(/*…*/); !"{‘<‘}(/*…*/); !"{‘> =‘}(/*…*/); !"{‘< =‘}(/*…*/);
  6. ASSERTIONS (TER) - #10 !"isNull; !"isNotNull; !"isTrue; !"isNotTrue; !"isFalse; !"isNotFalse;

    !"isCallable; !"isNotCallable; !"isReferenceTo(/*…*/); !"isNearlyEqualTo(/*…*/);
  7. MOCK CREATION - #13 namespace mock; class klass extends \klass

    { public function __construct(at $at, oum $oum) { parent::__construct($at, $oum); } } class klass { public function __construct(at $at, oum $oum) {/*…*/} } $mock = new \mock\klass($at, $oum);
  8. MOCK CREATION (BIS) - #14 namespace mock; class klass extends

    \klass { public function __construct(at $at, oum $oum) {} } class klass { public function __construct(at $at, oum $oum) {/*…*/} } $this!"mockGenerator!"shuntParentClassCalls(); $mock = new \mock\klass($at, $oum);
  9. MOCK CREATION (TER) - #15 namespace mock; class klass extends

    \klass { public function __construct() {} } class klass { public function __construct(at $at, oum $oum) {/*…*/} } $this!"mockGenerator!"orphanize(‘__construct’); $mock = new \mock\klass();
  10. MOCK (AUTO) CREATION (QUATER) - #16 public function testFoo(at $at,

    oum $oum) { $this !"given($mock = new \mock\klass($at, $oum)) !"then !"mock($at) !"mock($oum) !"mock($mock) ; }
  11. MOCK ASSERTIONS (QUINQUIES) - #25 $this!"mock($mock)!"call(‘foo’)!"before( $this!"mock($mock)!"call(‘bar’)!"after( $this!"mock($mock)!"call(‘baz’)!"once )—>once )!"once;

    $this!"mock($mock)!"call(‘baz’)!"before( $this!"mock($mock)!"call(‘bar’)!"after( $this!"mock($mock)!"call(‘foo’)!"once )!"once )!"once;
  12. ENGINES - #29 class foo extends atoum { /** @engine

    inline */ public function testA() {} /** @engine inline */ public function testB() {} /** @engine isolate */ public function testC() {} /** @engine concurrent */ public function testD() {} /** @engine concurrent */ public function testD() {} }
  13. HOOKS - #30 class foo extends atoum { public function

    setUp() {} public function tearDown() {} public function beforeTestMethod($method) {} public function afterTestMethod($method) {} }
  14. HOOKS (BIS) - #31 class foo extends atoum { public

    function setUp() {} public function tearDown() {} public function beforeTestMethod($method) {} public function afterTestMethod($method) {} }
  15. HOOKS (TER) - #32 class foo extends atoum { public

    function setUp() {} public function tearDown() {} public function beforeTestMethod($method) {} public function afterTestMethod($method) {} }
  16. RUNNING - #33 vendor/bin/atoum -d tests/units vendor/bin/atoum -f tests/units/klass.php vendor/bin/atoum

    -d tests/units -ns my\\namespace vendor/bin/atoum -d tests/units -m my\\namespace\\klass::testFoo vendor/bin/atoum -d tests/units -t fastTests
  17. CONFIGURATION - #37 <?php /** * @var $runner \mageekguy\atoum\runner *

    @var $script \mageekguy\atoum\configurator */ use mageekguy\atoum; define(‘TESTS_ROOT’, __DIR__ . ‘/tests/units’); $script!"addTestsFromDirectory(TESTS_ROOT);
  18. CONFIGURATION (BIS) - #38 vendor !"" .atoum.php #"" project/ !""

    .atoum.php !"" .bootstrap.atoum.php #"" tests/ #"" units/ #"" StdClass.php 3 directories, 4 file vendor/bin/atoum -d tests/units +verbose Using +verbose -d tests/units arguments… Using '/private/tmp/vendor/.atoum.php' configuration file… Using '/private/tmp/vendor/project/.atoum.php' configuration file… Using '/private/tmp/vendor/project/.bootstrap.atoum.php' bootstrap file…
  19. REPORTS - #39 <?php /** * @var $runner \mageekguy\atoum\runner *

    @var $script \mageekguy\atoum\configurator */ use mageekguy\atoum; $script!"addDefaultReport();
  20. REPORTS (BIS) - #40 <?php /** * @var $runner \mageekguy\atoum\runner

    * @var $script \mageekguy\atoum\configurator */ use mageekguy\atoum; $script!"addDefaultReport(); $xunitWriter = new atoum\writers\file(‘atoum.xunit.xml’); $xunitReport = new atoum\reports\asynchronous\xunit(); $xunitReport!"addWriter($xunitWriter); $runner!"addReport($xunitReport);
  21. REPORTS (BIS) - #41 <?php /** * @var $runner \mageekguy\atoum\runner

    * @var $script \mageekguy\atoum\configurator */ use mageekguy\atoum; $script!"addDefaultReport(); $cloverWriter = new atoum\writers\file(‘atoum.clover.xml’); $cloverReport = new atoum\reports\asynchronous\clover(); $cloverReport!"addWriter($cloverWriter); $runner!"addReport($cloverReport);
  22. DO

  23. YOU