Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use codeception/verify 2.1 in tests
  • Loading branch information
Naktibalda committed Apr 14, 2021
commit a2f3f93db6b03c9ea18b03bcef6811b16403d4fd
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