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 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 useCodeCoverageLoggerToSetProperty()
 {
     /** @var TestClassForCodeCoverageLogger $target */
     $target = \Enhance\Core::getCodeCoverageWrapper('TestClassForCodeCoverageLogger');
     $target->property = 8;
     $result = $target->property;
     \Enhance\Assert::areIdentical(8, $result);
 }
 public function getWithObjectIdExpectTest1()
 {
     $parseObject = $this->parseObject;
     $parseObject->testfield2 = $this->testfield2;
     $save = $parseObject->save();
     $return = $parseObject->get($save->objectId);
     \Enhance\Assert::areIdentical('test2', $return->testfield2);
 }
Exemplo n.º 5
0
 public function addTwoNumbersWith3and2Expect5Test()
 {
     // Arrange
     $target = \Enhance\Core::getCodeCoverageWrapper('ExampleClass');
     // Act
     $result = $target->addTwoNumbers(3, 2);
     // Assert
     \Enhance\Assert::areIdentical(5, $result);
 }
Exemplo n.º 6
0
 public function addTwoNumbersWith4and0Expect4()
 {
     $result = $this->target->addTwoNumbers(4, 0);
     \Enhance\Assert::areIdentical(4, $result);
 }
 public function createOutputTemplateWithCliExpectCliTemplate()
 {
     $output = \Enhance\TemplateFactory::CreateOutputTemplate(\Enhance\TemplateType::Cli, \Enhance\Language::English);
     \Enhance\Assert::areIdentical(\Enhance\TemplateType::Cli, $output->GetTemplateType());
 }
Exemplo n.º 8
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.º 9
0
 public function testGetNewLevel3KeyReturnsCorrectValue()
 {
     $expected = 'Don\'t you like Config ?';
     $actual = $this->overloadedObject->get('page.welcome.body');
     Assert::areIdentical($expected, $actual);
 }
Exemplo n.º 10
0
 public function createStubExpectCallsSucceed()
 {
     /** @var IMockExample $stub */
     $stub = \Enhance\StubFactory::createStub('ExampleClass');
     $stub->addExpectation(\Enhance\Expect::method('doSomething')->returns('Some Value'));
     $stub->addExpectation(\Enhance\Expect::method('anotherMethod')->returns(5));
     $result1 = $stub->doSomething();
     $result2 = $stub->doSomething();
     $result3 = $stub->anotherMethod();
     $stub->callNotExpectedMethod();
     \Enhance\Assert::areIdentical('Some Value', $result1);
     \Enhance\Assert::areIdentical('Some Value', $result2);
     \Enhance\Assert::areIdentical(5, $result3);
 }
Exemplo n.º 11
0
 public function TestGoogleDotComPCapFromDevice()
 {
     $consoleOut = array();
     $harFile = TMP . "/googleDotComFromDevice.har";
     $returnCode = ExecPcap2Har("unittests/data/googleDotComFromEmulator.pcap", $harFile, USE_LATEST_PCAP2HAR, SUPPRESS_PAGE_RECORDS, $consoleOut);
     \Enhance\Assert::areIdentical(print_r(array(), true), print_r($consoleOut, true));
     \Enhance\Assert::areIdentical(0, $returnCode);
     $harAsString = file_get_contents($harFile);
     $harAsPhpDict = json_decode($harAsString, true);
     \Enhance\Assert::isNotNull($harAsPhpDict);
     // Failed to parse as JSON
     // Test a few properties of the HAR, to see that it is well formed.
     \Enhance\Assert::areIdentical("1.1", $harAsPhpDict['log']['version']);
     // Older version of pcap2har see fewer requests, because packets arrive
     // out of the expected order.
     \Enhance\Assert::areIdentical(11, count($harAsPhpDict['log']['entries']));
 }
Exemplo n.º 12
0
 public function TestSampleSpeedIndex()
 {
     // Given the visual progress numbers above, the speed index can be
     // calculated to be 320.0.
     \Enhance\Assert::areIdentical(320.0, $this->progress['SpeedIndex']);
 }
Exemplo n.º 13
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 createOutputTemplateWithXmlExpectXmlTemplate()
 {
     $output = \Enhance\TemplateFactory::createOutputTemplate('Xml', \Enhance\Language::English);
     \Enhance\Assert::areIdentical(\Enhance\TemplateType::Xml, $output->getTemplateType());
 }