-
Notifications
You must be signed in to change notification settings - Fork 48
Fix: Risky tests #102
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
Fix: Risky tests #102
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,13 @@ | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd" | ||
| bootstrap="vendor/autoload.php" | ||
| colors="true" | ||
| beStrictAboutChangesToGlobalState="true" | ||
| beStrictAboutOutputDuringTests="true" | ||
| beStrictAboutResourceUsageDuringSmallTests="true" | ||
| beStrictAboutTestsThatDoNotTestAnything="true" | ||
| beStrictAboutTodoAnnotatedTests="true" | ||
| verbose="true" | ||
|
Contributor
Author
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. This increases the verbosity of the output. |
||
| > | ||
| <testsuites> | ||
| <testsuite name="Unit Tests"> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,7 +14,7 @@ class LDClientTest extends \PHPUnit_Framework_TestCase | |
|
|
||
| public function testDefaultCtor() | ||
| { | ||
| new LDClient("BOGUS_SDK_KEY"); | ||
| $this->assertInstanceOf(LDClient::class, new LDClient("BOGUS_SDK_KEY")); | ||
|
Contributor
Author
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. Not really sure if this test makes a lot of sense. |
||
| } | ||
|
|
||
| public function testToggleDefault() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| <?php | ||
| namespace LaunchDarkly\Tests; | ||
|
|
||
| use LaunchDarkly\LDUser; | ||
| use LaunchDarkly\LDUserBuilder; | ||
|
|
||
| class LDUserTest extends \PHPUnit_Framework_TestCase | ||
|
|
@@ -23,7 +24,10 @@ public function testCoerceLDUserKey() | |
| public function testEmptyCustom() | ||
| { | ||
| $builder = new LDUserBuilder("[email protected]"); | ||
|
|
||
| $user = $builder->build(); | ||
|
|
||
| $this->assertInstanceOf(LDUser::class, $user); | ||
| } | ||
|
|
||
| public function testLDUserSecondary() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,32 +47,31 @@ public function testCanParseVersionWithPrereleaseAndBuild() | |
| $this->assertEquals('build2.4', $sv->build); | ||
| } | ||
|
|
||
| /** | ||
| * @expectedException \InvalidArgumentException | ||
| * @expectedExceptionMessage not a valid semantic version | ||
| */ | ||
| public function testLeadingZeroNotAllowedInMajor() | ||
| { | ||
| try { | ||
| SemanticVersion::parse('02.3.4'); | ||
| $this->assertTrue(false, 'expected exception'); | ||
| // can't use expectException method because we must support older PHPUnit | ||
|
Contributor
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. In regards to this comment, what is the minimum PHPUnit version for your changes?
Contributor
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. I'll run our usual suite of tests against all of our supported PHP versions to be sure. |
||
| } catch (\InvalidArgumentException $e) { | ||
| } | ||
| SemanticVersion::parse('02.3.4'); | ||
| } | ||
|
|
||
| /** | ||
| * @expectedException \InvalidArgumentException | ||
| * @expectedExceptionMessage not a valid semantic version | ||
| */ | ||
| public function testLeadingZeroNotAllowedInMinor() | ||
| { | ||
| try { | ||
| SemanticVersion::parse('2.03.4'); | ||
| $this->assertTrue(false, 'expected exception'); | ||
| } catch (\InvalidArgumentException $e) { | ||
| } | ||
| SemanticVersion::parse('2.03.4'); | ||
| } | ||
|
|
||
| /** | ||
| * @expectedException \InvalidArgumentException | ||
| * @expectedExceptionMessage not a valid semantic version | ||
| */ | ||
| public function testLeadingZeroNotAllowedInPatch() | ||
| { | ||
| try { | ||
| SemanticVersion::parse('2.3.04'); | ||
| $this->assertTrue(false, 'expected exception'); | ||
| } catch (\InvalidArgumentException $e) { | ||
| } | ||
| SemanticVersion::parse('2.3.04'); | ||
| } | ||
|
|
||
| public function testZeroByItselfIsAllowed() | ||
|
|
@@ -147,22 +146,22 @@ public function testCanParseVersionWithMajorMinorAndBuildOnlyInLooseMode() | |
| $this->assertEquals('build1', $sv->build); | ||
| } | ||
|
|
||
| /** | ||
| * @expectedException \InvalidArgumentException | ||
| * @expectedExceptionMessage not a valid semantic version | ||
| */ | ||
| public function testCannotParseVersionWithMajorOnlyByDefault() | ||
| { | ||
| try { | ||
| SemanticVersion::parse('2'); | ||
| $this->assertTrue(false, 'expected exception'); | ||
| } catch (\InvalidArgumentException $e) { | ||
| } | ||
| SemanticVersion::parse('2'); | ||
| } | ||
|
|
||
| /** | ||
| * @expectedException \InvalidArgumentException | ||
| * @expectedExceptionMessage not a valid semantic version | ||
| */ | ||
| public function testCannotParseVersionWithMajorAndMinorOnlyByDefault() | ||
| { | ||
| try { | ||
| SemanticVersion::parse('2.3'); | ||
| $this->assertTrue(false, 'expected exception'); | ||
| } catch (\InvalidArgumentException $e) { | ||
| } | ||
| SemanticVersion::parse('2.3'); | ||
| } | ||
|
|
||
| public function testEqualVersionsHaveEqualPrecedence() | ||
|
|
||
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 enables color output.