public function testRemoveNotes() { $note1 = new NoteEntity(); $note1->setId(1); $note2 = new NoteEntity(); $note2->setId(2); $note3 = new NoteEntity(); $note3->setId(3); $notes = new ArrayCollection(); $notes->add($note1); $notes->add($note2); $notes->add($note3); $this->notes->setNotes($notes); $this->notes->removeNote($note1); $this->assertNotContains($note1, $this->notes->getNotes()->toArray()); }
public function testValidation() { $noteDescription = 'New Note Description'; $noteName = 'New Note: ' . uniqid(); $noteType = 'Confirmation'; $this->assertFalse($this->note->isValid()); $this->note->setDescription($noteDescription); $this->assertFalse($this->note->isValid()); $this->note->setName($noteName); $this->assertFalse($this->note->isValid()); $this->note->setType($noteType); $this->assertTrue($this->note->isValid()); $this->assertEquals($noteName, $this->note->getName()); $this->assertEquals($noteType, $this->note->getType()); }
public function testSetGetNotes() { $caseItemMock = $this->getMockedClass(); $emptyCollection = $caseItemMock->getNotes()->toArray(); $this->assertEmpty($emptyCollection); $noteCollection = new ArrayCollection(); for ($i = 0; $i < 10; $i++) { $note = new Note(); $note->setId($i); $noteCollection->add($note); } $caseItemMock->setNotes($noteCollection); $expected = 10; $array = $caseItemMock->getNotes()->toArray(); $this->assertEquals($expected, count($array)); for ($i = 0; $i < 10; $i++) { $note = $array[$i]; $this->assertEquals($i, $note->getId()); } }