Skip to content

Commit

Permalink
Use codeception/verify 2.1 in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Naktibalda committed Apr 14, 2021
1 parent eef5e5e commit a2f3f93
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"require-dev": {
"codeception/codeception": "^4.0",
"codeception/verify": "^1.2",
"codeception/verify": "^2.1",
"codeception/specify": "^1.0"
},
"license": "MIT"
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/ClassProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ public function testSimpleClassValidations()
verify($class->hasMethod('setNothing'))->false();
verify($class->hasProperty('name'))->true();
verify($class->hasProperty('otherName'))->false();
verify($class->traits())->isEmpty();
verify($class->interfaces())->isEmpty();
verify($class->traits())->empty();
verify($class->interfaces())->empty();
verify($class->parent())->null();
}

Expand All @@ -28,8 +28,8 @@ public function testMegaClassValidations()
/** @var $class ClassProxy **/
verify($class->isDefined())->true();
verify($class->hasMethod('setName'))->false();
verify($class->traits())->contains('Codeception\Specify');
verify($class->interfaces())->contains('Iterator');
verify($class->traits())->arrayContains('Codeception\Specify');
verify($class->interfaces())->arrayContains('Iterator');
verify($class->parent())->equals('stdClass');
}

Expand Down
12 changes: 6 additions & 6 deletions tests/unit/FunctionInjectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testReimplementFunc()
public function testVerifier()
{
$func = test::func('demo', 'strlen', 10);
expect(strlen('hello'))->equals(10);
verify(strlen('hello'))->equals(10);
$func->verifyInvoked();
$func->verifyInvoked(['hello']);
$func->verifyInvokedOnce();
Expand All @@ -86,7 +86,7 @@ public function testVerifier()
public function testVerifierFullyQualifiedNamespace()
{
$func = test::func('\demo', 'strlen', 10);
expect(strlen('hello'))->equals(10);
verify(strlen('hello'))->equals(10);
$func->verifyInvoked();
$func->verifyInvoked(['hello']);
$func->verifyInvokedOnce();
Expand All @@ -102,17 +102,17 @@ public function testFailedVerification()
{
$this->expectException(ExpectationFailedException::class);
$func = test::func('demo', 'strlen', function() { return 10; });
expect(strlen('hello'))->equals(10);
verify(strlen('hello'))->equals(10);
$func->verifyNeverInvoked();
}

public function testReferencedParameter()
{
$func = test::func('\demo', 'preg_match', 10);
expect(preg_match('@[0-9]+@', '1234', $match))->equals(10);
verify(preg_match('@[0-9]+@', '1234', $match))->equals(10);
test::clean();
expect(preg_match('@[0-9]+@', '1234#', $match))->equals(1);
expect($match[0])->equals('1234');
verify(preg_match('@[0-9]+@', '1234#', $match))->equals(1);
verify($match[0])->equals('1234');
}

}
2 changes: 1 addition & 1 deletion tests/unit/VerifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function testVerifyInvocationClosures()
$empty = $params[1][0]; // second call, first arg

verify($info)->equals($args);
verify($empty)->isEmpty();
verify($empty)->empty();
};

$this->specify('closure was called', function() use ($user, $info, $matcher) {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/testDoubleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function testSpecUndefinedClass()
$this->assertFalse($class->isDefined());
$this->assertFalse($class->hasMethod('__toString'));
$this->assertFalse($class->hasMethod('edit'));
verify($class->interfaces())->isEmpty();
verify($class->interfaces())->empty();
$this->any = $class->make();
$this->any = $class->construct();

Expand Down

0 comments on commit a2f3f93

Please sign in to comment.