Josegonzalez\Upload\Test\TestCase\File\Path\Basepath\DefaultTraitTest::testNewEntity PHP Метод

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

public testNewEntity ( )
    public function testNewEntity()
    {
        $this->setExpectedException('LogicException', '{primaryKey} substitution not allowed for new entities');
        $mock = $this->getMockForTrait('Josegonzalez\\Upload\\File\\Path\\Basepath\\DefaultTrait');
        $mock->entity = $this->getMock('Cake\\ORM\\Entity');
        $mock->table = $this->getMock('Cake\\ORM\\Table');
        $mock->settings = ['path' => 'webroot{DS}files{DS}{model}-{field}{DS}{primaryKey}/'];
        $mock->data = ['name' => 'filename'];
        $mock->field = 'field';
        $mock->entity->expects($this->once())->method('isNew')->will($this->returnValue(true));
        $mock->basepath();
    }