当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_TestCase::assertEquals方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_TestCase::assertEquals方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_TestCase::assertEquals方法的具体用法?PHP PHPUnit_Framework_TestCase::assertEquals怎么用?PHP PHPUnit_Framework_TestCase::assertEquals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_TestCase的用法示例。


在下文中一共展示了PHPUnit_Framework_TestCase::assertEquals方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assertTotalNumQueries

 /**
  * 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);
 }
开发者ID:lchen01,项目名称:STEdwards,代码行数:12,代码来源:DbProfiler.php

示例2: assertCalls

 /**
  * @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);
 }
开发者ID:Sorekk,项目名称:cvillecouncilus,代码行数:33,代码来源:CallLog.php

示例3: doDelete

 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');
 }
开发者ID:seytar,项目名称:psx,代码行数:7,代码来源:EntityController.php

示例4: check

 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());
 }
开发者ID:aarnaud,项目名称:lightSAML,代码行数:7,代码来源:OrganizationChecker.php

示例5: checkCertificateCN

 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']);
 }
开发者ID:aarnaud,项目名称:lightSAML,代码行数:8,代码来源:KeyDescriptorChecker.php

示例6: onAccessToken

 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');
 }
开发者ID:seytar,项目名称:psx,代码行数:9,代码来源:TestCallbackAbstract.php

示例7: is

 /**
  * 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);
 }
开发者ID:EasyFinance,项目名称:sfPhpunitPlugin,代码行数:15,代码来源:sfPHPUnitLimeAdapter.php

示例8: onRequest

 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;
 }
开发者ID:k42b3,项目名称:psx-ws,代码行数:10,代码来源:TestProviderAbstract.php

示例9: factory

 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;
 }
开发者ID:WebSpider,项目名称:OpenConext-engineblock,代码行数:7,代码来源:FormatterStubFactory.php

示例10: assertJsonResponse

 /**
  * 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);
     }
 }
开发者ID:ashutosh-srijan,项目名称:findit_akeneo,代码行数:14,代码来源:ToolsAPI.php

示例11: testSignSoapMessage

    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>MIIEVDCCAzygAwIBAgIJAPTrkMJbCOr1MA0G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MAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBACmSKrte07VrGB8dtrN5mrt28ILickQjguu46h6vChgQ4YfIAoA1KWNsZJUuuIzTDjE5xz2hsW37CI0yrNesv2ho2hhP+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));
    }
开发者ID:leoclaro,项目名称:xmldsig,代码行数:26,代码来源:SoapClientTest.php

示例12: iWantMyOriginalStringAgain

 /**
  * @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;
 }
开发者ID:testinaweb,项目名称:dynamic-crypto,代码行数:10,代码来源:FeatureContext.php

示例13: getValidIpAddress

 /**
  * @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);
 }
开发者ID:oqq,项目名称:ip-provider,代码行数:11,代码来源:IpProviderTest.php

示例14: testBuildLevels

 /** @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'));
 }
开发者ID:scortescz,项目名称:calendar,代码行数:9,代码来源:EventsTest.php

示例15: delete

 /**
  * 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;
 }
开发者ID:Atlis,项目名称:docker-magento2,代码行数:15,代码来源:MysqlStub.php


注:本文中的PHPUnit_Framework_TestCase::assertEquals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。