4 +--------------------------------------------------------------------+
6 +--------------------------------------------------------------------+
7 | Copyright CiviCRM LLC (c) 2004-2020 |
8 +--------------------------------------------------------------------+
9 | This file is a part of CiviCRM. |
11 | CiviCRM is free software; you can copy, modify, and distribute it |
12 | under the terms of the GNU Affero General Public License |
13 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
15 | CiviCRM is distributed in the hope that it will be useful, but |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
18 | See the GNU Affero General Public License for more details. |
20 | You should have received a copy of the GNU Affero General Public |
21 | License and the CiviCRM Licensing Exception along |
22 | with this program; if not, contact CiviCRM LLC |
23 | at info[AT]civicrm[DOT]org. If you have questions about the |
24 | GNU Affero General Public License or the licensing of CiviCRM, |
25 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
26 +--------------------------------------------------------------------+
30 * Test class for CRM_Contact_Page_View_Note BAO
35 class CRM_Contact_Page_View_NoteTest
extends CiviUnitTestCase
{
38 * Sets up the fixture, for example, opens a network connection.
39 * This method is called before a test is executed.
41 protected function setUp() {
46 * Tears down the fixture, for example, closes a network connection.
48 * This method is called after a test is executed.
50 protected function tearDown() {
54 public function testNoContactIdNote() {
55 $contactId = $this->individualCreate();
56 foreach ([1, 2, 3, 4, 5] as $noteID) {
57 $note = new CRM_Core_DAO_Note();
58 $note->entity_id
= $contactId;
59 $note->subject
= 'Test Note ' . $noteID;
60 $note->note
= 'Test Note from Tests';
61 $note->entity_table
= 'civicrm_contact';
63 $note->contact_id
= $contactId;
67 $page = new CRM_Contact_Page_View_Note();
68 $page->_contactId
= $contactId;
69 $page->_permission
= CRM_Core_PERMISSION
::EDIT
;
71 $this->assertEquals(count($page->values
), 5);
72 foreach ($page->values
as $note) {
73 $this->assertEquals($note['entity_id'], $contactId);
74 if ($note['id'] == 5) {
75 $this->assertEquals($note['createdBy'], 'Mr. Anthony Anderson II');