Mongolid\ActiveRecordTest::testShouldGetSchemaIfFieldsDescribesSchemaFields PHP Method

testShouldGetSchemaIfFieldsDescribesSchemaFields() public method

    public function testShouldGetSchemaIfFieldsDescribesSchemaFields()
    {
        // Arrage
        $fields = ['name' => 'string', 'age' => 'int'];
        $this->setProtected($this->entity, 'fields', $fields);
        // Assert
        $result = $this->entity->getSchema();
        $this->assertInstanceOf(Schema::class, $result);
        $this->assertEquals($fields, $result->fields);
        $this->assertEquals($this->entity->dynamic, $result->dynamic);
        $this->assertEquals($this->entity->getCollectionName(), $result->collection);
        $this->assertEquals(get_class($this->entity), $result->entityClass);
    }