Skip to content

Commit fa7d67e

Browse files
committed
Update for atoum 3.x
1 parent a41a838 commit fa7d67e

17 files changed

+61
-102
lines changed

.atoum.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,4 @@
11
<?php
2-
require_once __DIR__ . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . 'autoloader.php';
3-
4-
use mageekguy\atoum\phpunit;
5-
use mageekguy\atoum\autoloop;
6-
use mageekguy\atoum\report\fields\runner\result\notifier;
7-
8-
$extension = new autoloop\extension($script);
9-
$extension
10-
->setWatchedFiles(array(__DIR__ . '/classes'))
11-
->addToRunner($runner)
12-
;
13-
14-
$extension = new phpunit\extension($script);
15-
$extension->addToRunner($runner);
16-
17-
if (getenv('TRAVIS_PHP_VERSION') === '7.0')
18-
{
19-
$script
20-
->php('php -n -ddate.timezone=Europe/Paris')
21-
->noCodeCoverage()
22-
;
23-
}
242

253
$script->noCodeCoverageForClasses('mageekguy\atoum\asserter');
264
$script->noCodeCoverageForNamespaces('mageekguy\atoum\asserters');
27-
$script->noCodeCoverageForNamespaces('mageekguy\atoum\autoloop');
28-
29-
if (PHP_OS === 'Darwin') {
30-
$notifier = new notifier\terminal();
31-
$report = $script->addDefaultReport();
32-
$report->addField($notifier);
33-
}
34-

.bootstrap.atoum.php

Lines changed: 0 additions & 3 deletions
This file was deleted.

autoloader.php

Lines changed: 0 additions & 34 deletions
This file was deleted.

classes/constraints/containsOnly.php

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
namespace mageekguy\atoum\phpunit\constraints;
44

5+
use mageekguy\atoum\asserters\boolean;
6+
use mageekguy\atoum\asserters\integer;
7+
use mageekguy\atoum\asserters\phpArray;
8+
use mageekguy\atoum\asserters\phpFloat;
9+
use mageekguy\atoum\asserters\phpObject;
10+
use mageekguy\atoum\asserters\phpString;
11+
use mageekguy\atoum\asserters\variable;
512
use
613
mageekguy\atoum\phpunit\constraint,
714
mageekguy\atoum\exceptions,
@@ -51,35 +58,34 @@ protected function matches($actual)
5158

5259
private static function getAssertion($type)
5360
{
54-
$namespace = 'mageekguy\atoum\asserters';
5561
$assertion = null;
5662
$transform = null;
5763
$expected = null;
5864

5965
switch ($type)
6066
{
6167
case 'int':
62-
$classname = $namespace . '\\integer';
68+
$classname = integer::class;
6369
break;
6470

6571
case 'float':
66-
$classname = $namespace . '\\phpFloat';
72+
$classname = phpFloat::class;
6773
break;
6874

6975
case 'bool':
70-
$classname = $namespace . '\\boolean';
76+
$classname = boolean::class;
7177
break;
7278

7379
case 'string':
74-
$classname = $namespace . '\\phpString';
80+
$classname = phpString::class;
7581
break;
7682

7783
case 'array':
78-
$classname = $namespace . '\\phpArray';
84+
$classname = phpArray::class;
7985
break;
8086

8187
case 'null':
82-
$classname = $namespace . '\\variable';
88+
$classname = variable::class;
8389
$assertion = 'isNull';
8490
break;
8591

@@ -88,19 +94,19 @@ private static function getAssertion($type)
8894
case 'double':
8995
case 'real':
9096
case 'callable':
91-
$classname = $namespace . '\\boolean';
97+
$classname = boolean::class;
9298
$transform = 'is_' . $type;
9399
$assertion = 'isTrue';
94100
break;
95101

96102
case 'boolean':
97103
case 'integer':
98104
case 'resource':
99-
$classname = $namespace . '\\' . $type;
105+
$classname = 'mageekguy\atoum\asserters\\' . $type;
100106
break;
101107

102108
default:
103-
$classname = $namespace . '\\object';
109+
$classname = phpObject::class;
104110

105111
if ($type !== 'object') {
106112
$assertion = 'isInstanceOf';

classes/constraints/containsOnlyInstancesOf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ protected function matches($actual)
3030

3131
try
3232
{
33-
$asserter = new asserters\object(null, $this->analyzer);
33+
$asserter = new asserters\phpObject(null, $this->analyzer);
3434

3535
foreach ($actual as $value)
3636
{

classes/constraints/isInstanceOf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct($expected, $description = null)
2020

2121
protected function matches($actual)
2222
{
23-
$asserter = new asserters\object();
23+
$asserter = new asserters\phpObject();
2424

2525
try
2626
{

classes/constraints/isNotInstanceOf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function __construct($expected, $description = null)
2020

2121
protected function matches($actual)
2222
{
23-
$asserter = new asserters\object();
23+
$asserter = new asserters\phpObject();
2424

2525
try
2626
{

classes/test.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
abstract class test extends atoum\test
1313
{
14+
const defaultMethodPrefix = '/^(test|should)|.*_should_/';
1415
const defaultEngine = 'inline';
1516
const defaultNamespace = '#(?:^|\\\)tests?\\\.*?units?.*?\\\#i';
1617

@@ -173,6 +174,10 @@ public function setAssertionManager(assertion\manager $assertionManager = null)
173174
$test->skip('getMock is not supported.');
174175
}
175176
)
177+
->setHandler('getMockForAbstractClass', function() use ($test) {
178+
$test->skip('getMockForAbstractClass is not supported.');
179+
}
180+
)
176181
->setHandler('setExpectedException', function() use ($test) {
177182
$test->skip('setExpectedException is not supported.');
178183
}

composer.json

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@
1212
}
1313
],
1414
"require": {
15-
"atoum/atoum": "dev-virtual-hooks as 2.6.0"
15+
"atoum/atoum": "dev-virtual-hooks as 3.3.0"
1616

1717
},
1818
"require-dev": {
19-
"phpunit/phpunit": "@stable",
20-
"atoum/autoloop-extension": "^0.0.1"
19+
"phpunit/phpunit": "@stable"
2120
},
2221
"autoload": {
23-
"files": ["autoloader.php"]
22+
"psr-4": {
23+
"mageekguy\\atoum\\phpunit\\": "classes"
24+
},
25+
"classmap": [ "phpunit/" ],
26+
"files": ["configuration.php"]
2427
},
2528
"extra": {
2629
"branch-alias": {

configuration.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
use mageekguy\atoum;
4+
use mageekguy\atoum\phpunit;
5+
use mageekguy\atoum\scripts;
6+
7+
if (defined('mageekguy\atoum\scripts\runner') === true && (constant('mageekguy\atoum\version') === 'dev-master' || version_compare(constant('mageekguy\atoum\version'), '2.9.0-beta', '>=') === true)) {
8+
scripts\runner::addConfigurationCallable(function(atoum\configurator $script, atoum\runner $runner) {
9+
$extension = new phpunit\extension($script);
10+
$extension->addToRunner($runner);
11+
});
12+
}

0 commit comments

Comments
 (0)