Skip to content

Commit 4444f55

Browse files
Upgrade to PhpUnit 8 and remove webmozart/asserts again
1 parent 508ff70 commit 4444f55

File tree

8 files changed

+30
-32
lines changed

8 files changed

+30
-32
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ before_script:
3333
- bash tests/bin/travis_jackrabbit.sh
3434

3535
script:
36-
- vendor/bin/simple-phpunit
36+
- vendor/bin/phpunit
3737
- php vendor/bin/phpspec run
3838
- php vendor/behat/behat/bin/behat --suite=$BEHAT_SUITE

phpunit.xml.dist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
bootstrap="vendor/autoload.php"
77
>
88

9-
<php>
10-
<env name="SYMFONY_PHPUNIT_REMOVE_RETURN_TYPEHINT" value="1"/>
11-
</php>
12-
139
<testsuites>
1410
<testsuite name="PHPCR Shell Test Suite">
1511
<directory>./tests</directory>

src/PHPCR/Shell/Test/CliContext.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Behat\Behat\Context\Context;
1616
use Behat\Behat\Context\SnippetAcceptingContext;
1717
use Behat\Gherkin\Node\PyStringNode;
18+
use PHPUnit\Framework\Assert;
1819
use Symfony\Component\Filesystem\Filesystem;
1920

2021
/**
@@ -112,6 +113,6 @@ public function initializeDoctrineDbal()
112113
*/
113114
public function theCommandShouldNotFail()
114115
{
115-
\PHPUnit_Framework_Assert::assertEquals(0, $this->lastExitCode);
116+
Assert::assertEquals(0, $this->lastExitCode);
116117
}
117118
}

src/PHPCR/Shell/Test/ContextBase.php

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
use PHPCR\SimpleCredentials;
2525
use PHPCR\Util\NodeHelper;
2626
use PHPCR\Util\PathHelper;
27+
use PHPUnit\Framework\Assert;
2728
use Symfony\Component\Filesystem\Filesystem;
2829

2930
/**
@@ -199,7 +200,7 @@ public function iShouldSeeATableContainingTheFollowingRows(TableNode $table)
199200
}
200201
}
201202

202-
\PHPUnit_Framework_Assert::assertGreaterThanOrEqual(count($expectedRows), $foundRows, $this->getOutput());
203+
Assert::assertGreaterThanOrEqual(count($expectedRows), $foundRows, $this->getOutput());
203204
}
204205

205206
/**
@@ -208,7 +209,7 @@ public function iShouldSeeATableContainingTheFollowingRows(TableNode $table)
208209
public function iShouldSeeTheFollowing(PyStringNode $string)
209210
{
210211
$output = $this->getOutput();
211-
\PHPUnit_Framework_Assert::assertContains($string->getRaw(), $output);
212+
Assert::assertContains($string->getRaw(), $output);
212213
}
213214

214215
/**
@@ -217,7 +218,7 @@ public function iShouldSeeTheFollowing(PyStringNode $string)
217218
public function iShouldNotSeeTheFollowing(PyStringNode $string)
218219
{
219220
$output = $this->getOutput();
220-
\PHPUnit_Framework_Assert::assertNotContains($string->getRaw(), $output);
221+
Assert::assertNotContains($string->getRaw(), $output);
221222
}
222223

223224
/**
@@ -248,7 +249,7 @@ public function theCommandShouldNotFail()
248249
throw new \Exception('Command failed: ('.$exitCode.') '.$this->getOutput());
249250
}
250251

251-
\PHPUnit_Framework_Assert::assertEquals(0, $exitCode, 'Command exited with code: '.$exitCode);
252+
Assert::assertEquals(0, $exitCode, 'Command exited with code: '.$exitCode);
252253
}
253254

254255
/**
@@ -258,7 +259,7 @@ public function theCommandShouldFail()
258259
{
259260
$exitCode = $this->applicationTester->getLastExitCode();
260261

261-
\PHPUnit_Framework_Assert::assertNotEquals(0, $exitCode, 'Command exited with code '.$exitCode);
262+
Assert::assertNotEquals(0, $exitCode, 'Command exited with code '.$exitCode);
262263
}
263264

264265
/**
@@ -269,15 +270,15 @@ public function theCommandShouldFailWithMessage($arg1)
269270
$exitCode = $this->applicationTester->getLastExitCode();
270271
$output = $this->getOutput();
271272

272-
\PHPUnit_Framework_Assert::assertEquals($arg1, $output);
273+
Assert::assertEquals($arg1, $output);
273274
}
274275

275276
/**
276277
* @Given /^the file "([^"]*)" should exist$/
277278
*/
278279
public function theFileShouldExist($arg1)
279280
{
280-
\PHPUnit_Framework_Assert::assertTrue(file_exists($this->getWorkingFilePath($arg1)));
281+
Assert::assertTrue(file_exists($this->getWorkingFilePath($arg1)));
281282
}
282283

283284
/**
@@ -304,7 +305,7 @@ public function theFileExists($arg1)
304305
public function theOutputShouldContain(PyStringNode $string)
305306
{
306307
foreach ($string->getStrings() as $line) {
307-
\PHPUnit_Framework_Assert::assertContains($line, $this->getOutput());
308+
Assert::assertContains($line, $this->getOutput());
308309
}
309310
}
310311

@@ -315,7 +316,7 @@ public function theNodeShouldNotExist($arg1)
315316
{
316317
$session = $this->getSession();
317318
$node = $session->getNode($arg1);
318-
\PHPUnit_Framework_Assert::assertNull($node);
319+
Assert::assertNull($node);
319320
}
320321

321322
/**
@@ -326,7 +327,7 @@ public function theXpathCountIsInFile($arg1, $arg2, $arg3)
326327
$xpath = $this->getXPathForFile($arg3);
327328
$res = $xpath->query($arg1);
328329

329-
\PHPUnit_Framework_Assert::assertEquals($arg2, $res->length);
330+
Assert::assertEquals($arg2, $res->length);
330331
}
331332

332333
/**
@@ -363,7 +364,7 @@ public function iShouldNotBeLoggedIntoTheSession()
363364
{
364365
$this->executeCommand('session:info');
365366
$output = $this->getOutput();
366-
\PHPUnit_Framework_Assert::assertRegExp('/live .*no/', $output);
367+
Assert::assertRegExp('/live .*no/', $output);
367368
}
368369

369370
/**
@@ -427,7 +428,7 @@ public function thereShouldExistANodeAtBefore($arg1, $arg2)
427428
throw new \Exception('Could not find child node '.$arg1);
428429
}
429430

430-
\PHPUnit_Framework_Assert::assertEquals($arg2, $afterNode->getPath());
431+
Assert::assertEquals($arg2, $afterNode->getPath());
431432
}
432433

433434
/**
@@ -530,7 +531,7 @@ public function thenIShouldBeLoggedInAs($arg1)
530531
$session = $this->getSession();
531532
$userId = $session->getUserID();
532533

533-
\PHPUnit_Framework_Assert::assertEquals($userId, $arg1);
534+
Assert::assertEquals($userId, $arg1);
534535
}
535536

536537
/**
@@ -690,7 +691,7 @@ public function theCurrentNodeShouldBe($arg1)
690691
{
691692
$this->executeCommand('shell:path:show');
692693
$cnp = $this->applicationTester->getLastLine();
693-
\PHPUnit_Framework_Assert::assertEquals($arg1, $cnp, 'Current path is '.$arg1);
694+
Assert::assertEquals($arg1, $cnp, 'Current path is '.$arg1);
694695
}
695696

696697
/**
@@ -728,7 +729,7 @@ public function thePrimaryTypeOfShouldBe($arg1, $arg2)
728729
$session = $this->getSession();
729730
$node = $session->getNode($arg1);
730731
$primaryTypeName = $node->getPrimaryNodeType()->getName();
731-
\PHPUnit_Framework_Assert::assertEquals($arg2, $primaryTypeName, 'Node type of '.$arg1.' is '.$arg2);
732+
Assert::assertEquals($arg2, $primaryTypeName, 'Node type of '.$arg1.' is '.$arg2);
732733
}
733734

734735
/**
@@ -745,7 +746,7 @@ public function theNodeAtShouldHaveThePropertyWithValue($arg1, $arg2, $arg3)
745746
$propertyValue = $propertyValue->getIdentifier();
746747
}
747748

748-
\PHPUnit_Framework_Assert::assertEquals($arg3, $propertyValue);
749+
Assert::assertEquals($arg3, $propertyValue);
749750
}
750751

751752
/**
@@ -761,7 +762,7 @@ public function theNodeAtShouldHaveThePropertyWithValueAtIndex($arg1, $arg2, $ar
761762
}
762763

763764
$propertyType = $property->getValue();
764-
\PHPUnit_Framework_Assert::assertEquals($arg3, $propertyType[$index]);
765+
Assert::assertEquals($arg3, $propertyType[$index]);
765766
}
766767

767768
/**
@@ -777,7 +778,7 @@ public function thePropertyShouldHaveType($arg1, $arg2)
777778
));
778779
}
779780

780-
\PHPUnit_Framework_Assert::assertEquals($arg2, PropertyType::nameFromValue($property->getType()));
781+
Assert::assertEquals($arg2, PropertyType::nameFromValue($property->getType()));
781782
}
782783

783784
/**
@@ -793,8 +794,8 @@ public function thePropertyShouldHaveTypeAndValue($arg1, $arg2, $arg3)
793794
));
794795
}
795796

796-
\PHPUnit_Framework_Assert::assertEquals($arg2, PropertyType::nameFromValue($property->getType()));
797-
\PHPUnit_Framework_Assert::assertEquals($arg3, $property->getValue());
797+
Assert::assertEquals($arg2, PropertyType::nameFromValue($property->getType()));
798+
Assert::assertEquals($arg3, $property->getValue());
798799
}
799800

800801
/**
@@ -864,7 +865,7 @@ public function theNodeShouldBeLocked($arg1)
864865
$lockManager = $workspace->getLockManager();
865866
$isLocked = $lockManager->isLocked($arg1);
866867

867-
\PHPUnit_Framework_Assert::assertTrue($isLocked);
868+
Assert::assertTrue($isLocked);
868869
}
869870

870871
/**
@@ -877,7 +878,7 @@ public function theNodeShouldNotBeLocked($arg1)
877878
$lockManager = $workspace->getLockManager();
878879
$isLocked = $lockManager->isLocked($arg1);
879880

880-
\PHPUnit_Framework_Assert::assertFalse($isLocked);
881+
Assert::assertFalse($isLocked);
881882
}
882883

883884
/**

tests/PHPCR/Shell/Helper/EditorHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class EditorHelperTest extends TestCase
1818
{
1919
protected $helper;
2020

21-
public function setUp()
21+
public function setUp(): void
2222
{
2323
$this->helper = new EditorHelper();
2424
putenv('EDITOR=cat');

tests/PHPCR/Shell/Helper/NodeHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class NodeHelperTest extends TestCase
1919
{
2020
protected $nodeHelper;
2121

22-
public function setUp()
22+
public function setUp(): void
2323
{
2424
$this->session = $this->prophesize('PHPCR\SessionInterface');
2525
$this->helper = new NodeHelper($this->session->reveal());

tests/PHPCR/Shell/Helper/TextHelperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class TextHelperTest extends TestCase
1818
{
1919
protected $textHelper;
2020

21-
public function setUp()
21+
public function setUp(): void
2222
{
2323
$this->textHelper = new TextHelper();
2424
}

tests/PHPCR/Shell/Phpcr/PhpcrSessionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class PhpcrSessionTest extends TestCase
1919
{
20-
public function setUp()
20+
public function setUp(): void
2121
{
2222
$this->phpcr = $this->prophesize('PHPCR\SessionInterface');
2323
$this->session = new PhpcrSession($this->phpcr->reveal());

0 commit comments

Comments
 (0)