Skip to content

Commit 23c4c24

Browse files
committed
Update to phpunit 9 / phpunit-selenium dev-master
1 parent 711516b commit 23c4c24

File tree

8 files changed

+534
-276
lines changed

8 files changed

+534
-276
lines changed

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
}
3535
],
3636
"require": {
37-
"php": ">=7.1.0",
37+
"php": ">=7.3.0",
3838
"ext-ctype": "*",
3939
"ext-dom": "*",
4040
"ext-intl": "*",
@@ -57,8 +57,8 @@
5757
"psy/psysh": "^0"
5858
},
5959
"require-dev" : {
60-
"phpunit/phpunit" : "8.*",
61-
"phpunit/phpunit-selenium": "*",
60+
"phpunit/phpunit" : "9.*",
61+
"phpunit/phpunit-selenium": "dev-master",
6262
"phpdocumentor/shim": "^3",
6363
"pradosoft/prado-phpdoc-template": "*"
6464
},

composer.lock

Lines changed: 488 additions & 223 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpunit.xml

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,27 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<phpunit bootstrap="./tests/test_tools/phpunit_bootstrap.php"
3-
colors="true"
4-
convertErrorsToExceptions="true"
5-
convertNoticesToExceptions="true"
6-
convertWarningsToExceptions="true"
7-
stopOnFailure="false">
8-
<testsuites>
9-
<testsuite name="unit">
10-
<directory suffix="Test.php">./tests/unit</directory>
11-
</testsuite>
12-
<testsuite name="functional">
13-
<directory suffix="TestCase.php">./tests/FunctionalTests</directory>
14-
</testsuite>
15-
</testsuites>
16-
<filter>
17-
<whitelist>
18-
<directory suffix=".php">framework/</directory>
19-
</whitelist>
20-
</filter>
21-
<logging>
22-
<log type="testdox-html" target="./build/tests/index.html"/>
23-
<log type="coverage-html" target="./build/tests/coverage" lowUpperBound="35" highLowerBound="70"/>
24-
<log type="coverage-clover" target="./build/tests/coverage.xml"/>
25-
</logging>
26-
<php>
27-
<!-- selenium test cases can take up to 20 mins -->
28-
<ini name="max_execution_time" value="1200"/>
29-
</php>
30-
</phpunit>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="./tests/test_tools/phpunit_bootstrap.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory suffix=".php">framework/</directory>
6+
</include>
7+
<report>
8+
<clover outputFile="./build/tests/coverage.xml"/>
9+
<html outputDirectory="./build/tests/coverage" lowUpperBound="35" highLowerBound="70"/>
10+
</report>
11+
</coverage>
12+
<testsuites>
13+
<testsuite name="unit">
14+
<directory suffix="Test.php">./tests/unit</directory>
15+
</testsuite>
16+
<testsuite name="functional">
17+
<directory suffix="TestCase.php">./tests/FunctionalTests</directory>
18+
</testsuite>
19+
</testsuites>
20+
<logging>
21+
<testdoxHtml outputFile="./build/tests/index.html"/>
22+
</logging>
23+
<php>
24+
<!-- selenium test cases can take up to 20 mins -->
25+
<ini name="max_execution_time" value="1200"/>
26+
</php>
27+
</phpunit>

tests/FunctionalTests/active-controls/tests/ActiveImageButtonTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ public function test()
1111
$this->byId("{$base}image1")->click();
1212
$this->pauseFairAmount();
1313
//unable to determine mouse position
14-
$this->assertRegExp('/Image clicked at x=\d+, y=\d+/', $this->source());
14+
$this->assertMatchesRegularExpression('/Image clicked at x=\d+, y=\d+/', $this->source());
1515
}
1616
}

tests/FunctionalTests/issues/tests/Issue516TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function test()
2727
$this->byID("{$base}{$row2}ctl3")->click();
2828
$this->pauseFairAmount();
2929
$this->assertTrue($this->getElement("{$base}{$row2}TextBox") !== null);
30-
// click "save" and ensure bvalidation has been successfull
30+
// click "save" and ensure validation has been successfull
3131
$this->byID("{$base}{$row2}ctl3")->click();
3232
$this->pauseFairAmount();
3333
$this->assertElementNotPresent("{$base}{$row2}ctl1");

tests/FunctionalTests/tickets/tests/Ticket163TestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ public function test()
77
$this->url('tickets/index.php?page=Ticket163');
88
$this->assertStringContainsString('kr&nbsp;100,00', $this->source());
99
$this->assertStringContainsString('kr&nbsp;0,00', $this->source());
10-
$this->assertStringContainsString('kr&nbsp;100,00', $this->source());
10+
$this->assertStringContainsString('kr&nbsp;100,00', $this->source());
1111
}
12-
}
12+
}

tests/test_tools/PradoGenericSelenium2Test.php

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -47,24 +47,17 @@ class PradoGenericSelenium2Test extends \PHPUnit\Extensions\Selenium2TestCase
4747

4848
public static $timeout = 5; //seconds
4949

50-
public function prepareSession()
51-
{
52-
$session = parent::prepareSession();
53-
// Workaround for https://github.com/giorgiosironi/phpunit-selenium/issues/295
54-
$this->url('dummy.html');
55-
56-
return $session;
57-
}
58-
5950
protected function setUp(): void
6051
{
61-
// Workaroun for https://github.com/giorgiosironi/phpunit-selenium/issues/436
52+
53+
// Workaround for https://github.com/giorgiosironi/phpunit-selenium/issues/436
6254
$this->setDesiredCapabilities([
6355
'goog:chromeOptions' => [
64-
'w3c' => false
65-
]
56+
'w3c' => false,
57+
// 'args' => ['headless'],
58+
],
6659
]);
67-
// self::shareSession(true);
60+
self::shareSession(true);
6861
$this->setBrowserUrl(static::$baseurl);
6962
$this->setSeleniumServerRequestsTimeout(static::$timeout);
7063
}
@@ -82,7 +75,7 @@ protected function assertAttribute($idattr, $txt)
8275
$value = $element->attribute($attr);
8376

8477
if (strpos($txt, 'regexp:') === 0) {
85-
$this->assertRegExp('/' . substr($txt, 7) . '/', $value);
78+
$this->assertMatchesRegularExpression('/' . substr($txt, 7) . '/', $value);
8679
} else {
8780
$this->assertEquals($txt, $value);
8881
}
@@ -153,6 +146,9 @@ protected function assertElementNotPresent($id)
153146
} catch (\PHPUnit\Extensions\Selenium2TestCase\WebDriverException $e) {
154147
$this->assertEquals(\PHPUnit\Extensions\Selenium2TestCase\WebDriverException::NoSuchElement, $e->getCode());
155148
return;
149+
} catch (\InvalidArgumentException $e) {
150+
$this->assertEquals('Element not found.', $e->getMessage());
151+
return;
156152
}
157153
$this->fail('The element ' . $id . ' shouldn\'t exist.');
158154
}

tests/unit/Data/SqlMap/StatementExtendsTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ public function test_extends1()
1818
$manager = $this->sqlmap->SqlMapManager;
1919
$sql = $manager->getMappedStatement('test')->getSqlString();
2020

21-
$this->assertRegExp('/img_request/', $sql);
21+
$this->assertMatchesRegularExpression('/img_request/', $sql);
2222
// $this->assertNoPattern('/img_progress/', $sql);
2323

2424
$sql2 = $manager->getMappedStatement('GetAllProgress')->getSqlString();
25-
$this->assertRegExp('/img_request/', $sql2);
26-
$this->assertRegExp('/img_progress/', $sql2);
25+
$this->assertMatchesRegularExpression('/img_request/', $sql2);
26+
$this->assertMatchesRegularExpression('/img_progress/', $sql2);
2727
}
2828
}

0 commit comments

Comments
 (0)