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

you don't know atoum

you don't know atoum

Julien BIANCHI

June 04, 2016
Tweet

More Decks by Julien BIANCHI

Other Decks in Programming

Transcript

  1. YOU

  2. YOU

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

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

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

    !"isCallable; !"isNotCallable; !"isReferenceTo(/*…*/); !"isNearlyEqualTo(/*…*/);
  6. 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);
  7. 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);
  8. 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();
  9. 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) ; }
  10. 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;
  11. 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() {} }
  12. HOOKS - #30 class foo extends atoum { public function

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

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

    function setUp() {} public function tearDown() {} public function beforeTestMethod($method) {} public function afterTestMethod($method) {} }
  15. 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
  16. 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);
  17. 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…
  18. REPORTS - #39 <?php /** * @var $runner \mageekguy\atoum\runner *

    @var $script \mageekguy\atoum\configurator */ use mageekguy\atoum; $script!"addDefaultReport();
  19. 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);
  20. 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);
  21. DO

  22. YOU