Pheasant\Tests\BasicMappingTest::testBasicSaving PHP Method

testBasicSaving() public method

public testBasicSaving ( )
    public function testBasicSaving()
    {
        $post = new Post('First post, bitches!');
        $post->subtitle = 'Just because...';
        $this->assertEquals((string) $post->postid, null);
        $this->assertInstanceOf('\\Pheasant\\Identity', $post->identity());
        $this->assertEquals(array('title', 'subtitle'), array_keys($post->changes()));
        $this->assertFalse($post->isSaved());
        $post->save();
        $this->assertTrue($post->isSaved());
        $this->assertEquals(array(), $post->changes());
        $this->assertEquals($post->postid, 1);
        $this->assertEquals($post->title, 'First post, bitches!');
        $this->assertEquals($post->subtitle, 'Just because...');
        $post->title = 'Another title, perhaps';
        $this->assertTrue($post->isSaved());
        $this->assertEquals(array('title'), array_keys($post->changes()));
        $post->save();
        $this->assertEquals(array(), $post->changes());
        $this->assertEquals($post->title, 'Another title, perhaps');
    }