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);
 }
 public function sendWithDataExpectTrue()
 {
     $parsePush = \Enhance\Core::getCodeCoverageWrapper('parsePush');
     //$parsePush->channel = 'TEST_CHANNEL_ONE'; //this or channels required
     $parsePush->channels = array('TEST_CHANNEL_ONE', 'TEST_CHANNEL_TWO');
     //this or just channel required
     $parsePush->alert = 'Testing Channel 1';
     //required
     //BELOW SETTINGS ARE OPTIONAL, LOOKUP REST API DOCS HERE: http://parse.com/docs/rest#push FOR MORE INFO
     $parsePush->expiration_time = time(strtotime('+3 days'));
     //expire 3 day from now
     //$parsePush->expiration_time_interval = 86400; //expire in 24 hours from now
     $parsePush->type = 'ios';
     $parsePush->badge = 538;
     //ios only
     $parsePush->sound = 'cheer';
     //ios only
     $parsePush->content_available = 1;
     //ios only - for newsstand applications. Also, changed from content-available to content_available.
     //$parsePush->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
     $parsePush->customData = 'This data will be accessible in the ios and android SDK callback for push notifications';
     $return = $parsePush->send();
     \Enhance\Assert::isTrue($return);
 }
 public function deleteWithObjectIdExpectEmpty()
 {
     $parseObject = $this->parseObject;
     $parseObject->testfield1 = $this->testfield2;
     $save = $parseObject->save();
     $return = $parseObject->delete($save->objectId);
     \Enhance\Assert::isTrue($return);
 }
Пример #4
0
 public function testGetExistingLevel1KeyReturnsCorrectValue()
 {
     $expected = 'local';
     $actual = $this->loadedObject->get('environment');
     Assert::areIdentical($expected, $actual);
     $actual = $this->loadedObject->get('debug');
     Assert::isTrue($actual);
 }
 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);
 }
Пример #6
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);
 }
 public function assertNotContainsWithStringThatStartsWith()
 {
     $verifyFailed = false;
     try {
         $this->target->notContains('Test', 'Test Some String');
     } 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 assertAreIdenticalWithDifferentFloats()
 {
     $verifyFailed = false;
     try {
         $this->target->areIdentical(15.123346575, 15.123346574);
     } catch (\Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
Пример #15
0
 public function assertFailExpectError()
 {
     $verifyFailed = false;
     try {
         $this->target->fail();
     } 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 assertIsIntWithString()
 {
     $verifyFailed = false;
     try {
         $this->target->isInt('1');
     } 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 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 assertIsScalarWithObject()
 {
     $verifyFailed = false;
     try {
         $object = new \Enhance\TextFactory();
         $this->target->isScalar($object);
     } 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);
 }
 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));
 }
Пример #24
0
 public function createMockWithCallToUnexpectedMethodExpectReturnsException()
 {
     /** @var IMockExample $mock */
     $mock = \Enhance\MockFactory::createMock('ExampleClass');
     $verifyFailed = false;
     try {
         $mock->doSomething();
     } catch (Exception $e) {
         $verifyFailed = true;
     }
     \Enhance\Assert::isTrue($verifyFailed);
 }
Пример #25
0
 public function TestSplitISO6801DateIntoDateAndTimeComplete()
 {
     // Date with time can be split.
     $outputDate = "UNSET!!!";
     $outputTime = "UNSET!!!";
     \Enhance\Assert::isTrue(SplitISO6801DateIntoDateAndTime("2012-02-27T14:19:01.802190Z", $outputDate, $outputTime));
     \Enhance\Assert::areIdentical("2012-02-27", $outputDate);
     \Enhance\Assert::areIdentical("14:19:01.802190Z", $outputTime);
 }
 public function getGeoPointExpectType()
 {
     $return = \Enhance\Core::getCodeCoverageWrapper('parseGeoPoint', array(40.0, -30.0));
     \Enhance\Assert::isTrue(array_key_exists('__type', $return->location));
 }