/**
     * @test
     */
    public function propertyFunctionsUseAContentObjectIfOneHasBeenDefined()
    {
        $this->inject($this->nodeData, 'persistenceManager', $this->createMock('TYPO3\\Flow\\Persistence\\PersistenceManagerInterface'));
        $className = uniqid('Test');
        eval('
			class ' . $className . ' {
				public $title = "My Title";
				public $body = "My Body";
			}
		');
        $contentObject = new $className();
        $this->nodeData->setContentObject($contentObject);
        $this->assertTrue($this->nodeData->hasProperty('title'));
        $this->assertFalse($this->nodeData->hasProperty('iltfh'));
        $this->assertEquals('My Body', $this->nodeData->getProperty('body'));
        $this->assertEquals('My Title', $this->nodeData->getProperty('title'));
        $this->assertEquals(array('title' => 'My Title', 'body' => 'My Body'), $this->nodeData->getProperties());
        $actualPropertyNames = $this->nodeData->getPropertyNames();
        sort($actualPropertyNames);
        $this->assertEquals(array('body', 'title'), $actualPropertyNames);
        $this->nodeData->setProperty('title', 'My Other Title');
        $this->nodeData->setProperty('body', 'My Other Body');
        $this->assertEquals('My Other Body', $this->nodeData->getProperty('body'));
        $this->assertEquals('My Other Title', $this->nodeData->getProperty('title'));
    }
Esempio n. 2
0
 /**
  * Returns the names of all properties of this node.
  *
  * @return array Property names
  * @api
  */
 public function getPropertyNames()
 {
     return $this->nodeData->getPropertyNames();
 }