-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate uses #68
Merged
Merged
Deprecate uses #68
Changes from 9 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1e83545
Deprecate uses()
thekid 57d3f3f
Migrate to namespaces
thekid d957509
Remove uses() from code executed in new runtime, autoloading helps
thekid ec336ca
Remove uses() from code executed in new runtime, autoloading helps
thekid 0d78fe5
Merge branch 'cleanup/deprecate-uses' of github.com:thekid/core into …
thekid 6e61194
Migrate code in net.xp_framework.unittest.core.generics to namespaces
thekid 51c0610
Remove namespace tests, other tests are now rewritten to namespaces
thekid 9568278
Deprecate test for uses()
thekid ad7255c
QA: Fix up apidocs, use short array syntax
thekid 283d935
Adjust to new coding standards; use usleep() instead of loop
thekid File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
151 changes: 72 additions & 79 deletions
151
src/test/php/net/xp_framework/unittest/DemoTest.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,87 @@ | ||
<?php | ||
/* This class is part of the XP framework | ||
<?php namespace net\framework\unittest; | ||
|
||
/** | ||
* Shows different test scenarios | ||
* | ||
* $Id$ | ||
* @purpose Unit Test | ||
*/ | ||
|
||
uses('unittest.TestCase'); | ||
class DemoTest extends \unittest\TestCase { | ||
|
||
/** | ||
* Shows different test scenarios | ||
* A test that always succeeds | ||
* | ||
* @purpose Unit Test | ||
*/ | ||
class DemoTest extends TestCase { | ||
|
||
/** | ||
* A test that always succeeds | ||
* | ||
*/ | ||
#[@test] | ||
public function alwaysSucceeds() { | ||
$this->assertTrue(TRUE); | ||
} | ||
#[@test] | ||
public function alwaysSucceeds() { | ||
$this->assertTrue(true); | ||
} | ||
|
||
/** | ||
* A test that is ignored | ||
* | ||
*/ | ||
#[@test, @ignore('Ignored')] | ||
public function ignored() { | ||
$this->fail('Ignored test executed', 'executed', 'ignored'); | ||
} | ||
/** | ||
* A test that is ignored | ||
* | ||
*/ | ||
#[@test, @ignore('Ignored')] | ||
public function ignored() { | ||
$this->fail('Ignored test executed', 'executed', 'ignored'); | ||
} | ||
|
||
/** | ||
* Setup method | ||
* | ||
*/ | ||
public function setUp() { | ||
if (0 == strcasecmp('alwaysSkipped', $this->name)) { | ||
throw new PrerequisitesNotMetError('Skipping', null, $this->name); | ||
} | ||
/** | ||
* Setup method | ||
* | ||
*/ | ||
public function setUp() { | ||
if ('alwaysSkipped' === $this->name) { | ||
throw new PrerequisitesNotMetError('Skipping', null, $this->name); | ||
} | ||
} | ||
|
||
/** | ||
* A test that is skipped due to not met prerequisites. | ||
* | ||
*/ | ||
#[@test] | ||
public function alwaysSkipped() { | ||
$this->fail('Skipped test executed', 'executed', 'skipped'); | ||
} | ||
/** | ||
* A test that is skipped due to not met prerequisites. | ||
* | ||
*/ | ||
#[@test] | ||
public function alwaysSkipped() { | ||
$this->fail('Skipped test executed', 'executed', 'skipped'); | ||
} | ||
|
||
/** | ||
* A test that always fails because of a failed assertion | ||
* | ||
*/ | ||
#[@test] | ||
public function alwaysFails() { | ||
$this->assertTrue(FALSE); | ||
} | ||
/** | ||
* A test that always fails because of a failed assertion | ||
* | ||
*/ | ||
#[@test] | ||
public function alwaysFails() { | ||
$this->assertTrue(false); | ||
} | ||
|
||
/** | ||
* A test that always fails because the expected exception was not | ||
* thrown. | ||
* | ||
*/ | ||
#[@test, @expect('lang.IllegalArgumentException')] | ||
public function expectedExceptionNotThrown() { | ||
TRUE; | ||
} | ||
/** | ||
* A test that always fails because the expected exception was not | ||
* thrown. | ||
* | ||
*/ | ||
#[@test, @expect('lang.IllegalArgumentException')] | ||
public function expectedExceptionNotThrown() { | ||
true; | ||
} | ||
|
||
/** | ||
* A test that always fails because an exception is thrown. | ||
* | ||
*/ | ||
#[@test] | ||
public function throwsAnException() { | ||
throw new IllegalArgumentException(''); | ||
} | ||
/** | ||
* A test that always fails because an exception is thrown. | ||
* | ||
*/ | ||
#[@test] | ||
public function throwsAnException() { | ||
throw new IllegalArgumentException(''); | ||
} | ||
|
||
/** | ||
* A test that timeouts | ||
* | ||
*/ | ||
#[@test, @limit(time= 0.1)] | ||
public function timeouts() { | ||
$start= gettimeofday(); | ||
$end= (1000000 * $start['sec']) + $start['usec'] + 1000 * 200; // 0.2 seconds | ||
do { | ||
$now= gettimeofday(); | ||
} while ((1000000 * $now['sec']) + $now['usec'] < $end); | ||
} | ||
/** | ||
* A test that timeouts | ||
* | ||
*/ | ||
#[@test, @limit(time= 0.1)] | ||
public function timeouts() { | ||
$start= gettimeofday(); | ||
$end= (1000000 * $start['sec']) + $start['usec'] + 1000 * 200; // 0.2 seconds | ||
do { | ||
$now= gettimeofday(); | ||
} while ((1000000 * $now['sec']) + $now['usec'] < $end); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IIRC this was done because usleep() didn't work reliably on some platforms. Guess this can go by now. |
||
?> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 13 additions & 22 deletions
35
src/test/php/net/xp_framework/unittest/core/generics/AbstractDictionary.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,20 @@ | ||
<?php | ||
/* This class is part of the XP framework | ||
<?php namespace net\xp_framework\unittest\core\generics; | ||
|
||
/** | ||
* Lookup map | ||
* | ||
* $Id$ | ||
*/ | ||
|
||
$package= 'net.xp_framework.unittest.core.generics'; | ||
|
||
uses('net.xp_framework.unittest.core.generics.IDictionary'); | ||
|
||
#[@generic(self= 'K, V', implements= array('K, V'))] | ||
abstract class AbstractDictionary extends \lang\Object implements IDictionary { | ||
|
||
/** | ||
* Lookup map | ||
* Constructor | ||
* | ||
* @param [:var] initial | ||
*/ | ||
#[@generic(self= 'K, V', implements= array('K, V'))] | ||
abstract class net�xp_framework�unittest�core�generics�AbstractDictionary extends Object implements net�xp_framework�unittest�core�generics�IDictionary { | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param array<string, var> initial | ||
*/ | ||
public function __construct($initial= []) { | ||
foreach ($initial as $key => $value) { | ||
$this->put($key, $value); | ||
} | ||
public function __construct($initial= []) { | ||
foreach ($initial as $key => $value) { | ||
$this->put($key, $value); | ||
} | ||
} | ||
?> | ||
} |
23 changes: 7 additions & 16 deletions
23
src/test/php/net/xp_framework/unittest/core/generics/AbstractTypeDictionary.class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,10 @@ | ||
<?php | ||
/* This class is part of the XP framework | ||
<?php namespace net\xp_framework\unittest\core\generics; | ||
|
||
/** | ||
* Lookup map | ||
* | ||
* $Id$ | ||
*/ | ||
#[@generic(self= 'V', implements= array('lang.Type, V'))] | ||
abstract class AbstractTypeDictionary extends \lang\Object implements IDictionary { | ||
|
||
$package= 'net.xp_framework.unittest.core.generics'; | ||
|
||
uses('net.xp_framework.unittest.core.generics.IDictionary'); | ||
|
||
/** | ||
* Lookup map | ||
* | ||
*/ | ||
#[@generic(self= 'V', implements= array('lang.Type, V'))] | ||
abstract class net�xp_framework�unittest�core�generics�AbstractTypeDictionary extends Object implements net�xp_framework�unittest�core�generics�IDictionary { | ||
|
||
} | ||
?> | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be removed while at it