Asserts that a condition is not true.
public static assertNotTrue ( boolean $condition, string $message = '' ) | ||
$condition | boolean | |
$message | string |
public function toBeTrue() { if ($this->negate) { a::assertNotTrue($this->actual); } else { a::assertTrue($this->actual); } }
/** * @Then the default carrier should be changed */ public function theDefaultCarrierShouldBeChanged() { PHPUnit_Framework_Assert::assertNotTrue((bool) $this->currentCarrier()->is_default_carrier); PHPUnit_Framework_Assert::assertTrue((bool) $this->anotherCarrier()->is_default_carrier); }
/** * Expect that a condition is not true. * * @param string $message * * @return Expect */ public function notToBeTrue($message = '') { Assert::assertNotTrue($this->value, $message); return $this; }
public function isNotTrue() { Assert::assertNotTrue($this->actual, $this->description); return $this; }
/** * @Given /^the "([^"]*)" attribute "([^"]*)" is not "([^"]*)"$/ */ public function theAttributeIsNot($shortName, $attribute, $annotationProperty) { $class = $this->generator->getNamespace() . "\\" . $shortName; $reflection = new ReflectionClass($class); PHPUnit::assertTrue($reflection->hasProperty($attribute)); $property = $reflection->getProperty($attribute); $reader = new AnnotationReader(); /** @var Column $columnAnnotation */ $columnAnnotation = $reader->getPropertyAnnotation($property, Column::class); PHPUnit::assertNotTrue($columnAnnotation->{$annotationProperty}); }
/** * @depends testGetUser */ public function testUpdateUser($user) { $newUser = array('id' => $user['id'], 'firstName' => 'testguyFirstName', 'lastName' => 'testguyLastName', 'organization' => 'updatedTestOrg', 'email' => '*****@*****.**', 'password' => 'changedPassword', 'sysuser' => 1, 'enabled' => 1); self::$pdo->update(self::USER_ID, $newUser); $retUser = self::$pdo->get(self::USER_ID); PHPUnit_Framework_Assert::assertEquals('updatedTestOrg', $retUser['organization']); // Validate Updated Password Test $validated = self::$pdo->validateUser(self::USER_ID, 'changedPassword'); PHPUnit_Framework_Assert::assertTrue($validated); $validated = self::$pdo->validateUser(self::USER_ID, 'testguy1234'); PHPUnit_Framework_Assert::assertNotTrue($validated); // Validate Update with no password parameter in user unset($newUser['password']); $newUser['organization'] = 'testOrganization'; self::$pdo->update(self::USER_ID, $newUser); $retUser = self::$pdo->get(self::USER_ID); PHPUnit_Framework_Assert::assertEquals('testOrganization', $retUser['organization']); $validated = self::$pdo->validateUser(self::USER_ID, 'changedPassword'); PHPUnit_Framework_Assert::assertTrue($validated); }