Bolt\Tests\Stack\StackTest::testAddNewFile PHP Метод

testAddNewFile() публичный Метод

public testAddNewFile ( )
    public function testAddNewFile()
    {
        $expectedList = ['files://h.txt', 'files://a.jpg', 'files://b.txt', 'files://c.txt', 'files://d.doc', 'files://e.mp3', 'theme://f.txt'];
        $this->users->expects($this->once())->method('saveUser')->with(['stack' => $expectedList]);
        $file = $this->stack->add('h.txt', $removed);
        $this->assertTrue($file instanceof FileInterface, 'File object should be returned from add method');
        $this->assertEquals('files://h.txt', $file->getFullPath(), 'File object should be returned from add method');
        $this->assertTrue($removed instanceof FileInterface, 'Add method should set the removed parameter to the file object removed');
        $this->assertEquals('theme://g.txt', $removed->getFullPath(), 'Removed file should be the last file on the stack before the new one was added');
        $this->assertFiles($this->stack->getList(), $expectedList, 'Adding new file should prepend it to the stack and remove the oldest file');
        $this->assertEquals($expectedList, $this->session->get('stack'), 'Adding a file to the stack should persist change to session');
    }