X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fapi%2Fv4%2FAction%2FContactApiKeyTest.php;h=afa8fed64a271964bd5e1a56774caf8c220abd62;hb=84ad7693766a74f6a9e62bf1aed9209826ecd078;hp=11bcb58d249bdfda9b654c6eb6bc52fcd49af4e2;hpb=2fbf625b13c6c25b21bc69b2155fd85c1713cb59;p=civicrm-core.git diff --git a/tests/phpunit/api/v4/Action/ContactApiKeyTest.php b/tests/phpunit/api/v4/Action/ContactApiKeyTest.php index 11bcb58d24..afa8fed64a 100644 --- a/tests/phpunit/api/v4/Action/ContactApiKeyTest.php +++ b/tests/phpunit/api/v4/Action/ContactApiKeyTest.php @@ -57,10 +57,10 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase { // Can also be fetched via join $email = Email::get() - ->addSelect('contact.api_key') + ->addSelect('contact_id.api_key') ->addWhere('id', '=', $contact['email']['id']) ->execute()->first(); - $this->assertEquals($key, $email['contact.api_key']); + $this->assertEquals($key, $email['contact_id.api_key']); $this->assertFalse($isSafe($email), "Should reveal secret details ($key): " . var_export($email, 1)); // Remove permission and we should not see the key @@ -76,12 +76,12 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase { // Also not available via join $email = Email::get() - ->addSelect('contact.api_key') + ->addSelect('contact_id.api_key') ->addWhere('id', '=', $contact['email']['id']) ->setDebug(TRUE) ->execute(); - $this->assertContains('contact.api_key', $email->debug['undefined_fields']); - $this->assertArrayNotHasKey('contact.api_key', $email[0]); + $this->assertContains('contact_id.api_key', $email->debug['undefined_fields']); + $this->assertArrayNotHasKey('contact_id.api_key', $email[0]); $this->assertTrue($isSafe($email[0]), "Should NOT reveal secret details ($key): " . var_export($email[0], 1)); $result = Contact::get() @@ -108,7 +108,7 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase { catch (\Exception $e) { $error = $e->getMessage(); } - $this->assertContains('key', $error); + $this->assertStringContainsString('key', $error); } public function testGetApiKeyViaJoin() { @@ -137,14 +137,14 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase { $result = Email::get(FALSE) ->addWhere('contact_id', '=', $contact['id']) ->addSelect('email') - ->addSelect('contact.api_key') + ->addSelect('contact_id.api_key') ->execute() ->first(); $this->assertFalse($isSafe($result), "Should reveal secret details ($key): " . var_export($result, 1)); $result = Email::get(TRUE) ->addWhere('contact_id', '=', $contact['id']) - ->addSelect('contact.api_key') + ->addSelect('contact_id.api_key') ->execute() ->first(); $this->assertTrue($isSafe($result), "Should NOT reveal secret details ($key): " . var_export($result, 1)); @@ -179,7 +179,7 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase { ->execute() ->first(); - $this->assertContains('key', $error); + $this->assertStringContainsString('key', $error); // Assert key is still the same $this->assertEquals($result['api_key'], $key); @@ -225,7 +225,7 @@ class ContactApiKeyTest extends \api\v4\UnitTestCase { $error = $e->getMessage(); } - $this->assertContains('key', $error); + $this->assertStringContainsString('key', $error); $result = Contact::get(FALSE) ->addWhere('id', '=', $contact['id'])