assertEquals() 공개 메소드

public assertEquals ( $a, $b )
예제 #1
0
 /**
  * Assert that the given number of SQL queries were made.
  * 
  * @param integer $queryCount
  */
 public function assertTotalNumQueries($queryCount, $msg = null)
 {
     if (!$msg) {
         $msg = "Failed asserting that " . (int) $queryCount . " SQL queries were made.";
     }
     $this->_test->assertEquals($queryCount, $this->_profiler->getTotalNumQueries(), $msg);
 }
예제 #2
0
 /**
  * @param \PHPUnit_Framework_TestCase $testCase
  * @param array[] $expectedCalls
  */
 function assertCalls(\PHPUnit_Framework_TestCase $testCase, array $expectedCalls)
 {
     if (array_values($expectedCalls) !== $expectedCalls) {
         throw new \InvalidArgumentException('$expectedCalls must be a numeric array with no keys missing.');
     }
     $extractFunction = array($this, 'callGetFunction');
     $testCase->assertEquals("\n" . implode("\n", array_map($extractFunction, $expectedCalls)) . "\n", "\n" . implode("\n", array_map($extractFunction, $this->calls)) . "\n");
     $testCase->assertEquals($expectedCalls, $this->calls);
     for ($i = 0; TRUE; ++$i) {
         $actualCall = isset($this->calls[$i]) ? $this->calls[$i] : NULL;
         $expectedCall = isset($expectedCalls[$i]) ? $expectedCalls[$i] : NULL;
         if (NULL === $actualCall && NULL === $expectedCall) {
             break;
         }
         if (NULL === $actualCall) {
             $testCase->fail("Call {$i} missing.\nExpected: " . var_export($expectedCall, TRUE));
             break;
         }
         if (NULL === $expectedCall) {
             $testCase->fail("Call {$i} was not expected.\nActual: " . var_export($actualCall, TRUE));
             break;
         }
         if ($actualCall !== $expectedCall) {
             $testCase->fail("Call {$i} mismatch.\nExpected: " . var_export($expectedCall, TRUE) . "\nActual: " . var_export($this->calls[$i], TRUE));
             break;
         }
     }
     $testCase->assertEquals($expectedCalls, $this->calls);
 }
예제 #3
0
 protected function doDelete(RecordInterface $record, Version $version)
 {
     $this->testCase->assertEquals(8, $this->pathParameters->getProperty('fooId'));
     $this->testCase->assertEmpty($this->pathParameters->getProperty('bar'));
     $this->testCase->assertEquals(1, $record->getId());
     return array('success' => true, 'message' => 'You have successful delete a record');
 }
예제 #4
0
 public static function check(\PHPUnit_Framework_TestCase $test, $name, $display, $url, Organization $organization = null)
 {
     $test->assertNotNull($organization);
     $test->assertEquals($name, $organization->getOrganizationName());
     $test->assertEquals($display, $organization->getOrganizationDisplayName());
     $test->assertEquals($url, $organization->getOrganizationURL());
 }
예제 #5
0
 public static function checkCertificateCN(\PHPUnit_Framework_TestCase $test, $use, $cn, KeyDescriptor $kd = null)
 {
     $test->assertNotNull($kd);
     $test->assertEquals($use, $kd->getUse());
     $test->assertNotEmpty($kd->getCertificate()->getData());
     $crt = openssl_x509_parse($kd->getCertificate()->toPem());
     $test->assertEquals($cn, $crt['subject']['CN']);
 }
예제 #6
0
 protected function onAccessToken(AccessToken $accessToken)
 {
     $this->testCase->assertEquals('2YotnFZFEjr1zCsicMWpAA', $accessToken->getAccessToken());
     $this->testCase->assertEquals('example', $accessToken->getTokenType());
     $this->testCase->assertEquals(3600, $accessToken->getExpiresIn());
     $this->testCase->assertEquals('tGzv3JOkF0XG5Qx2TlKWIA', $accessToken->getRefreshToken());
     $this->response->setStatus(200);
     $this->response->getBody()->write('SUCCESS');
 }
 /**
  * Overwritten lime_test method
  *
  * @see lime_test#is()
  *
  */
 public function is($exp1, $exp2, $message = '')
 {
     // lime:
     //   $exp1 - actual, $exp2 - expected
     // phpunit:
     //   assertEquals($expected, $actual)
     // argument order is mixed up for phpunit
     $this->testCase->assertEquals($exp2, $exp1, $message);
 }
예제 #8
0
 protected function onRequest(Url $url, $maxWidth, $maxHeight)
 {
     $this->testCase->assertEquals('http://127.0.0.1/resource', (string) $url);
     $photo = new Type\Photo();
     $photo->setUrl('http://127.0.0.1/resource.png');
     $photo->setWidth(640);
     $photo->setHeight(480);
     $photo->setAuthorName('foobar');
     return $photo;
 }
 public static function factory(array $config)
 {
     if (self::$expectedConfiguration !== null) {
         PHPUnit_Framework_TestCase::assertEquals(self::$expectedConfiguration, $config, 'Expected formatter configuration did not match actual configuration');
     }
     return self::$stubToReturn;
 }
예제 #10
0
 /**
  * Test API response status
  *
  * @param Response $response
  * @param int    $statusCode
  * @param string $contentType
  */
 public static function assertJsonResponse($response, $statusCode = 201, $contentType = 'application/json')
 {
     \PHPUnit_Framework_TestCase::assertEquals($statusCode, $response->getStatusCode(), $response->getContent());
     if ($contentType !== '') {
         \PHPUnit_Framework_TestCase::assertTrue($response->headers->contains('Content-Type', $contentType), $response->headers);
     }
 }
예제 #11
0
    public function testSignSoapMessage()
    {
        $expected = '<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wns1="urn:hello-world:1.0"><SOAP-ENV:Body><wns1:sayHello xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wns1="urn:hello-world:1.0"><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
  <ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"></ds:CanonicalizationMethod>
    <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
  <ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod><ds:DigestValue>QG06QpnB5HBcTxoj9sP4lwgr5fs=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>KbCRtraU6vpqojaPm2ArAsWR/2xBqP0J7nplkXUmQpQkoFWiawnIW8pHVp0RWddlyP9TYBT0f10hN75oxkTvtmHQrxwAC6rjngr+872cHLKnpSZlfUVzAd2QSYR6Gbgk/lSKzZInwe9IEhexQjQ1qDldqu62D8imAyllCtg8bCXLfyHFjixLk19IkJoDjDula1PMLPLpEDuSy934jHSiy3PdA1HwNdlw/1oAqnlcrIA152ywAuPdaFMGgV5JqRPBH5y/wHQ0+4g1VlF7pttigFQcrXLEEZUrz2hdkVb71mZNZFlKIZ70Mdh9WjdgmsMpf1d41w9oOKtrzv46roMmIA==</ds:SignatureValue>
<ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIIEVDCCAzygAwIBAgIJAPTrkMJbCOr1MA0GCSqGSIb3DQEBBQUAMHkxCzAJBgNVBAYTAlVTMQ4wDAYDVQQIEwVNYWluZTESMBAGA1UEBxMJTGltaW5ndG9uMR8wHQYDVQQKExZ4bWxzZWNsaWJzLnBocCBMaWJyYXJ5MSUwIwYDVQQDExx4bWxzZWNsaWJzL3d3dy5jZGF0YXpvbmUub3JnMB4XDTA4MDcwNzIwMjIzMVoXDTE4MDcwNTIwMjIzMVoweTELMAkGA1UEBhMCVVMxDjAMBgNVBAgTBU1haW5lMRIwEAYDVQQHEwlMaW1pbmd0b24xHzAdBgNVBAoTFnhtbHNlY2xpYnMucGhwIExpYnJhcnkxJTAjBgNVBAMTHHhtbHNlY2xpYnMvd3d3LmNkYXRhem9uZS5vcmcwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDttdMyM5ISVD1Uz+BHAPrxVJ6N1eZonfg3DMvZVT0Zy64+qcXj8zuHC6lolDsfGnD8LUttraQ7qCL+bHKps+hjAhCRdx5Wcn4iDrlFpxFL7INnr6vekzsCQ45BPUrvksF9FKa7yX4iSDButmPfoT14gPnIuSe8Y5UeGe6Lk6sF0WgHyL+JmxOu377Kuhah2pXZ1+z7V4JIlNgemJtKlqrvgGeuE9TagfGHUL9BuZK5fUx/RSDUjqxUeKU3fft9fGIAZl0dduitC2Otv4dr1gxLrUmI+ZZ75FmtfKQT7SmS92QVI2B5WAPlL1bnbvhkZiyw7nFE+Q/wGJ2myE4RIFjdAgMBAAGjgd4wgdswHQYDVR0OBBYEFEC5iG0uGXLpQG/zMj/4TuDWfTpHMIGrBgNVHSMEgaMwgaCAFEC5iG0uGXLpQG/zMj/4TuDWfTpHoX2kezB5MQswCQYDVQQGEwJVUzEOMAwGA1UECBMFTWFpbmUxEjAQBgNVBAcTCUxpbWluZ3RvbjEfMB0GA1UEChMWeG1sc2VjbGlicy5waHAgTGlicmFyeTElMCMGA1UEAxMceG1sc2VjbGlicy93d3cuY2RhdGF6b25lLm9yZ4IJAPTrkMJbCOr1MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBACmSKrte07VrGB8dtrN5mrt28ILickQjguu46h6vChgQ4YfIAoA1KWNsZJUuuIzTDjE5xz2hsW37CI0yrNesv2ho2hhP+fIaxCGmcwLYXL80UaPRglYk5+wPWFOt3QFAVoEgwjLX9+y+c2Gu7xLgHAFZVRjQ5hhKT0Nj3vhnt0k8LcognNl1wKuWda7VL4tODp/2IOXr5o5v/OL3UesGfeWfvr8LVmMc5f7/vLAu1+2Yk+/C9/EZyf3BDZQ4z8ae/iwqprCTUIEjhUDcq4+0YN2EIw6suGE2FtWlsIywNErmoOhdrmntU61n3nFCQBi7QDUnZrAFrl4/bmk3eRJ00nE=</ds:X509Certificate></ds:X509Data></ds:KeyInfo></ds:Signature></wns1:sayHello></SOAP-ENV:Body></SOAP-ENV:Envelope>
';
        try {
            $this->client->__call('sayHello', []);
        } catch (\Exception $e) {
            // Ignore
        }
        $lastRequest = $this->client->__getLastRequest();
        TestCase::assertEquals($expected, $lastRequest);
        $dom = new DOMDocument();
        $dom->loadXML($lastRequest);
        $body = $dom->getElementsByTagNameNS($dom->documentElement->namespaceURI, 'Body')->item(0);
        $firstElement = $body->firstChild;
        // Check Signature
        $xmlDSigAdapter = $this->client->getXmlDSigAdapter();
        $newData = new DOMDocument();
        $newData->loadXML($firstElement->C14N());
        TestCase::assertTrue($xmlDSigAdapter->verify($newData));
    }
예제 #12
0
 /**
  * @Then I want my original string again
  */
 public function iWantMyOriginalStringAgain()
 {
     $dynamicDecrypter = DynamicCryptoFactory::buildDynamicDecrypter($this->passPhrase);
     $decryptedString = $dynamicDecrypter->decrypt($this->encryptedString);
     PHPUnit_Framework_TestCase::assertEquals($decryptedString, $this->string);
     echo $decryptedString;
 }
예제 #13
0
 /**
  * @test
  */
 public function getValidIpAddress()
 {
     $ip = '127.0.0.1';
     $exception = parent::throwException(new CouldNotResolveIpAddressException());
     $ipProvider = $this->getIpProviderMock($exception, 'foobar', $ip);
     $currentIpAddress = $ipProvider->getCurrentIpAddress();
     parent::assertEquals($ip, $currentIpAddress);
 }
예제 #14
0
 /** @dataProvider provideKeys */
 public function testBuildLevels(array $events)
 {
     foreach ($events as $key => $event) {
         $this->events->set($key, $event);
     }
     parent::assertEquals('first', $this->events->get('key'));
     parent::assertEquals('second', $this->events->get('key another'));
 }
예제 #15
0
 /**
  * Stub delete method and add needed asserts
  *
  * @param  string $table
  * @param  array|string $where
  * @return int
  */
 public function delete($table, $where = '')
 {
     \PHPUnit_Framework_TestCase::assertEquals('catalog_product_option_type_title', $table);
     \PHPUnit_Framework_TestCase::assertInternalType('array', $where);
     \PHPUnit_Framework_TestCase::assertEquals(ValueTest::$valueTitleData['id'], $where['option_type_id = ?']);
     \PHPUnit_Framework_TestCase::assertEquals(ValueTest::$valueTitleData['store_id'], $where['store_id = ?']);
     return 0;
 }
예제 #16
0
 public function assert()
 {
     $title = $this->webDriver->getTitle();
     \PHPUnit_Framework_TestCase::assertNotNull($title);
     \PHPUnit_Framework_TestCase::assertNotNull($this->title);
     $title = trim($title);
     \PHPUnit_Framework_TestCase::assertEquals($title, $this->title);
 }
 public static function assertEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
 {
     // expectation patch to support pre Doctrine 2.5 field aliases
     if (\Doctrine\ORM\Version::compare('2.5.0') == 1) {
         $expected = preg_replace('/(\\w+)_([0-9])/', '\\1\\2', $expected);
     }
     return parent::assertEquals($expected, $actual, $message);
 }
예제 #18
0
 /**
  * @Then /^the URL query should be "([^"]*)"$/
  */
 public function theURLQueryShouldBe($query = "")
 {
     if (empty($query)) {
         throw new \InvalidArgumentException("No query provided");
     }
     $currentURL = $this->getSession()->getCurrentUrl();
     $currentSchema = urldecode(parse_url($currentURL)["query"]);
     \PHPUnit_Framework_TestCase::assertEquals($query, $currentSchema);
 }
예제 #19
0
 /**
  * Asserts that the log buffer does NOT contain specified message
  *
  * @param string $expected Message subsctring
  * @param string $errmsg The error message to display.
  *
  * @return void
  */
 public function assertNotInLogs($message, $errorMsg = "Unexpected string '%s' found in logs:\n\n%s")
 {
     foreach ($this->getLines() as $log) {
         if (false !== stripos($log, $message)) {
             $this->testCase->fail(sprintf($errorMsg, $message, var_export($this->getLines(), true)));
         }
     }
     $this->testCase->assertEquals(1, 1);
     // increase number of positive assertions
 }
예제 #20
0
파일: Scenario.php 프로젝트: martyn82/apha
 /**
  * @param array $expectEvents
  */
 public function then(array $expectEvents = [])
 {
     $actualEvents = $this->eventStore->getEvents();
     /* @var $event Event */
     foreach ($expectEvents as $index => $event) {
         if (array_key_exists($index, $actualEvents)) {
             $event->setVersion($actualEvents[$index]->getVersion());
         }
     }
     $this->testCase->assertEquals($expectEvents, $actualEvents);
 }
예제 #21
0
 /**
  * Read a record from the connection.
  *
  * @param \PHPUnit_Framework_TestCase $testCase
  *
  * @return array
  */
 public function readRecord(\PHPUnit_Framework_TestCase $testCase)
 {
     $headerData = fread($this->stream, 8);
     $headerFormat = 'Cversion/Ctype/nrequestId/ncontentLength/CpaddingLength/x';
     $testCase->assertEquals(8, strlen($headerData));
     $record = unpack($headerFormat, $headerData);
     if ($record['contentLength'] > 0) {
         $record['contentData'] = '';
         do {
             $block = fread($this->stream, $record['contentLength'] - strlen($record['contentData']));
             $record['contentData'] .= $block;
         } while (strlen($block) > 0 && strlen($record['contentData']) !== $record['contentLength']);
         $testCase->assertEquals($record['contentLength'], strlen($record['contentData']));
     } else {
         $record['contentData'] = '';
     }
     if ($record['paddingLength'] > 0) {
         fread($this->stream, $record['paddingLength']);
     }
     return $record;
 }
예제 #22
0
 public function assert()
 {
     $title = $this->webDriver->getTitle();
     \PHPUnit_Framework_TestCase::assertNotNull($title);
     \PHPUnit_Framework_TestCase::assertNotNull($this->title);
     $title = trim($title);
     $pos = strpos($title, $this->title);
     \PHPUnit_Framework_TestCase::assertNotFalse($pos);
     $testEquals = $pos + strlen($this->title);
     $browserEquals = strlen($title);
     \PHPUnit_Framework_TestCase::assertEquals($testEquals, $browserEquals);
 }
 /**
  * @test
  * @expectedException \RuntimeException
  */
 public function it_should_compose_empty_message_without_auth()
 {
     $this->socketMessage = $this->socketMessage->reveal();
     $binaryMessage = $this->messageComposer->compose($this->socketMessage);
     $buffer = new Buffer($binaryMessage);
     \PHPUnit_Framework_Assert::assertEquals(18, $buffer->readInt32LE(0));
     \PHPUnit_Framework_TestCase::assertEquals(MessageType::HEARTBEAT_REQUEST, $buffer->readInt8(4));
     \PHPUnit_Framework_TestCase::assertEquals(MessageConfiguration::FLAGS_NONE, $buffer->readInt8(5));
     \PHPUnit_Framework_TestCase::assertEquals('12350000000000000000000000000000', bin2hex($buffer->read(6, 16)));
     //should throw exception out of range
     $buffer->read(22, 1);
 }
예제 #24
0
 public function it_generates_a_status_object()
 {
     $config = new Config();
     $config->load(SpecHelper::rootPath() . 'src/BackbonePhp/Application/config/models.json');
     $this->config = $config;
     $request = new Request();
     $response = new Response();
     $route = (object) [];
     $this->handleStatusRequest($request, $response, $route)->shouldReturn($this);
     Assertions::assertEquals('application/json', $response->getHeader('Content-Type'), 'should set content type to JSON');
     Assertions::assertEquals('ok', $response->getBody()->status, 'should set status field');
     Assertions::assertTrue(is_int($response->getBody()->timestamp), 'should set timestamp field');
 }
예제 #25
0
 public function it_sends_a_non_string_body_as_json()
 {
     $struct = array('test' => 'test');
     $this->setBody($struct)->shouldReturn($this);
     $result = (object) ['expected' => json_encode($struct, JSON_PRETTY_PRINT), 'actual' => ''];
     ob_start(function ($output) use($result) {
         $result->actual = $output;
         return null;
     });
     $this->sendBody()->shouldReturn($this);
     ob_end_flush();
     Assertions::assertEquals($result->expected, $result->actual, 'should send body as json');
 }
예제 #26
0
 public function it_support_response_code_and_type_in_template_requests()
 {
     // config
     $config = new Config();
     $this->config = $config;
     $request = new Request();
     $response = new Response();
     $config->set('appTitle', 'test');
     $request->setPath('/test');
     $route = (object) ["model" => (object) ["pageTemplate" => "/test/fixtures/index.html.tpl", "pageTitle" => 'test', "responseType" => 'application/test', "responseCode" => 123], "path" => "/test", "type" => "template", "template" => "/test/fixtures/static-body.html.tpl"];
     $this->handleTemplateRouteRequest($request, $response, $route)->shouldReturn($this);
     Assertions::assertEquals('application/test', $response->getHeader('Content-Type'), 'should have specified content type');
     Assertions::assertEquals('123', $response->getCode(), 'should have specified response code');
 }
 public function test()
 {
     $routerClass = $this->_routerClass;
     $routerInstance = new $routerClass();
     if (!isset($this->_expectModule)) {
         $this->_expectModule = $routerInstance->getDefaultModuleName();
     }
     if (!isset($this->_expectController)) {
         $this->_expectController = $routerInstance->getDefaultControllerName();
     }
     if (!isset($this->_expectAction)) {
         $this->_expectAction = $routerInstance->getDefaultActionName();
     }
     $postfix = "";
     if (isset($this->_requiredModule)) {
         $this->_router->requireModule($this->_requiredModule);
         if ($this->_requiredModule) {
             $postfix .= "(module '{$this->_requiredModule}' required)";
         } else {
             $postfix .= '(module required)';
         }
     }
     if (isset($this->_requiredController)) {
         $this->_router->requireController($this->_requiredController);
         if ($this->_requiredController) {
             $postfix .= "(controller '{$this->_requiredController}' required)";
         } else {
             $postfix .= '(controller required)';
         }
     }
     if (isset($this->_requiredAction)) {
         $this->_router->requireAction($this->_requiredAction);
         if ($this->_requiredAction) {
             $postfix .= "(action '{$this->_requiredAction}' required)";
         } else {
             $postfix .= '(action required)';
         }
     }
     $routable = $this->_router->route($this->_uri);
     if ($this->_isRoutable) {
         $this->_test->assertTrue($routable, "{$this->_routerClass} router should be able to route '{$this->_uri}' " . $postfix);
     } else {
         $this->_test->assertFalse($routable, "{$this->_routerClass} router should not be able to route '{$this->_uri}' " . $postfix);
         return;
     }
     $this->_test->assertEquals($this->_expectModule, $this->_router->getModuleName(), "{$this->_routerClass} routes {$this->_uri} to module '{$this->_expectModule}'");
     $this->_test->assertEquals($this->_expectController, $this->_router->getControllerName(), "{$this->_routerClass} routes {$this->_uri} to controller '{$this->_expectController}'");
     $this->_test->assertEquals($this->_expectAction, $this->_router->getActionName(), "{$this->_routerClass} routes {$this->_uri} to action '{$this->_expectAction}'");
     $this->_test->assertEquals($this->_expectArguments, $this->_router->getActionArguments(), "{$this->_routerClass} gets " . var_export($this->_expectArguments, true) . " from uri '{$this->_uri}'");
 }
 /**
  * @dataProvider optionsDataProvider
  * @param string $username
  * @param array $options
  * @param array $expectedOptions
  * @param string $expectedTemplate
  */
 public function testGetSkypeButton($username, $options, $expectedOptions, $expectedTemplate)
 {
     $env = $this->getMockBuilder('\\Twig_Environment')->disableOriginalConstructor()->getMock();
     $env->expects($this->once())->method('render')->with($expectedTemplate, $this->anything())->will($this->returnCallback(function ($template, $options) use($expectedOptions, $username) {
         \PHPUnit_Framework_TestCase::assertArrayHasKey('name', $options['options']);
         \PHPUnit_Framework_TestCase::assertEquals($expectedOptions['name'], $options['options']['name']);
         \PHPUnit_Framework_TestCase::assertArrayHasKey('participants', $options['options']);
         \PHPUnit_Framework_TestCase::assertEquals($expectedOptions['participants'], $options['options']['participants']);
         \PHPUnit_Framework_TestCase::assertArrayHasKey('element', $options['options']);
         \PHPUnit_Framework_TestCase::assertContains('skype_button_' . md5($username), $options['options']['element']);
         return 'BUTTON_CODE';
     }));
     $this->assertEquals('BUTTON_CODE', $this->extension->getSkypeButton($env, $username, $options));
 }
예제 #29
0
 /**
  * Assert that the method calls match the array of calls.
  *
  * Example usage:
  *
  *    // Code under test calls method
  *    $mock->testMethod(1,2,3);
  *    $mock->testMethod('a', 'b', 'c');
  *
  *    // Test asserts calls
  *    self::assertCalls(
  *      $mock,
  *      'testMethod',
  *      array(1,2,3),
  *      array('a', 'b', 'c')
  *    );
  *
  * @param  $mock         a mock object
  * @param  $method_name  name of method to check
  * @param  ...           arrays of expected arguments for each call
  * @param  $msg          message for assert (optional)
  */
 public static function assertCalls(FBMock_Mock $mock, $method_name)
 {
     FBMock_Utils::assertString($method_name);
     $args = func_get_args();
     $msg = '';
     if (is_string(end($args))) {
         $msg = array_pop($args);
     }
     $expected_calls = array_slice($args, 2);
     self::assertNumCalls($mock, $method_name, count($expected_calls), $msg);
     $actual_calls = $mock->mockGetCalls($method_name);
     foreach ($expected_calls as $i => $call) {
         PHPUnit_Framework_TestCase::assertEquals($call, $actual_calls[$i], $msg ?: "Call {$i} for method {$method_name} did not match expected call");
     }
 }
예제 #30
0
 public static function check(\PHPUnit_Framework_TestCase $test, $type, $company, $givenName, $surName, $email, $phone, ContactPerson $contact = null)
 {
     $test->assertNotNull($contact);
     $test->assertEquals($type, $contact->getContactType());
     $test->assertEquals($company, $contact->getCompany());
     $test->assertEquals($givenName, $contact->getGivenName());
     $test->assertEquals($surName, $contact->getSurName());
     $test->assertEquals($email, $contact->getEmailAddress());
     $test->assertEquals($phone, $contact->getTelephoneNumber());
 }