public function expectWithMethodTimes()
 {
     $target = \Enhance\Expect::method('TestA')->times(1);
     \Enhance\Assert::isFalse($target->ExpectArguments);
     \Enhance\Assert::isTrue($target->ExpectTimes);
     \Enhance\Assert::areIdentical(1, $target->ExpectedCalls);
 }
Exemplo n.º 2
0
 public function sendWithDataExpectTrue()
 {
     $AVPush = \Enhance\Core::getCodeCoverageWrapper('AVPush');
     //$AVPush->channel = 'TEST_CHANNEL_ONE'; //this or channels required
     $AVPush->channels = array('TEST_CHANNEL_ONE', 'TEST_CHANNEL_TWO');
     //this or just channel required
     $AVPush->alert = 'Testing Channel 1';
     //required
     //BELOW SETTINGS ARE OPTIONAL, LOOKUP REST API DOCS HERE: http://AV.com/docs/rest#push FOR MORE INFO
     $AVPush->expiration_time = time(strtotime('+3 days'));
     //expire 3 day from now
     //$AVPush->expiration_time_interval = 86400; //expire in 24 hours from now
     $AVPush->type = 'ios';
     $AVPush->badge = 538;
     //ios only
     $AVPush->sound = 'cheer';
     //ios only
     $AVPush->content_available = 1;
     //ios only - for newsstand applications. Also, changed from content-available to content_available.
     //$AVPush->title = 'test notification title'; //android only - gives title to the notification
     //CUSTOM DATA CAN BE SENT VERY EASILY ALONG WITH YOUR NOTIFICATION MESSAGE AND CAN BE ACCESSED PROGRAMATICALLY VIA THE MOBILE DEVICE... JUST DON'T SET NAMES THE SAME AS RESERVERD ONES MENTIONED ABOVE
     $AVPush->customData = 'This data will be accessible in the ios and android SDK callback for push notifications';
     $return = $AVPush->send();
     \Enhance\Assert::isObject($return);
 }
 public function getJoinedStringWithTwoStringsExpectJoinedResult()
 {
     /** @var ExampleAnotherClass $target */
     $target = \Enhance\Core::getCodeCoverageWrapper('\\FirstTest\\ExampleAnotherClass', array('xx', 'yy'));
     $result = $target->getJoinedString('A', 'B');
     \Enhance\Assert::areIdentical('ABxx', $result);
 }
 public function deleteWithObjectIdExpectEmpty()
 {
     $parseObject = $this->parseObject;
     $parseObject->testfield1 = $this->testfield2;
     $save = $parseObject->save();
     $return = $parseObject->delete($save->objectId);
     \Enhance\Assert::isTrue($return);
 }
 public function useCodeCoverageLoggerToSetProperty()
 {
     /** @var TestClassForCodeCoverageLogger $target */
     $target = \Enhance\Core::getCodeCoverageWrapper('TestClassForCodeCoverageLogger');
     $target->property = 8;
     $result = $target->property;
     \Enhance\Assert::areIdentical(8, $result);
 }
 public function deleteWithUrlExpectTrue()
 {
     $file = new parseFile('text/plain', 'Working at Parse is great!');
     $save = $file->save('hello.txt');
     //SET BOTH ARGUMENTS BELOW TO FALSE, SINCE WE ARE DELETING A FILE, NOT SAVING ONE
     $todelete = new parseFile();
     $return = $todelete->delete($save->name);
     \Enhance\Assert::isTrue($return);
 }
Exemplo n.º 7
0
 public function addTwoNumbersWith3and2Expect5Test()
 {
     // Arrange
     $target = \Enhance\Core::getCodeCoverageWrapper('ExampleClass');
     // Act
     $result = $target->addTwoNumbers(3, 2);
     // Assert
     \Enhance\Assert::areIdentical(5, $result);
 }
Exemplo n.º 8
0
 public function deleteWithObjectIdExpectTrue()
 {
     $testUser = new AVUser();
     $testUser->username = $this->testUser['username'];
     $testUser->password = $this->testUser['password'];
     $user = $testUser->signup();
     $AVUser = $this->AVUser;
     $return = $AVUser->delete($user->objectId, $user->sessionToken);
     \Enhance\Assert::isTrue($return);
 }
 public function assertContainsWithStringThatDoesNotContain()
 {
     $verifyFailed = false;
     try {
         $this->target->contains('Test', 'Some Other String');
     } catch (Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsNumericWithNormalString()
 {
     $verifyFailed = false;
     try {
         $this->target->isNumeric('xyz');
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsStringWithInteger()
 {
     $verifyFailed = false;
     try {
         $this->target->isString(1);
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsNotNullWithNull()
 {
     $verifyFailed = false;
     try {
         $this->target->isNotNull(null);
     } catch (Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
Exemplo n.º 13
0
 public function assertFailExpectError()
 {
     $verifyFailed = false;
     try {
         $this->target->fail();
     } catch (Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsNotScalarWithBool()
 {
     $verifyFailed = false;
     try {
         $this->target->isNotScalar(true);
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsArrayWithNumber()
 {
     $verifyFailed = false;
     try {
         $this->target->isArray(500);
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsNotFloatWithFloat()
 {
     $verifyFailed = false;
     try {
         $this->target->isNotFloat(1.1);
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsTrueWith1ExpectFail()
 {
     $verifyFailed = false;
     try {
         $this->target->isTrue(1);
     } catch (Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertNotContainsWithStringThatStartsWith()
 {
     $verifyFailed = false;
     try {
         $this->target->notContains('Test', 'Test Some String');
     } catch (Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertAreIdenticalWithDifferentFloats()
 {
     $verifyFailed = false;
     try {
         $this->target->areIdentical(15.123346575, 15.123346574);
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
Exemplo n.º 20
0
 public function assertIsIntWithString()
 {
     $verifyFailed = false;
     try {
         $this->target->isInt('1');
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsScalarWithObject()
 {
     $verifyFailed = false;
     try {
         $object = new \Enhance\TextFactory();
         $this->target->isScalar($object);
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsNotArrayWithArray()
 {
     $verifyFailed = false;
     try {
         $array = array('foo' => 'bar', 12 => true);
         $this->target->isNotArray($array);
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertIsNotInstanceOfTypeWithIdenticalTypes()
 {
     $verifyFailed = false;
     $object = new SomeOtherType();
     try {
         $this->target->isNotInstanceOfType('SomeOtherType', $object);
     } catch (Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
 public function assertThrowsWithArgumentsAndNoExceptionExpectFail()
 {
     $Stub = new StubThrowsClass();
     $verifyFailed = false;
     try {
         $this->target->throws($Stub, 'doesNotThrowWithArgs', array(4, 4));
     } catch (Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
Exemplo n.º 25
0
 public function scenarioTestWithMismatchWithAndExpectExpectException()
 {
     $target = \Enhance\Core::getCodeCoverageWrapper('ScenarioExampleClass');
     $scenario = \Enhance\Core::getScenario($target, 'addTwoNumbers');
     $scenario->with(1, 2);
     // missing the expectation, this is the point of this test
     $scenario->with(1, 2)->expect(5);
     try {
         $scenario->VerifyExpectations();
     } catch (exception $e) {
         \Enhance\Assert::AreIdentical('Scenario must be initialised with the same number of "with" and "expect" calls', $e->getMessage());
     }
 }
Exemplo n.º 26
0
 function test_format_number_dp_strict_zeros()
 {
     $useranswer = '1.3';
     $dp = '3';
     $res = $this->target->format_number_dp_strict_zeros($useranswer, $dp);
     \Enhance\Assert::areIdentical('1.300', $res);
     $useranswer = '1.34';
     $dp = '2';
     $res = $this->target->format_number_dp_strict_zeros($useranswer, $dp);
     \Enhance\Assert::areIdentical('1.34', $res);
     $useranswer = '1.3492';
     $dp = '2';
     $res = $this->target->format_number_dp_strict_zeros($useranswer, $dp);
     \Enhance\Assert::areIdentical('1.35', $res);
     $useranswer = '1.349000';
     $dp = '4';
     $res = $this->target->format_number_dp_strict_zeros($useranswer, $dp);
     \Enhance\Assert::areIdentical('1.3490', $res);
 }
Exemplo n.º 27
0
 public function addTwoNumbersWith4and0Expect4()
 {
     $result = $this->target->addTwoNumbers(4, 0);
     \Enhance\Assert::areIdentical(4, $result);
 }
 public function findWithNotInQueryExpectResults()
 {
     $parseQuery = $this->parseQuery;
     $parseQuery->whereNotInQuery('object1', 'test', array('where' => array('name' => array('$exists' => true))));
     $return = $parseQuery->find();
     \Enhance\Assert::isTrue(is_array($return->results));
 }
 public function createOutputTemplateWithCliExpectCliTemplate()
 {
     $output = \Enhance\TemplateFactory::CreateOutputTemplate(\Enhance\TemplateType::Cli, \Enhance\Language::English);
     \Enhance\Assert::areIdentical(\Enhance\TemplateType::Cli, $output->GetTemplateType());
 }
 public function getGeoPointExpectType()
 {
     $return = \Enhance\Core::getCodeCoverageWrapper('parseGeoPoint', array(40.0, -30.0));
     \Enhance\Assert::isTrue(array_key_exists('__type', $return->location));
 }