4 +--------------------------------------------------------------------+
5 | Copyright CiviCRM LLC. All rights reserved. |
7 | This code is published under the GNU AGPLv3 license with some |
8 | permitted exceptions and without any warranty. For full license |
9 | and copyright information, see https://civicrm.org/licensing |
10 +--------------------------------------------------------------------+
14 * Test class for CRM_Contact_Page_View_Note BAO
19 class CRM_Contact_Page_View_NoteTest
extends CiviUnitTestCase
{
22 * Sets up the fixture, for example, opens a network connection.
23 * This method is called before a test is executed.
25 protected function setUp() {
30 * Tears down the fixture, for example, closes a network connection.
32 * This method is called after a test is executed.
34 protected function tearDown() {
38 public function testNoContactIdNote() {
39 $contactId = $this->individualCreate();
40 foreach ([1, 2, 3, 4, 5] as $noteID) {
41 $note = new CRM_Core_DAO_Note();
42 $note->entity_id
= $contactId;
43 $note->subject
= 'Test Note ' . $noteID;
44 $note->note
= 'Test Note from Tests';
45 $note->entity_table
= 'civicrm_contact';
47 $note->contact_id
= $contactId;
51 $page = new CRM_Contact_Page_View_Note();
52 $page->_contactId
= $contactId;
53 $page->_permission
= CRM_Core_PERMISSION
::EDIT
;
55 $this->assertEquals(count($page->values
), 5);
56 foreach ($page->values
as $note) {
57 $this->assertEquals($note['entity_id'], $contactId);
58 if ($note['id'] == 5) {
59 $this->assertEquals($note['createdBy'], 'Mr. Anthony Anderson II');